<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jidneya </title>
    <description>The latest articles on Forem by Jidneya  (@jid).</description>
    <link>https://forem.com/jid</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1246010%2F8bc3ff83-b85a-4654-9f1c-33b0a718100c.jpg</url>
      <title>Forem: Jidneya </title>
      <link>https://forem.com/jid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jid"/>
    <language>en</language>
    <item>
      <title>Graph Databases</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sun, 17 Mar 2024 18:19:50 +0000</pubDate>
      <link>https://forem.com/jid/graph-databases-48af</link>
      <guid>https://forem.com/jid/graph-databases-48af</guid>
      <description>&lt;h1&gt;
  
  
  Graph databases
&lt;/h1&gt;

&lt;p&gt;Let’s talk about some exciting new advancements in the world of data management – graph databases. To first delve into what graph databases are and why we should even think about them we must first understand what a graph is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Graphs
&lt;/h2&gt;

&lt;p&gt;A graph in computer science is very different to your normal x-y graphs that you may have seen in maths. In computer science a graph does not depict the nature of a relationship between two variables, instead is focuses on more the fact that there is some sort of relationship between objects. &lt;br&gt;
A graph has some key components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  A node / vertices is an object and is represented by a circle&lt;/li&gt;
&lt;li&gt;  An edge is the relationship between objects and is represented by lines&lt;/li&gt;
&lt;li&gt;  An edge can have an associated value, called it’s weight which could represent many things which we will discuss below, this graph is called a weighted graph&lt;/li&gt;
&lt;li&gt;  Edges can also have a direction suggesting a one way relationship. This is called a directed graph.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Right now this may look very useless to you but graph theory is actually a very important part of theoretical computer science and maths, because of it’s real life applications. An example is modelling cities as nodes, and the edges as the roads in between them with the weight being the distance of that road, and then we can use Dijkstra’s shortest path algorithm to find the shortest path between two cities, which is what google maps does. &lt;/p&gt;

&lt;h2&gt;
  
  
  Graph Databases
&lt;/h2&gt;

&lt;p&gt;Great, now we know what a graph is, we can discuss graph databases. A graph database stores data in the way we see in real life, by this I mean that all the data is stored in the form of a network of nodes, and relationships between said entities (credit to Neo4j):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23z3jt41nt89wsfj9rto.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F23z3jt41nt89wsfj9rto.png" alt=" " width="655" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the diagram to above we have two nodes in our graph database (Dan and Ann), and Dan loves Ann, so there is a relationship between these two nodes, so we connect them. Some important thing to note are the fact that the love is one sided, so this graph is a directed and it also suggests that Dan’s love is only one sided. Another important feature that can be seen is how the Node, with label “Person”, has a property of “name”. This means that this person could have multiple properties such as height, or birthday.&lt;/p&gt;

&lt;p&gt;This is an another beauty of graph databases – making use of objects. What is an object?. Well we can view the world as a collection of objects, such as people, birds, cars, etc, and each object has its own properties like how a car has the property of horsepower, but a person doesn’t. We use these objects as our nodes, and this is how we store he majority of our data. &lt;/p&gt;

&lt;p&gt;This is an abstract way of thinking about data and very different from our usual relational databases where everything is stored in tables and there is a strict and rigid format that must be adhered to when making such databases. On the other hand graph databases is a more flexible and adaptable tool. &lt;/p&gt;

&lt;h2&gt;
  
  
  NoSQL databases
&lt;/h2&gt;

&lt;p&gt;We can not discuss graph databases without discussing NoSQL databases. This is because graph databases are a type of NoSQL databases. NoSQL stand for “not only SQL”, or “non SQL”, it came up as a more flexible alternative for traditional SQL databases, because companies need to manage large data volumes at high speeds with the ability to scale up quickly to run modern web applications. &lt;/p&gt;

&lt;p&gt;In this era of growth within cloud, big data, and mobile and web applications, NoSQL databases provide that speed and scalability. NoSQL also provides horizontal scaling which basically means that it is very easy to add more data and distribute workload equally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why even bother?
&lt;/h2&gt;

&lt;p&gt;Graph databases have many real life applications because of their ability to go through hierarchies in data,  find hidden connections, and even find inter relationships between items. So as our data continues to grow in both volume and the number of observable connections that may provide new information, graph databases are able to cope with these kinds of huge data sets while relational databases are slow and clunky for this kind of use case. &lt;/p&gt;

&lt;p&gt;Some real life uses cases are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Social media recommendations&lt;/li&gt;
&lt;li&gt;  Fraud detection &lt;/li&gt;
&lt;li&gt;  Network management&lt;/li&gt;
&lt;li&gt;  Knowledge graphs for AI&lt;/li&gt;
&lt;li&gt;  Supply chain efficiency &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>database</category>
      <category>nosql</category>
      <category>learning</category>
    </item>
    <item>
      <title>Learning Clojure: Part 2, REPLs and data types</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sun, 18 Feb 2024 19:45:50 +0000</pubDate>
      <link>https://forem.com/jid/learning-clojure-part-2-repls-and-data-types-3c75</link>
      <guid>https://forem.com/jid/learning-clojure-part-2-repls-and-data-types-3c75</guid>
      <description>&lt;p&gt;Hello everyone, today we will learn about the REPL in Clojure and how to use it, along with the data types supported by Clojure. &lt;/p&gt;

&lt;h1&gt;
  
  
  REPL
&lt;/h1&gt;

&lt;p&gt;A REPL is a read-eval-print-loop. In simple terms, it is a prompt in which you type your code, it evaluates it, prints the result and then shows the prompt again. It achieves this using a running program and is useful for us to test code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting a REPL session
&lt;/h2&gt;

&lt;p&gt;I assume that you have already set up Clojure on your system, and below I will show how to open a REPL using Leiningen in command line, because that is what i am using. You can also do this on other IDEs like eclipse, but that is something that i am not really aware of. &lt;/p&gt;

&lt;p&gt;Anyways we must first open up administrator command prompt and type in the following prompt&lt;br&gt;
&lt;code&gt;lein repl&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I have attached an image below of my command prompt, and what it should look like&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F22r6xz81jmqd1283ahim.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F22r6xz81jmqd1283ahim.png" alt=" " width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Special variables in a REPL session
&lt;/h2&gt;

&lt;p&gt;we have three special variables in out REPL session which are '*1', '*2' and '*3', and these refer to the results of the most recent three expressions. I have given a basic prompts to the system to demonstrate these special variable below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdhl8xl4p4qgmjg9goun.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhdhl8xl4p4qgmjg9goun.png" alt=" " width="135" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is basically all we have to know for now about the REPL, now lets move onto Data types&lt;/p&gt;

&lt;h1&gt;
  
  
  Data types
&lt;/h1&gt;

&lt;p&gt;If you have any experience in Java, you will be delighted to know that since Clojure requires Java, the data types are near identical with a few extras:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Integers&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;short, long and int - these are used for whole numbers&lt;/li&gt;
&lt;li&gt;Octal number - used for octal representation of numbers&lt;/li&gt;
&lt;li&gt;Radix number - used for radix representation of numbers&lt;/li&gt;
&lt;li&gt;hexadecimal number - used for hexadecimal representation of numbers&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;Floating point - use for floating point numbers and scientific notation &lt;/p&gt;

&lt;p&gt;char - holds a single character&lt;/p&gt;

&lt;p&gt;Boolean - true or false&lt;/p&gt;

&lt;p&gt;String  - holds a piece of text &lt;/p&gt;

&lt;p&gt;Nil - This is a null value in Clojure&lt;/p&gt;

&lt;p&gt;Atom - they provide a way to manage shared, synchronous, independent state &lt;/p&gt;

&lt;h2&gt;
  
  
  Max and min values
&lt;/h2&gt;

&lt;p&gt;Since the Clojure data types stem form the java ones, they have the same maximum and minimum values and i will list two here:&lt;/p&gt;

&lt;p&gt;int - -2,147,483,648 to 2,147,483,647&lt;br&gt;
float - 1.40129846432481707e-45 to 3.40282346638528860e+38&lt;/p&gt;

&lt;p&gt;Now lets show this in some code. Below i some simple code with comments on the data types:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyvawov7krvo2ntqhw12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftyvawov7krvo2ntqhw12.png" alt=" " width="497" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output to the program is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4fizji75og43d51nw8lk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4fizji75og43d51nw8lk.png" alt=" " width="472" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(If you were wondering i am using cursive on IntelliJ for this code)&lt;/p&gt;

&lt;p&gt;Thank you for reading this week's tutorial. I hope it was fruitful, and i will be back soon with more content on Clojure so that we can get to better understand how to use the language. &lt;/p&gt;

</description>
      <category>programming</category>
      <category>clojure</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Bipartite graphs</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sun, 11 Feb 2024 23:02:15 +0000</pubDate>
      <link>https://forem.com/jid/bipartite-graphs-5d8</link>
      <guid>https://forem.com/jid/bipartite-graphs-5d8</guid>
      <description>&lt;h2&gt;
  
  
  What is a bipartite graph
&lt;/h2&gt;

&lt;p&gt;bipartite graph is actually really simple graph that I shall explain in just a few minutes below&lt;/p&gt;

&lt;p&gt;A bipartite graph is such a graph where you can split the nodes into two sets that have no intersection (disjoint sets), where no two nodes in the same set have an edge between them. So this means that an edge will only connect two nodes from different sets. &lt;/p&gt;

&lt;p&gt;An example:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzlpw6me24f9gt46b0zp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzlpw6me24f9gt46b0zp.png" alt=" " width="782" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you will have to forgive my terrible digital drawing skills, but i think this simple diagram gets the point across. We have 5 nodes here and there are two different sets: N1, N2, N3 are a part of one set, and N4, N5, N6 are part of the other set. There are also no edges within the red nodes, or within the green nodes.&lt;/p&gt;

&lt;h2&gt;
  
  
  attributes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Two disjoint set of vertices&lt;/li&gt;
&lt;li&gt;A node can only have as many edges as there are nodes in the smaller set&lt;/li&gt;
&lt;li&gt;Every edge will connect an edge in one set to an edge in another set&lt;/li&gt;
&lt;li&gt;There are no odd-length cycles. This is because to have an odd length cycle there must be an edge between nodes in the same set, and this goes against the definition of a bipartite graph&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Uses
&lt;/h2&gt;

&lt;p&gt;One use that will be something that we all have interacted with is web search engines, as queries can be one set while web pages is another set. &lt;br&gt;
Another use of bipartite graphs is in neural networks which are very useful in machine learning. &lt;br&gt;
One last use is in matching problems. These are very important problems in graph theory, and one way to solve these is to use the Hungarian algorithm which is what i shall write an article on soon.&lt;/p&gt;

&lt;p&gt;Well that is the basics of bipartite graphs and i hope that you found this insightful. Until next time. &lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>beginners</category>
      <category>learning</category>
    </item>
    <item>
      <title>Learning Clojure Part 1</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Fri, 02 Feb 2024 22:55:17 +0000</pubDate>
      <link>https://forem.com/jid/learning-clojure-part-1-49kl</link>
      <guid>https://forem.com/jid/learning-clojure-part-1-49kl</guid>
      <description>&lt;p&gt;After being persisted by my friends to learn Clojure, I finally caved and now we are here. I am not an expert going into this i am in fact as clueless as a beginner with experience mainly in java and python. SO please feel free to correct any mistakes i may have made  &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Clojure
&lt;/h2&gt;

&lt;p&gt;For those people who don't know, Clojure is a functional programming language that runs on JVM (java virtual machine). It is described as a dynamic general purpose language, and every feature is supported at runtime. What this means is that you can run commands at run time and we will get to know this better over the course of the series. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to get Clojure running
&lt;/h2&gt;

&lt;p&gt;There are many ways to do this for different operating systems and i suggest you go look at some videos, or articles suited to your operating system to get Clojure running. Usually you would need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Leiningen, which is a build system for Clojure&lt;/li&gt;
&lt;li&gt;A JDK, as Clojure runs on JVM&lt;/li&gt;
&lt;li&gt;A IDE, in my case i use IntelliJ, not for any particular reason, simply because I do all my java in it&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Actually writing some code
&lt;/h2&gt;

&lt;p&gt;Now to the fun bit, coding. It would be worth noting that i am following tutorialspoint.com for learning, so you can always check them out if you ever don't understand anything. Also we write Clojure in a .clj file. &lt;/p&gt;

&lt;h1&gt;
  
  
  Hello World
&lt;/h1&gt;

&lt;p&gt;What better way to start than writing a hello world prompt:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(ns clojure.examples.hello&lt;br&gt;
   (:gen-class))&lt;br&gt;
(defn HelloWorld []&lt;br&gt;
   (println "Hello World"))&lt;br&gt;
(HelloWorld)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is one way to do it, and I think that will explain the basics well. &lt;br&gt;
'defn' is how we define a function, and in functional programming, functions play a pretty big role, but we will come onto that later. &lt;br&gt;
Our 'HelloWorld' function is defined to print the statement "Hello World". To call the function we simply put call it in a pair of parenthesis.&lt;/p&gt;

&lt;p&gt;Of course we could simply do something like &lt;br&gt;
&lt;code&gt;(ns clojure.examples.Main&lt;br&gt;
  (:gen-class))&lt;br&gt;
(println "hello world")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But i feel like this is not giving the right feel for Clojure from what I have seen, as it's true capabilities lie in it's functional side.&lt;/p&gt;

&lt;h1&gt;
  
  
  Prefix notation
&lt;/h1&gt;

&lt;p&gt;There is just one more thing that I would like to touch upon in this article and that is prefix notation. This simply means that operators are placed before operands, two examples below:&lt;br&gt;
&lt;code&gt;(+ 1 2)&lt;br&gt;
(str "Hello" "World")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In the first line we are simply doing: 1 + 2, but in prefix notation we put the '+' first . You can think of the '+' being the function and the 1 and 2 being it's 1st and 2nd parameters respectively.&lt;/p&gt;

&lt;p&gt;It is the same for the second line. We are simply using the str operator to concatenate (add strings to make one big string) the two strings given , which can also be considered as parameter&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Well that is it for today. I hope that my explanation of the basics was good enough peak your interest and I hope that you will join me in this journey. Please feel free to help me through the comments if you are already experienced at this. Thank you and until next time.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>clojure</category>
    </item>
    <item>
      <title>Math in computer science: Vectors</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sat, 27 Jan 2024 22:29:28 +0000</pubDate>
      <link>https://forem.com/jid/math-in-computer-science-vectors-46i1</link>
      <guid>https://forem.com/jid/math-in-computer-science-vectors-46i1</guid>
      <description>&lt;p&gt;Time for some more math. This week I would like to share something new i have learned: vectors. &lt;/p&gt;

&lt;p&gt;This is a very interesting topic because most people think that it is use din physics to represent forces or velocity, but this topic is also used a lot in computer science. &lt;/p&gt;

&lt;h2&gt;
  
  
  What are vectors?
&lt;/h2&gt;

&lt;p&gt;Now let me first define a vector. Most of you will already know that a vector can be used to define a point in a 3d space. This is true, however in the world of computer science a vector is also represented by a list of numbers or a function. By a function i just mean a mapping a values and not a mathematical function that will perform operation on an input. &lt;/p&gt;

&lt;p&gt;Vectors are quite useful because of their ability to represent both magnitude and direction. This is why they are used for many things like video games, new models of AI, and even plane navigation systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Operations on vectors
&lt;/h2&gt;

&lt;p&gt;Now let us see what we can do with vectors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;adding and subtracting vectors: to do this you just need to add or subtract the respective x and y values of each vector&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scaling vectors: Simply multiply all the coordinates with the scaling factor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Convex combination: This is where you have two vectors and you find a vector that lies in the region enclose by the two. To do this you make a new vector of the form:&lt;br&gt;
                      au + bv&lt;br&gt;
where 'u' and 'v' are the two vectors we have and 'a' and 'b' are just scaling factors, however there are some restrictions:&lt;br&gt;
a + b = 1&lt;br&gt;
'a' and 'b' are greater than zero&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dot product: i know it sounds scary but trust me it is not. To find the dot product of two vectors you simply multiple the corresponding coordinates for each ,e.g. multiply the x coordinates and y coordinates. Next you just add the products an that's that. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finding the angle between vectors: This is a very useful one. For this one there is a formula that is below (credit to mathsathome.com):&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwlhizaea83p1yln4bmms.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwlhizaea83p1yln4bmms.png" alt=" " width="720" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me explain a few points. 'a.b' means that dot product of 'a' and 'b'. Finally |a| simply means that absolute value, this means that no matter if 'a' is positive or negative |a| will always give a positive value. You can consider it to return the magnitude of the vector as the sign just represents the direction. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Vectors are very useful tools and now you now the basic functions and can start implementing them in your own projects to explore their many capabilities that make them such versatile tools in many fields such as physics. Thank you for reading.  &lt;/p&gt;

</description>
      <category>learning</category>
      <category>maths</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Maths in computer science: Bayes' Theorem</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sun, 21 Jan 2024 21:01:25 +0000</pubDate>
      <link>https://forem.com/jid/maths-in-computer-science-bayes-theorem-gc0</link>
      <guid>https://forem.com/jid/maths-in-computer-science-bayes-theorem-gc0</guid>
      <description>&lt;p&gt;Bayes’ Theorem &lt;br&gt;
Bayes’ theorem is a theorem that is useful when the conditional probability of the thing we are interested in is hard or impossible to estimate but its converse is available. This sounds complicated but I will try an explain this through the course of this article. &lt;br&gt;
First off I think It would be useful to know what Bayes’ theorem has to do with computer science. This theorem is very useful when used in AI, a few examples of which are Bayesian networks( a way to model and make predictions is a world of events) and Naïve bayes.&lt;/p&gt;

&lt;p&gt;Now to understand what Bayes’ theorem is we must first understand what conditional probability is. Conditional probability is the probability of an event occurring , based on the probability that a previous event has occurred. It is often portrayed as “Probability of event A given event B”, and its notation is P(A|B). To calculate P(A|B) we can use a mathematical formula: P(A|B) = P(A and B) / P(B).&lt;br&gt;
Now let us start to understand Bayes’ theorem through an example: If there is a patient with a set of symptoms, say S, then the doctor concludes that they could have condition, say C. So if the probability of having condition C, when showing symptoms S: P(C|S), is high then we must start treating the patient for what condition we can assume they have. However when trying to find P(C|S) we run into a problem, in medical records patients are sorted according to their treatments and not by the symptoms they showed. Thus we now can’t find P(C|S), but we realise that we could find the probability that a patient has symptoms S given that they have condition C: P(S|C). This is the inverse of what we want but we can use Bayes’ theorem to find out what we actually want from it’s inverse.&lt;/p&gt;

&lt;p&gt;Below I have shown the formula for Bayes’ Theorem, and the derivation to this formula is really simple. We already know that :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgroe8d01emug44majw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgroe8d01emug44majw1.png" alt=" " width="557" height="313"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;P(A|B) = P(A and B) / P(A).&lt;br&gt;
And if you know this or not I want you to just accept for now that:&lt;br&gt;
P(A and B) = P(B|A) x P(A)&lt;br&gt;
Now we just substitute equation 2 into equation 1, and we have Bayes’ theorem. Right now this may just look like you have spent all your time reading just to find out about this one formula that doesn’t even seem that useful, but let me tell you that the uses of this are widespread and not only in the field of computing but also in other fields such as economics and medicine.&lt;/p&gt;

&lt;p&gt;To give you a proper idea as for what this theorem is used for I will list out a few examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Fraud detection: The theorem can help in predicting whether a transaction form a credit card is a fraud or not, using past records on what the customer buys, and other risk factors that the credit card company decides. &lt;/li&gt;
&lt;li&gt; Weather forecasting: We all check the weather before leaving for school, and you can thank Bayes’ theorem for updating the probability of certain weather conditions from new data that is gathered from satellites and weather stations. It like that patient example we saw earlier.&lt;/li&gt;
&lt;li&gt; Machine learning: Bayes’ theorem is used in machine learning for a multitude of things such as classifying items, anomaly detection, etc. 
Overall this is a very important part of statistics that plays a major role in the computer science field, mainly through its implication when it comes to software being able to more accurately understand it’s environments and be able to predict things that could happen in the future given past data. This help’s AI models to grow and become even better, and all this from just a simple maths equation that you have just learnt.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>Representing Graphs: Adjacency List</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sat, 13 Jan 2024 18:33:48 +0000</pubDate>
      <link>https://forem.com/jid/representing-graphs-adjacency-list-3gh2</link>
      <guid>https://forem.com/jid/representing-graphs-adjacency-list-3gh2</guid>
      <description>&lt;p&gt;We went through Adjacency matrix in the last post and understood how they work and why they are not really a viable solution in many places. However in this post we will discuss the better alternative: Adjacency lists &lt;/p&gt;

&lt;h2&gt;
  
  
  Adjacency List
&lt;/h2&gt;

&lt;p&gt;Adjacency list use a HashMap, and if you don't know what that is let me give you a quick run down. A HashMap is an array where each element stores two things a key and a value. The position of the value in the array is determined by the key, as it is fed to a hashing algorithm to get a index number, which is where the key and the value is stored. &lt;/p&gt;

&lt;p&gt;Now that we know what a HashMap is we can continue with adjacency lists. When we store a node in an adjacency list we have to input three things, the source node, the destination node, and the weight(if the graph is weighted). The source node is what you use as your key value. Now is where it gets interesting, instead of a value we store a list in that position. In this list we store pairs of destination nodes and weights. Thus we can represent which node connects to which and what weight this edge holds. &lt;/p&gt;

&lt;p&gt;A simple example is (credit to GeeksForGeeks for the image):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90cyo3ro1uhj6zr4zjbs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F90cyo3ro1uhj6zr4zjbs.png" alt="adjacency list" width="731" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages and disadvantages
&lt;/h2&gt;

&lt;p&gt;Advantages of this method include saving space on graphs with not too many connections, it also makes adding new nodes and connections much easier and can be used to represent undirected and directed graphs. &lt;/p&gt;

&lt;p&gt;Disadvantages include the fact that for large graphs with many connections it is going to take more memory than an adjacency matrix, and also it takes longer in an adjacency matrix to access and edge. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While most of the time an adjacency list is preferred because of how easy it to expand and shrink it, and how it also saves you space. There are also some cases where a matrix would make more sense because of the disadvantages listed above.&lt;/p&gt;

&lt;p&gt;Thank you for reading, I do hope you found the article informative and useful.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>learning</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to represent graphs: Adjacency Matrix</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Sat, 13 Jan 2024 18:17:12 +0000</pubDate>
      <link>https://forem.com/jid/how-to-represent-graphs-adjacency-matrix-2kmi</link>
      <guid>https://forem.com/jid/how-to-represent-graphs-adjacency-matrix-2kmi</guid>
      <description>&lt;p&gt;I talked about what graphs are in terms of not only computer science but just as a general concept in my last post. I suggest you read that first if you don't already have an understanding on what graphs are.&lt;/p&gt;

&lt;p&gt;Now I would like to discuss this topic in the context of computer science and how such useful data structures can actually be implemented. This will be a language agnostic tutorial, meaning that these concepts can be implemented in any language.&lt;/p&gt;

&lt;p&gt;There are 2 main ways to implement graphs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adjacency Matrix&lt;/li&gt;
&lt;li&gt;Adjacency List&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Adjacency Matrix
&lt;/h2&gt;

&lt;p&gt;Let us take a look at the first method - adjacency matrix. In this method we will be representing a graph using a table. For this example assume we have a undirected, unweighted graph, however this method work for directed and weighted graphs as well. In this method we will label the rows and columns of our table with nodes. Next we look for connections in our graph, assume that node '1' is connected to node '2', then we will put a value of 1 in the square with position [2, 1], where 2 represents the column, and 1 represents the row. We use a value of one because it is standard for representing TRUE. We continue with this process and fill in all the connections. The picture below shows this example (Credit to GeeksForGeeks for the image).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptlikjqvidr9vieuz22d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fptlikjqvidr9vieuz22d.png" alt="Adjacency matrix of an undirected graph" width="700" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the graph was weighted we would just fill in the squares with the weights instead of 1.&lt;/p&gt;

&lt;p&gt;There are not many advantages to this method except for the fact that inserting and deleting connections is very easy. However in a graph with few connections and lots of nodes, a lot of the squares in the matrix would be empty, and this is wasted space which is not very good. Also adding or removing a node to the graph means that you will have to add or remove a row and column which is not recommended.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is one way one that graphs are represented, and it is relatively easy to code yourself, however something like this would not be favored in big projects or industry simply because of how much space it wastes and it being hard to rescale.&lt;/p&gt;

&lt;p&gt;We will discuss a better way to represent graphs - Adjacency lists - in the next article. I hope you enjoyed reading.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Math's in computer science: Graph theory</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Tue, 09 Jan 2024 19:49:56 +0000</pubDate>
      <link>https://forem.com/jid/maths-in-computer-science-graph-theory-59dm</link>
      <guid>https://forem.com/jid/maths-in-computer-science-graph-theory-59dm</guid>
      <description>&lt;p&gt;Graph theory is a pretty big deal in computer science, and often regarded as a topic that just focuses on computer science. However graph theory is so much bigger than just computer science, it is more accurate to say that it is the study of the field of graphs, whose applications in computer science are invaluable to say the least. I hope to enlighten you with this knowledge.  &lt;/p&gt;

&lt;p&gt;Firstly I think it is important to explain what we mean by a graph in this context. A graph is something that we use to help define and visualize relationships between components. We do this visually by calling the components "nodes", and the lines that connect them to other components as "edges". An example is below (credit to GeeksforGeeks for the picture)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzo364jgqmf9hacjdrsrx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzo364jgqmf9hacjdrsrx.png" alt=" " width="800" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it is time to discuss the types of graphs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Weighted graph: This is a graph where the edges represent a value, such as maybe the distance from points, or the time is takes to go from point to point. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Undirected Graph: A graph where the edges don't point from one node to another, so it is bidirectional relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Directed Graph: A graph where the edges do point from one node to another to symbolize a one way relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trees: Trees are undirected graphs where two nodes are only ever connected by one edge.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But why would we take the time and effort to learn this topic that just seems like a bunch of circles connected by lines. One direct application is GPS. You can model the streets as graphs and this proves to be very useful. Other applications include social networks, computer networks, and even when computers solve sudoku puzzles. &lt;/p&gt;

&lt;p&gt;Great now you know the basics of Graph theory. The topic goes so much deeper so i will need more than one post to delve into this. I hoped you enjoyed reading. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>tutorial</category>
      <category>learning</category>
    </item>
    <item>
      <title>Math in computer science: Binary</title>
      <dc:creator>Jidneya </dc:creator>
      <pubDate>Wed, 03 Jan 2024 18:14:59 +0000</pubDate>
      <link>https://forem.com/jid/math-in-computer-science-binary-5961</link>
      <guid>https://forem.com/jid/math-in-computer-science-binary-5961</guid>
      <description>&lt;p&gt;Binary is fundamental in the study of computer science and is the basis for all digital computing. It is the system that computer use to represent data in which each digit can only have one of two possible digits: 1 or 0. &lt;/p&gt;

&lt;p&gt;One reason that computers use binary is because of the fact that transistors are used in commuter processors, and these can have two states, ON or OFF. So the 1 in binary is for ON and the 0 is for OFF, but what does binary actually represent and how do 1 and 0's become what we see on our screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  How binary works
&lt;/h2&gt;

&lt;p&gt;A binary number is a series of 8 binary digits (bits), and these are called bytes. These are what are used for the computer to process and hold data. In a byte the bit position is the power of 2 that that position represents. This means that the 5th bit will represent either a decimal value of0 if the binary is 0, or a decimal value of 2^5 if the binary value is 1. Like this you can represent 256 numbers from just one byte.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw3ukaqvy89sgsi1djxk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcw3ukaqvy89sgsi1djxk.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What makes binary different to decimal
&lt;/h2&gt;

&lt;p&gt;Binary is a Base-2 system, meaning that each bit can only take two values. On the other hand the decimal system, which is the one we use in daily life uses a base-10 system, so each digit can take 10 different values, ranging from 0 to 9. &lt;/p&gt;

&lt;h2&gt;
  
  
  How is binary used
&lt;/h2&gt;

&lt;p&gt;Different decimal numbers are used to represent different things in our computers, such as numbers, letters and even color's. So for example the ASCII decimal value for the letter "A" is 65, and so when we type "A", we actually give the processor the byte 01000001, and it then converts this into the letter "A", and we see it on our screen. This is the same for numbers and color's.&lt;/p&gt;

&lt;p&gt;I hope you now see how fundamental binary is and how is allows our computers to display and store multitudes of data.&lt;/p&gt;

</description>
      <category>learning</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
