<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Math - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Math - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 30 May 2026 11:14:47 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/math/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How Does Cosine Similarity Work? The Math Behind LLMs Explained ]]>
                </title>
                <description>
                    <![CDATA[ When you talk to a large language model (LLM), it feels like the model understands meaning. But under the hood, the system relies on numbers, vectors, and math to find the relationships between words and sentences. One of the most important tools tha... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-does-cosine-similarity-work/</link>
                <guid isPermaLink="false">68cb5c87b90c34f2f16f5703</guid>
                
                    <category>
                        <![CDATA[ LLM&#39;s  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ llm ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manish Shivanandhan ]]>
                </dc:creator>
                <pubDate>Thu, 18 Sep 2025 01:12:39 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1758157868492/7d242ca0-7721-4d25-93fb-2f0a6e319690.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When you talk to a large language model (LLM), it feels like the model understands meaning. But under the hood, the system relies on numbers, vectors, and math to find the <a target="_blank" href="https://www.turingtalks.ai/p/how-to-perform-sentence-similarity-check-using-sentence-transformers">relationships between words</a> and sentences.</p>
<p>One of the most important tools that makes this possible is cosine similarity. If you want to know how an LLM can judge that two sentences mean almost the same thing, cosine similarity is the key.</p>
<p>This article explains cosine similarity in plain language, shows the math behind it, and connects it to the way modern language models work. By the end, you will see why this simple idea of measuring angles between vectors powers search, chatbots, and many other AI systems.</p>
<h2 id="heading-table-of-contents"><strong>Table of Contents</strong></h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-what-is-cosine-similarity">What Is Cosine Similarity</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-math-behind-cosine-similarity">The Math Behind Cosine Similarity</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-a-simple-example">A Simple Example</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-cosine-similarity-in-embeddings">Cosine Similarity in Embeddings</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-llms-use-cosine-similarity">How LLMs Use Cosine Similarity</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-limits-of-cosine-similarity">Limits of Cosine Similarity</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-why-it-matters-for-llms">Why It Matters for LLMs</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></p>
</li>
</ul>
<h2 id="heading-what-is-cosine-similarity"><strong>What Is Cosine Similarity?</strong></h2>
<p>Imagine you have two sentences. To a computer, they are not words but vectors, a long lists of numbers that capture meaning.</p>
<p>Cosine similarity measures how close these two vectors are, not by their length, but by the angle between them.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757481567784/ccd74ce9-d561-47b5-a5e8-c3e77ed36e79.png" alt="Cosine Similarity" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>Think of two arrows starting from the same point. If they point in the same direction, the angle between them is zero, and cosine similarity is one. If they point in opposite directions, the angle is 180 degrees, and cosine similarity is negative one. If they are at a right angle, the cosine similarity is zero.</p>
<p>So, cosine similarity tells us whether two vectors are pointing in the same general direction. In language tasks, this means it tells us whether two pieces of text carry a similar meaning.</p>
<h2 id="heading-the-math-behind-cosine-similarity"><strong>The Math Behind Cosine Similarity</strong></h2>
<p>To understand cosine similarity, we need to look at a bit of math. The cosine of an angle in geometry is the ratio between the dot product of two vectors and the product of their magnitudes. Written as a formula, cosine similarity looks like this:</p>
<pre><code class="lang-plaintext">cosine_similarity(A, B) = (A · B) / (||A|| * ||B||)
</code></pre>
<p>Here:</p>
<ul>
<li><p><code>A · B</code> is the dot product of vectors A and B.</p>
</li>
<li><p><code>||A||</code> is the magnitude (length) of vector A.</p>
</li>
<li><p><code>||B||</code> is the magnitude of vector B.</p>
</li>
</ul>
<p>The dot product multiplies corresponding numbers in the two vectors and adds them up. The magnitude of a vector is like finding the length of an arrow, using the <a target="_blank" href="https://en.wikipedia.org/wiki/Pythagorean_theorem">Pythagorean theorem</a>.</p>
<p>This formula always gives a value between -1 and 1. A value close to 1 means the vectors are pointing in nearly the same direction. A value close to 0 means they are unrelated. A value close to -1 means they are opposite.</p>
<h2 id="heading-a-simple-example"><strong>A Simple Example</strong></h2>
<p>Let’s see a short example using Python. Suppose you want to check how similar two short texts are. We can use <a target="_blank" href="https://scikit-learn.org/">scikit-learn</a> to turn them into vectors and then compute cosine similarity.</p>
<pre><code class="lang-plaintext">from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity

texts = [
    "I love machine learning",
    "I love deep learning"
]

vectorizer = TfidfVectorizer().fit_transform(texts)
vectors = vectorizer.toarray()

similarity = cosine_similarity([vectors[0]], [vectors[1]])
print("Cosine similarity:", similarity[0][0])
</code></pre>
<p>The code starts by importing two important tools. <code>TfidfVectorizer</code> is responsible for turning text into numbers, while <code>cosine_similarity</code> measures how similar two sets of numbers are. Together, they let us compare text in a way a computer can understand.</p>
<p>Next, we define the sentences we want to compare. In this example, we use “I love machine learning” and “I love deep learning.” These two sentences share some words such as “I,” “love,” and “learning,” while differing in one word: “machine” versus “deep.” This makes them good examples to test, because they are clearly related but not exactly the same.</p>
<p>The vectorizer then builds a vocabulary from all the unique words across the two sentences. For these inputs, the vocabulary becomes <code>["deep", "learning", "love", "machine"]</code>. This means the program now has a list of all the words it will track when building the numerical representation of the sentences.</p>
<p>Each sentence is then converted into a vector, which is simply a list of numbers. These numbers are not just raw word counts. Instead, they are weighted using TF-IDF, which stands for <a target="_blank" href="https://www.learndatasci.com/glossary/tf-idf-term-frequency-inverse-document-frequency/">Term Frequency–Inverse Document Frequency</a>.</p>
<p>TF-IDF gives more importance to words that matter in a sentence and less importance to very common words. In simplified form, the first sentence becomes something like <code>[0. 0.50154891 0.50154891 0.70490949]</code>, while the second becomes <code>[0.70490949 0.50154891 0.50154891 0. ]</code>. The numbers may look small, but what matters is their relative values.</p>
<p>The <code>.toarray()</code> method then converts these vectors into standard Python arrays. This makes them easier to handle, since the TF-IDF output is stored in a special sparse format by default.</p>
<p>Once the sentences are represented as vectors, cosine similarity is applied. This step checks the angle between the two vectors.</p>
<p>If the vectors point in exactly the same direction, their similarity score will be one. If they are unrelated, the score will be close to zero. If they point in opposite directions, the score will be negative.</p>
<p>In this case, because the two sentences share most of their words, the vectors point in a similar direction, so the cosine similarity falls somewhere around 0.5 to 0.7.</p>
<p>In simple terms, this code shows how a computer can compare two sentences by turning them into vectors of numbers and then checking how close those vectors are. By using cosine similarity, the program can judge not just whether the sentences share words, but also how strongly they overlap in meaning.</p>
<h2 id="heading-cosine-similarity-in-embeddings"><strong>Cosine Similarity in Embeddings</strong></h2>
<p>In practice, LLMs like GPT or BERT do not use simple word counts. Instead, they use embeddings.</p>
<p>An <a target="_blank" href="https://www.freecodecamp.org/news/how-ai-agents-remember-things-vector-stores-in-llm-memory/">embedding</a> is a dense vector that captures meaning. Each word, phrase, or sentence is turned into a set of numbers that place it in a high-dimensional space.</p>
<p>In this space, words with similar meaning are close together. For example, the embeddings for “king” and “queen” are closer than the embeddings for “king” and “table.”</p>
<p>Cosine similarity is the tool that allows us to measure how close two embeddings are. When you search for “dog,” the system can look for embeddings that point in a similar direction. That way, it finds results about “puppy,” “canine,” or “pet” even if those exact words are not in your query.</p>
<h2 id="heading-how-llms-use-cosine-similarity">How LLMs Use Cosine Similarity</h2>
<p>Large language models use cosine similarity in many ways. When you ask a question, the model encodes your input into a vector. It then compares this vector with stored knowledge or with candidate answers using cosine similarity.</p>
<p>For semantic search, cosine similarity helps rank documents. A system can embed all documents into vectors, then embed your query and compute similarity scores. The documents with the highest scores are the most relevant.</p>
<p>In clustering, cosine similarity helps group sentences that have related meaning. In recommendation systems, it helps match users to items by comparing their preference vectors.</p>
<p>Even when generating answers, LLMs rely on vector similarity to decide which words or phrases best follow in context. Cosine similarity gives the model a simple but powerful way to measure closeness of meaning.</p>
<h2 id="heading-limits-of-cosine-similarity"><strong>Limits of Cosine Similarity</strong></h2>
<p>While cosine similarity is powerful, it has limits. It depends heavily on the quality of embeddings. If embeddings fail to capture meaning well, similarity scores may not reflect real-world closeness.</p>
<p>Also, cosine similarity only measures direction. Sometimes, magnitude contains useful information too. For example, a sentence embedding might have a length that reflects confidence. By ignoring it, cosine similarity may lose part of the picture.</p>
<p>Still, despite these limits, cosine similarity remains one of the most widely used methods in natural language processing.</p>
<h2 id="heading-why-it-matters-for-llms"><strong>Why It Matters for LLMs</strong></h2>
<p>Cosine similarity is not just a math trick. It is a bridge between human language and machine understanding. It allows a model to treat meaning as geometry, turning questions and answers into points in space.</p>
<p>Without cosine similarity, embeddings would be less useful, and tasks like semantic search, clustering, and ranking would be harder. By reducing the problem to measuring angles, we make meaning measurable and usable.</p>
<p>Every time you search on Google, chat with an AI, or use a recommendation engine, cosine similarity is at work behind the scenes.</p>
<h2 id="heading-conclusion"><strong>Conclusion</strong></h2>
<p>Cosine similarity explains how LLMs judge the closeness of meaning between words, sentences, or even whole documents. It works by comparing the angle between vectors, not their length, which makes it ideal for text. With embeddings, cosine similarity becomes the foundation of semantic search, clustering, recommendations, and many other tasks in natural language processing.</p>
<p>The next time an AI gives you an answer that feels “close enough,” remember that a simple mathematical idea, measuring the angle between two arrows, is doing much of the heavy lifting.</p>
<p><em>Hope you enjoyed this article. Signup for my free AI newsletter</em> <a target="_blank" href="https://www.turingtalks.ai/"><strong><em>TuringTalks.ai</em></strong></a> <em>for more hands-on tutorials on AI. You can also find</em> <a target="_blank" href="https://manishshivanandhan.com/"><strong><em>visit my website</em></strong></a><em>.</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ The Architecture of Mathematics – And How Developers Can Use it in Code ]]>
                </title>
                <description>
                    <![CDATA[ "To understand is to perceive patterns." - Isaiah Berlin Math is not just numbers. It is the science of finding complex patterns that shape our world. This means that to truly understand it, we need to see beyond numbers, formulas, and theorems and ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-architecture-of-mathematics-and-how-developers-can-use-it-in-code/</link>
                <guid isPermaLink="false">68308ee8ccde6bc325c82393</guid>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ MathJax ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Tiago Capelo Monteiro ]]>
                </dc:creator>
                <pubDate>Fri, 23 May 2025 15:06:16 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1748012748947/1df613bf-93e7-4f03-b0f0-47ff49f38504.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <blockquote>
<p>"To understand is to perceive patterns." - Isaiah Berlin</p>
</blockquote>
<p>Math is not just numbers. It is the science of finding complex patterns that shape our world. This means that to truly understand it, we need to see beyond numbers, formulas, and theorems and understand its structures.</p>
<p>The main goal of this article is to show how math is just like a growing tree of ideas. I want to show that math is a living system of logic, not just formulas to memorize. With analogies, history, and code examples, I want to help you understand math more deeply and how you can apply it to programming.</p>
<p>I’ve also included some code examples here to help you connect theory and practice. I show them to demonstrate how math ideas are applied to real problems. Whether you are new to more advanced math or are more experienced, these code examples will help you understand how to apply math in programming.</p>
<p>This link across theory and application reflects my own studies. I am a finalist in an undergraduate degree in Electrical and Computer Engineering at NOVA FCT, one of the best engineering faculties in Portugal.</p>
<p>My engineering degree is one with more math and physics. This is because it’s key to get a solid grasp of math to understand electronics, telecommunications, control theory, and other areas of engineering.</p>
<p>Here’s a brief overview of some of the math and physics subjects I’ve learned:</p>
<ul>
<li><p><strong>Partial Differential Equations (PDEs):</strong> These equations model real-world phenomena, from heat diffusion to the economy of a country.</p>
</li>
<li><p><strong>Harmonic Analysis (Fourier &amp; Laplace):</strong> Integral transforms like the Fourier and Laplace transform allow us to understand problems in new domains.</p>
</li>
<li><p><strong>Complex Analysis:</strong> Extending calculus into the complex plane gives rise to powerful tools used in physics and engineering.</p>
</li>
<li><p><strong>Numerical Analysis:</strong> When analytical solutions are impossible or inefficient, numerical methods provide computer-based approximations. This is crucial for real-world applications.</p>
</li>
<li><p><strong>Control and Signal Theory:</strong> These areas show us how to design stable systems like rockets, trains, and robots.</p>
</li>
<li><p><strong>Physics:</strong> Courses in Classical Mechanics and Electromagnetism helped bridge theoretical math to physical laws</p>
</li>
</ul>
<p>During my years of study, besides technical skills, I’ve developed a deeper understanding of how the world works and the structure of the field of mathematics. And I’ve started to find patterns in how math is a framework of interconnected logic.</p>
<h3 id="heading-in-this-article-well-explore">In this article, we’ll explore:</h3>
<ul>
<li><p><a class="post-section-overview" href="#heading-simple-analogy-the-tree-of-mathematics">Simple Analogy: The Tree of Mathematics</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-structure-and-history-of-mathematics">The Structure and History of Mathematics</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-an-tree-example-foundations-of-relativity-by-albert-einstein">An Tree example: Foundations of Relativity by Albert Einstein</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-biggest-paradox-of-math-discovered-by-kurt-godel">The Biggest Paradox of Math, Discovered by Kurt Gödel</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-what-about-applied-math-and-engineering">What About Applied Math and Engineering?</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-code-examples-analytical-and-numerical-approaches">Code Examples – Analytical and Numerical Approaches</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-the-impact-of-a-grand-unified-theory-of-mathematics">The Impact of a Grand Unified Theory of Mathematics</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-a-final-lesson-from-history">A Final Lesson From History</a></p>
</li>
</ul>
<h2 id="heading-simple-analogy-the-tree-of-mathematics">Simple Analogy: The Tree of Mathematics</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518175609/78838825-d872-42df-9dc8-736fa012a630.jpeg" alt="Photo of two trees by Johannes Plenio: https://www.pexels.com/photo/two-brown-trees-1632790/" class="image--center mx-auto" width="5456" height="3632" loading="lazy"></p>
<p>Imagine math as a vast tree growing forever.</p>
<p>The roots of the tree are the foundations of mathematics: logic and set theory. From this foundation emerge the main basic fields of math: arithmetic, algebra, geometry, and analysis.</p>
<p>As the tree divides further and further into more branches, new, more complex subfields start to appear, like topology, abstract algebra, and complex analysis. Sometimes the branches are connected to each other.</p>
<p>And remember: this tree is always growing in many directions. From branches creating new branches to branches connecting to other branches. Little by little, it grows.</p>
<p>Throughout history, there have been times that, due to some big scientific discoveries, parts of the math tree started to grow very fast. Other times, decades and even centuries passed without many new branches. This is the case for imaginary numbers, for example.</p>
<p>And you might wonder: How many more branches and connections between them will keep appearing?</p>
<h2 id="heading-the-structure-and-history-of-mathematics">The Structure and History of Mathematics</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518363058/9911acd4-ad4f-4da2-a62b-9fa87e219c35.jpeg" alt="Photo of a writing desk and notebook on Pixabay: https://www.pexels.com/photo/brown-wooden-desk-159618/" class="image--center mx-auto" width="2480" height="1806" loading="lazy"></p>
<p>The first mathematical ideas appeared independently across ancient civilizations. For example:</p>
<ul>
<li><p>India’s invention of zero</p>
</li>
<li><p>Islamic algebraic advances</p>
</li>
<li><p>Greek geometric rigor</p>
</li>
</ul>
<p>Over time, many different great mathematicians created and shared them by writing and giving lectures.</p>
<p>Eventually, these new ideas were shared widely with new generations and these new generations created new math based on old math.</p>
<p>This is is how new branches are continuously born from previous branches of the tree of mathematics.</p>
<p>And this is why Isaac Newton wrote, in a letter to Robert Hooke in 1675:</p>
<blockquote>
<p>If I have seen further, it is by standing on the shoulders of giants</p>
</blockquote>
<p>He meant that by working from previous knowledge, he was able to create and (re)discover new ideas.</p>
<p>Yet, the real power of math lies in practicing it over and over and understanding it more and more deeply. As one of my professors once explained:</p>
<blockquote>
<p><em>More important than knowing the theorems is knowing the ideas behind them and the history of how they were created.</em></p>
</blockquote>
<p>Very often, to solve problems, it is necessary to think in terms of first principles and build from there. Math teaches exactly that. In this way, math is not just an academic subject. It is a language spoken by scientists and engineers around the globe.</p>
<p>By having it well preserved and shared, it is still possible to create new math from previous ideas. And it’s possible for the big tree to continue growing based on previous branches or nodes.</p>
<h2 id="heading-an-tree-example-foundations-of-relativity-by-albert-einstein">An Tree example: Foundations of Relativity by Albert Einstein</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518865627/e84ff108-b383-405b-8bb0-73ffb50b4dcf.jpeg" alt="Albert Einstein, one of the greatest physics giants in history" class="image--center mx-auto" width="1920" height="1200" loading="lazy"></p>
<p>Albert Einstein created the general and special theories of relativity. These have big consequences nowadays:</p>
<ul>
<li><p>GPS and Global Communication</p>
</li>
<li><p>Advancements in Satellite Telecommunications</p>
</li>
<li><p>Space Exploration and Satellite Launches</p>
</li>
</ul>
<p>But this was only possible through the unification of geometry with calculus, called <strong>differential geometry.</strong> The evolution of differential geometry happened over the centuries, thanks to many great mathematicians. Below are some of them, but this is not a complete list:</p>
<ul>
<li><p><strong>Euclid (circa 300 BCE):</strong> Contributed to geometry, laying the groundwork for later mathematical systems</p>
</li>
<li><p><strong>Archimedes (circa 287–212 BCE):</strong> Pioneered the understanding of volume, surface area, and the principles of mechanics</p>
</li>
<li><p><strong>René Descartes (1596–1650):</strong> Developed Cartesian coordinates and analytical geometry</p>
</li>
<li><p><strong>Isaac Newton (1642–1727) &amp; Gottfried Wilhelm Leibniz (1646–1716):</strong> Newton’s laws of motion and gravitation, alongside Leibniz’s development of calculus, formed the basis of classical mechanics that Einstein sought to extend and modify in his theory of relativity.</p>
</li>
<li><p><strong>Leonhard Euler (1707–1783):</strong> Contributed to the development of differential equations, which are essential in the mathematical foundations of physics.</p>
</li>
<li><p><strong>Gaspard Monge (1746–1818):</strong> The father of differential geometry and pioneer in descriptive geometry</p>
</li>
<li><p><strong>Carl Friedrich Gauss (1777–1855):</strong> Made groundbreaking advances in geometry, including the concept of curved surfaces.</p>
</li>
<li><p><strong>Bernhard Riemann (1826–1866):</strong> Introduced Riemannian geometry, a branch of differential geometry.</p>
</li>
</ul>
<p>Once again, as Isaac Newton wrote, in a letter to Robert Hooke in 1675:</p>
<blockquote>
<p>If I have seen further, it is by standing on the shoulders of giants.</p>
</blockquote>
<p>Albert Einstein saw what no one else in his time saw, thanks to these great math giants and countless others.</p>
<h2 id="heading-the-biggest-paradox-of-math-discovered-by-kurt-godel">The Biggest Paradox of Math, Discovered by Kurt Gödel</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518411126/df53f84c-f920-4b42-9081-5aeb1017f543.jpeg" alt="Kurt Gödel, one of the greatest math giants in history" class="image--center mx-auto" width="900" height="750" loading="lazy"></p>
<p>The biggest paradox in math, in my opinion, is what Kurt Gödel discovered. His early 20th century research revealed a limitation within this cycle.</p>
<p>This paradox – that is, <a target="_blank" href="https://en.wikipedia.org/wiki/G%C3%B6del%27s_incompleteness_theorems">his incompleteness theorems</a> – shows that in any consistent formal system capable of expressing simple arithmetic, there will always be true mathematical statements that cannot be proven within the system itself.</p>
<p>This means that in ALL systems, there are limits to what you can actually prove as to what is true and false. For for mathematicians, this means that the tree will never be completed. There are truths that are beyond formal truths, and yet we still assume that they are true (albeit unproven).</p>
<p>This way, it proves that no matter how many mathematicians work in the field or how much AI is used to find new mathematics, there will always exist limitations. Some things are impossible to prove that are true, and we just know that they are due to approximation estimations and other non logical exact methods.</p>
<h2 id="heading-what-about-applied-math-and-engineering">What About Applied Math and Engineering?</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518581076/606f3bce-d7db-4ac3-9322-833673a734b0.jpeg" alt="Photo by JESHOOTS.com: https://www.pexels.com/photo/person-holding-a-chalk-in-front-of-the-chalk-board-714699/" class="image--center mx-auto" width="5472" height="3648" loading="lazy"></p>
<p>Applied math and engineering involves interpreting the same pure math ideas in real-world scenarios. Actually, in many cases, it is the combination of many math ideas. Let’s consider some examples:</p>
<p>Principal component analysis (PCA) is a widely used tool in data science. Yet, it is a mixture of linear algebra (in PCA, eigenvalues) with optimization (order eigenvalues that represent more data with less data) in order to make datasets shorter.</p>
<p>In machine learning, logistic regression is a mixture of calculus with statistics and probability.</p>
<p>In harmonic analysis, Laplace, Fourier, and Z-transforms are a way to see the same thing in a new domain to get new insights. In this case, integrals are used to make this mapping.</p>
<p>In deep learning, neural networks are just many matrices multiplying and updating themselves that adapt to model a dataset representing a system. This optimization of matrix values happens with activation functions, a gradient descent-based optimization method (tells how much values need to change), and backpropagation (applies those alterations to all matrix values).</p>
<p>I have actually written an article where I teach <a target="_blank" href="https://www.freecodecamp.org/news/activation-functions-in-neural-networks/">why activation functions are important</a> if you want to check it out.</p>
<p>But the best example of this fusion of math with engineering is in <a target="_blank" href="https://www.freecodecamp.org/news/basic-control-theory-with-python/">control theory</a>.</p>
<p>Control theory is the study of the architecture of systems. From trains to cars to airplanes, everything is based on control theory. It is everywhere in nearly all modern electronic devices. In electric circuits, control theory is also used heavily to guarantee circuit stability in the face of electric disturbances.</p>
<p>So as you can probably start to see, many of the tools we now have are just a mixture of many pure math ideas. Just many combinations and recipes of pure math ideas. In essence, applied math is the application of pure math as “ingredients“ in "recipes" to solve problems.</p>
<p>So, we’ve explored the structure and evolution of mathematics. Yet, it is important to see how these ideas can be applied in real life. Pure math makes the framework, and applied math applies that framework to solve problems. To understand this, we’ll examine two code examples that show how you can use math ideas as programming tools.</p>
<h2 id="heading-code-examples-analytical-and-numerical-approaches">Code Examples – Analytical and Numerical Approaches</h2>
<p>These code examples demonstrate a couple ways you can use Python to solve math equations.</p>
<p>In the first code example, we’ll solve the problem in the same way that kids in school solve math exercises: essentially, by hand with a pencil. Moving variables from left to right to find their values. In the second example, we’ll solve the problem using numerical analysis.</p>
<h3 id="heading-example-1-solve-a-problem-analytically">Example 1: Solve a Problem Analytically</h3>
<p>When we solve math problems analytically, like we did in school, we are manipulating symbols to get exact values. Often there symbols are x, y and z. In Python, we can do this using the SymPy library:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sympy <span class="hljs-keyword">import</span> symbols, Eq, solve

x, y = symbols(<span class="hljs-string">'x y'</span>)
eq1 = Eq(<span class="hljs-number">2</span>*x + <span class="hljs-number">3</span>*y, <span class="hljs-number">6</span>)
eq2 = Eq(-x + y, <span class="hljs-number">1</span>)

solution = solve((eq1, eq2), (x, y))
print(solution)
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747160359386/7a21cddc-f4ba-4f9f-afa0-d1cc11fb27d6.png" alt="7a21cddc-f4ba-4f9f-afa0-d1cc11fb27d6" class="image--center mx-auto" width="2080" height="1224" loading="lazy"></p>
<p>Essentially, we are finding x and y based on this equation:</p>
<p>$$\begin{align*} 2x + 3y &amp;= 6 \\ -x + y &amp;= 1 \end{align*}$$</p><p>Which gives us the following result:</p>
<pre><code class="lang-python">{x: <span class="hljs-number">3</span>/<span class="hljs-number">5</span>, y: <span class="hljs-number">8</span>/<span class="hljs-number">5</span>}
</code></pre>
<p>Or:</p>
<ul>
<li><p>x= 0.6</p>
</li>
<li><p>y = 1.6</p>
</li>
</ul>
<p>When we say that we’re solving this analytically, it means that we’re finding an exact mathematical solution using formulas or equations.</p>
<p>But many times, problems are harder and can be solved by adding symbols to the right or left of the equation.</p>
<p>Sometimes, there can be so many symbols and transformed versions of them, with things like derivatives and integrals, that it can become very hard to manage and takes a lot of time.</p>
<p>For this reason, there is an area of mathematics devoted to finding approximations of already created mathematical formulas called numerical analysis. It makes it faster to solve these problems. And this is the method we will explore next.</p>
<h3 id="heading-example-2-solve-numerically-approximation">Example 2: Solve Numerically (Approximation)</h3>
<p>We’ll now use SciPy to solve the same system with numerical methods:</p>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> scipy.linalg <span class="hljs-keyword">import</span> solve

A = np.array([[<span class="hljs-number">3</span>, <span class="hljs-number">2</span>, <span class="hljs-number">-1</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>],
              [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">2</span>, <span class="hljs-number">-2</span>],
              [<span class="hljs-number">4</span>, <span class="hljs-number">-1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>],
              [<span class="hljs-number">5</span>, <span class="hljs-number">3</span>, <span class="hljs-number">-2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
              [<span class="hljs-number">2</span>, <span class="hljs-number">-3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>]])

b = np.array([<span class="hljs-number">12</span>, <span class="hljs-number">5</span>, <span class="hljs-number">7</span>, <span class="hljs-number">9</span>, <span class="hljs-number">10</span>])

solution = solve(A, b)

print(solution)
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747160347486/d1f17aa6-b288-4e41-9be7-0810c45e778c.png" alt="d1f17aa6-b288-4e41-9be7-0810c45e778c" class="image--center mx-auto" width="2080" height="1764" loading="lazy"></p>
<p>In this code example, this line of code:</p>
<pre><code class="lang-python">solution = solve(A, b)
</code></pre>
<p>Uses the <a target="_blank" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.solve.html">solve</a> method from the <a target="_blank" href="https://scipy.org/">SciPy</a> Python library:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.linalg <span class="hljs-keyword">import</span> solve
</code></pre>
<p>It’s a method that helps you find the values of x in an equation A⋅x=b, where a is a square grid of numbers and b is a list of numbers. Which gives us the following:</p>
<pre><code class="lang-python">[ <span class="hljs-number">1.35022026</span> <span class="hljs-number">-0.79955947</span> <span class="hljs-number">-1.17180617</span>  <span class="hljs-number">3.14317181</span> <span class="hljs-number">-0.83920705</span>]
</code></pre>
<p>Now imagine, in this simple case, that a matrix like A could represent the <strong>traffic flow</strong> between cities or intersections, and b could represent the <strong>traffic entering or leaving</strong> each city.</p>
<p>By solving the system, it could help us determine the distribution of traffic between cities to meet desired traffic conditions.</p>
<p>Of course, these types of problems are far more complex in real life. But to understand and solve the big problems, you need to first understand the smaller problems.</p>
<p>And by the way, a system of equations is the same thing as a matrix. We just represent systems of equations as matrices to make the findings of properties and clarity easier to understand.</p>
<p>The thing is that by using matrices, it is easier to make calculations and to perform linear algebra math to check for characteristics of the matrix and understand it better.</p>
<p>In essence, a matrix represents a system of equations. Also, systems of equations can represent real life phenomena like the economy of a country or the weather.</p>
<p>If you want to know more, I wrote an <a target="_blank" href="https://www.freecodecamp.org/news/numerical-analysis-explained-how-to-apply-math-with-python/">entire article on numerical analysis</a> that you can check out.</p>
<h2 id="heading-the-impact-of-a-grand-unified-theory-of-mathematics">The Impact of a Grand Unified Theory of Mathematics</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1747518681068/54a9556c-2a79-441c-a6d6-27ff38e1f4ff.jpeg" alt="Photo by Porapak Apichodilok: https://www.pexels.com/photo/person-holding-world-globe-facing-mountain-346885/" class="image--center mx-auto" width="5184" height="3456" loading="lazy"></p>
<p>Despite the biggest paradox in mathematics, what would happen with a <a target="_blank" href="https://www.scientificamerican.com/article/the-evolving-quest-for-a-grand-unified-theory-of-mathematics/">Grand Unified Theory of Mathematics</a>?</p>
<p>Remember that such a theory tells us that there are things that are true that are impossible to formally prove, and we need to just accept it. But even with this assumption, it is still possible to unify all math.</p>
<p>This is what <a target="_blank" href="https://en.wikipedia.org/wiki/Langlands_program">the Langland's program</a> is trying to solve. A kind of attempt to interconnect the largest parts of the big tree of math to uncover new patterns in math.</p>
<p>With a Grand Unified Theory of Mathematics, we would be able to understand how every branch of the tree connects with the others and all the relationships between them.</p>
<h3 id="heading-what-is-the-value-of-this-big-unification-for-society">What is the value of this big unification for society?</h3>
<p>By studying history, we can find patterns. The unification of various fields has created many massive impacts on society, such as:</p>
<ul>
<li><p>In the 19th century, James Clerk Maxwell united the fields of <em>electricity</em> and <em>magnetism</em> with his famous Maxwell equations. This allowed the creation of radios and electric grids around the globe. In turn, it served as a foundation for all technological progress in the 20th and 21th century.</p>
</li>
<li><p>In the 20th century, the unification of <em>algebra</em> with <em>logic</em> led to the rise of digital systems. In turn, digital systems gave the rise of processors and the evolution of computers to the modern laptop.</p>
</li>
<li><p>Also in the 20th century, the unification of <em>probability</em> and <em>communication</em> led to information theory. This became the foundation for the internet. This unification was carried out by a great mathematician called Clause Shannon.</p>
</li>
</ul>
<p>In the end, a Grand Unified Theory of Mathematics could be one of the biggest achievements in modern society.</p>
<p>It could lead to new discoveries in physics, such as in string theory or quantum gravity, where deep mathematical structures are needed to create new physics. In AI, it could help unify all machine learning models in a common architecture. This would help accelerate the development of new AI models. It could also open the door to new cryptographic methods and material science advances, revealing, with math, the deep patterns still not found in these fields.</p>
<p>Just as uniting electricity and magnetism led to modern technology, a unified math framework would lead to a wave of innovation.</p>
<h2 id="heading-a-final-lesson-from-history">A Final Lesson From History</h2>
<p>From Greek geometry to AI, math has grown like a tree over centuries. By understanding its structure, it is possible to see its role in finding the patterns of our universe. I hope I was able to make you see math in this way.</p>
<p>In addition, we can conclude that the unification of scientific fields makes the foundations for the creation of new innovations to help society go forward. Many profound societal transformations only came to be thanks to abstract math ideas. When these are shared and refined, they become the hidden architecture of progress in society. Innovation begins when disconnected ideas are united, well-linked, and widely shared.</p>
<p>Find the full code <a target="_blank" href="https://github.com/tiagomonteiro0715/freecodecamp-my-articles-source-code">here</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ 120 Free Online Math Courses from the World’s Top Universities ]]>
                </title>
                <description>
                    <![CDATA[ In this article, we’ve compiled over 300 online courses offered by the 60 best universities in the world for studying math. We did so by combining popular university rankings to identify the best inst ]]>
                </description>
                <link>https://www.freecodecamp.org/news/math-online-courses-from-worlds-top-universities/</link>
                <guid isPermaLink="false">66c376b59a8c3b7871c66a55</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ online courses ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Manoel ]]>
                </dc:creator>
                <pubDate>Sun, 12 Jan 2025 06:00:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/05/mathematics-banner.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, we’ve compiled over 300 online courses offered by the 60 best universities in the world for studying math.</p>
<p>We did so by combining popular university rankings to identify the best institutions, and then using the&nbsp;<a href="https://www.classcentral.com/subjects"><strong>Class Central database</strong></a> to find all their math online courses.</p>
<h2 id="heading-methodology"><strong>Methodology</strong></h2>
<p>I built the list following the same data-driven approach used to build the list of&nbsp;<a href="https://www.classcentral.com/report/cs-online-courses/"><strong>computer science courses from the top CS universities</strong></a>.</p>
<p>First, I identified the leading&nbsp;<a href="https://en.wikipedia.org/wiki/College_and_university_rankings#Global_rankings"><strong>world university rankings</strong></a>. Since I was specifically interested in math, I looked at their latest rankings of the best universities for studying math (or closest superset). Here are the rankings I ended up using:</p>
<ul>
<li><p><a href="https://www.topuniversities.com/university-subject-rankings/mathematics"><strong>QS: World University Ranking 2025 — Mathematics</strong></a></p>
</li>
<li><p><a href="https://www.timeshighereducation.com/world-university-rankings/2025/subject-ranking/physical-sciences"><strong>Times Higher Education: World University Ranking 2025 — Physical Sciences</strong></a></p>
</li>
</ul>
<p>Then, we crawled and scraped each ranking.</p>
<p>Now that I had some data, I used&nbsp;<a href="https://jupyter.org/"><strong>Jupyter</strong></a> with Python to process it. I combined the three rankings into one by averaging the position of each university in each ranking. Then, I filtered out the universities that didn’t offer online courses, and limited the list to the top 60 institutions.</p>
<p>For the latest update of this article, Suparn used the same sources and methodology to find the top 60 universities offering online math courses.</p>
<img src="https://cdn.hashnode.com/uploads/covers/67609e10de2c94d89bd72b33/83ffe01a-ea37-4faf-9cde-264d7b9eab73.png" alt="83ffe01a-ea37-4faf-9cde-264d7b9eab73" style="display:block;margin:0 auto" width="642" height="713" loading="lazy">

<p><em>Combined ranking: top 10 universities for studying mathematics in 2024</em></p>
<p>As you can see in the image above, I found that the top three math institutions are:</p>
<ol>
<li><p><a href="https://www.classcentral.com/university/harvard"><strong>Harvard</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/university/mit"><strong>MIT</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/university/stanford"><strong>Stanford</strong></a></p>
</li>
</ol>
<p>Finally, we used the&nbsp;<a href="https://www.classcentral.com/subjects"><strong>Class Central database</strong></a>, with its 250K online courses, to find all the math courses offered by the universities in the ranking.</p>
<p>The end result is a list of more than 300 online courses offered by 60 best universities in the world for studying math in 2025.</p>
<p>While processing the data, I noticed something interesting: 59 of the top 60 universities offer online courses, a lot more than I would have guessed. The world’s top institutions are very prolific creators of online courses.</p>
<h2 id="heading-stats"><strong>Stats</strong></h2>
<ul>
<li><p>Enrollments range from 21 to over 13 million. There are 8 courses with over 1 million enrollments</p>
</li>
<li><p>Altogether, the courses in this list have over 52 million enrollments, with an average of over 296 thousand enrollments</p>
</li>
<li><p>222 courses are free and 98 are paid</p>
</li>
<li><p>291 courses are in English, 19 Chinese, 7 French, and 1 each in Spanish, German, Korean.</p>
</li>
<li><p>Together, they account for 2,118 reviews at Class Central, with an average of 28 reviews</p>
</li>
<li><p>Average Rating 4.51 out of 5.0</p>
</li>
<li><p>80 courses are beginner level, 57 are intermediate level, and 11 are advanced level.</p>
</li>
</ul>
<hr>
<h2 id="heading-general-mathematics-45"><strong>General Mathematics (45)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/fibonacci-6684?ref=freecodecamp"><strong>Fibonacci Numbers and the Golden Ratio</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(271)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-stanford-university-how-to-learn-math-for-st-917?ref=freecodecamp"><strong>How to Learn Math: For Students</strong></a> from <em>Stanford University</em> ★★★★☆(17)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/engineering-stanford-university-convex-optimizati-1577?ref=freecodecamp"><strong>Convex Optimization</strong></a> from <em>Stanford University</em> ★★★★★(8)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mathematics-engineers-capstone-66368?ref=freecodecamp"><strong>Mathematics for Engineers: The Capstone Course</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(5)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-a-level-mathematics--12873?ref=freecodecamp"><strong>A-level Mathematics for Year 12 - Course 1: Algebraic Methods, Graphs and Applied Mathematics Methods</strong></a> from <em>Imperial College London</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/what-is-a-proof-9212?ref=freecodecamp"><strong>Mathematical Thinking in Computer Science</strong></a> from <em>University of California, San Diego</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-engineering-mathematics-uw-me564-and-me565-80316?ref=freecodecamp"><strong>Engineering Mathematics</strong></a> from <em>University of Washington</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mathematics-engineers-89548?ref=freecodecamp"><strong>Mathematics for Engineers</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-political-geometry-the-mathematics-of-redistricting-moon-duchin-radcliffe-institute-179717?ref=freecodecamp"><strong>Political Geometry - The Mathematics of Redistricting</strong></a> from <em>Harvard University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/computer-science-columbia-university-essential-ma-295554?ref=freecodecamp"><strong>Essential Math for AI</strong></a> from <em>Columbia University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-a-level-further-math-27956?ref=freecodecamp"><strong>A-level Further Mathematics for Year 12 - Course 1: Complex Numbers, Matrices, Roots of Polynomial Equations and Vectors</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/delivery-problem-9211?ref=freecodecamp"><strong>Delivery Problem</strong></a> from <em>University of California, San Diego</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/differential-equations-imperial-college-london-a--56548?ref=freecodecamp"><strong>A-level Further Mathematics for Year 13 - Course 1: Differential Equations, Further Integration, Curve Sketching, Complex Numbers, the Vector Product and Further Matrices</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-stanford-university-como-aprender-matematica-19072?ref=freecodecamp"><strong>Cómo Aprender Matemáticas - Para Estudiantes</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-further-mathematics--59515?ref=freecodecamp"><strong>Further Mathematics Year 13 course 2: Applications of Differential Equations, Momentum, Work, Energy &amp; Power, The Poisson Distribution, The Central Limit Theorem, Chi Squared Tests, Type I and II Errors</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-foundational-mathematics-for-ai-424969?ref=freecodecamp"><strong>Foundational Mathematics for AI</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/complexity-57707?ref=freecodecamp"><strong>Introduction to Complexity Science</strong></a> from <em>Nanyang Technological University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-int-277196?ref=freecodecamp"><strong>Introduction to optimization on smooth manifolds: first order methods</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-nonlinear-dynamics-and-chaos-steven-strogatz-cornell-university-53089?ref=freecodecamp"><strong>Nonlinear Dynamics and Chaos</strong></a> from <em>Cornell University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mit-res-ll-005-mathematics-of-big-data-and-machine-learning-iap-2020-90326?ref=freecodecamp"><strong>Mathematics of Big Data and Machine Learning, IAP 2020</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-how-learning-ten-equations-can-improve-your-life-david-sumpter-142810?ref=freecodecamp"><strong>How Learning Ten Equations Can Improve Your Life - David Sumpter</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/discrete-mathematics-ch-8275?ref=freecodecamp"><strong>离散数学</strong></a> from <em>Shanghai Jiao Tong University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-mathematics-of-visual-illusions-ian-stewart-142846?ref=freecodecamp"><strong>The Mathematics of Visual Illusions - Ian Stewart</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-math-boot-camp-for-engineers-450374?ref=freecodecamp"><strong>Math Boot Camp for Engineers</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-wrinkling-oxford-mathematics-research-seminar-142813?ref=freecodecamp"><strong>Wrinkling - Oxford Mathematics Research Seminar</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96615?ref=freecodecamp"><strong>Analyse I (partie 4) : Limite d'une fonction, fonctions continues</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96616?ref=freecodecamp"><strong>Analyse I (partie 5) : Fonctions continues et fonctions dérivables, la fonction dérivée</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-potential-for-ai-in-science-and-mathematics-terence-tao-309891?ref=freecodecamp"><strong>The Potential for AI in Science and Mathematics</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-lecture-don-knuth-pi-and-the-art-of-computer-programming-2019-191798?ref=freecodecamp"><strong>Stanford Lecture - Pi and The Art of Computer Programming - 2019</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96617?ref=freecodecamp"><strong>Analyse I (partie 6) : Etudes des fonctions, développements limités</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-prime-time-james-maynard-142831?ref=freecodecamp"><strong>Prime Time - James Maynard</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-bach-and-the-cosmos-142834?ref=freecodecamp"><strong>Bach and the Cosmos</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96612?ref=freecodecamp"><strong>Analyse I (partie 1) : Prélude, notions de base, les nombres réels</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96618?ref=freecodecamp"><strong>Analyse I (partie 7) : Intégrales indéfinies et définies, intégration (chapitres choisis)</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-num8er-my5teries-marcus-du-sautoy-142833?ref=freecodecamp"><strong>The Number Mysteries - Marcus du Sautoy</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96613?ref=freecodecamp"><strong>Analyse I (partie 2) : Introduction aux nombres complexes</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-ana-96614?ref=freecodecamp"><strong>Analyse I (partie 3) : Suites de nombres réels I et II</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-s190-introduction-to-metric-spaces-january-iap-2023-292270?ref=freecodecamp"><strong>Introduction to Metric Spaces</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-cascading-principles-conrad-shawcross-martin-bridson-and-james-sparks-with-fatos-ustek-142782?ref=freecodecamp"><strong>Cascading Principles - Conrad Shawcross, Martin Bridson and James Sparks with Fatos Ustek</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-why-does-rudolph-have-a-shiny-nose-chris-budd-142815?ref=freecodecamp"><strong>Why Does Rudolph Have a Shiny Nose? - Chris Budd</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-blueprints-how-mathematics-shapes-creativity-marcus-du-sautoy-459393?ref=freecodecamp"><strong>Blueprints - How Mathematics Shapes Creativity</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-the-312495?ref=freecodecamp"><strong>Théorie des Groupes (partie 1) - Une introduction à la théorie des catégories</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-productive-generalization-timothy-gowers-142817?ref=freecodecamp"><strong>Productive Generalization - Timothy Gowers</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-euler-s-pioneering-equation-142838?ref=freecodecamp"><strong>Euler’s Pioneering Equation</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-travelling-santa-problem-and-other-seasonal-challenges-marcus-du-sautoy-142851?ref=freecodecamp"><strong>The Travelling Santa Problem and Other Seasonal Challenges - Marcus du Sautoy</strong></a> from <em>University of Oxford</em></p>
</li>
</ul>
<h2 id="heading-linear-algebra-32"><strong>Linear Algebra (32)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/matrix-algebra-engineers-11986?ref=freecodecamp"><strong>Matrix Algebra for Engineers</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(843)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-the-university-of-texas-at-austin--1337?ref=freecodecamp"><strong>Linear Algebra - Foundations to Frontiers</strong></a> from <em>The University of Texas at Austin</em> ★★★★☆(15)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-harvard-university-introduction-to-2963?ref=freecodecamp"><strong>Introduction to Linear Models and Matrix Algebra</strong></a> from <em>Harvard University</em> ★★★★☆(12)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-machine-learning-10453?ref=freecodecamp"><strong>Mathematics for Machine Learning: Linear Algebra</strong></a> from <em>Imperial College London</em> ★★★☆☆(9)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-06sc-linear-algebra-fall-2011-40964?ref=freecodecamp"><strong>Linear Algebra</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(5)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-065-matrix-methods-in-data-analysis-signal-processing-and-machine-learning-spring-2018-40965?ref=freecodecamp"><strong>Matrix Methods in Data Analysis, Signal Processing, and Machine Learning</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-ecole-polytechnique-federale-de-la-3852?ref=freecodecamp"><strong>Algèbre Linéaire (Partie 1)</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mit-a-2020-vision-of-linear-algebra-spring-2020-90324?ref=freecodecamp"><strong>MIT - A 2020 Vision of Linear Algebra, Spring 2020</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/algebra-ecole-polytechnique-federale-de-lausanne--4521?ref=freecodecamp"><strong>Algèbre Linéaire (Partie 2)</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-ecole-polytechnique-federale-de-la-4555?ref=freecodecamp"><strong>Algèbre Linéaire (Partie 3)</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/algebra-the-georgia-institute-of-technology-linea-20933?ref=freecodecamp"><strong>Linear Algebra III: Determinants and Eigenvalues</strong></a> from <em>Georgia Institute of Technology</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-the-georgia-institute-of-technolog-20934?ref=freecodecamp"><strong>Linear Algebra IV: Orthogonality &amp; Symmetric Matrices and the SVD</strong></a> from <em>Georgia Institute of Technology</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/gtx-applications-of-linear-algebra-48140?ref=freecodecamp"><strong>Applications of Linear Algebra</strong></a> from <em>Georgia Institute of Technology</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-systems-and-matrix-equations-260358?ref=freecodecamp"><strong>Linear Algebra: Linear Systems and Matrix Equations</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-the-georgia-institute-of-technolog-20932?ref=freecodecamp"><strong>Linear Algebra II: Matrix Algebra</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/matrix-algebra-determinants-and-eigenvectors-260357?ref=freecodecamp"><strong>Linear Algebra: Matrix Algebra, Determinants, &amp; Eigenvectors</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-the-georgia-institute-of-technolog-20958?ref=freecodecamp"><strong>Linear Algebra I: Linear Equations</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-for-ai-beginner-part-1-linear-algebra-56641?ref=freecodecamp"><strong>Math for AI beginner part 1 Linear Algebra</strong></a> from <em>Korea Advanced Institute of Science and Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/introduction-to-linear-algebra-269564?ref=freecodecamp"><strong>Introduction to Linear Algebra</strong></a> from <em>The University of Sydney</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/orthogonality-and-diagonalization-261475?ref=freecodecamp"><strong>Linear Algebra: Orthogonality and Diagonalization</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-the-university-of-texas-at-austin--17390?ref=freecodecamp"><strong>Advanced Linear Algebra: Foundations to Frontiers</strong></a> from <em>The University of Texas at Austin</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mit-2-087-engineering-mathematics-linear-algebra-and-odes-fall-2014-90348?ref=freecodecamp"><strong>Engineering Mathematics: Linear Algebra and ODEs, Fall 2014</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-algebra-elementary-to-advanced-262269?ref=freecodecamp"><strong>Linear Algebra from Elementary to Advanced</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/gtx-introductory-linear-algebra-48139?ref=freecodecamp"><strong>Introductory Linear Algebra</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-06-linear-algebra-spring-2010-292263?ref=freecodecamp"><strong>Linear Algebra</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-s096-matrix-calculus-for-machine-learning-and-beyond-january-iap-2023-292269?ref=freecodecamp"><strong>Matrix Calculus for Machine Learning and Beyond</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-res-18-010-a-2020-vision-of-linear-algebra-spring-2020-292290?ref=freecodecamp"><strong>A Vision of Linear Algebra</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-085-computational-science-and-engineering-i-fall-2008-292264?ref=freecodecamp"><strong>Computational Science and Engineering I</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-linear-algebra-and-nxn-systems-450373?ref=freecodecamp"><strong>Linear Algebra and NxN Systems</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-1-369970?ref=freecodecamp"><strong>线性代数(1)</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-2-369986?ref=freecodecamp"><strong>线性代数(2)</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-369972?ref=freecodecamp"><strong>简明线性代数</strong></a> from <em>Tsinghua University</em></p>
</li>
</ul>
<h2 id="heading-differential-equations-12"><strong>Differential Equations (12)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/differential-equations-engineers-13258?ref=freecodecamp"><strong>Differential Equations for Engineers</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(374)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/ordinary-differential-equations-9736?ref=freecodecamp"><strong>Differential Equations Part I Basic Theory</strong></a> from <em>Korea Advanced Institute of Science and Technology</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-03sc-differential-equations-fall-2011-40963?ref=freecodecamp"><strong>Differential Equations</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/introduction-to-ordinary-differential-equations-p-92976?ref=freecodecamp"><strong>Differential Equations Part II Series Solutions</strong></a> from <em>Korea Advanced Institute of Science and Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/differential-equations-part-iii-systems-of-equati-104429?ref=freecodecamp"><strong>Differential Equations Part III Systems of Equations</strong></a> from <em>Korea Advanced Institute of Science and Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-2-087-engineering-math-differential-equations-and-linear-algebra-fall-2014-292214?ref=freecodecamp"><strong>Engineering Math: Differential Equations and Linear Algebra</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-numerical-solution-of-differential-equations-oxford-mathematics-3rd-year-student-lecture-142806?ref=freecodecamp"><strong>Numerical Solution of Differential Equations - Oxford Mathematics 3rd Year Student Lecture</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-03-differential-equations-spring-2010-292262?ref=freecodecamp"><strong>Differential Equations</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-differential-equations-fourier-series-and-partial-differential-equations-450355?ref=freecodecamp"><strong>Differential Equations: Fourier Series and Partial Differential Equations</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-introduction-to-differential-equations-450366?ref=freecodecamp"><strong>Introduction to Differential Equations</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-differential-equations-2x2-systems-450354?ref=freecodecamp"><strong>Differential Equations: 2x2 Systems</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/differential-equations-imperial-college-london-a--480607?ref=freecodecamp"><strong>A-level Further Mathematics for Year 13 - Course 1: Differential Equations, Further Integration, Curve Sketching, Complex Numbers, the Vector Product and Further Matrices</strong></a> from <em>Imperial College London</em></p>
</li>
</ul>
<h2 id="heading-statistics-amp-probability-54"><strong>Statistics &amp; Probability (54)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/udacity-intro-to-statistics-361?ref=freecodecamp"><strong>Intro to Statistics</strong></a> from <em>Stanford University</em> ★★★★☆(39)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-massachusetts-institute-of-technology-1496?ref=freecodecamp"><strong>Probability - The Science of Uncertainty and Data</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(34)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-stanford-university-statistical-learni-1579?ref=freecodecamp"><strong>Statistical Learning with R</strong></a> from <em>Stanford University</em> ★★★★☆(28)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-massachusetts-institute-of-technology--11482?ref=freecodecamp"><strong>Fundamentals of Statistics</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★☆(10)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-harvard-university-fat-chance-probabi-10159?ref=freecodecamp"><strong>Data Analysis: Basic Probability and Statistics</strong></a> from <em>Harvard University</em> ★★★★☆(6)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-intro-6099?ref=freecodecamp"><strong>Introduction to Probability and Data with R</strong></a> from <em>Duke University</em> ★★★★☆(6)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-harvard-university-statistical-inferen-2967?ref=freecodecamp"><strong>Statistical Inference and Modeling for High-throughput Experiments</strong></a> from <em>Harvard University</em> ★★★★★(4)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-massachusetts-institute-of-technology-6830?ref=freecodecamp"><strong>Computational Probability and Inference</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/stanford-statistics-33479?ref=freecodecamp"><strong>Introduction to Statistics</strong></a> from <em>Stanford University</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-university-of-edinburgh-statistics-7508?ref=freecodecamp"><strong>Statistics: Unlocking the World of Data</strong></a> from <em>University of Edinburgh</em> ★★★★☆(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-harvard-university-introduction-to-pr-11423?ref=freecodecamp"><strong>Introduction to Probability</strong></a> from <em>Harvard University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/introduction-statistics-data-analysis-pu-13079?ref=freecodecamp"><strong>Introduction to Statistics &amp; Data Analysis in Public Health</strong></a> from <em>Imperial College London</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/summary-statistics-12762?ref=freecodecamp"><strong>Summary Statistics in Public Health</strong></a> from <em>Johns Hopkins University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/hypothesis-testing-public-health-12760?ref=freecodecamp"><strong>Hypothesis Testing in Public Health</strong></a> from <em>Johns Hopkins University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/crash-course-in-causality-8425?ref=freecodecamp"><strong>A Crash Course in Causality: Inferring Causal Effects from Observational Data</strong></a> from <em>University of Pennsylvania</em> ★★★★☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-seoul-national-university-introductory-10115?ref=freecodecamp"><strong>Introductory Statistics : Basic Ideas and Instruments for Statistical Inference</strong></a> from <em>Seoul National University</em> ★☆☆☆☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-650-statistics-for-applications-fall-2016-40966?ref=freecodecamp"><strong>Statistics for Applications</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/causal-inference-12136?ref=freecodecamp"><strong>Causal Inference</strong></a> from <em>Columbia University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/causal-inference-2-13095?ref=freecodecamp"><strong>Causal Inference 2</strong></a> from <em>Columbia University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-seoul-national-university-introductory-10114?ref=freecodecamp"><strong>Introductory Statistics : Analyzing Data Using Graphs and Statistics</strong></a> from <em>Seoul National University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/survival-analysis-r-public-health-13076?ref=freecodecamp"><strong>Survival Analysis in R for Public Health</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-statistics-for-data-science-essentials-290692?ref=freecodecamp"><strong>Statistics for Data Science Essentials</strong></a> from <em>University of Pennsylvania</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/logistic-regression-r-public-health-13075?ref=freecodecamp"><strong>Logistic Regression in R for Public Health</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-stanford-university-introduction-to-p-21383?ref=freecodecamp"><strong>Introduction to Probability Management</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-university-of-wisconsin-madison-st-104261?ref=freecodecamp"><strong>Statistics Using Python</strong></a> from <em>University of Wisconsin–Madison</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-georgia-institute-of-technology-pr-20610?ref=freecodecamp"><strong>Probability and Statistics I: A Gentle Introduction to Probability</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-seoul-national-university-introductory-12755?ref=freecodecamp"><strong>Introductory Statistics : Sample Survey and Instruments for Statistical Inference</strong></a> from <em>Seoul National University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-georgia-institute-of-technology-pr-20609?ref=freecodecamp"><strong>Probability and Statistics III: A Gentle Introduction to Statistics</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/inferential-statistics-intro-13443?ref=freecodecamp"><strong>Inferential Statistics</strong></a> from <em>Duke University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-statistics-110-probability-91487?ref=freecodecamp"><strong>Statistics 110 - Probability</strong></a> from <em>Harvard University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-seoul-national-university-mathematical-under-59063?ref=freecodecamp"><strong>Mathematical understanding of uncertainty</strong></a> from <em>Seoul National University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-georgia-institute-of-technology-pr-20608?ref=freecodecamp"><strong>Probability and Statistics II: Random Variables – Great Expectations to Bell Curves</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-the-georgia-institute-of-technology-pr-20607?ref=freecodecamp"><strong>Probability and Statistics IV: Confidence Intervals and Hypothesis Tests</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/chances-probability-uncertainty-statistics-22209?ref=freecodecamp"><strong>What are the Chances? Probability and Uncertainty in Statistics</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/advanced-statistics-data-science-21688?ref=freecodecamp"><strong>Advanced Statistics for Data Science</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-advanced-probability-and-statistical-methods-363744?ref=freecodecamp"><strong>Advanced Probability and Statistical Methods</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-6-041sc-probabilistic-systems-analysis-and-applied-probability-fall-2013-40940?ref=freecodecamp"><strong>Probabilistic Systems Analysis and Applied Probability</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistics-with-python-18753?ref=freecodecamp"><strong>Statistics with Python</strong></a> from <em>University of Michigan</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-statistics-with-python-using-numpy-pandas-and-scipy-433744?ref=freecodecamp"><strong>Statistics with Python Using NumPy, Pandas, and SciPy</strong></a> from <em>University of Michigan</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/probabilistic-graphical-models-18689?ref=freecodecamp"><strong>Probabilistic Graphical Models</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-6-041-probabilistic-systems-analysis-and-applied-probability-fall-2010-40939?ref=freecodecamp"><strong>Probabilistic Systems Analysis and Applied Probability</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/machine-learning-ecole-polytechnique-federale-de--53237?ref=freecodecamp"><strong>Selected Topics on Discrete Choice</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-bayesian-networks-3-maximum-likelihood-stanford-cs221-ai-autumn-2019-108714?ref=freecodecamp"><strong>Bayesian Networks 3 - Maximum Likelihood - Stanford CS221: AI (Autumn 2019)</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-bayesian-networks-1-inference-stanford-cs221-ai-autumn-2019-108716?ref=freecodecamp"><strong>Bayesian Networks 1 - Inference - Stanford CS221: AI</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-bayesian-networks-2-forward-backward-stanford-cs221-ai-autumn-2019-108715?ref=freecodecamp"><strong>Bayesian Networks 2 - Forward-Backward - Stanford CS221: AI</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/gtx-statistics-confidence-intervals-and-hypothesi-52845?ref=freecodecamp"><strong>Statistics, Confidence Intervals and Hypothesis Tests</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mit-res-6-012-introduction-to-probability-spring-2018-90317?ref=freecodecamp"><strong>MIT RES.6-012 Introduction to Probability, Spring 2018</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-webinar-data-overload-making-sense-of-statistics-in-the-news-kristin-sainani-108717?ref=freecodecamp"><strong>Data Overload - Making Sense of Statistics in the News, Kristin Sainani</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/gtx-probability-random-variables-52844?ref=freecodecamp"><strong>Probability/Random Variables</strong></a> from <em>Georgia Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-brooklyn-quant-experience-lecture-series-alejandra-quintos-lima-132421?ref=freecodecamp"><strong>Dependent Stopping Times and Application to Credit Risk Theory - BQE Lecture Series</strong></a> from <em>New York University (NYU)</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/inferential-statistics-intro-de-65371?ref=freecodecamp"><strong>Inferenzstatistik</strong></a> from <em>Duke University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-counting-project-tim-harford-309892?ref=freecodecamp"><strong>The Counting Project - How Data Built the Modern World</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/probability-intro-ko-60065?ref=freecodecamp"><strong>R을 사용한 확률 및 데이터 소개</strong></a> from <em>Duke University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/statistical-methods-for-computer-science-365531?ref=freecodecamp"><strong>Statistical Methods for Computer Science</strong></a> from <em>Johns Hopkins University</em></p>
</li>
</ul>
<h2 id="heading-calculus-30"><strong>Calculus (30)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/single-variable-calculus-5066?ref=freecodecamp"><strong>Calculus: Single Variable Part 1 - Functions</strong></a> from <em>University of Pennsylvania</em> ★★★★★(8)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/introduction-to-calculus-12547?ref=freecodecamp"><strong>Introduction to Calculus</strong></a> from <em>The University of Sydney</em> ★★★★★(6)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/differentiation-calculus-5068?ref=freecodecamp"><strong>Calculus: Single Variable Part 2 - Differentiation</strong></a> from <em>University of Pennsylvania</em> ★★★★★(5)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-calculus-for-engineers-435609?ref=freecodecamp"><strong>Calculus for Engineers</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(5)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/integration-calculus-5069?ref=freecodecamp"><strong>Calculus: Single Variable Part 3 - Integration</strong></a> from <em>University of Pennsylvania</em> ★★★★☆(4)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/applications-calculus-5070?ref=freecodecamp"><strong>Calculus: Single Variable Part 4 - Applications</strong></a> from <em>University of Pennsylvania</em> ★★★★★(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-01-single-variable-calculus-fall-2006-40961?ref=freecodecamp"><strong>Single Variable Calculus</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-harvard-university-calculus-applied-8778?ref=freecodecamp"><strong>Calculus Applied!</strong></a> from <em>Harvard University</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-tsinghua-university-combinatorial-mathematic-2552?ref=freecodecamp"><strong>Combinatorial Mathematics | 组合数学</strong></a> from <em>Tsinghua University</em> ★★★★☆(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-introductory-calculus-oxford-mathematics-1st-year-student-lecture-142820?ref=freecodecamp"><strong>Introductory Calculus - Oxford Mathematics 1st Year Student Lecture</strong></a> from <em>University of Oxford</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-differentiati-27984?ref=freecodecamp"><strong>Calculus through Data &amp; Modeling: Differentiation Rules</strong></a> from <em>Johns Hopkins University</em> ★★★★☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/discrete-calculus-5067?ref=freecodecamp"><strong>Single Variable Calculus</strong></a> from <em>University of Pennsylvania</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/applied-calculus-with-python-65788?ref=freecodecamp"><strong>Applied Calculus with Python</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-precalculus-r-27987?ref=freecodecamp"><strong>Calculus through Data &amp; Modeling: Precalculus Review</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-applied-math-for-materials-science-and-engineering-435166?ref=freecodecamp"><strong>Applied Math for Materials Science and Engineering</strong></a> from <em>Korea Advanced Institute of Science and Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-imits-derivat-27983?ref=freecodecamp"><strong>Calculus through Data &amp; Modeling: Limits &amp; Derivatives</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-a-level-further-math-34205?ref=freecodecamp"><strong>A-Level Further Mathematics for Year 12 - Course 2: 3 x 3 Matrices, Mathematical Induction, Calculus Methods and Applications, Maclaurin Series, Complex Numbers and Polar Coordinates</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-series-and-in-32774?ref=freecodecamp"><strong>Calculus through Data &amp; Modelling: Series and Integration</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-techniques-of-32771?ref=freecodecamp"><strong>Calculus through Data &amp; Modelling: Techniques of Integration</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-integration-a-32769?ref=freecodecamp"><strong>Calculus through Data &amp; Modelling: Integration Applications</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-applying-diff-27982?ref=freecodecamp"><strong>Calculus through Data &amp; Modeling: Applying Differentiation</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-introduction-to-advanced-calculus-326156?ref=freecodecamp"><strong>Introduction to Advanced Calculus</strong></a> from <em>The University of Sydney</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-calculus-1c-coordinate-systems-infinite-series-450345?ref=freecodecamp"><strong>Calculus 1C: Coordinate Systems &amp; Infinite Series</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-calculus-1a-differentiation-450343?ref=freecodecamp"><strong>Calculus 1A: Differentiation</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-calculus-1b-integration-450344?ref=freecodecamp"><strong>Calculus 1B: Integration</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-369963?ref=freecodecamp"><strong>微积分（先修课）</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-a-level-further-math-480606?ref=freecodecamp"><strong>A-Level Further Mathematics for Year 12 - Course 2: 3 x 3 Matrices, Mathematical Induction, Calculus Methods and Applications, Maclaurin Series, Complex Numbers and Polar Coordinates</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-369971?ref=freecodecamp"><strong>微积分——极限理论与一元函数</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-1-370156?ref=freecodecamp"><strong>微积分-1</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-2-370274?ref=freecodecamp"><strong>微积分-2</strong></a> from <em>Tsinghua University</em></p>
</li>
</ul>
<h2 id="heading-mathematical-modeling-9"><strong>Mathematical Modeling (9)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/youtube-modelling-ice-sheets-oxford-mathematics-research-seminar-142812?ref=freecodecamp"><strong>Modelling Ice Sheets - Oxford Mathematics Research Seminar</strong></a> from <em>University of Oxford</em> ★★★★★(4)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-infectious-disease-modeling-in-practice-290078?ref=freecodecamp"><strong>Infectious Disease Modeling in Practice</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-scaling-the-maths-of-life-142839?ref=freecodecamp"><strong>Scaling the Maths of Life</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-how-do-mathematicians-model-infectious-disease-outbreaks-142814?ref=freecodecamp"><strong>How Do Mathematicians Model Infectious Disease Outbreaks?</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mathematical-modelling-in-biology-neuronal-signalling-oxford-mathematics-2nd-yr-student-lecture-309888?ref=freecodecamp"><strong>Mathematical Modelling in Biology - Neuronal Signalling</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-mathematical-modelling-in-biology-enzyme-kinetics-perturbation-theory-2nd-year-student-lecture-309889?ref=freecodecamp"><strong>Mathematical Modelling in Biology - Enzyme Kinetics and Perturbation Theory - Lecture 2</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-responsible-modelling-erica-thompson-462461?ref=freecodecamp"><strong>Responsible Modelling and the Ethics of Mathematics for Decision Support</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-3-minute-thesis-competition-2025-467240?ref=freecodecamp"><strong>3 Minute Thesis Competition 2025 - Oxford Mathematics Postgraduate Research Presentations</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-going-for-gold-the-mathematics-of-sporting-glory-amandine-aftalion-493192?ref=freecodecamp"><strong>Going for Gold - The Mathematics of Sporting Glory</strong></a> from <em>University of Oxford</em></p>
</li>
</ul>
<h2 id="heading-convex-optimization-17"><strong>Convex Optimization (17)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-1-285326?ref=freecodecamp"><strong>Convex Optimization I - Lecture 1</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-3-285578?ref=freecodecamp"><strong>Convex Optimization I - Lecture 3</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-2-285579?ref=freecodecamp"><strong>Convex Optimization I - Lecture 2</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-8-285963?ref=freecodecamp"><strong>Convex Optimization I - Lecture 8</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-5-285852?ref=freecodecamp"><strong>Convex Optimization I - Lecture 5</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-4-285853?ref=freecodecamp"><strong>Convex Optimization I - Lecture 4</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-6-285916?ref=freecodecamp"><strong>Convex Optimization I - Lecture 6</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-7-285964?ref=freecodecamp"><strong>Convex Optimization I - Lecture 7</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-13-286918?ref=freecodecamp"><strong>Convex Optimization I - Lecture 13</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-16-287056?ref=freecodecamp"><strong>Convex Optimization I - Lecture 16</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-15-287057?ref=freecodecamp"><strong>Convex Optimization I - Lecture 15</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-10-286233?ref=freecodecamp"><strong>Convex Optimization I - Lecture 10</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-9-286235?ref=freecodecamp"><strong>Convex Optimization I - Lecture 9</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-12-286627?ref=freecodecamp"><strong>Convex Optimization I - Lecture 12</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-11-286628?ref=freecodecamp"><strong>Convex Optimization I - Lecture 11</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-ee364a-convex-optimization-i-stephen-boyd-i-2023-i-lecture-17-287055?ref=freecodecamp"><strong>Convex Optimization I - Lecture 17</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-374050?ref=freecodecamp"><strong>最优化理论与方法</strong></a> from <em>Nanjing University</em></p>
</li>
</ul>
<h2 id="heading-probability-theory-8"><strong>Probability Theory (8)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/xuetangx-369962?ref=freecodecamp"><strong>概率论与数理统计</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-res-6-012-introduction-to-probability-spring-2018-487385?ref=freecodecamp"><strong>Introduction to Probability</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-chance-luck-and-ignorance-how-to-put-our-uncertainty-into-numbers-david-spiegelhalter-408640?ref=freecodecamp"><strong>How to Put Uncertainty into Numbers - Understanding Chance, Luck and Ignorance</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-can-we-truly-understand-by-counting-hugo-duminil-copin-431258?ref=freecodecamp"><strong>Can We Truly Understand by Counting? Understanding Complex Physical Systems Through Mathematics</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-probability-measure-and-martingales-let-there-be-time-filtrations-and-stopping-times-442699?ref=freecodecamp"><strong>Probability, Measure and Martingales - Let There Be Time: Filtrations and Stopping Times</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-probability-measure-and-martingales-martingales-definition-and-first-properties-3rd-yr-lecture-444276?ref=freecodecamp"><strong>Martingales: Definition and First Properties - Probability, Measure and Martingales</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-probability-measure-and-martingales-stopped-martingales-and-optional-sampling-theorems-446439?ref=freecodecamp"><strong>Probability, Measure and Martingales - Stopped Martingales and Optional Sampling Theorems</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-probability-measure-and-martingales-vitali-s-convergence-theorem-and-martingale-inequalities-447539?ref=freecodecamp"><strong>Vitali's Convergence Theorem and Martingale Inequalities - Lecture 5</strong></a> from <em>University of Oxford</em></p>
</li>
</ul>
<h2 id="heading-others-113"><strong>Others (113)</strong></h2>
<ul>
<li><p><a href="https://www.classcentral.com/course/vector-calculus-engineers-17387?ref=freecodecamp"><strong>Vector Calculus for Engineers</strong></a> from <em>The Hong Kong University of Science and Technology</em> ★★★★★(261)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/maththink-370?ref=freecodecamp"><strong>Introduction to Mathematical Thinking</strong></a> from <em>Stanford University</em> ★★★★☆(51)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/bayesian-6097?ref=freecodecamp"><strong>Bayesian Statistics</strong></a> from <em>Duke University</em> ★★★☆☆(12)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/pre-calculus-the-university-of-texas-at-austin-di-2537?ref=freecodecamp"><strong>Discovery Precalculus: A Creative and Connected Approach</strong></a> from <em>The University of Texas at Austin</em> ★★★★★(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/combinatorics-2464?ref=freecodecamp"><strong>Combinatorics and Probability</strong></a> from <em>University of California, San Diego</em> ★★★★☆(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/ac-922?ref=freecodecamp"><strong>Analytic Combinatorics</strong></a> from <em>Princeton University</em> ★★★★☆(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/data-science-harvard-university-data-science-line-10352?ref=freecodecamp"><strong>Data Science: Linear Regression</strong></a> from <em>Harvard University</em> ★★☆☆☆(3)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-university-of-hong-kong-engineering-calc-12335?ref=freecodecamp"><strong>Engineering Calculus and Differential Equations</strong></a> from <em>The University of Hong Kong</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-02-multivariable-calculus-fall-2007-40962?ref=freecodecamp"><strong>Multivariable Calculus</strong></a> from <em>Massachusetts Institute of Technology</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/graphs-9213?ref=freecodecamp"><strong>Introduction to Graph Theory</strong></a> from <em>University of California, San Diego</em> ★★★★★(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-regression-model-6098?ref=freecodecamp"><strong>Linear Regression and Modeling</strong></a> from <em>Duke University</em> ★★★★☆(2)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-regression-r-public-health-13077?ref=freecodecamp"><strong>Linear Regression in R for Public Health</strong></a> from <em>Imperial College London</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/simple-regression-analysis-public-health-12763?ref=freecodecamp"><strong>Simple Regression Analysis in Public Health</strong></a> from <em>Johns Hopkins University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/independent-precalculus-11928?ref=freecodecamp"><strong>Precalculus</strong></a> from <em>Modern States</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/algebra-ii-44579?ref=freecodecamp"><strong>Algebra: Elementary to Advanced - Functions &amp; Applications</strong></a> from <em>Johns Hopkins University</em> ★★★★☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/algebra-elementary-to-advanced-45201?ref=freecodecamp"><strong>Algebra: Elementary to Advanced</strong></a> from <em>Johns Hopkins University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-cou-3241?ref=freecodecamp"><strong>Cours préparatoire: Fonctions Trigonométriques, Logarithmiques et Exponentielles</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em> ★★★★☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-banach-contraction-mapping-theorem-oxford-mathematics-1st-year-student-lecture-309890?ref=freecodecamp"><strong>The Banach Contraction Mapping Theorem - Oxford Mathematics 1st Year Lecture</strong></a> from <em>University of Oxford</em> ★★★★☆(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-seduction-of-curves-the-lines-of-beauty-that-connect-mathematics-art-and-the-nude-142842?ref=freecodecamp"><strong>The Seduction of Curves - The Lines of Beauty That Connect Mathematics, Art and The Nude</strong></a> from <em>University of Oxford</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-lecture-don-knuth-hamiltonian-paths-in-antiquity-2016-360-degrees-192031?ref=freecodecamp"><strong>Hamiltonian Paths in Antiquity - Stanford Lecture 2016</strong></a> from <em>Stanford University</em> ★★★★★(1)</p>
</li>
<li><p><a href="https://www.classcentral.com/course/precalculus-relations-functions-21858?ref=freecodecamp"><strong>Precalculus: Relations and Functions</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/precalculus-mathematical-modelling-21860?ref=freecodecamp"><strong>Precalculus: Mathematical Modeling</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/precalculus-periodic-functions-21859?ref=freecodecamp"><strong>Precalculus: Periodic Functions</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/precalculus-data-modelling-21944?ref=freecodecamp"><strong>Precalculus through Data and Modelling</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-combinatorics-and-algorithms-design-367422?ref=freecodecamp"><strong>Combinatorics and Algorithms Design</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-367107?ref=freecodecamp"><strong>组合数学</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/linear-regression-modeling-health-data-238186?ref=freecodecamp"><strong>Linear Regression Modeling for Health Data</strong></a> from <em>University of Michigan</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/differential-calculus-data-modeling-31705?ref=freecodecamp"><strong>Differential Calculus through Data and Modeling</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-differential-calculus-451299?ref=freecodecamp"><strong>Differential Calculus</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-217-graph-theory-and-additive-combinatorics-fall-2019-40969?ref=freecodecamp"><strong>Graph Theory and Additive Combinatorics</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-225-graph-theory-and-additive-combinatorics-fall-2023-297716?ref=freecodecamp"><strong>Graph Theory and Additive Combinatorics</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-petri-367209?ref=freecodecamp"><strong>Petri网：模型、理论与应用</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-02sc-multivariable-calculus-fall-2010-292261?ref=freecodecamp"><strong>Multivariable Calculus</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-multivariable-calculus-1-vectors-and-derivatives-450389?ref=freecodecamp"><strong>Multivariable Calculus 1: Vectors and Derivatives</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-multidimensional-analysis-geometry-introduction-to-the-derivative-in-higher-dimensions-lecture-1-309886?ref=freecodecamp"><strong>Multidimensional Analysis and Geometry - Introduction to the Derivative in Higher Dimensions - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-multivariable-calculus-3-theorems-and-applications-463286?ref=freecodecamp"><strong>Multivariable Calculus 3: Theorems and Applications</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-multivariable-calculus-2-integrals-465629?ref=freecodecamp"><strong>Multivariable Calculus 2: Integrals</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-369974?ref=freecodecamp"><strong>微积分——多元函数与重积分</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-370160?ref=freecodecamp"><strong>多元微积分（先修课）</strong></a> from <em>University of Science and Technology of China</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-sarah-bana-using-language-models-to-understand-wage-premia-158536?ref=freecodecamp"><strong>Using Language Models to Understand Wage Premia</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/algebra-i-44578?ref=freecodecamp"><strong>Algebra: Elementary to Advanced - Equations &amp; Inequalities</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/polynomials-roots-44577?ref=freecodecamp"><strong>Algebra: Elementary to Advanced - Polynomials and Roots</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-linear-quadratic-functions-460837?ref=freecodecamp"><strong>Honors Algebra 2: Linear and Quadratic Functions</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-history-of-mathematics-classical-algebra-19th-century-beginnings-of-modern-algebra-3rd-yr-lecture-458978?ref=freecodecamp"><strong>History of Mathematics - Classical Algebra - 19th-Century Beginnings of Modern Algebra - 3rd Year Lecture</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-history-of-mathematics-classical-algebra-equation-solving-1800-bc-ad-1800-3rd-year-lecture-454856?ref=freecodecamp"><strong>History of Mathematics - Classical Algebra: Equation Solving 1800 BC - AD 1800 - 3rd Year Lecture</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-ha2-exploring-inverse-functions-483430?ref=freecodecamp"><strong>Honors Algebra 2: Algebraic, Exponential &amp; Log Functions</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/honors-algebra-2-483721?ref=freecodecamp"><strong>Honors Algebra 2</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/honors-algebra-2-493326?ref=freecodecamp"><strong>Honors Algebra 2</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-series-trig-and-prob-488269?ref=freecodecamp"><strong>Honors Algebra 2: Series, Trigonometry, and Probability</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-geometry-scalar-triple-product-oxford-mathematics-1st-year-student-lecture-142809?ref=freecodecamp"><strong>Geometry - Scalar Triple Product: Oxford Mathematics First Year Student Lecture</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-geometry-conics-lecture-1-oxford-mathematics-1st-year-student-lecture-413445?ref=freecodecamp"><strong>Introduction to Conic Sections and Their Mathematical Properties - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-natural-tilings-from-hard-rock-to-soft-cells-gabor-domokos-454857?ref=freecodecamp"><strong>Natural Tilings: From Hard Rock to Soft Cells</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/calculus-through-data-and-modelling-vector-calcul-32766?ref=freecodecamp"><strong>Calculus through Data &amp; Modelling: Vector Calculus</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-math-for-ai-beginner-part-2--vector-calulus-435177?ref=freecodecamp"><strong>Math for AI Beginner Part 2 : Vector Calulus</strong></a> from <em>Korea Advanced Institute of Science and Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-multidimensional-analysis-geometry-introduction-to-the-derivative-in-higher-dimensions-lecture-2-326536?ref=freecodecamp"><strong>Multidimensional Analysis and Geometry: Introduction to the Derivative in Higher Dimensions - Lecture 2</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-100a-real-analysis-fall-2020-292266?ref=freecodecamp"><strong>Real Analysis</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-100b-real-analysis-spring-2025-480608?ref=freecodecamp"><strong>Real Analysis</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/discrete-mathematics-8133?ref=freecodecamp"><strong>Discrete Mathematics</strong></a> from <em>Shanghai Jiao Tong University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/dmathgen-4431?ref=freecodecamp"><strong>离散数学概论 Discrete Mathematics Generality</strong></a> from <em>Peking University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-6-1200j-mathematics-for-computer-science-spring-2024-472711?ref=freecodecamp"><strong>Mathematics for Computer Science</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-data-science-decisions-in-time-using-causal-information-302389?ref=freecodecamp"><strong>Data Science Decisions in Time: Using Causal Information</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-373158?ref=freecodecamp"><strong>教育定量研究方法（高级）</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-opt-22235?ref=freecodecamp"><strong>Optimization: principles and algorithms - Linear optimization</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-373729?ref=freecodecamp"><strong>运筹学</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/meaningful-predictive-modeling-13495?ref=freecodecamp"><strong>Meaningful Predictive Modeling</strong></a> from <em>University of California, San Diego</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-foundations-of-probability-and-random-variables-363771?ref=freecodecamp"><strong>Foundations of Probability and Random Variables</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-cs109-i-future-of-probability-i-2022-i-lecture-28-261762?ref=freecodecamp"><strong>Stanford CS109 - Future of Probability - Lecture 28</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-probability-measure-and-martingales-an-introduction-oxford-mathematics-3rd-year-student-lecture-440564?ref=freecodecamp"><strong>Probability, Measure and Martingales: An Introduction</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-9-1-from-coin-flips-to-clinical-trials-introduction-to-probability-medical-software-course-478147?ref=freecodecamp"><strong>From Coin Flips to Clinical Trials - Introduction to Probability - Medical Software Course</strong></a> from <em>Yale University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-introduction-to-uncertainty-quantification-389380?ref=freecodecamp"><strong>Introduction to Uncertainty Quantification</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-random-processes-363787?ref=freecodecamp"><strong>Random Processes</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-curves-lecture-3-curves-in-affine-plane-and-the-projective-plane-3rd-year-lecture-475094?ref=freecodecamp"><strong>Algebraic Curves - Curves in Affine Plane and the Projective Plane - Lecture 3</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-curves-lecture-2-more-on-projective-geometry-3rd-year-student-lecture-474180?ref=freecodecamp"><strong>Algebraic Curves - More on Projective Geometry - Lecture 2</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-curves-lecture-4-properties-of-algebraic-curves-3rd-year-lecture-476232?ref=freecodecamp"><strong>Algebraic Curves - Properties of Algebraic Curves - Lecture 4</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-10-34-numerical-methods-applied-to-chemical-engineering-fall-2015-292239?ref=freecodecamp"><strong>Numerical Methods Applied to Chemical Engineering</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-the-butterfly-effect-what-does-it-really-signify-142845?ref=freecodecamp"><strong>The Butterfly Effect - What Does It Really Signify?</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/integral-calculus-data-modeling-32794?ref=freecodecamp"><strong>Integral Calculus through Data and Modeling</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-foundations-of-logic-372018?ref=freecodecamp"><strong>Foundations of Logic</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-paradox-and-infinity-450391?ref=freecodecamp"><strong>Paradox and Infinity</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-01sc-single-variable-calculus-fall-2010-292260?ref=freecodecamp"><strong>Single Variable Calculus</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-102-introduction-to-functional-analysis-spring-2021-292267?ref=freecodecamp"><strong>Introduction to Functional Analysis</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-groups-and-group-actions-representations-of-groups-by-permutations-1st-year-student-lecture-490563?ref=freecodecamp"><strong>Groups and Group Actions - Representations of Groups by Permutations</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-the-312496?ref=freecodecamp"><strong>Théorie des Groupes (partie 2) - Quotients de groupe</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-the-318521?ref=freecodecamp"><strong>Théorie des Groupes (partie 3) - Actions de groupe</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-ecole-polytechnique-federale-de-lausanne-the-318522?ref=freecodecamp"><strong>Théorie des Groupes (partie 4) - Groupes abéliens et sous-groupes de Sylow</strong></a> from <em>École Polytechnique Fédérale de Lausanne</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-groups-and-group-actions-group-homomorphisms-oxford-mathematics-1st-year-student-lecture-486687?ref=freecodecamp"><strong>Groups and Group Actions - Group Homomorphisms</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-stanford-webinar-how-to-be-a-statistical-detective-191789?ref=freecodecamp"><strong>How to Be a Statistical Detective</strong></a> from <em>Stanford University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-6-451-principles-of-digital-communication-ii-spring-2005-292231?ref=freecodecamp"><strong>Principles of Digital Communication II</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-knotty-problems-marc-lackenby-142829?ref=freecodecamp"><strong>Knotty Problems - Marc Lackenby</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-can-yule-solve-my-problems-alex-bellos-142840?ref=freecodecamp"><strong>Can Yule Solve My Problems - Alex Bellos</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-analysis-iii-basic-properties-of-riemann-integration-oxford-mathematics-1st-year-student-lecture-350251?ref=freecodecamp"><strong>Analysis III: Basic Properties of Riemann Integration - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mit-ocw-18-086-mathematical-methods-for-engineers-ii-spring-2006-292265?ref=freecodecamp"><strong>Mathematical Methods for Engineers II</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-why-there-are-no-three-headed-monsters-142855?ref=freecodecamp"><strong>Why There Are No Three-Headed Monsters</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-from-ronald-ross-to-chatgpt-the-birth-and-strange-life-of-the-random-walk-jordan-ellenberg-309894?ref=freecodecamp"><strong>From Ronald Ross to ChatGPT: The Birth and Strange Life of the Random Walk</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-introduction-to-complex-numbers-lecture-1-oxford-mathematics-1st-year-student-lecture-388050?ref=freecodecamp"><strong>Introduction to Complex Numbers - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/math-imperial-college-london-a-level-further-math-480605?ref=freecodecamp"><strong>A-level Further Mathematics for Year 12 - Course 1: Complex Numbers, Matrices, Roots of Polynomial Equations and Vectors</strong></a> from <em>Imperial College London</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-geometry-conics-lecture-2-oxford-mathematics-1st-year-student-lecture-416550?ref=freecodecamp"><strong>Geometry: Conics - Lecture 2</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-numbers-are-serious-but-they-are-also-fun-michael-atiyah-142837?ref=freecodecamp"><strong>Numbers Are Serious but They Are Also Fun - Michael Atiyah</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-linear-diophantine-equations-and-the-extended-euclidean-algorithm-1st-year-student-lecture-309893?ref=freecodecamp"><strong>Linear Diophantine Equations and the Extended Euclidean Algorithm - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-1-1-2-480915?ref=freecodecamp"><strong>1 + 1 = 2 - The Foundation of Mathematical Counting and Number Systems</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-complex-analysis-multivalued-functions-and-integration-oxford-mathematics-2nd-yr-student-lecture-423307?ref=freecodecamp"><strong>Complex Analysis: Multivalued Functions and Integration - Lecture 4</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-topology-algebraic-invariants-of-spaces-oxford-mathematics-4th-year-lecture-461204?ref=freecodecamp"><strong>Algebraic Topology - Algebraic Invariants of Spaces</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-topology-chains-cycles-and-homology-classes-464218?ref=freecodecamp"><strong>Algebraic Topology - Chains, Cycles, and Homology Classes</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/coursera-ha2-polynomials-483431?ref=freecodecamp"><strong>Honors Algebra 2: Polynomials and Complex Numbers</strong></a> from <em>Johns Hopkins University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/mitx-online-transfer-functions-and-the-laplace-transform-450402?ref=freecodecamp"><strong>Transfer Functions and the Laplace Transform</strong></a> from <em>Massachusetts Institute of Technology</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-16-the-taylor-series-and-other-mathematical-concepts-109937?ref=freecodecamp"><strong>The Taylor Series, Complex Numbers, and Simple Harmonic Motion - Lecture 16</strong></a> from <em>Yale University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-social-sequence-analysis-an-overview-142517?ref=freecodecamp"><strong>Social Sequence Analysis: An Introduction and Overview</strong></a> from <em>The University of Chicago</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/xuetangx-370013?ref=freecodecamp"><strong>数值分析与算法</strong></a> from <em>Tsinghua University</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-lie-groups-introduction-to-lie-groups-oxford-mathematics-4th-year-student-lecture-468329?ref=freecodecamp"><strong>Lie Groups - Introduction to Lie Groups</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-lie-groups-the-exceptional-lie-group-g2-469728?ref=freecodecamp"><strong>Lie Groups - The Exceptional Lie Group G2</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-algebraic-curves-lecture-1-introduction-to-projective-geometry-3rd-year-student-lecture-471866?ref=freecodecamp"><strong>Algebraic Curves - Introduction to Projective Geometry - Lecture 1</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-commutative-algebra-primary-decomposition-oxford-mathematics-3rd-year-student-lecture-482554?ref=freecodecamp"><strong>Commutative Algebra - Primary Decomposition</strong></a> from <em>University of Oxford</em></p>
</li>
<li><p><a href="https://www.classcentral.com/course/youtube-commutative-algebra-primary-decomposition-2-oxford-mathematics-3rd-year-student-lecture-484445?ref=freecodecamp"><strong>Commutative Algebra - Primary Decomposition 2</strong></a> from <em>University of Oxford</em></p>
</li>
</ul>
<h2 id="heading-more-courses"><strong>More Courses</strong></h2>
<img src="https://www.classcentral.com/report/wp-content/uploads/2021/12/free-certificates-banner.png" alt="free-certificates-banner" style="display:block;margin:0 auto" width="1024" height="512" loading="lazy">

<p>With over 300 courses to pick from, we hope you find something you like. But if these aren’t enough, check out&nbsp;<a href="https://www.classcentral.com/"><strong>Class Central’s catalog</strong></a> of 250K online courses or our thematic collections:</p>
<ul>
<li><p><a href="https://www.classcentral.com/report/cs-online-courses/"><strong>1000+ Free Computer Science Courses from World’s Top Universities</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/report/matlab-free-certificates/"><strong>30 Hours of MATLAB Courses with Free Certificate</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/report/wolfram-u-free-certificates/"><strong>40+ Free Certificates from Wolfram U</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/report/free-google-certifications/"><strong>450+ Free Google Certificates and Badges</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/report/big-tech-free-courses/"><strong>10,000+ Free Courses from Tech Giants: Learn from Google, Microsoft, Amazon, and More</strong></a></p>
</li>
<li><p><a href="https://www.classcentral.com/report/ocw-courses/"><strong>8000+ OpenCourseWare Courses from Top Institutions</strong></a>.</p>
</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Practical Guide to Linear Algebra in Data Science and AI ]]>
                </title>
                <description>
                    <![CDATA[ "In God we trust; all others bring data." – W. Edwards Deming This famous quote from Edwards Deming perfectly captures the essence of modern Data Science and AI. Data is the lifeblood of Data Science and AI fields – Machine Learning, Deep Learning, ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/linear-algebra-roadmap/</link>
                <guid isPermaLink="false">66d4614e55db48792eed3fa5</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Artificial Intelligence ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Data Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Tatev Aslanyan ]]>
                </dc:creator>
                <pubDate>Tue, 04 Jun 2024 20:22:06 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/06/image--12-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <blockquote>
<p>"In God we trust; all others bring data." – W. Edwards Deming</p>
</blockquote>
<p>This famous quote from Edwards Deming perfectly captures the essence of modern Data Science and AI.</p>
<p>Data is the lifeblood of Data Science and AI fields – Machine Learning, Deep Learning, Generative AI and much more. And understanding how to analyze and manipulate data it is key to unlocking its full potential.</p>
<p>The key to understanding all these concepts is linear algebra – the unsung hero behind many powerful algorithms and techniques.</p>
<p>If you've ever felt a disconnect between the linear algebra you learned in school and its practical use in your career, you're not alone. If you believe you should study and work your way through an entire book of Introduction to Linear Algebra, then you are again not alone.</p>
<p>Many aspiring data science and AI professionals struggle to bridge this gap and think they need to spend countless hours to master mathematics for Data Science and AI. But don't worry, this guide is here to help.</p>
<p>I'll show you how linear algebra isn't just a theoretical concept or old fashioned forgotten area of expertise. You'll learn how it's a practical tool that you can use to solve real-world problems in your field.</p>
<p>Linear Algebra combined with Mathematical Analysis (called Calculus I and II in many undergrad studies) form the backbone of Machine Learning, Deep Learning, Computer Vision, and Generative AI. From building recommendation systems and training Neural Networks to analyzing medical images, understanding linear algebra opens up a world of possibilities.</p>
<p>In this guide, you'll discover:</p>
<ul>
<li><p><strong>Real-World Applications:</strong> We'll explore how linear algebra is applied across various industries, from healthcare to finance, and everything in between (with a special and detailed focus on Data Science and AI).</p>
</li>
<li><p><strong>Practical Tips:</strong> You'll learn how to translate theoretical concepts into actionable steps for your data science projects.</p>
</li>
<li><p><strong>Linear Algebra RoadMap 2024:</strong> You will get a roadmap for Linear Algebra in 2024 – on paper and in a video tutorial.</p>
</li>
<li><p><strong>Career Development Resources:</strong> I will provide you resources to help you learn linear algebra and accelerate your career in data science and AI.</p>
</li>
</ul>
<p>Whether you're a student, a recent graduate, or an experienced professional aspiring to become technical professional, this guide will equip you with the knowledge and skills to learn and leverage linear algebra effectively in your work. And you won't have to spend all your time on endless browsing and searching.</p>
<blockquote>
<p>"Mathematics is like the producer of the movies: you don't see them but they are actually running the show." – Tatev Aslanyan</p>
</blockquote>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><p><a class="post-section-overview" href="#heading-core-concepts-in-linear-algebra-that-you-will-actually-use">Core Linear Algebra Concepts</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-linear-algebra-roadmap-your-path-to-success">Linear Algebra Roadmap</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-linear-algebra-in-action-real-world-applications-in-data-science-ai-and-beyond">Real-World Applications of Linear Algebra</a></p>
</li>
<li><p><a target="_blank" href="https://www.freecodecamp.org/news/p/280a85fe-64a6-4850-8418-7dbb04524b4b/practical-tips-tools-and-resources-for-learning-linear-algebra">Resources for Learning Linear Algebra</a></p>
</li>
</ol>
<h2 id="heading-core-concepts-in-linear-algebra-that-you-will-actually-use">Core Concepts in Linear Algebra that You Will Actually Use</h2>
<p>Let's dive into the heart of linear algebra and explore the core concepts that you will leverage daily in your Data Science, Machine Learning, or AI journey.</p>
<h3 id="heading-vectors-and-matrices-the-building-blocks-of-your-data">Vectors and Matrices: The Building Blocks of Your Data</h3>
<p>Think of vectors as lists of numbers (like NumPy arrays), and matrices as tables of numbers (multiple arrays stacked next to each other). In the world of data science and AI, vectors and matrices are your bread and butter.</p>
<p><strong>Vectors</strong> can represent anything from customer characteristics (salary, age, height, income, purchase history) to word embeddings (numerical representations of words, text, and strings in general in natural language processing [NLP]). These vectors in datasets are commonly referred to as features – or, if used as response variables, as labels, dependent variables, and so on.</p>
<p><strong>Matrices</strong> are powerful data structures that store datasets, with each row representing a data point and each column representing a feature. When you load your data and store it in a dataframe, all the rows of your data are basically the rows of your matrix, while all the features and response variables combined are the columns in your matrix.</p>
<p>Simple vector or matrix operations like addition, subtraction, multiplication of vectors and matrices are tools for data manipulation and transformation. These tools are used to normalize or standardize features, scale the data, combine different datasets or even perform forward pass/backward pass when training neural networks.</p>
<p>Linear algebra operations all power these common and daily tasks in Data Science and Machine Learning.</p>
<h3 id="heading-linear-transformations-manipulating-and-transforming-data">Linear Transformations: Manipulating and Transforming Data</h3>
<p>In the world of data, transformations are the key. You need transformations to rotate an image and resize it.</p>
<p>These are also common ways to perform data augmentation in Computer Vision. Maybe you want to adjust the colors or contrast. These tasks are all done through linear transformations, which are essentially functions that map one set of data points to another.</p>
<p>In the world of linear algebra, multiplying a matrix by a vector (or another matrix), transposing the matrix and inverting it, is like applying a specific transformation to your data. This is incredibly powerful for:</p>
<ul>
<li><p><strong>Image and signal processing:</strong> Enhancing images, removing noise, or transforming audio signals.</p>
</li>
<li><p><strong>Data preprocessing:</strong> Scaling features, standardizing variables, and preparing data for machine learning models.</p>
</li>
<li><p><strong>Feature engineering:</strong> Creating new features by combining or manipulating existing ones through linear combinations.</p>
</li>
</ul>
<h3 id="heading-eigenvalues-and-eigenvectors-the-essence-of-your-data">Eigenvalues and Eigenvectors: The Essence of Your Data</h3>
<p>Think of eigenvalues and eigenvectors as the DNA of your data matrix. These sets of important values reveal the fundamental characteristics and directions, respectively, of largest variation (information).</p>
<p>Once you know the eigenvalues and eigenvectors, you can quickly figure out which features in your data contain the most variation (that is information). This is basically your golden ticket for feature selection.</p>
<p>Eigenvalues and eigenvectors are essential in linear algebra, as they offer insights into matrix properties. They are particularly useful across various disciplines such as engineering, physics, data science and AI.</p>
<ul>
<li><p><strong>Eigenvalues</strong> indicate the factor by which an eigenvector is scaled by a matrix, revealing key properties like system stability or oscillation.</p>
</li>
<li><p><strong>Eigenvectors</strong> are vectors that remain directed along the same line under a matrix transformation, only scaled in magnitude. They help simplify complex systems and elucidate structural properties of transformations.</p>
</li>
</ul>
<p>Eigenvalues and Eigenvectors are essential for:</p>
<ul>
<li><p><strong>Dimensionality Reduction (PCA):</strong> PCA uses eigenvectors to identify the directions of greatest variation (variance) in your data, allowing you to reduce the number of features while retaining the most important information.</p>
</li>
<li><p><strong>PageRank Algorithm:</strong> Google's famous algorithm uses eigenvectors to determine the importance of web pages.</p>
</li>
<li><p><strong>Understanding data clusters:</strong> Eigenvectors help us to identify groups or clusters within your data.</p>
</li>
</ul>
<p>Don't be intimidated by the names – eigenvalues and eigenvectors are simply numbers and vectors that describe the inherent structure of your data. Understanding them gives you a powerful lens through which to analyze and interpret complex datasets.</p>
<h3 id="heading-matrix-factorization-uncover-hidden-patterns-in-your-data">Matrix Factorization: Uncover Hidden Patterns in Your Data</h3>
<p>Imagine a massive table of article ratings from thousands of users. Hidden within this data are patterns that reveal user preferences and article similarities.</p>
<p>Matrix factorization, particularly a technique called Singular Value Decomposition (SVD), is the key to creating such a recommender system.</p>
<p>SVD breaks down large matrices into smaller, more manageable matrices that reveal what are called latent factors. These are the underlying characteristics that explain why users rate things (like movies) the way they do. This is the algorithm behind famous recommendation systems like Amazon or Netflix, which use these latent factors to suggest items and movies you'll love.</p>
<p>But matrix factorization isn't just for building powerful recommender systems. It's a versatile tool used for:</p>
<ul>
<li><p><strong>Dimensionality reduction:</strong> Simplify your data by identifying the most important features.</p>
</li>
<li><p><strong>Topic modeling:</strong> Discover hidden topics in a collection of documents.</p>
</li>
<li><p><strong>Image compression:</strong> Reduce the size of image files without sacrificing too much quality.</p>
</li>
<li><p><strong>Recommendation systems:</strong> Predict user preferences and similarities to generate meaningful recommendations and suggest relevant items.</p>
</li>
</ul>
<h2 id="heading-linear-algebra-roadmap-your-path-to-success">Linear Algebra RoadMap – Your Path to Success</h2>
<p>Now let's look at a roadmap that'll help guide you as you master Linear Algebra for Data Science and AI. It's a structured journey that builds upon foundational concepts and progressively delves into advanced topics with real-world applications.</p>
<p>This roadmap, from <a target="_blank" href="https://academy.lunartech.ai/courses">LunarTech</a>s 25+ hour <a target="_blank" href="https://academy.lunartech.ai/product/fundamentals-to-linear-algebra">Linear Algebra Course</a> is aligned with resources such as the <em>Linear Algebra and Its Applications</em> by David C. Lay, Steven R. Lay,and Judi J. McDonald (Cambridge Linear Algebra Book) and the <em>Interactive Linear Algebra</em> by Dan Margalit and Joseph Rabinoff (UBC Linear Algebra Book). It provides you with a solid foundation to tackle real-world problems in data science and AI.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/LinearAlgebraRoadmap-3-1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><a target="_blank" href="https://academy.lunartech.ai/product/fundamentals-to-linear-algebra"><em>Image Source: LunarTech - Fundamentals to Linear Algebra</em></a></p>
<h3 id="heading-refresh-your-memory-of-high-school-algebra">Refresh your Memory of High School Algebra</h3>
<ul>
<li><p>Begin by refreshing your understanding of <strong>Real Numbers &amp; Vector Spaces</strong>, ensuring you grasp the fundamental properties and operations of numbers and vectors.</p>
</li>
<li><p>Refresh your knowledge of <strong>Angles and Trigonometry</strong>, essential for understanding vector relationships and transformations.</p>
</li>
<li><p>Make sure you are clear on <strong>Norm vs. Euclidean Distance</strong>, as norms quantify vector magnitude, and Euclidean distance measures the distance between vectors. This is a very important concept for your future journey of implementing math in real world.</p>
</li>
<li><p>Refresh your knowledge on the <strong>Pythagorean Theorem and Orthogonality</strong>, crucial for concepts like projections and orthogonal transformations.</p>
</li>
<li><p>Make sure you are clear on <strong>Cartesian Coordinate System</strong> for visualizing vectors and understand the geometric side of vectors.</p>
</li>
</ul>
<h3 id="heading-foundations-of-vectors">Foundations of Vectors</h3>
<ul>
<li><p>Dive into <strong>Vectors and Operations</strong>, including vector addition, subtraction, scalar multiplication, and their geometric interpretations.</p>
</li>
<li><p>Study <strong>Special Vectors and Operations</strong>, such as unit vectors, zero vectors, and linear combinations.</p>
</li>
<li><p>Explore <strong>Advanced Vector Concepts</strong>, including linear independence, span, basis, and dimension, crucial for understanding vector spaces.</p>
</li>
<li><p>Master the <strong>Dot Product and its Applications</strong>, understanding its role in calculating angles, projections, and vector similarity.</p>
</li>
<li><p>Understand the <strong>Cauchy-Schwarz</strong> inequality – related to dot product and trigonometric concepts, which provides bounds on the dot product and has applications in various fields.</p>
</li>
</ul>
<h3 id="heading-foundations-of-linear-systems-and-matrices">Foundations of Linear Systems and Matrices</h3>
<ul>
<li><p>Master <strong>Matrices and Solving Linear Systems</strong>, as learning how to represent systems of equations in matrix form and solve them using techniques like Gaussian elimination will help you understand ML and AI for real.</p>
</li>
<li><p>Study <strong>Core Matrix Operations</strong>, including addition, subtraction, scalar multiplication, matrix multiplication, and transposition.</p>
</li>
<li><p>Practice <strong>Gaussian Reduction, REF, RREF</strong>, row echelon form (REF), and reduced row echelon form (RREF) for solving linear systems and finding inverses.</p>
</li>
<li><p>Explore the concepts of <strong>Null Space, Column Space, Basis, Rank, Full Rank</strong>, essential for understanding the solutions and properties of linear systems.</p>
</li>
<li><p>Learn the <strong>Algebraic Laws for Matrices with Proofs</strong>, solidifying your understanding of matrix algebra.</p>
</li>
</ul>
<h3 id="heading-linear-transformations-and-matrices">Linear Transformations and Matrices</h3>
<ul>
<li><p>Dive into <strong>Linear Transformations and Matrices</strong>, and make sure you understand how matrices can represent linear transformations in vector spaces.</p>
</li>
<li><p>Learn how to <strong>Transpose a Matrix</strong> and its properties.</p>
</li>
<li><p>Study <strong>Determinants and Their Properties</strong>, understanding their significance in determining invertibility and calculating areas/volumes.</p>
</li>
<li><p>Master <strong>Transpose and Inverses of Matrices (2x2) and (3x3)</strong>, essential for solving linear systems and understanding matrix transformations.</p>
</li>
<li><p>Explore <strong>Vector Spaces and Projections</strong>, understanding subspaces, orthogonal projections, and their applications in data science.</p>
</li>
<li><p>Understand and pratice the <strong>Gram-Schmidt Process</strong> for orthogonalizing a set of vectors, crucial for <strong>QR decomposition</strong> (popular Matrix Factorization technique) and other applications.</p>
</li>
</ul>
<h3 id="heading-advanced-linear-algebra-topics">Advanced Linear Algebra Topics</h3>
<ul>
<li><p>Delve into <strong>Matrix Factorization</strong>, understanding techniques like QR decomposition, eigenvalue decomposition, and singular value decomposition (SVD).</p>
</li>
<li><p><strong>QR Decomposition:</strong> Learn how to decompose a matrix into an orthogonal matrix (Q) and an upper triangular matrix (R), useful for solving linear systems and least squares problems.</p>
</li>
<li><p><strong>Eigenvalues, Eigenvectors, and Eigen Decomposition:</strong> Understand how to find these fundamental characteristics of a matrix and their applications in dimensionality reduction (PCA) and other areas.</p>
</li>
<li><p><strong>Singular Value Decomposition (SVD):</strong> Learn this powerful matrix factorization technique widely used in data science for dimensionality reduction, recommendation systems, and other applications.</p>
</li>
</ul>
<p>Here is the YouTube tutorial, <a target="_blank" href="https://youtu.be/MnSCu_iQGlg?si=Oanb5PY6NuJ6FphF"><strong>Linear Algebra Roadmap 2024</strong></a>, which explains in even more detail the Linear Algebra Roadmap topic by topic.</p>
<p>By following this roadmap, you'll gain a comprehensive understanding of linear algebra concepts, starting from the basics and gradually progressing to advanced topics, equipping you with the skills necessary to tackle real-world problems in data science and AI.</p>
<h2 id="heading-linear-algebra-in-action-real-world-applications-in-data-science-ai-and-beyond">Linear Algebra in Action: Real-World Applications in Data Science, AI, and Beyond</h2>
<p>Mathematics is like producer of the movies: you don't see them but they are actually running the show.</p>
<p>In this section, we'll delve into specific examples that showcase the practical power of linear algebra across various cutting edge fields. You'll see how seemingly abstract concepts translate into real-world solutions that drive innovation and impact our daily lives.</p>
<p>Let's explore how linear algebra is revolutionizing many different industries.</p>
<h3 id="heading-linear-algebra-in-data-science-and-machine-learning">Linear Algebra in Data Science and Machine Learning</h3>
<h4 id="heading-linear-regression">Linear Regression</h4>
<p><strong>Linear Regression</strong>, which is a fundamental ML algorithm, relies on linear algebra to find the best-fit line (or hyperplane) that minimizes the error between predicted and actual values.</p>
<p>Matrices and vectors are used to represent data and model parameters, while matrix operations like inversion and transpose are crucial for solving the regression equations.</p>
<p><strong>Application - House Price Prediction:</strong> Predicting housing prices based on features like square footage, number of bedrooms, and location. You can check out a complete end-to-end <a target="_blank" href="https://www.youtube.com/watch?v=tbvNGN5dBuE&amp;t=104s">case study here</a>.</p>
<p>Imagine you're a real estate agent trying to predict the price of a house. You have data on various features of different houses: the square footage, the number of bedrooms, and so on.</p>
<p>These features are put into a table-like structure called a matrix, denoted as X. Each row of X represents a different house, and each column represents a specific feature – for instance, one column might be the square footage, another the number of bedrooms. The prices of the corresponding houses are stored in another matrix, Y.</p>
<p>Your goal is to predict the price (Y) of a new house based on its features (X). Linear regression uses linear algebra to find the relationship between these features and the price.</p>
<p>The "line of best fit" is defined by a set of coefficients called Beta (β). Each element in Beta corresponds to a particular feature in X and tells you how much that feature influences the final price. We also add an error term, epsilon (ε), to account for any random variation in house prices that can't be explained by the features we have.</p>
<p>Under the hood, linear regression uses matrix operations like <strong>transposes, inverses, and matrix multiplication</strong> to calculate the Beta values that give the best prediction. So, while you might not see the complex math directly, linear algebra is the engine that powers the price estimates you see on real estate websites!</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/qxNrPWYV8R8" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<h4 id="heading-logistic-regression">Logistic Regression</h4>
<p>This algorithm uses linear algebra to model the relationship between customer features (like tenure, usage patterns, and demographics) and the probability of churn. Coefficients learned through linear algebra determine the importance of each feature in predicting churn.</p>
<p><strong>Application - Customer Churn Prediction*</strong>:* A telecommunications company might use logistic regression to identify customers at high risk of switching to a competitor. The model analyzes factors like call duration, data usage, customer service interactions, and billing issues.</p>
<h4 id="heading-support-vector-machines-svm">Support Vector Machines (SVM)</h4>
<p><strong>SVM</strong> is a powerful classification algorithm that uses linear algebra to find the optimal hyperplane separating different classes of data. The concept of vector dot products is central to calculating distances and determining the margin between classes.</p>
<p><strong>Application - Spam Email Identification:</strong> classifies emails as spam or not spam based on features like word frequency and email length.</p>
<h4 id="heading-feature-extraction">Feature Extraction</h4>
<p>Techniques like Principal Component Analysis (PCA) leverage linear algebra to extract the most important features from image data, reducing dimensionality and improving computational efficiency.</p>
<p><strong>Application - Object Detection:</strong> Object detection algorithms often use PCA to reduce the complexity of image features before classification.</p>
<h4 id="heading-principal-component-analysis-pca">Principal Component Analysis (PCA)</h4>
<p><strong>PCA</strong> leverages linear algebra, specifically eigenvalues and eigenvectors, to identify the directions of greatest variance in high-dimensional data. By projecting data onto these principal components, PCA reduces dimensionality while preserving the most important information.</p>
<p><strong>Application - Genomics:</strong> In genomics research, PCA is used to analyze gene expression data from thousands of genes. By reducing the dimensionality of the data, researchers can more easily visualize patterns and identify relationships between genes.</p>
<h3 id="heading-linear-algebra-in-deep-learning-and-generative-ai">Linear Algebra in Deep Learning and Generative AI</h3>
<h4 id="heading-neural-networks">Neural Networks</h4>
<p>The foundation of deep learning, neural networks are essentially interconnected layers of nodes (neurons) that process information using linear algebra operations. Matrices represent weights and biases, while matrix multiplication and activation functions propagate signals through the network.</p>
<p><strong>Application - Image Classification with CNNs:</strong> Image classification using convolutional neural networks (CNNs), where linear algebra is used for filtering operations and feature extraction.</p>
<h4 id="heading-image-transformations">Image Transformations</h4>
<p>Linear algebra is used extensively for image manipulation, including rotation, scaling, translation, and shearing. Matrices are used to represent these transformations, and matrix multiplication is used to apply them to images.</p>
<p><strong>Application in Facial Recognition:</strong> Facial recognition software uses linear transformations to align and normalize face images for comparison.</p>
<h4 id="heading-generative-adversarial-networks-gans">Generative Adversarial Networks (GANs)</h4>
<p><strong>GAN</strong>s, a type of generative model, use linear algebra operations within their neural networks to learn and generate new data samples, such as images or text.</p>
<p><strong>Application in Generating Images:</strong> Generating realistic images of human faces or creating artwork in the style of famous painters.</p>
<h4 id="heading-variational-autoencoders-vaes">Variational Autoencoders (VAEs)</h4>
<p>These generative models use linear algebra to encode high-dimensional data into a lower-dimensional latent space. This space is structured to follow a standard distribution (usually a Gaussian), making it easier to sample new data points and generate diverse outputs. Matrix operations are crucial for encoding and decoding data between the original space and the latent space.</p>
<p><strong>Application in Healthcare with VAE:</strong> A pharmaceutical company uses VAEs to generate novel molecular structures with desired properties. By encoding existing drug molecules into a latent space, the VAE can explore this space to generate new candidate molecules that potentially have therapeutic effects.</p>
<p>All these examples are just the tip of the iceberg. Linear algebra plays an important role in countless applications across data science and AI. By understanding its core concepts, you'll be equipped to not only use existing algorithms but also contribute to the development of new and innovative solutions.</p>
<h2 id="heading-practical-tips-tools-and-resources-for-learning-linear-algebra">Practical Tips, Tools, and Resources for Learning Linear Algebra</h2>
<p>I often get asked about the best resources for learning linear algebra and specifically what book to read to master it. My advice, as someone who's gone through the traditional academic route of textbooks and countless theoretical examples: don't feel obligated to read those massive linear algebra textbooks cover to cover.</p>
<p>They are valuable resources, but not the most efficient way to learn if your goal is to apply linear algebra in your data science career.</p>
<p>Instead, focus on a clear, guided, and time-efficient approach to learning the theory that you'll <em>actually</em> use. Then, prioritize practical application: learn how to implement these concepts in Python and utilize them in machine learning, deep learning, and other areas. This is a far more effective use of your time.</p>
<p>So, where should you start? The answer is to understand the essentials and implement these concepts with clear guidance. This will help save your time and make it easier to learn effectively.</p>
<p>First of all, make sure you read through the roadmap and watch the accompanying video that I included above. And then you can move on to the following:</p>
<h3 id="heading-fundamentals-of-linear-algebra-25-hour-course">Fundamentals of Linear Algebra: 25+ Hour Course</h3>
<p>If you're overwhelmed by dense textbooks or endless theoretical examples, you're not alone. Linear algebra can be intimidating, but it's a crucial foundation for anyone working in data science and AI.</p>
<p>LunarTech's concise, career-focused course will equip you with the skills you need to excel in data science and AI. Try it now – it's included in our LunarTech Max plan at the moment. You can sign up for the <a target="_blank" href="https://academy.lunartech.ai/product/fundamentals-to-linear-algebra%22">Fundamentals of Linear Algebra 25+h Course here</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/maxresdefault-6.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><a target="_blank" href="https://academy.lunartech.ai/product/fundamentals-to-linear-algebra"><em>Source: Fundamentals to Linear Algebra 25+h Course</em></a></p>
<ul>
<li><p><em>Undergraduate Students:</em> Ace your linear algebra exams and build a strong foundation for further study.</p>
</li>
<li><p><em>Working Professionals:</em> Gain the skills you need to understand, create, and implement cutting-edge AI and machine learning algorithms.</p>
</li>
</ul>
<p>Whether you're a student looking for a clear and concise approach to linear algebra or a professional aiming to advance your career in AI and data science, this course will equip you with the knowledge and skills you need to succeed.</p>
<h3 id="heading-free-linear-algebra-crash-course-7-hours">Free Linear Algebra Crash Course – 7 Hours</h3>
<p>This shorter, demo version of the main course is perfect for learners who need a quick yet comprehensive overview of the key concepts in linear algebra. It’s great as a refresher or for those who need to understand the basics before diving into more complex topics, and is a starting point to learn Linear Algebra.</p>
<p>You can check out this <a target="_blank" href="https://youtu.be/n9jZmymHX6o?si=VnE0wVXg9C16lond">Linear Algebra Crash Course - Mathematics for Machine Learning and Generative AI [Full 7h]</a> to get started.</p>
<h3 id="heading-freecodecamp-linear-algebra-course-and-textbook">freeCodeCamp Linear Algebra Course and Textbook</h3>
<p>You can also <a target="_blank" href="https://www.freecodecamp.org/news/linear-algebra-full-course/">check out this free freeCodeCamp course</a> that covers key Linear Algebra topics like Gaussian reduction, vector spaces, linear maps, determinants, and eigenvalues and eigenvectors. There are many practical examples, and the course encourages you to work through each of them to solidify your knowledge.</p>
<p>There's also a link to download the professor's textbook if you're interested in that.</p>
<h2 id="heading-connect-with-me"><strong>Connect with Me</strong></h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/05/image-5-1.png" alt="Screenshot-2023-10-23-at-6.59.27-PM" width="600" height="400" loading="lazy"></p>
<p><em>Image Source: [LunarTech](https://lunartech.ai" style="box-sizing: inherit; margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant-caps: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size-adjust: inherit; font-kerning: inherit; font-variant-alternates: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-variant-position: inherit; font-feature-settings: inherit; font-optical-sizing: inherit; font-variation-settings: inherit; font-size: 17.6px; vertical-align: baseline; background-color: transparent; color: var(--gray90); text-decoration: underline; cursor: pointer; word-break: break-word;)</em></p>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/tatev-karen-aslanyan/">Follow me on LinkedIn for a ton of Free Resources in ML and AI</a></p>
</li>
<li><p><a target="_blank" href="https://tatevaslanyan.com/">Visit my Personal Website</a></p>
</li>
<li><p>Subscribe to my <a target="_blank" href="https://tatevaslanyan.substack.com/">The Data Science and AI Newsletter</a></p>
</li>
</ul>
<p>Want to discover everything about a career in Data Science, Machine Learning and AI, and learn how to secure a Data Science job? Download this free <a target="_blank" href="https://downloads.tatevaslanyan.com/six-figure-data-science-ebook"><strong>Data Science and AI Career Handbook</strong></a>.</p>
<p>Thank you for choosing this guide as your learning companion. As you continue to explore the vast field of machine learning, I hope you do so with confidence, precision, and an innovative spirit. Best wishes in all your future endeavors!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Apply Math with Python – Numerical Analysis Explained ]]>
                </title>
                <description>
                    <![CDATA[ Numerical analysis is the bridge between math and computer science.  Essentially, it is the development of algorithms that approximate solutions that pure math would also solve, but using less computational resources and faster. This field is very im... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/numerical-analysis-explained-how-to-apply-math-with-python/</link>
                <guid isPermaLink="false">66ba533e80dbd3f269f5887b</guid>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Tiago Capelo Monteiro ]]>
                </dc:creator>
                <pubDate>Thu, 29 Feb 2024 11:41:59 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/07/maxim-hopman-fiXLQXAhCfk-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Numerical analysis is the bridge between math and computer science. </p>
<p>Essentially, it is the development of algorithms that approximate solutions that pure math would also solve, but using less computational resources and faster.</p>
<p>This field is very important. Because for most solutions in the real world, we only need good approximations and not the exact solutions.</p>
<p>In this article, we will explore:</p>
<ul>
<li><a class="post-section-overview" href="#heading-an-analogy-that-illustrates-the-importance-of-numerical-analysis">Analogy Illustrating the Importance of Numerical Analysis</a> </li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/p/a66b15d8-ae59-4c46-8e58-5211690e1032/fundamentals">Fundamentals of Numerical Analysis</a> </li>
<li><a class="post-section-overview" href="#heading-application-of-numerical-analysis-in-real-world-problems">Application of Numerical Analysis in Real-World Problems</a></li>
<li><a class="post-section-overview" href="#heading-an-introduction-to-partial-differential-equations-pdes">Introduction to Partial Differential Equations (PDEs)</a></li>
<li><a class="post-section-overview" href="#heading-an-introduction-to-optimization-in-numerical-analysis">Introduction to Optimization in Numerical Analysis</a></li>
</ul>
<h2 id="analogy">An Analogy that Illustrates the Importance of Numerical Analysis</h2>

<p>How can we measure the coastline of an island?</p>
<p>If we try to measure every centimeter of every small segment, it would be impossible and probably time-consuming.</p>
<p>Because of the sea, the coastline is always changing at that level of detail.</p>
<p>However, by approximating and measuring in larger segments, we can get a practical measurement of the coastline.</p>
<p>This situation mirrors numerical analysis.</p>
<p>Approximation gives insights in situations where precise measurement is impossible or impractical.</p>
<p>Just as we accept a good estimation of the coastline length, numerical analysis uses approximation to solve hard problems.</p>
<h2 id="fundamentals">Fundamentals of Numerical Analysis</h2>

<p>Numerical analysis is all about approximation. It is like using binoculars to see a landscape that is very far away. We can't see every leaf. But we get a good enough picture to understand the terrain.</p>
<p>This is crucial in numerical analysis.</p>
<p>In this, we solve hard math problems where exact solutions are either impossible or extremely resource-intensive.</p>
<p>By approximating, we get sufficient good results with less computational effort.</p>
<h2 id="application">Application of Numerical Analysis in Real-World Problems</h2>

<p>There are many applications of numerical analysis</p>
<ul>
<li>In engineering, it enables simulation of structures and fluids.</li>
<li>In finance, for risk assessment and portfolio optimization.</li>
<li>In environmental science, it predicts climate patterns.</li>
</ul>
<p>In each field, numerical analysis is a toolkit to solve problems where pure math just takes too much time, or it is impossible to give good results.</p>
<h2 id="intro-PDE">An Introduction to Partial Differential Equations (PDEs)</h2>

<p>Partial Differential Equations (PDEs) are equations that describe how quantities like heat, sound, or electricity change in different places and as time goes on.</p>
<p>Solving PDEs is very important. Because it allows us to control these changes.</p>
<p>By allowing us to control them, we can:</p>
<ul>
<li>Predict weather patterns.</li>
<li>Understand sound propagation in different environments.</li>
<li>Design efficient transportation systems.</li>
<li>Optimize energy distribution.</li>
</ul>
<p>However, most PDE can only be approximated with numerical methods.</p>
<p>It is either too hard or impossible to find through normal calculations.</p>
<p>This way, with numerical methods, we are able to solve PDEs which in turn allows us to solve many real life problems.</p>
<h3 id="heading-numerical-solutions-of-pdes-with-scipy">Numerical Solutions of PDEs with SciPy</h3>
<p>Solving PDEs with numerical methods often involves dividing the PDEs in small, manageable parts. Solve each one and then add them up.</p>
<p>SciPy, a Python library for scientific and technical computing, gives many tools for this purpose.</p>
<p>Now, let's solve a heat transfer problem in a rod.</p>
<p>In the below code, we will see line by line how it allows us to know how heat spreads in a rod:</p>
<pre><code><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> solve_bvp

def heat_equation(x, y):
    <span class="hljs-keyword">return</span> np.vstack((y[<span class="hljs-number">1</span>], -y[<span class="hljs-number">0</span>]))

def boundary_conditions(ya, yb):
    <span class="hljs-keyword">return</span> np.array([ya[<span class="hljs-number">0</span>], yb[<span class="hljs-number">0</span>] - <span class="hljs-number">1</span>])

x = np.linspace(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">5</span>)
y = np.zeros((<span class="hljs-number">2</span>, x.size))

sol = solve_bvp(heat_equation, boundary_conditions, x, y)
</code></pre><p>Lets see how thhe code works block by block in the following sections.</p>
<h3 id="heading-how-to-importing-libraries">How to importing libraries</h3>
<pre><code><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> solve_bvp
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/5-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Importing libraries</em></p>
<p>Here we import 2 python libraries:</p>
<ul>
<li><a target="_blank" href="null">N</a><a target="_blank" href="https://numpy.org/">umPy</a></li>
<li><a target="_blank" href="null">S</a><a target="_blank" href="https://scipy.org/">ciPy</a></li>
</ul>
<p>These two python libraries are some of the most used in data science.</p>
<h3 id="heading-how-to-define-the-head-equation-and-boundary-conditions">How to define the head equation and boundary conditions</h3>
<pre><code>def heat_equation(x, y):
    <span class="hljs-keyword">return</span> np.vstack((y[<span class="hljs-number">1</span>], -y[<span class="hljs-number">0</span>]))

def boundary_conditions(ya, yb):
    <span class="hljs-keyword">return</span> np.array([ya[<span class="hljs-number">0</span>], yb[<span class="hljs-number">0</span>] - <span class="hljs-number">1</span>])
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/6.png" alt="Image" width="600" height="400" loading="lazy">
<em>Defining heat equation and boundary conditions</em></p>
<p>We create <code>heat_equation(x, y)</code> and <code>boundary_conditions(ya, yb)</code>.</p>
<p>In <code>heat_equation(x, y)</code> we are defining the differential equation we want to solve.</p>
<p>The <code>boundary_conditions(ya, yb)</code> function defines constrains at the start and end of a solution. The condition is that the end of the solution needs to be one unit less than the start.</p>
<h3 id="heading-how-to-solve-the-equation">How to solve the equation</h3>
<pre><code>x = np.linspace(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">5</span>)
y = np.zeros((<span class="hljs-number">2</span>, x.size))

sol = solve_bvp(heat_equation, boundary_conditions, x, y)
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/7.png" alt="Image" width="600" height="400" loading="lazy">
<em>Solving equation</em></p>
<p>The line <code>sol = solve_bvp(heat_equation, boundary_conditions, x, y)</code> is the solution.</p>
<p>The code <a target="_blank" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_bvp.html"><code>solve_bvp</code>  stands for solve boundary value problem</a>.</p>
<p>It takes four arguments:</p>
<ul>
<li><code>heat_equation</code>: This is the main problem we are trying to solve.</li>
<li><code>boundary_conditions</code>: These are the mathematical constrains at the start and end of a solution.</li>
<li><code>x</code>:  Are the spots we choose to explore our answers.</li>
<li><code>y</code>: Are initial attempts to solve the problem, based on your chosen <code>x</code> values.</li>
</ul>
<h2 id="intro-optimization">An Introduction to Optimization in Numerical Analysis</h2>

<p>Optimization is finding the best solution from all solutions. It is like finding the most efficient route in a complex network of roads.</p>
<p>Numerical optimization methods find the most efficient or cost-effective solution to a problem, whether that is:</p>
<ul>
<li>Minimizing waste in production.</li>
<li>Maximizing efficiency in a logistic network.</li>
<li>Finding best fit for a certain data model.</li>
</ul>
<h3 id="heading-an-overview-of-numerical-optimization-techniques-with-scipy">An Overview of Numerical Optimization Techniques with SciPy</h3>
<p>The goal in this example is to minimize transportation cost across a network. </p>
<p>For instance, let's consider an optimization problem in logistics, where the goal is to minimize transportation cost across a network. </p>
<p>SciPy's <code>minimize</code> function can be used to find the best strategy to minimizes cost while meeting all constraints:</p>
<pre><code><span class="hljs-keyword">from</span> scipy.optimize <span class="hljs-keyword">import</span> minimize

def objective_function(x):
    <span class="hljs-keyword">return</span> x[<span class="hljs-number">0</span>]**<span class="hljs-number">2</span> + x[<span class="hljs-number">1</span>]**<span class="hljs-number">2</span>

def constraint_eq(x):
    <span class="hljs-keyword">return</span> x[<span class="hljs-number">0</span>] + x[<span class="hljs-number">1</span>] - <span class="hljs-number">10</span>

con_eq = {<span class="hljs-string">'type'</span>: <span class="hljs-string">'eq'</span>, <span class="hljs-string">'fun'</span>: constraint_eq}

bounds = [(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>), (<span class="hljs-number">0</span>, <span class="hljs-number">10</span>)]

x0 = [<span class="hljs-number">5</span>, <span class="hljs-number">5</span>]

result = minimize(objective_function, x0, method=<span class="hljs-string">'SLSQP'</span>, bounds=bounds, constraints=[con_eq])
</code></pre><p>Lets explain how the code works block by block.</p>
<h3 id="heading-how-to-importing-the-library">How to importing the library</h3>
<pre><code><span class="hljs-keyword">from</span> scipy.optimize <span class="hljs-keyword">import</span> minimize
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/8.png" alt="Image" width="600" height="400" loading="lazy">
<em>Importing scipy</em></p>
<p>Once again we import the necessary library:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html">https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html</a></div>
<h3 id="heading-how-to-defining-objective-and-constraint-equation">How to defining objective and constraint equation</h3>
<pre><code>def objective_function(x):
    <span class="hljs-keyword">return</span> x[<span class="hljs-number">0</span>]**<span class="hljs-number">2</span> + x[<span class="hljs-number">1</span>]**<span class="hljs-number">2</span>

def constraint_eq(x):
    <span class="hljs-keyword">return</span> x[<span class="hljs-number">0</span>] + x[<span class="hljs-number">1</span>] - <span class="hljs-number">10</span>

con_eq = {<span class="hljs-string">'type'</span>: <span class="hljs-string">'eq'</span>, <span class="hljs-string">'fun'</span>: constraint_eq}
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/9.png" alt="Image" width="600" height="400" loading="lazy">
<em>Define objective and constrain equations</em></p>
<ul>
<li>The objective function is the function we want to minimize to find the best answer.</li>
<li>The constraint equation is the equation that limits the search space to those <code>x</code> values that fulfill this equation.</li>
</ul>
<p><code>con_eq</code> is defined by the following:</p>
<ul>
<li><code>'type': 'eq'</code> indicates the type of constraint.  <code>'eq'</code> means equality, in other words, the function must equal zero at the solution.</li>
<li><code>'fun': constraint_eq</code> assigns the constraint function.</li>
</ul>
<p>We will see in the next block of code, it is where we constrain the possible solutions of the problem.</p>
<h3 id="heading-how-to-define-an-initial-condition-and-result">How to define an initial condition and result</h3>
<pre><code>bounds = [(<span class="hljs-number">0</span>, <span class="hljs-number">10</span>), (<span class="hljs-number">0</span>, <span class="hljs-number">10</span>)]

x0 = [<span class="hljs-number">5</span>, <span class="hljs-number">5</span>]

result = minimize(objective_function, x0, method=<span class="hljs-string">'SLSQP'</span>, bounds=bounds, constraints=[con_eq])
</code></pre><p><img src="https://www.freecodecamp.org/news/content/images/2024/02/10.png" alt="Image" width="600" height="400" loading="lazy">
<em>Defining initial condition and solving equation</em></p>
<p>To understand this block of code, let's understand each parameter of <code>result = minimize(objective_function, x0, method='SLSQP', bounds=bounds, constraints=[con_eq])</code>:</p>
<ul>
<li><code>objective_function</code>: Is the function to be minimized.</li>
<li><code>x0</code>: Is the initial guess for the variables.</li>
<li><code>method='SLSQP'</code>: This specifies the optimization algorithm we are using. In this case, we use <a target="_blank" href="https://docs.scipy.org/doc/scipy/reference/optimize.minimize-slsqp.html">SLSQP (Sequential Least SQuares Programming)</a>.</li>
<li><code>bounds=bounds</code>: This parameter specifies the bounds for each of the decision variables. </li>
<li><code>constraints=[con_eq]</code>: This parameter tells us the constraints applied in the optimization problem.</li>
</ul>
<h2 id="heading-this-is-how-many-real-life-problems-are-solved">This is how many real life problems are solved</h2>
<p>Many things in real life are modeled with partial differential equation.</p>
<p>Then, with optimization methods developed with numerical analysis, they are optimized.</p>
<p>I am writing this because I know math can be boring for some people, and they may not be aware of where it is applied to solve real problems. The Calculus they learn can be applied in non-ideal situations outside the exams exercises.</p>
<p>Here, we can see finally see why math is important in two scenarios:</p>
<ul>
<li>To model systems to get solutions from it</li>
<li>To optimize a certain system</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Numerical analysis is one of the most important areas of applied math in STEM.</p>
<p>From solving PDE to optimize problems, numerical analysis is everywhere.</p>
<p>With more complex problems, numerical analysis is growing in importance to get faster algorithms that approximate pure math solutions.</p>
<p>This way, it is a bridge between theoretical mathematics and practical application.</p>
<p>If you want to, you can get the full code used in this article on <a target="_blank" href="https://github.com/tiagomonteiro0715/freecodecamp-my-articles-source-code">GitHub</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Add Numbers in Excel ]]>
                </title>
                <description>
                    <![CDATA[ Did you know you can write Python code in a spreadsheet? You'd be surprised how many different ways there are to do things in Excel. Below, I'll show you 9 ways to add two or more numbers. You can skip to a certain section if you'd like to see that ]]>
                </description>
                <link>https://www.freecodecamp.org/news/add-numbers-in-excel/</link>
                <guid isPermaLink="false">66b8ddc62755c964523f056c</guid>
                
                    <category>
                        <![CDATA[ excel ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ spreadsheets ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Eamonn Cottrell ]]>
                </dc:creator>
                <pubDate>Thu, 12 Oct 2023 21:02:58 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/10/add-numbers-thumb-2.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Did you know you can write Python code in a spreadsheet?</p>
<p>You'd be surprised how many different ways there are to do things in Excel. Below, I'll show you 9 ways to add two or more numbers. You can skip to a certain section if you'd like to see that method:</p>
<ol>
<li><a class="post-section-overview" href="#">Manual</a></li>
<li><a class="post-section-overview" href="#-1">References</a></li>
<li><a class="post-section-overview" href="#-2">SUM()</a></li>
<li><a class="post-section-overview" href="#-3">SUMIF()</a></li>
<li><a class="post-section-overview" href="#-4">SUBTOTAL()</a></li>
<li><a class="post-section-overview" href="#-5">AGGREGATE()</a></li>
<li><a class="post-section-overview" href="#-6">VBA</a></li>
<li><a class="post-section-overview" href="#-7">Python</a></li>
<li><a class="post-section-overview" href="#-8">Highlight</a></li>
</ol>
<h2 id="heading-video-walkthrough">Video Walkthrough</h2>
<p>If you prefer to watch me go through each of these in a demo workbook, here's a video for that:</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/xe5Ohlgizi8" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>To write a formula or a function in Excel (which we'll be doing in the examples below), start out by simply typing an equals sign in a cell.</p>
<p><code>=</code></p>
<p>This triggers Excel to know that what follows will be a formula or a built-in function.</p>
<p><a id="manual"></a></p>
<h2 id="heading-manual">Manual</h2>
<p>This is simplest version of a formula in Excel. Start out with the equals sign, and then type in the numbers and operation you want to do. Just like a calculator:</p>
<p><code>=6+102</code></p>
<p>Pressing enter will result in <code>108</code> being listed in the cell</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-30.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of manual addition in Excel</em></p>
<p><a id="reference"></a></p>
<h2 id="heading-references">References</h2>
<p>The next step up in Excel is to start using cell references. Notice that on the top and on the left side of the main spreadsheet area, there are columns designated by letters and rows designated by numbers.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/rowscolumns.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of rows and columns</em></p>
<p>We can refer to specific cells using "A1" notation. Like a set of (x,y) coordinates on a graph, this simply means that by referring to C4, for instance, we are referring to the cell found in column C, row 4.</p>
<p>To add numbers using references, we start again with the equals sign and refer to the values in specific cells directly.</p>
<p>This has the added advantage of being dynamic. If a value is changed in one of the cells, the result of the sum automatically updates.</p>
<p><code>=SUM(A1+A3)</code> provides us with the value of the numbers in <code>A1</code> and <code>A3</code>.</p>
<p><a id="sum"></a></p>
<h2 id="heading-sum">SUM()</h2>
<p>The first two methods are examples of using formulas. We manually give Excel a series of instructions that it executes. </p>
<p>Excel also has built-in functions which we can use by starting with the equals sign and then referring to the function by name. Functions also take variables which we pass to them by using a set of parenthesis after the name of the function.</p>
<p>The <code>SUM()</code> function takes either a range or a comma-separated list of cell references. It then returns the sum of all the numbers in the range. </p>
<p>You can select a range by either clicking and dragging or by declaring one by typing in the A1 notation with a colon in between the top left cell and the bottom right cell of the range.</p>
<p><code>SUM(A5:A11)</code> adds all the numbers in cells <code>A5, A6, A7, A8, A9, A10, A11</code></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-31.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of the SUM() function</em></p>
<p><a id="sumif"></a></p>
<h2 id="heading-sumif">SUMIF()</h2>
<p>A more powerful version of <code>SUM()</code> is the <code>SUMIF()</code> function. This adds conditional logic. It needs at least two variables: a range and a condition. We could give it the same range as above and have a condition be that it only adds up numbers that are greater than zero.</p>
<p>A third, optional variable is a <code>sum_range</code>. This allows for us to match a condition in one range with the sum of values in another range.</p>
<p>In the example sheet, I have inserted checkboxes in column C. Checkboxes in Excel are <a target="_blank" href="https://youtu.be/hROvLovbl8E">a new feature</a>. This is the range that I'm checking for a condition. The condition is TRUE. Now I enter the range that I want to sum if the condition in the corresponding row of the first range is indeed TRUE.</p>
<p>When using a range and a sum_range separately like this, they do have to be of the same size or it will not behave as you want it to.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-32.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of SUMIF() function in Excel</em></p>
<p><a id="subtotal"></a></p>
<h2 id="heading-subtotal">SUBTOTAL()</h2>
<p>Ok, here's where things start to get interesting.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/butts.gif" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The <code>SUBTOTAL()</code> function allows us to do a ton of different things. Ultimately, it returns a subtotal of a list or database. But inside of <code>SUBTOTAL()</code> there are other functions. The first argument that we give <code>SUBTOTAL()</code> is a number corresponding to one of these functions:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-33.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of functions within SUBOTAL from Microsoft Excel</em></p>
<p>Looking at the function list, we see that 9 or 109 both correspond to the <code>SUM()</code> function which we want to use. If we have hidden rows in our range that we don't want to include in the sum, we use 109 to ignore those – if not, simply 9.</p>
<p>So the function looks like this: <code>SUBTOTAL(9,B3:B12)</code>. This sums <code>B3:B12</code> even if one or more of those rows are hidden.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-34.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of SUBTOTAL in Excel</em></p>
<p><a id="aggregate"></a></p>
<h2 id="heading-aggregate">AGGREGATE()</h2>
<p>We can think of <code>AGGREGATE()</code> as a souped-up version of <code>SUBTOTAL()</code>. It works in the same way but has a lot more built-in functions (19 of them) and allows for detailed specificity on what values, if any, to ignore in the calculation.</p>
<p><code>AGGREGATE(function_num, options, ref1, [ref2], …)</code> is the full reference formula. Again, we pass it a number corresponding to one of the 19 built-in functions, then an optional argument for what type of values to ignore, followed by the reference array and an optional second reference array.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-35.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of options for Aggregate function from Microsoft Excel</em></p>
<p>For our example, we again use 9 as our function number, but we can use option 5 to explicitly exclude hidden rows:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-36.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of Aggregate function in Excel</em></p>
<p><a id="vba"></a></p>
<h2 id="heading-vba">VBA</h2>
<p>Now we're warmed up. Let's get overly complicated.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/complicated.gif" alt="Image" width="600" height="400" loading="lazy">
<em>gif of complicated nonsense</em></p>
<p>Visual Basic for Applications is Microsoft's baked-in programming language in Microsoft Office applications.</p>
<p>Open it up by selecting Visual Basic from the Developer tab. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/vba.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of VBA in Developer tab in Excel</em></p>
<p>If you don't see the developer tab, go to File - Options - Customize Ribbon and add it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/developer-tab.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of Customizing Ribbon in Excel</em></p>
<p>Also, <code>Alt +11</code> is the keyboard shortcut to open up VBA.</p>
<p>Once here, we can write code to do all sorts of things. Our example isn't very practical since a function will do it quicker, but the following code will Sum the range <code>A1:A11</code>, put the result in <code>F11</code> and display a message pop-up with the result:</p>
<pre><code class="lang-vba">Sub AssignSumVariable()
   Dim result As Double
   'Assign the variable
   result = WorksheetFunction.Sum(Range("B1:B11"))
   'Show the result
   MsgBox "The total of the ranges is " &amp; result
   'Put the result in cell F9
  Range("F9") = result
End Sub
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-37.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of VBA in Excel</em></p>
<p><a id="python"></a></p>
<h2 id="heading-python">Python</h2>
<p>Yes, this is now ridiculous. But, it's good to know what Excel can do when you have more complicated tasks that require tools like VBA or Python. At the time of this writing, Python is available in Excel for people using the Beta Channel of Excel.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/overkill.gif" alt="Image" width="600" height="400" loading="lazy">
<em>gif of woman saying "seems like overkill"</em></p>
<p>You can check your eligibility and join Microsoft 365 Insider if you want to test out new features like this in the future.</p>
<p>Go to File - Account, and then select the 365 Insider channel button for more info.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-38.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of Microsoft 365 Insider options</em></p>
<p>Once Python is usable in Excel, you activate it by typing <code>=py</code> and then the <code>tab</code> key. This turns the cell into a Python command line.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-39.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of Python command line in Excel</em></p>
<p>From here, we can write Python code directly in the cell. The following code uses the custom xl() function for Python to use a range. We hold the range in the numbers variable and then using dot notation, we sum that range with the <code>numbers.sum()</code> line:</p>
<pre><code class="lang-python">numbers = xl(<span class="hljs-string">"'Sum➕'!$B$3:$B$12"</span>)
numbers.sum()
</code></pre>
<p>Now to execute the Python code, click <code>CTRL + ENTER</code>.</p>
<p>What we now see is that we've got a Python Series in the cell:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-40.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In order to just display the answer, we can click the Python Output selector just to the left of the formula bar and select <code>Excel Value</code>:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/python-object.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of Python Output in Excel</em></p>
<p>Now, our cell is updated with the correct value.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-42.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of cells in Excel</em></p>
<p>The real value of Python in Excel comes with manipulating dataframes using built-in libraries like Matplotlib, NumPy, or Pandas.</p>
<p>Okay, take a breath, we'll finish with something simple and easy...👇</p>
<p><a id="highlight"></a></p>
<h2 id="heading-highlight">Highlight</h2>
<p>Bonus time. If you highlight cells in Excel by either clicking and dragging mouse over a range, or by <code>CTRL</code>+ <code>Left-Click</code> individual cells, some automatic calculations are visible in the bottom right of the window, including the Average, Count and Sum:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/highlight.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If the sum isn't immediately visible, right clicking will pull up auto-calculations that you can toggle on and off:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/10/image-29.png" alt="Image" width="600" height="400" loading="lazy">
<em>screenshot of auto-calculation options in Excel</em></p>
<h2 id="heading-thanks-for-reading">Thanks for reading!</h2>
<p>Hope this is helpful for you!</p>
<p>Follow me on LinkedIn: <a target="_blank" href="https://www.linkedin.com/in/eamonncottrell/">https://www.linkedin.com/in/eamonncottrell/</a></p>
<p>And YouTube: <a target="_blank" href="https://www.youtube.com/@eamonncottrell">https://www.youtube.com/@eamonncottrell</a></p>
<p>Have a great one! 👋</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Calculate Definite and Indefinite Integrals in Python ]]>
                </title>
                <description>
                    <![CDATA[ By Roy Chng Python is a versatile programming language that offers libraries and tools for scientific computing and mathematical calculations.  Many essential mathematical operations frequently involve definite and indefinite integrals. In this artic... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/calculate-definite-indefinite-integrals-in-python/</link>
                <guid isPermaLink="false">66d460c5bd438296f45cd3a4</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 31 Jul 2023 18:02:27 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/07/calculating-integrals-python-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Roy Chng</p>
<p>Python is a versatile programming language that offers libraries and tools for scientific computing and mathematical calculations. </p>
<p>Many essential mathematical operations frequently involve definite and indefinite integrals. In this article, we will explore how to perform these calculations using Python.</p>
<h2 id="heading-how-to-calculate-single-variable-definite-integrals">How to Calculate Single Variable Definite Integrals</h2>
<h3 id="heading-install-scipy">Install SciPy</h3>
<p>Before we start, we need to install the SciPy module. It provides a collection of Mathematical algorithms and functions that we'll use.</p>
<p>You can do this by running the following command in a terminal:</p>
<pre><code>pip install scipy
</code></pre><p>To calculate single variable definite integrals, we need to first import <code>quad</code> from <code>scipy.integrate</code>. It is a general purpose function used to calculate single variable definite integrals.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> quad
</code></pre>
<h3 id="heading-elementary-functions">Elementary Functions</h3>
<p>From there, we'll need to define the integrand as a function in Python.</p>
<p>For example, if we wanted to calculate the integral of x-squared, we would define the integrand as a Python function like so:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">x</span>):</span>
    <span class="hljs-keyword">return</span> x**<span class="hljs-number">2</span>
</code></pre>
<p>Once we define the integrand, we can calculate the definite integral using the quad function like this:</p>
<pre><code class="lang-python">print(quad(integrand, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>))
<span class="hljs-comment"># (0.33333333333333337, 3.700743415417189e-15)</span>
</code></pre>
<p>In the above code, <code>0</code> represents the lower limit of integration and <code>1</code> represents the upper limit of integration. They can be any other number.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_1-4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the of integral of x^2 from 0 to 1 with the associated code</em></p>
<p>In this example, we calculate that the estimated result of the integral from 0 to 1 of x-squared is approximately 0.333 with an absolute error of roughly 3.7e-15.</p>
<p>The quad function returns a tuple of an estimation of the definite integral followed by the absolute error of the estimation.</p>
<p>What the <code>quad</code> function does is essentially evaluate the <code>integrand</code> function at multiple different values between our limits of integration to be able to calculate an estimate of the integral.</p>
<p>Another example would be if I wanted to calculate the integral of <code>(x+1)/x**2</code>. We would first define it as a function in Python, and pass it into the <code>quad</code> function along with the limits of integration:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> quad

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">x</span>):</span>
    <span class="hljs-keyword">return</span>(x+<span class="hljs-number">1</span>)/x**<span class="hljs-number">2</span>

print(quad(integrand, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>))
<span class="hljs-comment"># (1.1931471805599452, 1.3246594716242401e-14)</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_2-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the of integral of (x+1)/x^2 from 1 to 2 with the associated code</em></p>
<p>In this example, we calculate that the estimated result of the integral from 1 to 2 of x +1 all over x-squared is approximately 1.19 with an absolute error of roughly 1.32e-14.</p>
<h3 id="heading-other-common-functions">Other Common Functions</h3>
<p>If we wanted to use common mathematical functions such as <code>sin(x)</code> or <code>log(x)</code>, we can use another Python package for scientific computing – NumPy. You can install the package using the following command:</p>
<pre><code>pip install numpy
</code></pre><p>By importing it, we have access to these common functions which we can use in our integrand:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> quad
<span class="hljs-keyword">from</span> numpy <span class="hljs-keyword">import</span> log, sin

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">x</span>):</span>
    <span class="hljs-keyword">return</span> log(sin(x))

print(quad(integrand, <span class="hljs-number">0</span>, <span class="hljs-number">2</span>))
<span class="hljs-comment"># (-1.1022223889049558, 1.2237126744196256e-15)</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_3-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the of integral of log(sin(x)) from 0 to 2 with the associated code</em></p>
<p>In this example, we calculate that the estimated result of the integral from 0 to 2 of log(sin(x)) is approximately -1.10 with an absolute error of roughly 1.22e-15.</p>
<p>A full list of mathematical functions that NumPy provides is <a target="_blank" href="https://numpy.org/doc/stable/reference/routines.math.html">in their documentation</a>.</p>
<h3 id="heading-how-to-use-constants">How to Use Constants</h3>
<p>NumPy also provides useful constants such as <code>e</code> and <code>pi</code>, as well as <code>inf</code>. It's a floating point representation of positive infinity. We can use it to calculate a definite integral that converges.</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> quad
<span class="hljs-keyword">from</span> numpy <span class="hljs-keyword">import</span> inf, exp

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">x</span>):</span>
  <span class="hljs-keyword">return</span> exp(-x)

print(quad(integrand, <span class="hljs-number">0</span>, inf))
<span class="hljs-comment"># (1.0000000000000002, 5.842606742906004e-11)</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_4-4.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the of integral of e^x from 0 to infinity with the associated code</em></p>
<p>In this example, we calculate that the estimated result of the integral of e raised to the negative x from 0 to infinity is approximately 1.00 with an absolute error of roughly 5.84e-11.</p>
<h2 id="heading-how-to-calculate-multi-variable-integrals">How to Calculate Multi-Variable Integrals</h2>
<h3 id="heading-double-integrals">Double Integrals</h3>
<p>To calculate double integrals, we need to import the <code>dblquad</code> function from <code>scipy.integrate</code>:</p>
<pre><code><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> dblquad
</code></pre><p>We define the integrand in a similar way to definite it with one variable, only this time we specified two arguments instead.</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">y, x</span>):</span>
    <span class="hljs-keyword">return</span> x*y**<span class="hljs-number">2</span>
</code></pre>
<p>We can then calculate the definite integral using the <code>dblquad</code> function given by <code>scipy</code>.</p>
<p>Note that the integrand is a function that needs to accept <code>y</code> as the first parameter and <code>x</code> as the second parameter.</p>
<pre><code class="lang-python">print(dblquad(integrand, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">4</span>))
<span class="hljs-comment"># (9.333333333333334, 2.0679162295394134e-13)</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_5-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the integral of (xy^2) dxdy from 2 to 4 for y and integral from 0 to 1 for x with the associated code</em></p>
<p>In this example, we calculate that the estimated result of the double integral x times y-squared from x = 0 to 1 and from y = 2 to y = 4 is approximately 9.33 with an absolute error of roughly 2.07e-13.</p>
<p>The function requires us to pass in the integrand, and the lower and upper limits of integration for <code>x</code>, followed by the lower and upper limits of integration for <code>y</code>.</p>
<h3 id="heading-variable-limits">Variable Limits</h3>
<p>To calculate integrals with variable limits, we'll need to define functions for the lower and upper limits of integration for y in terms of x:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">upper_limit_y</span>(<span class="hljs-params">x</span>):</span>
    <span class="hljs-keyword">return</span> x**<span class="hljs-number">2</span>

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">lower_limit_y</span>(<span class="hljs-params">x</span>):</span>
    <span class="hljs-keyword">return</span> x

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">y, x</span>):</span>
    <span class="hljs-keyword">return</span> x+y

print(dblquad(integrand, <span class="hljs-number">0</span>, <span class="hljs-number">2</span>, lower_limit_y, upper_limit_y))
</code></pre>
<p>In this example, we calculate that the estimated result of the double integral of x+y from x = 0 to x = 2, and from y = x to y = x^2 is approximately 3.2 with an absolute error of roughly 1.10e-13.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/indefinite_integral_example_3-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the double integral (x+y) dydx from 0 to 2 for x and integral from x to x^2 for y with the associated code</em></p>
<h3 id="heading-triple-integrals">Triple Integrals</h3>
<p>To calculate triple integrals, we can use the <code>tplquad</code> function:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> scipy.integrate <span class="hljs-keyword">import</span> tplquad

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">integrand</span>(<span class="hljs-params">z, y, x</span>):</span>
    <span class="hljs-keyword">return</span> z*(x+y+z)

print(tplquad(integrand, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>))
<span class="hljs-comment"># (2.8333333333333335, 3.6983326566167174e-14)</span>
</code></pre>
<p>The function requires us to pass in similar arguments, being the upper and lower limits of integration in <code>x</code>, <code>y</code> and <code>z</code>.</p>
<p>In this example, we calculate that the estimated result of the triple integral of z multiplied by (x+y+z) from x = 0 to x = 1, y = 4 to y = 5, and z = 0 to z = 1 is approximately 2.83 with an absolute error of 3.70e-14:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/definite_integral_example_6-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the triple integral z(x+y+z) dxdydz from 0 to 1 for x, 4 to 5 for y and 0 to 1 for z with the associated code</em></p>
<h2 id="heading-how-to-evaluate-single-variable-indefinite-integrals">How to Evaluate Single Variable Indefinite Integrals</h2>
<p>To calculate single variable indefinite integrals with Python, we need to use the SymPy library. It's used for symbolic computation and involves exact computation using variables. To install it, install the SymPy module:</p>
<pre><code>pip install sympy
</code></pre><p>Once it has been installed, we can import the <code>Symbol</code> and <code>integrate</code> methods from <code>sympy</code>:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sympy <span class="hljs-keyword">import</span> Symbol, integrate
</code></pre>
<p>We first need to define the variables used in the integrand:</p>
<pre><code class="lang-python">x = Symbol(<span class="hljs-string">'x'</span>)
</code></pre>
<p>After that, we can integrate the function using the <code>integrate</code> method that SymPy provides. It expects two arguments: the first is the integrand, and the second is the variable we are integrating with respect to.</p>
<p>For example, if we wanted to integrate x-squared with respect to <code>x</code>, we can define the integrand in Python as <code>x**2</code>:</p>
<pre><code class="lang-python">print(integrate(x**<span class="hljs-number">2</span>, x))
<span class="hljs-comment"># (x**3)/3</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/indefinite_integral_example_1-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the indefinite integral of x^2</em></p>
<p>In this example, we calculate the integral of x-squared which is x-cubed over 3.</p>
<p><strong>Note that SymPy doesn't add the constant of integration, but it is implied.</strong></p>
<p>SymPy also provides other common functions such as <code>sin(x)</code> and <code>exp(x)</code> that we can use.</p>
<p>Before using them, we first need to import it from <code>sympy</code>:</p>
<pre><code class="lang-python"><span class="hljs-keyword">from</span> sympy <span class="hljs-keyword">import</span> Symbol, integrate, sin
</code></pre>
<p>Using the imported <code>sin</code> function, we can then evaluate the integral of <code>sin(x)</code>.</p>
<pre><code class="lang-python">x = Symbol(<span class="hljs-string">'x'</span>)
print(integrate(sin(x), x))
<span class="hljs-comment"># -cos(x)</span>
</code></pre>
<p>In this example, we calculate the integral of sin(x) which is -cos(x):</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/07/indefinite_integral_example_2-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Result of the indefinite integral of sin(x)</em></p>
<p>Sympy provides the full list of mathematical functions you can use <a target="_blank" href="https://docs.sympy.org/latest/modules/functions/elementary.html">in their documentation</a></p>
<h2 id="heading-summary">Summary</h2>
<p>In this tutorial, we went over the basics of how to calculate both definite and indefinite integrals in Python. We also looked at how to calculate integrals of elementary functions, ones that involved common mathematical functions, as well as using constants.</p>
<p>We made use of popular Python libraries for scientific comptutation and went over examples of calculating integrals.</p>
<p>If you enjoy my writing, consider subscribing to <a target="_blank" href="https://www.youtube.com/@turbinethree">my YouTube channel</a>.</p>
<p>Happy Coding!</p>
<p>## </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Exponent in Python – Power Function and Exponents Using a Loop ]]>
                </title>
                <description>
                    <![CDATA[ By Dillion Megida The exponent of a number refers to the power to which that number should be raised. In this article, I'll show you how to find exponents using two ways: the power function and a loop. Exponents are usually written like this: Baseexp... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/python-bytes-to-string-how-to-convert-a-str-to-bytes-and-back-again/</link>
                <guid isPermaLink="false">66d84f4caeb1c87b6855d3f6</guid>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 14 Feb 2023 17:54:02 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/02/21.-exponents.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Dillion Megida</p>
<p>The exponent of a number refers to the power to which that number should be raised. In this article, I'll show you how to find exponents using two ways: the power function and a loop.</p>
<p>Exponents are usually written like this: <strong>Base<sup>exponent</sup></strong></p>
<p>Take an example like <strong>10<sup>3</sup></strong>. This means, "10, raised to the power of 3". The result of this is evaluated as <code>10 * 10 * 10</code> (10 multiplied by itself 3 times), which is <code>1000</code>.</p>
<p>There are different ways you can evaluate the exponent of a number (the number is referred to as the base). One way is using the <code>**</code> operator. With this operator, you have the number, followed by the operator, and then the exponent like this <code>10 ** 3</code> which is 10<sup>3</sup></p>
<p>But in this post, I'll show you two other ways, which are the <code>pow</code> function and using a loop.</p>
<h2 id="heading-exponents-with-the-pow-function">Exponents with the <code>pow</code> function</h2>
<p><code>pow</code> is an in-built function in Python for evaluating a number raised to an exponent. The syntax for this function is:</p>
<pre><code class="lang-python">pow(base, exponent, modulo)
</code></pre>
<p>This function accepts three arguments:</p>
<ul>
<li><code>base</code>: the number which will be raised</li>
<li><code>exponent</code>: the power to which the number will be raised</li>
<li><code>modulo</code>: an optional number that evaluates the remainder when the raised number is divided by it</li>
</ul>
<p>The last argument is optional, but according to the <a target="_blank" href="https://docs.python.org/2/library/functions.html#pow">python documentation on pow</a>, this argument computes more efficiently than <code>pow(base, exponent) % number</code>.</p>
<p>Let's see some examples:</p>
<pre><code class="lang-python">result1 = pow(<span class="hljs-number">100</span>, <span class="hljs-number">3</span>)
print(result1) <span class="hljs-comment"># 1000000</span>

result2 = pow(<span class="hljs-number">5</span>, <span class="hljs-number">4</span>)
print(result2) <span class="hljs-comment"># 625</span>

result3 = pow(<span class="hljs-number">3</span>, <span class="hljs-number">2</span>, <span class="hljs-number">5</span>)
print(result3) <span class="hljs-comment"># 4</span>
</code></pre>
<p>In the last example, we have <code>pow(3, 2, 5)</code>. What happens here is that 3 is first raised to the power of 2, which is 9. Then 9 is divided by 5, and the remainder, which is returned, is <code>4</code>.</p>
<p>Note that there's also a <code>Math.pow</code> function in Python. The difference between this and pow(), is that <code>pow()</code> will only return a float number when the number is a float. It will return an integer if the number is whole. But <code>math.pow()</code> always returns a float number.</p>
<h2 id="heading-exponents-with-a-loop">Exponents with a loop</h2>
<p>You can use any kind of loop to achieve this, but for this post, I'll use a <code>while</code> loop.</p>
<p>The syntax for a <code>while</code> loop is:</p>
<pre><code class="lang-python"><span class="hljs-keyword">while</span> condition:
  <span class="hljs-comment"># code to execute</span>
</code></pre>
<p>For exponents, I can put this loop in a function like this:</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">loopExp</span>(<span class="hljs-params">number, exp</span>):</span>
  result = number
  counter = <span class="hljs-number">1</span>

  <span class="hljs-keyword">while</span> counter &lt; exp:
    result *= number
    counter += <span class="hljs-number">1</span>

  <span class="hljs-keyword">return</span> result
</code></pre>
<p>Here, we defined a <code>loopExp</code> function that takes two inputs: <code>number</code> and <code>exp</code> which stands for exponent.</p>
<p>In the function, we initialize the <code>result</code> and <code>counter</code> variables with the value of <code>number</code> and <code>1</code> respectively. Then we have the <code>while</code> loop which runs as long as the <code>counter</code> variable is less than the <code>exp</code> input.</p>
<p>In each loop, we update the <code>result</code> variable by multiplying the previous value of the <code>result</code> with the <code>number</code> input. We also increment the <code>counter</code> variable by 1. Then we return the <code>result</code> variable.</p>
<p>Let's see this function in use:</p>
<pre><code class="lang-python">result1 = loopExp(<span class="hljs-number">100</span>, <span class="hljs-number">3</span>)
print(result1) <span class="hljs-comment"># 1000000</span>

result2 = loopExp(<span class="hljs-number">5</span>, <span class="hljs-number">4</span>)
print(result2) <span class="hljs-comment"># 625</span>

result3 = loopExp(<span class="hljs-number">3</span>, <span class="hljs-number">2</span>)
print(result3) <span class="hljs-comment"># 9</span>
</code></pre>
<p>As you can see in the results, we have the exponents calculated using the loop in the <code>loopExp</code> function.</p>
<h2 id="heading-wrapping-up">Wrapping up</h2>
<p>In this article, I've shown you how to evaluate exponents in different ways. I used examples to show you the <code>**</code> operator, the <code>pow</code> and <code>Math.pow</code> functions, and also using a loop.</p>
<p>Kindly share this if you find it helpful :) </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Your Linux Terminal as a Calculator – Mathematical Expression Solver ]]>
                </title>
                <description>
                    <![CDATA[ Can you solve the below math expression on your own without using any device? Take as much time as you need – but no tools allowed: ( ( 11 + 97 ) + ( 2 * 63 ) - ( 7 / 93 ) * ( 8 - 25 ) ]]>
                </description>
                <link>https://www.freecodecamp.org/news/solve-your-math-equation-on-terminal/</link>
                <guid isPermaLink="false">66ba10f67282cc17abcf0c6a</guid>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ terminal ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Arunachalam B ]]>
                </dc:creator>
                <pubDate>Thu, 15 Dec 2022 17:40:54 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/12/FreeCodeCamp---Evaluate-expression-on-Terminal.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Can you solve the below math expression on your own without using any device? Take as much time as you need – but no tools allowed:</p>
<pre><code class="lang-bash">( ( 11 + 97 ) + ( 2 * 63 ) - ( 7 / 93 ) * ( 8 - 25 ) / ( 9 * 64 ) ) * ( ( 64 / 34 ) + ( 94 - 20 ) - ( 23 + 98 ) * ( 199 * 928 ) / ( 92 * 26 ) ) * ( ( ( 2 * 1 ) / 2 ) - 1 )
</code></pre>
<p>Kudos to you if you solved it on your own. I'm sure you'll be angry with me, though, after discovering that the result of this long expression just evaluated to zero. </p>
<p>So what if you used your browser to find the answer? How long would that take?</p>
<p>Searching this expression on Google took less than a second to get the answer (using a 500MBPS connection) along with 5,21,00,000 results. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-25.png" alt="Image" width="600" height="400" loading="lazy">
<em>Search results by Google for the given expression</em></p>
<p>Yahoo gave us the answer in less than 500 ms along with 1,480,000,000 search results. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-26.png" alt="Image" width="600" height="400" loading="lazy">
<em>Search results by Yahoo for the given expression</em></p>
<p>Bing didn't even return anything.</p>
<p>But my terminal and system calculator were almost instant in finding the answer (took &lt; 10 ms). </p>
<p>Using the terminal is one of the quickest ways to evaluate a mathematical expression. But many developers are unaware that you can solve mathematical expressions using your terminal. </p>
<p>In this article, you'll learn how to solve math problems in the Linux terminal. </p>
<h2 id="heading-how-to-evaluate-a-mathematical-expression-in-the-linux-terminal">How to Evaluate a Mathematical Expression in the Linux Terminal</h2>
<p>You can use the <code>expr</code> command to evaluate mathematical expression in your terminal. Basic mathematical operations such as addition, subtraction, multiplication, division and modulus all work using the <code>expr</code> command. </p>
<p>Let's have a quick look at each of these operations:</p>
<pre><code class="lang-bash">expr 12 + 8   <span class="hljs-comment"># Addition</span>

expr 20 - 10  <span class="hljs-comment"># Subtraction</span>

expr 5 \* 2   <span class="hljs-comment"># Multiplication</span>

expr 8 \/ 4   <span class="hljs-comment"># Division</span>

expr 5 \% 3   <span class="hljs-comment"># Modulus</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-64.png" alt="Image" width="600" height="400" loading="lazy">
<em>Using the <code>expr</code> terminal command to find answers to arithmetic operations</em></p>
<p>Running each of those commands in the terminal evaluates and returns the answer of that expression (as you can verify in the attached screenshot). </p>
<p>You might be thinking, "Why is there a backward slash () for the last 3 operations (Multiplication, Division, and Modulus)?"</p>
<p>A backward slash in programming is basically used to escape characters. Let's take the example of the Multiplication symbol (<em>). "</em>" is used in regular expressions which basically means to include all files and folders. </p>
<p>Here's a quick example:</p>
<pre><code class="lang-bash">cp ./* ../backup/
</code></pre>
<p>Running the above command will copy all the files and folders in the current directory to the backup directory. </p>
<p>Similarly, each symbol has their own meaning. Using a backward slash () will escape its regular usage pattern. This is the reason that most symbols are prefixed with a backward slash. </p>
<p>But, you may wonder, is this all this command can do? </p>
<p>The answer is no. I've shared a sample of the expressions, but we could use any others and get the results in a fraction of a second. </p>
<h2 id="heading-how-to-evaluate-a-logical-expression-in-the-terminal">How to Evaluate a Logical Expression in the Terminal</h2>
<p>In addition to finding the results of a mathematical expression, you can use this command to evaluate a logical expression. </p>
<p>Logical expressions containing &lt;, &lt;=, &gt;, &gt;=, =, != can be evaluated with this command. </p>
<p>Let's have a quick look at how it works:</p>
<pre><code class="lang-bash">expr 2 \&lt; 1

expr 29320 \&gt; 23820

expr 29320 \&gt;= 29320

expr 29320 \&lt; 29320

expr 29320 \&lt;= 29320

expr 293202 \= 293203

expr 293202 \!= 293203
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-65.png" alt="Image" width="600" height="400" loading="lazy">
<em>Evaluate logical expressions with <code>expr</code> command</em></p>
<p>The command returns "1" if the expression evaluates to true and "0" if it evaluates to false. </p>
<p>From the above commands you can notice that all the logical operators are escaped with a backward slash (). </p>
<h2 id="heading-what-do-the-special-logical-operators-do">What Do the Special Logical Operators Do?</h2>
<p>I read your mind. You're thinking, "I know about logical operators. What are the special logical operators?". </p>
<p>Well, the special logical operators are:</p>
<ul>
<li>AND (&amp;)</li>
<li>OR (|)</li>
</ul>
<p>From a programming perspective, the AND operator evaluates to true if both sides of the operator evaluates to true. The OR operator evaluates to true if either of the sides evaluates to true. </p>
<p>Here's the table for your reference. Some people may be familiar with <code>1</code> and <code>0</code>. For those people, replace FALSE with <code>0</code> and TRUE with <code>1</code>. </p>
<table>
    <tbody><tr>
        <td>X</td>
        <td>Y</td>
        <td>X OR Y</td>
        <td>X AND Y</td>
    </tr>
    <tr>
        <td>FALSE</td>
        <td>FALSE</td>
        <td>FALSE</td>
        <td>FALSE</td>
    </tr>
    <tr>
        <td>FALSE</td>
        <td>TRUE</td>
        <td>TRUE</td>
        <td>FALSE</td>
    </tr>
    <tr>
        <td>TRUE</td>
        <td>FALSE</td>
        <td>TRUE</td>
        <td>FALSE</td>
    </tr>
    <tr>
        <td>TRUE</td>
        <td>TRUE</td>
        <td>TRUE</td>
        <td>TRUE</td>
    </tr>
</tbody></table>

<p>But they have a completely different usage with the <code>expr</code> command. Let's have a quick look at it. </p>
<p>The <code>expr</code> command works similar to the above table. But there's an exception for a particular case. This command will never return <code>1</code> if an expression evaluates to true – instead it returns an argument. </p>
<p>Evaluating <code>expr ARG1 | ARG2</code> returns ARG1 if ARG1 is neither <code>null</code> nor <code>0</code>, otherwise it'll return ARG2. On the other hand, evaluating <code>expr ARG1 &amp; ARG2</code> returns ARG1 if neither of the arguments are <code>null</code> or <code>0</code> . It returns <code>0</code> otherwise. </p>
<p>Let's examine few examples with the logical OR operator:</p>
<pre><code class="lang-bash">expr 1 \| 2     <span class="hljs-comment"># Returns first argument (1)</span>

expr 0 \| 2     <span class="hljs-comment"># Returns second argument (2) as first argument is 0</span>

expr <span class="hljs-string">""</span> \| 2    <span class="hljs-comment"># Returns second argument (2) as first argument is null </span>
                  (Empty string [<span class="hljs-string">""</span>] is considered as null <span class="hljs-keyword">in</span> terminal)

expr 100 \| 78    <span class="hljs-comment"># Returns first argument 100</span>

expr <span class="hljs-string">""</span> \| <span class="hljs-string">""</span>   <span class="hljs-comment"># Returns 0 as both arguments are null ("")</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-68.png" alt="Image" width="600" height="400" loading="lazy">
<em>Evaluating logical OR expressions with <code>expr</code> command</em></p>
<p>The above screenshot represents operations with logical OR operator (|). Reading that you may still have a couple of questions:</p>
<h3 id="heading-whats-the-purpose-of-using-empty-double-quotes-in-the-expression">What's the purpose of using empty double quotes ("") in the expression?</h3>
<p>Empty double quotes represent a <code>null</code> value in bash. So, as said earlier, if the first argument is null, the second argument is returned. </p>
<h3 id="heading-what-if-both-the-arguments-are-null">What if both the arguments are null?</h3>
<p>When evaluating both arguments with null values, both the Logical OR and AND operators return <code>0</code>. </p>
<p>Let's examine a few examples with the logical AND operator:</p>
<pre><code class="lang-bash">expr 1 \&amp; 2     <span class="hljs-comment"># Returns first argument (1)</span>

expr 1 \&amp; 0     <span class="hljs-comment"># Returns 0 as one (second) argument is 0</span>

expr 0 \&amp; 1     <span class="hljs-comment"># Returns 0 as one (first) argument is 0</span>

expr <span class="hljs-string">""</span> \&amp; 1    <span class="hljs-comment"># Returns 0 as one (first) argument is null ("")</span>

expr 1 \&amp; <span class="hljs-string">""</span>    <span class="hljs-comment"># Returns 0 as one (second) argument is null ("")</span>

expr <span class="hljs-string">""</span> \| <span class="hljs-string">""</span>   <span class="hljs-comment"># Returns 0 as both arguments are null ("")</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-69.png" alt="Image" width="600" height="400" loading="lazy">
<em>Evaluating logical AND expressions with <code>expr</code> command</em></p>
<h2 id="heading-how-to-perform-string-operations-with-the-expr-command">How to Perform String Operations with the <code>expr</code> Command</h2>
<p>The <code>expr</code> command is not limited to mathematical and logical operations. It can perform string operations, too. </p>
<h3 id="heading-pattern-matching-with-regex">Pattern Matching with Regex</h3>
<p>The <code>expr</code> command can verify if a text matches with a regex pattern. It returns the matched pattern of the text if it exists or else returns an empty line. </p>
<p>The syntax to verify the regex is:</p>
<pre><code class="lang-bash">expr STRING : REGEXP

or

expr match STRING REGEXP
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-71.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>expr</code> command evaluates regex pattern match with the given text</em></p>
<p>You can achieve this either by using the <code>match</code> keyword or by using a semicolon (<code>:</code>) between the string and the regex pattern. </p>
<p>Alternatively, you can use the semicolon to find the number of characters matching between the two texts. </p>
<p>Here's an example:</p>
<pre><code class="lang-bash">expr Remember : Remo    <span class="hljs-comment"># Returns 0</span>

expr Remember : Rem     <span class="hljs-comment"># Returns 3</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-75.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>expr</code> command to find the number of characters matching the given text</em></p>
<h3 id="heading-find-the-length-of-a-text">Find the length of a text</h3>
<p>You can use the <code>expr length</code> command to find the length of the given text. </p>
<pre><code class="lang-bash">expr length Linux

expr length <span class="hljs-string">"Learning Linux is fun"</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-72.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>expr length</code> command showing the number of characters in the given text</em></p>
<p>You can enter the text directly after the <code>expr length</code> command if it does not have any spaces. If the text has spaces, enclose them within double quotes (""), or else you'll get an error. </p>
<h3 id="heading-find-a-character-in-a-text">Find a character in a text</h3>
<p>You can find a particular character from a given text using the <code>expr index</code> command. It returns the place where the character exists. </p>
<pre><code class="lang-bash">expr index STRING CHAR
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-74.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>expr index</code> to find a character from a text</em></p>
<p>Remember that the <code>expr index</code> command performs a case-sensitive search and returns the first matching index of a character from the text. </p>
<h3 id="heading-extract-a-substring-from-a-string">Extract a substring from a string</h3>
<p>Extracting a substring from a string is simple using <code>expr</code> command. Entering the string, start index, and number of characters to be clipped after the start index will return the expected substring. </p>
<pre><code class="lang-bash">expr substr Carpenter 4 3      <span class="hljs-comment"># Returns pen</span>
</code></pre>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/12/image-76.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>expr substr</code> command to find a substring from a string</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, you have learnt the use cases of the <code>expr</code> command.</p>
<p>If you enjoyed my tutorial, you can subscribe to my newsletter on my <a target="_blank" href="https://5minslearn.gogosoon.com/">personal site</a> to receive more such insightful articles straight to your inbox. You'll also find a consolidated list of all my blog posts. </p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Round to 2 Decimal Places in Python ]]>
                </title>
                <description>
                    <![CDATA[ By Dillion Megida Python provides many math methods for mathematical operations such as square roots, exponents, and so on.  In this article, I will show you how to round up a number to a specified decimal place. What is a Decimal Place? Look at this... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-round-to-2-decimal-places-in-python/</link>
                <guid isPermaLink="false">66d84f17d592ae8435de7164</guid>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 22 Aug 2022 17:17:58 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/round-up-numbers-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Dillion Megida</p>
<p>Python provides many math methods for mathematical operations such as square roots, exponents, and so on. </p>
<p>In this article, I will show you how to round up a number to a specified decimal place.</p>
<h2 id="heading-what-is-a-decimal-place">What is a Decimal Place?</h2>
<p>Look at this number: <strong>324.89</strong>.</p>
<p>Each number here has a position which is refered to as <strong>place value</strong>. The place value of:</p>
<ul>
<li><strong>3</strong> is <strong>hundreds</strong></li>
<li><strong>2</strong> is <strong>tens</strong></li>
<li><strong>4</strong> is <strong>ones</strong></li>
<li><strong>8</strong> is <strong>tenths</strong></li>
<li><strong>9</strong> is <strong>hundredths</strong></li>
</ul>
<p>After the decimal point, you have two numbers: <strong>8</strong>, then <strong>9</strong>. The decimal place of a number is the position of the number after a decimal point (on the right side of it). </p>
<p>This definition means that the decimal place of <strong>8</strong> (in the tenths position) is 1, and <strong>9</strong> (in the hundredths position) is 2.</p>
<h2 id="heading-how-to-round-up-to-a-certain-decimal-place">How to Round Up to a Certain Decimal Place</h2>
<p>What does it mean then to round up to a certain decimal place? It means that you round up a number at a decimal place based on the number after it. </p>
<p>If the number after the decimal place is 5 or more, the number at the decimal place is rounded up <strong>+1</strong>. Otherwise, the number at the decimal place stays the same and the number after the decimal place is rounded down to 0.</p>
<p>For example, let's say we want to round up <strong>24.89</strong> to <strong>1</strong> decimal place. Or you can put it as rounding up <strong>24.89</strong> to the nearest <strong>tenth</strong>.</p>
<p>The number <strong>8</strong> is at the 1 decimal place, and the number after 8 is <strong>9</strong>. Since 9 is more than 5, <strong>24.89</strong>, rounded up to the nearest tenth will be <strong>24.9</strong>.</p>
<p>As another example, let's take <strong>24.82</strong> and round it to 1 decimal place (the nearest tenth). Since <strong>2</strong> is not larger than 5, <strong>8</strong> remains the same, and <strong>2</strong> gets rounded down – resulting in <strong>24.8</strong>. </p>
<h2 id="heading-how-to-round-up-a-decimal-place-in-python">How to Round Up a Decimal Place in Python</h2>
<p>Now that you understand how to round up a decimal place, let's see how to do it in Python.</p>
<p>You can use the global <code>round</code> function to round up numbers to a decimal place. The syntax is:</p>
<pre><code class="lang-python">round(number, decimal_point)
</code></pre>
<p>The function accepts the number and <code>decimal_point</code> as arguments. <code>decimal_point</code> specifies the decimal place that you want to round the number up to. Let's see an example:</p>
<pre><code class="lang-python">num = <span class="hljs-number">24.89</span>

rounded = round(num, <span class="hljs-number">1</span>)
print(rounded)

<span class="hljs-comment"># 24.9</span>
</code></pre>
<p>Here's another example of a longer number:</p>
<pre><code class="lang-python">num = <span class="hljs-number">20.4454</span>

rounded3 = round(num, <span class="hljs-number">3</span>)
<span class="hljs-comment"># to 3 decimal places</span>

rounded2 = round(num, <span class="hljs-number">2</span>)
<span class="hljs-comment"># to 2 decimal places</span>

print(rounded3)
<span class="hljs-comment"># 20.445</span>

print(rounded2)
<span class="hljs-comment"># 20.45</span>
</code></pre>
<p>For <code>rounded3</code>, the <code>num</code> is rounded up to 3 decimal places. At the 3rd decimal place is <strong>5</strong>, and the number that comes after it is <strong>4</strong>. Since 4 is not greater than 5, the number 5 stays the same and 4 is rounded down to 0.</p>
<p>For <code>rounded2</code>, the <code>num</code> is rounded up to 2 decimal places. At the 2nd decimal place is <strong>4</strong>, and the number after it is <strong>5</strong>. Since this number is greater than or equal to 5, the number <strong>4</strong> is rounded up to 5.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Rounding up numbers can be useful for keeping floating numbers within fixed digits. </p>
<p>For example, this is useful with currencies that only accept two decimal places (like the dollar: $100.99). In cases where a calculation for a product results in $50.678, you may want to round it to 2 decimal places, like this: $50.68. This way, it can be easier to give someone the actual monetary value.</p>
<p>In this article, I've briefly explained what decimal places are, and how to round numbers to certain decimal places in Python.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Use Graph Theory to Build a More Sustainable World ]]>
                </title>
                <description>
                    <![CDATA[ Discrete mathematics is an area of math based on the study of formal structures whose nature is fundamentally separate and distinct.  This means it focuses on integers and natural sets of numbers, shapes, and other objects that you can count finitely... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-value-of-graph-theory-within-sustainability/</link>
                <guid isPermaLink="false">66baef4fd453cb5eb7951596</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ algorithms ]]>
                    </category>
                
                    <category>
                        <![CDATA[ graph theory ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ sustainability ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Daniel García Solla ]]>
                </dc:creator>
                <pubDate>Fri, 19 Aug 2022 20:50:13 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/graph-theory-image.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Discrete mathematics is an area of math based on the study of formal structures whose nature is fundamentally separate and distinct. </p>
<p>This means it focuses on integers and natural sets of numbers, shapes, and other objects that you can count <strong>finitely</strong> or distinguish from one another. It models reality in a manner specifically suited to certain real-world applications. </p>
<p>From industry and logistics to computer science and telecommunications, having a quantized representation of everything around us has led to magnificent advances in our understanding and control of the physical world.</p>
<p>It's important to have at least a rough idea of the main distinctions between discreteness and continuity to address <strong>graph theory</strong>. But these aren't very well-known concepts to people outside the world of mathematics.</p>
<p>At first, continuous math is the one predominantly taught in the education system due to its versatility, usefulness, and practicality in most areas. </p>
<p>It’s based on the analysis of real numbers and functions that encapsulate mappings between these quantities, along with the notion of the infinitesimal change of a variable. This results in a series of tools like limits or derivatives that constitute <strong>calculus<em>.</em></strong> </p>
<p>On the other hand, the discrete paradigm is more straightforward and intuitive, with the exception of a few cases. And its finiteness is given by the primordial element constituting it – <a target="_blank" href="https://www.mathsisfun.com/sets/sets-introduction.html"><strong>sets</strong></a><strong><em>.</em></strong> </p>
<p>Among the most notorious use areas are those whose main components imply algorithms and data structures. Although the use cases of math are not what most people think they are. </p>
<p>In the real world, we don’t often face problems in the same way as in the education system. Indeed, discrete ways of approaching riddles and modeling the input data we need to come up with a solution are more usual than continuous ones, especially regarding system optimization issues.</p>
<p>For this reason, we should reconsider the role of this way of doing mathematics since it involves the development of <strong>critical/</strong><a target="_blank" href="https://en.wikipedia.org/wiki/Computational_thinking"><strong>computational thinking</strong></a>. This is crucial for the current era in which we are surrounded by technology. It also involves the improvement of problem-solving skills, making it possible for us to face any new challenges. </p>
<p>By doing so, we can see how relevant it is to apply a solid mathematical foundation to common global threats that are increasing daily, like misinformation, lack of fluency in handling technology, geopolitical instability, and even climate change.</p>
<p>Notwithstanding the apparent remoteness between the latter issue and graph theory itself, we should think about the way we live and the system by which our civilization is maintained as we know it.</p>
<h2 id="heading-goals-of-this-article">Goals of this Article</h2>
<p>This article aims to explain graph theory, one of the most significant components of all discrete mathematics, in an intuitive, simple, and visual way. I'll also try to guide its use towards the development of new disruptive techniques applicable in areas such as <strong>environmental</strong> care, necessary to preserve and <strong>regenerate</strong> our nature. </p>
<p>Effectively achieving this will not only foster curiosity or inspire readers who may intend to continue learning, but will also contribute to a further rising in society’s awareness about sustainability issues. This will increase the likelihood that in the future, the problems that scientists predict to be threatening to our existence and the existence of life on the planet will be curbed, thanks to scientific knowledge and specifically the contribution of graph theory.</p>
<p>Still, given its broad scope, it will be impossible to explain graph theory entirely in this article. So, I'll focus on the visual side of any explanation over the formal one since you can easily consult that in any textbook. That will also provide a different point of view from certain definitions. </p>
<p>Also, it's essential that we treat the idea of a graph as comprehensively as possible. We'll focus on its history, representation, and most descriptive properties instead of advanced concepts like singular cycles. This will help you grasp the kernel of graph theory and prepare you to learn these advanced concepts more easily.</p>
<h3 id="heading-heres-what-well-cover">Here's what we'll cover:</h3>
<ol>
<li><a class="post-section-overview" href="#heading-basic-elements-of-graph-theory">Basic Elements of Graph Theory</a></li>
<li><a class="post-section-overview" href="#heading-history-of-graph-theory">History of Graph Theory</a></li>
<li><a class="post-section-overview" href="#heading-definition-of-a-graph">Definition of a Graph</a></li>
<li><a class="post-section-overview" href="#heading-representations-of-graphs">Representations of Graphs</a></li>
<li><a class="post-section-overview" href="#heading-properties-of-graphs">Properties of Graphs</a></li>
<li><a class="post-section-overview" href="#heading-algorithms-and-graph-theory">Algorithms and Graph Theory</a></li>
<li><a class="post-section-overview" href="#heading-why-are-graphs-important-in-achieving-sustainability">Why Are Graphs Important in Achieving Sustainability?</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ol>
<h2 id="heading-basic-elements-of-graph-theory">Basic Elements of Graph Theory</h2>
<p>Whether you are new to Graph Theory or already know something about it, reviewing the basics is always worthwhile. </p>
<p>First, let’s introduce the idea of a <em>“graph”</em> with a usual representation you may have seen:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-90.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of an arbitrary graph</em></p>
<p>Above, you have a graph where we can see, at the most fundamental level, two different building blocks: vertices (shown as circles) and edges (shown as lines connecting circles). </p>
<p>You can create a structure with those elements that can encapsulate the functioning of many systems present in our life that we don’t even realize. </p>
<p>But, most surprising of all is that graph theory as a whole is derived from such a simple concept as <strong>objects linked to each other.</strong></p>
<h2 id="heading-history-of-graph-theory">History of Graph Theory</h2>
<p>To understand the origin of this idea, we have to look back to the 18th century, when <a target="_blank" href="https://en.wikipedia.org/wiki/Leonhard_Euler"><strong>Leonhard Euler</strong></a> solved the famous <a target="_blank" href="https://mathworld.wolfram.com/KoenigsbergBridgeProblem.html#:~:text=The%20K%C3%B6nigsberg%20bridge%20problem%20asks,that%20the%20trip%20ends%20in"><strong>Seven Bridges of Königsberg</strong></a> problem<em>.</em> </p>
<p>By that time, the city was crossed by the Pregel river, generating four pieces of land interconnected with seven bridges, as seen below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-91.png" alt="Image" width="600" height="400" loading="lazy">
_Image extracted from [<strong>here</strong>](https://en.wikipedia.org/wiki/File:Konigsberg<em>bridges.png" rel="noopener)</em></p>
<p>The task consisted of finding a path that crosses all bridges without passing by the same bridge twice, starting and ending at the same point. </p>
<p>At first, with so few bridges, it may be easy to find a brute force solution by trying combinations of paths. But, since we don’t know if a feasible solution exists, it’s helpful to formalize the problem elements and correctly prove its solvability before starting any process. </p>
<p>Also, if the number of bridges increases, it will become much more complex to solve, as the combinations increase remarkably fast.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-92.png" alt="Image" width="600" height="400" loading="lazy">
<em>Königsberg problem displayed as a graph</em></p>
<p>As seen above, Euler represented land areas with graph vertices (also called nodes) and bridges with edges, concluding that it was impossible to have such a traversal through the graph. </p>
<p>Briefly, if we look at the number of edges incident to each vertex, we will see that every value is odd for every node, meaning that the graph does not have an eulerian cycle. This means that it’s not an eulerian graph, and we can’t positively prove the problem. </p>
<p>Nevertheless, this approach represented a breakthrough in the mathematical conception of various questions that were yet unsolvable. Euler’s contributions to the elaboration of this theory, which has been perfected and broadened over the years, made him one of the most influential mathematicians of his time.</p>
<h2 id="heading-definition-of-a-graph">Definition of a Graph</h2>
<p>Now that you know what a graph looks like drawn on a diagram, let’s review the official formal definition:</p>
<blockquote>
<p>A graph <strong>G</strong> is a pair of sets <strong>(V, E)</strong> where <strong>V</strong> is a non-zero set containing the graph’s vertices and <strong>E</strong> is a set made of element pairs belonging to <strong>V.</strong></p>
</blockquote>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-93.png" alt="Image" width="600" height="400" loading="lazy">
<em>Formal definition of a graph with its corresponding sets</em></p>
<p>Above, we represented the two main components of a graph in two corresponding sets, one for vertices <strong>V</strong> and another for edges <strong>E</strong>. So, our graph <strong>G</strong> is ultimately an ordered pair of these sets. But before we continue, we must look inside those sets to see what they look like and understand why.</p>
<p>On the one hand, <strong>V</strong> is a collection of items <strong>v</strong> in which each element contains the necessary data to define a vertex. Abstractly they are called with the letter <strong>v</strong> and a numerical subindex. </p>
<p>But in practice, they can be complex objects holding parameters, profiles, and so on. </p>
<p>On the other hand, the set of edges <strong>E</strong> is a little more complicated to define since it needs to determine the connections between vertices. In this case, the elements are unordered pairs of vertices from set <strong>V</strong> such that each pair is of the form <strong>{x, y}</strong>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-94.png" alt="Image" width="600" height="400" loading="lazy">
<em>Both formal and graphical representations of a graph</em></p>
<p>To familiarize yourself with these structures above, you have an arbitrary, fully defined graph with its respective sets. In <strong>V,</strong> you can see all the vertices numbered from 1 to 5 and placed in the upper diagram in a specific distribution, but you can arrange them according to your needs. </p>
<p>Meanwhile, in <strong>E,</strong> you can observe all the edges (lines) establishing an interconnection link between vertices. </p>
<p>The appropriate terminology to address this link is the following: for instance, if we have the edge {v1, v4}, we call it <strong>incident</strong> to v1 and v4. Also, those vertices are denoted to be <strong>adjacent</strong> since an edge links them.</p>
<p>As you may notice, there isn’t an edge {v4, v1} in <strong>E</strong>. But to find an explanation for this phenomenon, we have to introduce the main distinction that generates two classes of graphs. </p>
<p>The first one <strong>(undirected)</strong>, to which the above examples belong, includes all graphs whose edges can be traversed in both directions. This makes them <strong>unordered</strong> pairs of vertices. </p>
<p>On the other hand, we can have a graph in which all its edges can only be traversed in one direction, that is, from one vertex to another exclusively. Thus, its vertex pairs on <strong>E</strong> set must be <strong>ordered,</strong> meaning that going from v1 to v4 is not the same as going from v4 to v1. This second class is known as a <strong>directed graph.</strong></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-95.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a directed graph.</em></p>
<p>Before learning how to represent a graph computationally to perform operations on it, you need to understand the vertex <strong>degree</strong> concept. </p>
<p>In undirected graphs, the degree of a vertex refers to the number of edges incident to it, considering that self-connecting edges (loops) count as 2 in the total score. </p>
<p>By contrast, in directed graphs, we have <strong>in-degree</strong> and <strong>out-degree</strong> values for each vertex, representing the number of incoming and outcoming edges, respectively.</p>
<h2 id="heading-representations-of-graphs">Representations of Graphs</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Dc_opxjAdBqAmnbX1VLd9g.png" alt="Image" width="600" height="400" loading="lazy">
<em>The 2 most popular ways to computationally store a graph</em></p>
<p>Sometimes, the most intuitive solution for a problem is not always the most efficient in computer science. In this context, it generates different ways of representing a graph according to a problem’s nature.</p>
<h3 id="heading-what-is-an-adjacency-matrix">What is an Adjacency Matrix?</h3>
<p>An adjacency matrix is one of the most popular methods to store a graph on a computer. But its major drawback is unused memory consumption. </p>
<p>For <strong>directed</strong> graphs like the one above, there is a matrix size <strong>|V|x|V|</strong> (being |V| the cardinality of the vertices set, thus the number of vertices on the graph) where each element can be a 0 if there is no connection between vertices or a 1 if the row element links the column one by an outgoing edge. Also, if the graph is <a target="_blank" href="https://www.baeldung.com/cs/weighted-vs-unweighted-graphs"><strong>weighted</strong></a>, the 1 value is substituted with the <strong>weight</strong> parameter associated with each edge when necessary.</p>
<p>However, if the graph is <strong>undirected<em>,</em></strong> the same criteria apply with the difference that no distinction is made between outgoing and incoming edges this time. So there will be a 1 value if an edge exists between the row and column elements.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-96.png" alt="Image" width="600" height="400" loading="lazy">
<em>Adjacency matrix element definition for each type of graph.</em></p>
<h3 id="heading-what-is-an-incidence-matrix">What is an Incidence Matrix?</h3>
<p>Similar to the previous method, there is a matrix size <strong>|V|x|E|</strong> in which the same rules are fulfilled. The difference is that if an edge <strong>e</strong> is incoming to a vertex <strong>v</strong>, the corresponding element will be a -1 instead of 0.</p>
<h3 id="heading-how-to-use-adjacency-lists">How to Use Adjacency Lists</h3>
<p>When using matrices, if the graph has many vertices but few edges <strong>(a sparse graph),</strong> the matrix will contain a high number of zeroes. This wastes a lot of memory and makes the representation inefficient in terms of space.</p>
<p>To solve this issue, <strong>adjacency lists</strong> appeared as an alternative replacing matrices with a combination of different data structures – arrays, and linked lists. </p>
<p>The kernel of this method is an array containing all the graph’s nodes. Each array element will have a linked list holding each leading node’s neighbor vertices (adjacent vertices). In the case of directed graphs, only the neighbor elements connected by an outgoing edge from the lead node will be inside the linked list.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-97.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a graph depicted as an adjacency list</em></p>
<p>So if we have a <strong>dense</strong> graph with a high number of edges, we should store it in <strong>matrix</strong> form. This has the advantage of O(1) time complexity when checking vertex connection and matrix symmetry along the main diagonal in undirected graphs. </p>
<p>But, if our graph is <strong>sparse,</strong> the low density of edges make an <strong>adjacency list</strong> the best choice to depict it computationally.</p>
<h2 id="heading-properties-of-graphs">Properties of Graphs</h2>
<p>Like any other mathematical object, graphs have specific properties that make them unique and functional for their purposes. Some have to do with their composition, others with topology, and even accessibility. </p>
<p>Undoubtedly, the most relevant properties concern traversals, since they allow us to model and optimize real-world scenarios.</p>
<h3 id="heading-what-is-a-graph-traversal">What is a graph traversal?</h3>
<p>First, we need a starting node v1 and an ending node v2 to traverse a graph. Then, we can define a <strong>walk</strong> from v1 to v2 as an alternate sequence of vertices and edges. There, we can go through these elements as much as we need, and there is always an edge after a vertex (except the last one). </p>
<p>In the case of v1 being equal to v2, the walk would be <strong>closed</strong>.</p>
<p>Still, we can add repetition restrictions. So if we want a walk in which no edge is repeated, it’s renamed as <strong>“trail”</strong>. Consequently, if the trail is closed, it would be denoted as <strong>“circuit”</strong>. </p>
<p>The same happens if we restrict vertex repetition – the walk renames to <strong>“path,”</strong> and a closed path is known as a <strong>“cycle”.</strong></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-98.png" alt="Image" width="600" height="400" loading="lazy">
<em>Formal and graphical examples of network traversal types.</em></p>
<p><img src="https://cdn-images-1.medium.com/max/800/1*jqQrm3fY_X5CEhCkbloQmw.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>This traversing ability comes along with an interesting property valid for all existing undirected/directed graphs. It’s formalized as follows:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Dc_opxjAdBqAmnbX1VLd9g-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Formalization of the degree sum property.</em></p>
<p>This establishes that the sum of all vertex degrees equals two times the cardinality of the edge set in an undirected graph. If directed, the sum breaks into two terms, each referring to each node in and out-degree. </p>
<p>This is fairly straightforward to prove, because every time you add an edge to a graph, you need two vertices to build the pair of elements stored on <strong>E.</strong> So if you add a loop (edge linking a node with itself), you anyways need to define a pair of elements from <strong>V,</strong> regardless of whether they are the same. </p>
<p>This characteristic supports us when solving questions like:</p>
<blockquote>
<p>Given a 6-<strong>regular</strong> graph (with all its vertex degrees set to 6) <em>of</em> <strong>n</strong> vertices, how many edges will it have?</p>
</blockquote>
<p>As its resolution is immediate, going deeper when thinking about similar questions improves your understanding of its nature and why it's that way.</p>
<h3 id="heading-what-is-connectivity">What is Connectivity?</h3>
<p>Now, let’s move on to the properties related to the graph’s linking capability. Starting with an undirected graph, we can assure that a vertex <strong>v</strong> reaches <strong>u</strong> if there's a path from <strong>v</strong> to <strong>u</strong>. Also, we can look at the whole graph and define it as <strong>connected</strong> if every pair of vertices in it is indeed connected.</p>
<p>Being connected is often associated with the uniqueness of its components. That is, if we end up with a <strong>disconnected</strong> graph, its number of components will always be greater than 1. </p>
<p>You can imagine a component as a zone of the graph isolated and disconnected from the rest of the vertices. And this, if we consider a graph, will be connected and will only have one connected component as if it were a connected graph.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-99.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a 2 component made graph.</em></p>
<p>In contrast, when dealing with <strong>directed</strong> graphs, two vertices <strong>u</strong> and <strong>v</strong> are said to be <strong>strongly</strong> connected if they can reach each other and <strong>weakly</strong> connected if they are connected on the <strong>underlying</strong> (all edges replaced by undirected ones) graph.</p>
<p>As you can imagine, these properties generate many possibilities and new characteristics to consider. </p>
<p>To briefly mention, we can take advantage of the discrete nature of graphs to remove nodes and edges from them. Therefore, concepts such as articulation points or bridges emerge as one of the simplest ways to study a graph’s weak points.</p>
<p>An <strong>articulation point</strong> is a vertex that, if we remove from the graph together with all its incident edges, the graph will increase its connected components. </p>
<p>Likewise, a <strong>bridge</strong> is just an edge meeting the same previous condition with the difference that no vertex is removed from the graph.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-100.png" alt="Image" width="600" height="400" loading="lazy">
<em>Visual example of an articulation point and a bridge.</em></p>
<p>As an extension to the properties section, it’s worth mentioning some tools and characteristics of graphs that will help us recognize the key of the algorithms we will see later:</p>
<h3 id="heading-what-are-subgraphs">What are Subgraphs?</h3>
<p>Their name is an appropriate indicator of what subgraphs are, since it is quite illustrative. A <strong>subgraph</strong> is a collection of vertices and edges that we can extract from an arbitrary graph <strong>G</strong> to form another graph, usually undersized. </p>
<p>Formally, a graph <strong>H</strong> is a subgraph of <strong>G</strong> if it’s formed by a subset of vertices of <strong>G</strong> and similarly a subset of edges of <strong>G,</strong> with every edge being a valid pair of nodes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-101.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a subgraph validity</em></p>
<p>The number of classifications and research we can perform about subgraphs makes it impossible to cover everything here. But the basis for further learning we'll start with the following ideas about its morphology, topology, and composition.</p>
<p>A subgraph <strong>H</strong> spans a graph <strong>G</strong> if both have the same vertices stored on <strong>V</strong> set. In this situation, subgraph <strong>H</strong> is known as a <a target="_blank" href="https://youtu.be/Kh9LiX2farU"><strong>spanning subgraph</strong></a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-102.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a spanning subgraph.</em></p>
<p>Given a graph <strong>G,</strong> if we apply the vertex removal operation n times with n&lt;|V|, the resulting graph will be an <a target="_blank" href="https://youtu.be/1HXbz09Bipw"><strong>induced graph</strong></a><strong>.</strong></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-103.png" alt="Image" width="600" height="400" loading="lazy">
<em>Steps taken to reach an induced graph.</em></p>
<p>Topology doesn't just concern subgraphs. It's also mainly studied with general graphs. So reviewing some broad classifications and features will make graph theory more manageable.</p>
<p>A graph is said to be <strong>complete</strong> if it’s undirected, has no loops, and every pair of distinct nodes is connected with only one edge. Also, we can have an <strong>n-complete</strong> graph <strong>Kn</strong> depending on the number of vertices.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-104.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of the first 5 complete graphs.</em></p>
<p>We should also talk about the area of graph coloring. A graph is <strong>bipartite</strong> when its nodes can be divided into two <a target="_blank" href="https://en.wikipedia.org/wiki/Disjoint_sets"><strong>disjoint sets</strong></a> whose union results in the whole initial vertex set, with the condition that every edge has its extremes on both sets simultaneously. This allows for the possibility of coloring each vertex set with a different color. </p>
<p>Also, it can be a <a target="_blank" href="https://youtu.be/VvCytJvd4H0"><strong>complete-bipartite</strong></a> graph if both sets are densely connected (every vertex of one set is connected with all vertices of the other collection).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-105.png" alt="Image" width="600" height="400" loading="lazy">
<em>Some examples of arbitrary complete-bipartite graphs.</em></p>
<p>You might also need to represent a graph in a plane without any of its edges <strong>intersecting</strong>. Then, if possible, the graph will be <strong>planar</strong>. To better understand the state of this characteristic, we can use <a target="_blank" href="https://en.wikipedia.org/wiki/Kuratowski%27s_theorem"><strong>Kuratowski’s theorem</strong></a>. It involves advanced concepts like <a target="_blank" href="https://youtu.be/z-GfKbzvtBA"><strong>isomorphism</strong></a> and <a target="_blank" href="https://youtu.be/RatkBWHUSqo"><strong>homomorphism</strong></a> concerning k5 complete and k3,3 complete bipartite graphs.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-106.png" alt="Image" width="600" height="400" loading="lazy">
<em>Visual difference between planar and non-planar graphs.</em></p>
<h3 id="heading-what-are-particular-cycles">What are Particular Cycles?</h3>
<p>Finally, some graph features deserve special attention. For example, when it’s a matter of cycle finding, there's a deep relationship with vertex degrees, integral graph topology, and traversability. </p>
<p>To visualize this relationship, we'll return to the <strong>Königsberg</strong> problem. In it, we need to traverse all the graph’s edges without repeating any of them, starting and finishing in the same vertex.</p>
<p>Since graphs were new then, Euler developed a solution by defining a unique type of cycle only found in graphs meeting precise conditions – like the degree of all their nodes being even. </p>
<p>These cycles were named <strong>Eulerian</strong> after their creator, and every graph that has one is also called an <strong>Eulerian graph</strong>. </p>
<p>There are also <strong>Eulerian Paths</strong>. These remove the condition of having to start and end on the same vertex and require the graph to have exactly two odd-degree nodes, which will be the path extremes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Bg0mEKTsoZXGZwcD-F3_HQ.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Visualization of an eulerian path.</em></p>
<p>Also, suppose we focus on contemporary issues like the traveling salesman problem (<a target="_blank" href="https://en.wikipedia.org/wiki/Travelling_salesman_problem"><strong>TSP</strong></a>), an <strong>NP-Hard</strong> problem mainly used by delivery and logistic companies. </p>
<p>In that case, we will realize the relevance of the <strong>hamiltonian cycles</strong> and paths to support practical solutions to similar questions. Similar to the eulerianity, a graph is <strong>Hamiltonian</strong> if it contains a cycle in which every vertex is used instead of edges.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Bg0mEKTsoZXGZwcD-F3_HQ-1.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Visualization of a hamiltonian cycle.</em></p>
<p>These latter properties become challenging to deal with, given the complexity of the problems involved. Although, knowing the critical foundation supporting everything around them allows us to continue exploring with reasonable confidence.</p>
<h2 id="heading-algorithms-and-graph-theory">Algorithms and Graph Theory</h2>
<p>Once you have a solid grasp of graph theory, its elements, attributes, and tools, we should also review some basic algorithms comprising the principles of almost all other graph processes. Then we can move on to graph theory's use in climate preservation projects.</p>
<h3 id="heading-breadth-first-search-algorithm">Breadth-first search algorithm</h3>
<p>Here, we will only consider 3 algorithms since there are many types and very specialized ones for determined tasks.</p>
<p>To start with something simple and intuitive, we will unscramble <a target="_blank" href="https://youtu.be/oDqjPvD54Ss"><strong>Breadth-First Search</strong></a>. It's a graph traversal algorithm used to go through a graph in a breadthward motion. </p>
<p>In simple terms, it starts at an arbitrary vertex and iteratively visits its adjacent vertices, repeating this step until there are no more unvisited ones. </p>
<p>This behavior serves as the shortest path finder across all graph nodes, although you can stop the execution when a particular vertex is visited.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Bg0mEKTsoZXGZwcD-F3_HQ-2.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Representation of breadth-first search algorithm</em></p>
<h3 id="heading-depth-first-search-algorithm">Depth-first search algorithm</h3>
<p>The second algorithm is a variant of the previous one, known as <a target="_blank" href="https://youtu.be/7fujbpJ0LB4"><strong>Depth First Search</strong></a><strong>.</strong> Its goal is similar but is also useful when detecting cycles, connected components, <a target="_blank" href="https://youtu.be/eL-KzMXSXXI"><strong>topological sorting</strong></a>, or checking for graph bipartitions. </p>
<p>But the way it works differs in some aspects, like the precedence of the <strong>depth</strong> over <strong>breadth</strong> – that is, not all neighboring nodes are visited in each step. Instead, one of them is chosen for further <strong>deepening</strong>, and the process is repeated until the path reaches a dead end and recursively goes back to the starting node, visiting every vertex.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/1_Bg0mEKTsoZXGZwcD-F3_HQ-3.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Representation of depth-first search algorithm</em></p>
<h3 id="heading-dijkstras-shortest-path-algorithm">Dijkstra's Shortest-Path algorithm</h3>
<p>Finally, the last one we will treat is <a target="_blank" href="https://youtu.be/pSqmAO-m7Lk"><strong>Dijkstra’s algorithm</strong></a>, the most widespread <strong>Single Source Shortest Path</strong> problem solver ever created. </p>
<p>It’s designed to operate in weighted graphs with non-negative weights, and tries to find the most efficient route between 2 selected nodes. </p>
<p>Compared to the previous algorithms, that change increases the number of steps before completion. However, the key idea behind it is straightforward:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-108.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example Graph used to explain Dijkstra's algorithm</em></p>
<p>As you can see in the above example, if we want to go from v1 to v2, we can select the edge between them and arrive at our destination after traversing six distance units. </p>
<p>On the other hand, if we choose to go through the v3 or v4 paths, we would be walking seven units. So we need to make a <strong>decision</strong> on whether or not to take a particular path.</p>
<p>On large graphs, the algorithm calculates the provisional shortest paths along every single node. It then updates these values and minimizes “distance” (given by weights) by a complete graph traversal, as you can see in <a target="_blank" href="https://youtu.be/EFg3u_E6eHU"><strong>this</strong></a> animation.</p>
<h2 id="heading-why-are-graphs-important-in-achieving-sustainability">Why Are Graphs Important in Achieving Sustainability?</h2>
<p>At this point, you may realize that Graph Theory is valuable because it can encapsulate and abstractly model problems of a nuanced nature. Especially those problems whose origin stems from society’s need to pursue a degree of globalization that brings a standard of wellness to everyone’s lives. </p>
<p>Yet many of us are unaware that the comfort we currently enjoy brought about by advances in communications, transport, nutrition, and entertainment requires the coordinated operation of complex systems to be in place. </p>
<p>So the overpopulation experienced since the twentieth century causes these systems to be so massive that they entail a severe environmental impact based on CO2 emissions and the systematic dumping of waste into natural environments.</p>
<h3 id="heading-graphs-can-help-with-transportation-of-goods">Graphs can help with transportation of goods</h3>
<p>In this context, everything involving the transport of goods and logistics contributes a significant amount of CO2 to the atmosphere. Here is where using graphs has a clear benefit for the environment. They can find optimal paths between cities or world locations, reducing the emissions of the vehicles engaged in such transport. </p>
<p>For example, you can experiment with Google Maps by tracing routes between distant places. You will notice it can automatically choose an appropriate route, minimizing the corresponding environmental cost. </p>
<p>Google Maps is working is based on <a target="_blank" href="https://en.wikipedia.org/wiki/Parallel_single-source_shortest_path_algorithm"><strong>Single Source Shortest Path</strong></a> algorithms like Dijkstra or advanced ones such as <a target="_blank" href="https://youtu.be/ySN5Wnu88nE"><strong>A-star</strong></a>. A-star is a heuristic variant of Dijkstra. These are used in combination with other state-of-the-art graph mechanics used to add certain constraints to algorithms. </p>
<h3 id="heading-graphs-can-help-with-waste-management">Graphs can help with waste management</h3>
<p>Graphs also have a place in the global industry by simulating or directly managing <a target="_blank" href="https://youtu.be/LdOnanfc5TM"><strong>networks</strong></a><strong>,</strong> manufacturing processes, and schedules. They can potentially reduce the amount of incorrectly handled/wasted energy and resources.</p>
<p>It’s also worth mentioning the numerous possibilities that graphs have to offer when we deal with the problem of excessive waste accumulation. </p>
<p>Nowadays, it's widely believed that plants and trees are the major contributors to oxygen in our atmosphere thanks to photosynthesis. But we have to account that between 50% and 85% of the oxygen released into the atmosphere each year is produced <a target="_blank" href="https://www.nationalgeographic.com.es/naturaleza/verdadero-pulmon-planeta-esta-oceanos_14776#:~:text=El%20fitoplancton%20presente%20en%20los%20oc%C3%A9anos%20%28y%20no%20los%20bosques%2C%20como%20se%20cree%20habitualmente%29%20producen%20entre%20el%2050%25%20y%20el%2085%20%25%20del%20ox%C3%ADgeno%20que%20se%20libera%20cada%20a%C3%B1o%20a%20la%20atm%C3%B3sfera."><strong>under the sea</strong></a>. </p>
<p>Ironically, data on waste thrown into the ocean are constantly increasing as the consumer society advances on time, causing a dramatic impact on the actual lungs of our planet, as well as on the animal species it shelters. </p>
<p>To avoid having to decide where to dump our garbage, we can use graph theory to generate simulations of molecular physical systems, atomic structures, and chemical reactions to develop new recyclable or biodegradable materials. These would reduce the environmental impact of the products we use. </p>
<p>Also, these simulations have the potential to be useful in biology, where deciphering the ultimate workings of <strong>DNA</strong> can lead to better food quality, as well as more efficient mass-production methods.</p>
<h3 id="heading-graphs-can-help-with-machine-learning-and-ai">Graphs can help with machine learning and AI</h3>
<p>Finally, the most well-known application of graphs is in the field of <strong>machine learning</strong>. </p>
<p>Despite all the other significant uses for graphs in computer science (like communication networks, distributed systems, or data structures), machine learning has shown us with its exponential evolution over the last decade that it is a highly promising technology when tackling climate change. </p>
<p>Simply put, <strong>machine learning</strong> is a subset of <strong>artificial intelligence</strong> that focuses on enabling machines to learn and detect patterns on large datasets. Sometimes, this learning is inspired by natural phenomena like synapses on human neurons, resulting in new techniques such as <a target="_blank" href="https://en.wikipedia.org/wiki/Artificial_neural_network"><strong>Artificial Neural Networks</strong></a><strong>.</strong> </p>
<p>Regarding environmental care, the ability of these techniques to analyze large amounts of data makes it possible to measure our effect on the planet better. </p>
<p>As a real working example, <a target="_blank" href="https://joinus4theplanet.org/"><strong>Joinus4theplanet</strong></a> is an initiative focused on taking advantage of social media to raise awareness about the value of sustainability. It has developed a machine learning system able to perform waste sorting with the help of <a target="_blank" href="https://youtu.be/YRhxdVk_sIs"><strong>convolutional models</strong></a> designed to process multidimensional data in order to palliate the effects of incorrect recycling.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-109.png" alt="Image" width="600" height="400" loading="lazy">
<em>Example of a social network is represented as a graph. Image from [<strong>Wikipedia.</strong>](https://en.wikipedia.org/wiki/File:SocialNetworkAnalysis.png" rel="noopener ugc nofollow)</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>If we want to maintain a considerable amount of progress inside our civilizations and provide a thriving future for the next generations, we have to consider graphs as an essential tool when rethinking the way our technological and economic systems work.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Calculate Percentage in Excel – Formula for Percentages ]]>
                </title>
                <description>
                    <![CDATA[ A percentage is a kind of fraction saying how many parts over 100 something is. In this article you will see in detail what a percentage is, and how to calculate a percentage in Excel. First, before diving into how it works in Excel, let's take a loo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-calculate-percentage-in-excel-formula-for-percentages/</link>
                <guid isPermaLink="false">66b0c38ebb3f390180bed0d5</guid>
                
                    <category>
                        <![CDATA[ excel ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ MathJax ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ilenia Magoni ]]>
                </dc:creator>
                <pubDate>Thu, 18 Aug 2022 17:44:39 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/victoria-strukovskaya-OhL_qEqpef4-unsplash-1.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>A percentage is a kind of fraction saying how many parts over 100 something is. In this article you will see in detail what a percentage is, and how to calculate a percentage in Excel.</p>
<p>First, before diving into how it works in Excel, let's take a look at the math.</p>
<p>If you want to jump directly to the Excel part, and avoid the math part, please proceed to the section <a class="post-section-overview" href="#heading-how-to-work-with-percentages-in-excel">How to work with percentages in Excel</a>.</p>
<h2 id="heading-what-is-the-formula-for-calculating-a-percentage">What is the Formula for Calculating a Percentage?</h2>
<p>Percentages from 0% to 100% are equivalent to decimal values from 0 to 1. That means you can convert from a percentage to a decimal number. Let's see how.</p>
<h3 id="heading-how-to-convert-from-decimal-number-to-percentage">How to Convert from Decimal Number to Percentage</h3>
<p>You can convert from a decimal number to a percentage in the following way:</p>
<ul>
<li>take the decimal number, (d),</li>
<li>multiply it by (100),</li>
<li>and then add the percentage (\%) symbol,</li>
</ul>
<p>In short, if you want to get a percentage from a number (d) you can do this:</p>
<p>$$ ( d \cdot 100 ) \% $$</p><h3 id="heading-how-to-convert-from-a-percentage-to-a-decimal-number">How to Convert from a Percentage to a Decimal Number</h3>
<p>If you want to convert from a percentage to a number, you can:</p>
<ul>
<li>take the percentage (P\%),</li>
<li>remove the percentage symbol, (P)</li>
<li>then divide the number by (100): (\frac{P}{100})</li>
</ul>
<p>In short, to convert a percentage (P\%) to a decimal number:</p>
<p>$$ \frac{P\xcancel{\%}}{100} $$</p><h3 id="heading-how-to-calculate-the-percentage-of-a-number">How to Calculate the Percentage of a Number</h3>
<p>There are three cases in which you might want to calculate the percentage of a number:</p>
<ul>
<li>to add a percentage to the number (like for calculating how much you have to pay including VAT)</li>
<li>to just get the percentage of the number</li>
<li>to subtract a percentage from the number (like for a sale)</li>
</ul>
<h4 id="heading-how-to-add-a-percentage-to-a-number">How to add a percentage to a number</h4>
<p>Let's first use a specific case, and then let's generalise.</p>
<p>You went shopping, and the total you need to pay is $185 + VAT. Let's say VAT in this case is 17%.</p>
<p>So you would have to calculate 17% of $185 and then add it to $185.</p>
<p>$$ \$185  \cdot 17 \% + \$185 $$</p>
<p>You can make it a single operation if instead you multiply by ( 117 \% ).</p>
<p>$$ \$185 \cdot ( 100\% + 17\% ) = \$185 \cdot 117\% $$</p>
<p>If you have a simple calculator that doesn't have a percentage operator, you can convert the percentage to a decimal number as we discussed above. Here's what that would look like:</p>
<p>$$ \$185 \cdot 117\% = \$185 \cdot \frac{117 \xcancel{ \% }}{ 100 } = \$185 \cdot 1.17 $$</p>
<p>So, in general, if you want to add a percentage ( P \% ) to a number ( n ) you can do this:</p>
<p>$$ n \cdot ( 100\% + P\%) $$</p><p>Or if instead you have the percentage in the decimal number form ( d ) you can do this:</p>
<p>$$ n \cdot (1 + d) $$</p><h4 id="heading-how-to-calculate-the-percentage-of-a-number-1">How to calculate the percentage of a number</h4>
<p>If you want to buy a house you need to pay a deposit on the house. Let's say that's 15% of the total value of the house.</p>
<p>If the house price is $200,000, how can you calculate it?</p>
<p>You can multiply the price by the percent number to get the percentage.</p>
<p>$$ \$200,000 \cdot 15 \% = \$30,000 $$</p>
<p>So if you want to know what's the percentage (P\%) or fraction (d) of a number (m), you can multiply that number by the percentage or fraction.</p>
<p>$$ m \cdot P\% \newline \, \\ m \cdot d $$</p><h4 id="heading-how-to-subtract-a-percentage-from-a-number">How to subtract a percentage from a number</h4>
<p>This case is common for calculating the price of an item on sale. For example, if something has an original price of $999 and it is on sale for 20% less, you can calculate the the final price by figuring out what is 20% of $999. Well, it's $199.80, so then you just subtract that value from $999.</p>
<p>The final price of the item on sale is $799.20.</p>
<p>You can calculate it in a single step if you multiply the original price by ((100\% - 20\%)) or (80\%):</p>
<p>$$ \$999 \cdot (100\% - 20\%) = \$999 \cdot 80\% = \$779.20 $$</p>
<p>So the general formula to subtract a percentage (P\%) from a number (b) is:</p>
<p>$$ b \cdot (100\% - P\%) $$</p><p>Or in decimal form:</p>
<p>$$ b \cdot (1 - d) $$</p><h3 id="heading-how-to-calculate-the-percentage-of-a-number-in-respect-to-another-number">How to Calculate the Percentage of a Number in Respect to Another Number</h3>
<p>A cake weights 11 lbs, and you eat 3 pieces for a total of 21 oz. How can you know what percentage of cake have you eaten?</p>
<p>It's important to do calculations of this kind with everything in the same units. So, first, let's convert the weight of the cake to ounces.</p>
<p>$$ 11~\mathrm{lb} \cdot \frac{16~\mathrm{oz}}{\mathrm{lb}} = 176~\mathrm{oz} $$</p><p>Now it's possible to see the percentage of the cake you've eaten: you need to divide the part (in this case the 21 oz of cake you have eaten) by the whole (the 176 oz of the whole cake):</p>
<p>$$ \frac{11~\mathrm{oz}}{176~\mathrm{oz}} = 0.0625 $$</p><p>As seen in the paragraph on how to convert a decimal to a number, you can convert this to a percentage with ( 0.0625 \cdot 100 \% = 6.25\%).</p>
<p>In this example, you have eaten 6.25% of the whole cake.</p>
<h3 id="heading-how-do-you-combine-two-percentages">How Do You Combine Two Percentages?</h3>
<p>Let's say that some items in an online store are discounted at 20%, and then there is an offer for a 10% discount for everything in your cart at payment.</p>
<p>If you are getting a discount of 20% and then another 10% on top of that... how much is the discount?</p>
<p>It's not 30%, because the second discount is applied at a different time than the first discount.</p>
<p>A discount of 20% means you pay 80% ((100\% - 20\%)) of the original price, and a discount of 10% means you pay 90% ((100\% - 10\%))of the original price. Combining the two discounts means multiplying together the two percentages, like so:</p>
<p>$$ 80\% \cdot 90\% = 72\% $$</p><p>Or in decimal form:</p>
<p>$$ 0.80 \cdot 0.90 = 0.72 $$</p><p>So you pay 72% of the original price, or have a discount of 28%.</p>
<h2 id="heading-why-are-a-decimal-and-a-percentage-equivalent">Why Are a Decimal and a Percentage Equivalent?</h2>
<p>Percentage comes from "per cent", or "over one hundred". The percentage symbol represents the line fraction with 100 in the denominator.</p>
<p>$$ 0.20 = \frac{20}{100} = 20\% $$</p><p>The percentage is a simple way to describe how many hundredths of a whole something is.</p>
<h2 id="heading-how-to-work-with-percentages-in-excel">How to Work with Percentages in Excel</h2>
<p>Now it's time to start working with Excel. Let's start with a pretty important thing. How do you write percentages in Excel?</p>
<h3 id="heading-how-to-write-percentages-in-excel">How to Write Percentages in Excel</h3>
<p>In Excel you can write percentages in two ways:</p>
<ul>
<li>You can write a decimal number and then format the cell as a percentage from the format drop down menu or from the Percent Style button:</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-86.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image the Percent Style button is circled in red, and a decimal number is written in the cell. In the second image, the cell has been formatted as a percentage, and the number is converted to a percentage.</em></p>
<ul>
<li>You can write a percentage in the cell, and the cell will automatically take the percentage formatting:</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-87.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image you can see that the empty cell has the "General" formatting, in the second image you can see a percentage being written in the cell, and in the third image you can see that the cell has taken the percentage formatting.</em></p>
<p>The default format is for a whole percentage. You can change the number of decimal places shown with the "Increase Decimal" and "Decrease Decimal" buttons.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-112.png" alt="Image" width="600" height="400" loading="lazy">
<em>The two buttons "Increase Decimal" and "Decrease Decimal" circled in red.</em></p>
<p>Let's say you have a decimal form of 0.12345. Formatting it to a percentage will show ( 12\% ). You can use the buttons to show the decimal places.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-113.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image, the value 12% appears in the cell K1. In the second image, after using the "Increase Decimal" button twice, the value 12.35% appears in the cell K1. In the third image, after using the button "Decrease Decimal" once, the value 12.3% appears in the cell K1.</em></p>
<h3 id="heading-how-to-calculate-the-percentage-of-a-number-in-excel">How to Calculate the Percentage of a Number in Excel</h3>
<p>In math, the percentage of a number is calculated by multiplying that number by the percentage: ( 87\% \cdot 824 = 716.88 ).</p>
<p>In Excel, let's say you have the number in cell A1 and the percentage in cell B1. To calculate the result, you can write in cell C1 <code>=A1*B1</code>:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-110.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image you can see the formula to calculate the percentage of a number, and then its result in the second image.</em></p>
<h3 id="heading-how-to-calculate-the-percentage-of-a-number-with-respect-to-another-in-excel">How to Calculate the Percentage of a Number with Respect to Another in Excel</h3>
<p>In math, you can calculate the percentage of a number with respect to another number by taking the ratio of the two numbers and then converting to a percentage.</p>
<p>If you want to know what percentage 75 is with respect to 142, you can do ( \frac{75}{142} = 0.528 = 52.8\% ).</p>
<p>Let's write 75 in cell G1, and 142 in cell H1. To get the percentage of 75 in respect of 142 you can write in cell I1 <code>=G1/H1</code>. The cell will have the result in decimal format, but you can format it to a percentage using the Percent Style button. Then you can adjust the number of decimal places with the Increase Decimal and Decrease Decimal buttons.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-111.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image you can see the formula to do the calculation. In the second image it results in a decimal number. In the third image it has been converted to a percentage, and then in the fourth the number of digits after the decimal separator has been changed.</em></p>
<h3 id="heading-how-to-calculate-a-percentage-of-multiple-percentages-in-excel">How to Calculate a Percentage of Multiple Percentages in Excel</h3>
<p>Let's take the example used above.</p>
<p>An online store has a promotion on some items for 20% off. Then there is another promotion of 10% off for everything in the cart at the moment of payment.</p>
<p>The first discount means you pay 80% of the original price of the item. And then you pay 90% of what's in the cart.</p>
<p>How much is the discount?</p>
<p>You get the result by multiplying the two percentages. ( 90\% \cdot 80\%).</p>
<p>In Excel, if you have the first percentage in I2 and the second in J2, you can write <code>=I2*J2</code> to calculate the result.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/08/image-120.png" alt="Image" width="600" height="400" loading="lazy">
<em>In the first image you can see the formula to calculate the percentage from multiple percentages, and then its result in the second image.</em></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Percentages are a mathematical tool we use in every day life. In this tutorial, you have learned how they work mathematically, and how to use them in Excel.</p>
<p>I hope this article has been useful.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is a Factorial? How to Calculate Factorials with Examples ]]>
                </title>
                <description>
                    <![CDATA[ A factorial is a mathematical operation that you write like this: n!. It represents the multiplication of all numbers between 1 and n. So if you were to have 3!, for example, you'd compute 3 x 2 x 1 (which = 6). Let's see how it works with some more ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-a-factorial/</link>
                <guid isPermaLink="false">66b0c3bff8d7f56c3f394b08</guid>
                
                    <category>
                        <![CDATA[ Advanced Mathematics ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mathematics ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ilenia Magoni ]]>
                </dc:creator>
                <pubDate>Wed, 03 Aug 2022 16:32:53 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/antoine-dautry-_zsL306fDck-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>A factorial is a mathematical operation that you write like this: <code>n!</code>. It represents the multiplication of all numbers between 1 and n.</p>
<p>So if you were to have <code>3!</code>, for example, you'd compute 3 x 2 x 1 (which = 6). Let's see how it works with some more examples.</p>
<h2 id="heading-definition-of-a-factorial">Definition of a Factorial</h2>
<p>The factorial of a number is the multiplication of all the numbers between 1 and the number itself. It is written like this: <code>n!</code>. So the factorial of 2 is <code>2!</code> (= 1 × 2).</p>
<p>To calculate a factorial you need to know two things:</p>
<ol>
<li><code>0! = 1</code></li>
<li><code>n! = (n - 1)! × n</code></li>
</ol>
<p>The factorial of 0 has value of 1, and the factorial of a number <code>n</code> is equal to the multiplication between the number <code>n</code> and the factorial of <code>n-1</code>.</p>
<p>For example, <code>5!</code> is equal to <code>4! × 5</code>.</p>
<p>Here the first few factorial values to give you an idea of how this works:</p>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Factorial</td><td>Multiplication</td><td>Result</td></tr>
</thead>
<tbody>
<tr>
<td>0!</td><td>1</td><td>1</td></tr>
<tr>
<td>1!</td><td>1</td><td>1</td></tr>
<tr>
<td>2!</td><td>1 × 2</td><td>2</td></tr>
<tr>
<td>3!</td><td>1 × 2 × 3</td><td>6</td></tr>
<tr>
<td>4!</td><td>1 × 2 × 3 × 4</td><td>24</td></tr>
<tr>
<td>5!</td><td>1 × 2 × 3 × 4 × 5</td><td>120</td></tr>
<tr>
<td>6!</td><td>1 × 2 × 3 × 4 × 5 × 6</td><td>720</td></tr>
<tr>
<td>7!</td><td>1 × 2 × 3 × 4 × 5 × 6 × 7</td><td>5040</td></tr>
<tr>
<td>8!</td><td>1 × 2 × 3 × 4 × 5 × 6 × 7 × 8</td><td>40,320</td></tr>
<tr>
<td>9!</td><td>1 × 2 × 3 × 4 × 5 × 6 × 7 × 8 × 9</td><td>362,880</td></tr>
</tbody>
</table>
</div><h2 id="heading-what-is-a-factorial-used-for">What is a Factorial Used For?</h2>
<p>Practically speaking, a factorial is the number of different permutations you can have with <code>n</code> items: 3 items can be arranged in exactly 6 different ways (expressed as <code>3!</code>). </p>
<p>For example, let's see all the arrangements you can have with the three items, A, B and C:</p>
<pre><code class="lang-text">ABC
ACB
BAC
BCA
CAB
CBA
</code></pre>
<p>And in fact, <code>3! = 6</code>.</p>
<h3 id="heading-how-to-calculate-the-factorial-of-0">How to Calculate the Factorial of 0</h3>
<p>Looking at the factorial from this point of view, what's the factorial of 0?</p>
<p>Well, how many different ways can you arrange 0 elements? </p>
<p>There is exactly 1 way to arrange zero elements. And that's making a sequence of zero elements.</p>
<h3 id="heading-factorial-use-cases">Factorial Use Cases</h3>
<p>You typically use a factorial when you have a problem related to the number of possible arrangements. Let's look at some example problems.</p>
<h4 id="heading-factorial-example-problem-1-the-letters-in-the-word-camper">Factorial example problem 1: the letters in the word "camper"</h4>
<p><em>How many different ways can you arrange the letters of the word <code>camper</code>?</em></p>
<p>The word <code>camper</code> has 6 letters, so the number of possible arrangements is given by the factorial of 6: <code>6! = 6 × 5 × 4 × 3 × 2 × 1 = 720</code>. That would have been a pretty big number of arrangements to find by hand, wouldn't it?</p>
<h4 id="heading-factorial-example-problem-2-drawing-colored-balls-from-a-bag">Factorial example problem 2: drawing colored balls from a bag</h4>
<p>Let's say there are three balls in a bag – one green, one blue, and one yellow.</p>
<p>If you draw the three balls in sequence, what chance is there that you'll get the yellow first, the green one second, and the blue one last?</p>
<p>Maybe now you are wondering what chances have to do with factorials – well, in a moment you will see.</p>
<p>There are 6 possible sequences in which the balls can be drawn: 3! = 6.</p>
<p>There is a chance of 1 over the total number of possibilities to get the yellow-green-blue sequence, so that is <code>1/(3!)</code> or <code>1/6</code> or <code>16.7%</code> chance to get the desired outcome.</p>
<h2 id="heading-how-to-calculate-a-factorial-programmatically-with-javascript">How to Calculate a Factorial Programmatically with JavaScript</h2>
<p>There are two ways to calculate factorials programmatically in JavaScript:</p>
<h3 id="heading-how-to-calculate-a-factorial-in-js-with-recursion">How to calculate a factorial in JS with recursion</h3>
<p>Let's get back to the two things to know when calculating a factorial – that is <code>0! = 1</code> and <code>n! = (n - 1)! × n</code>. We can use the first one to create the base case of the recursive function, because in that case we know the result already.</p>
<pre><code class="lang-js"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">factorial</span>(<span class="hljs-params">n</span>) </span>{
  <span class="hljs-keyword">if</span> (n === <span class="hljs-number">0</span>) {
      <span class="hljs-keyword">return</span> <span class="hljs-number">1</span>;
  }
}
</code></pre>
<p>The second thing to know about how to calculate a factorial, <code>n! = (n - 1)! × n</code>, can be the recursive case.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">factorial</span>(<span class="hljs-params">n</span>) </span>{
    <span class="hljs-keyword">if</span> (n === <span class="hljs-number">0</span>) {
        <span class="hljs-keyword">return</span> <span class="hljs-number">1</span>;
    } <span class="hljs-keyword">else</span> {
        <span class="hljs-keyword">return</span> factorial(n<span class="hljs-number">-1</span>) * n;
    }
}
</code></pre>
<h3 id="heading-how-to-calculate-a-factorial-with-a-javascript-while-loop">How to calculate a factorial with a JavaScript <code>while</code> loop</h3>
<p>We said before that <code>0! = 1</code>. So, to calculate the factorial of a number with a loop, we can initialize a variable to <code>1</code>, and multiply the numbers from <code>n</code> to <code>1</code> by the variable inside the loop.</p>
<p>In this way, if the input is higher than 1, the output will easily be 1.</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">factorial</span>(<span class="hljs-params">n</span>) </span>{
    <span class="hljs-keyword">let</span> result = <span class="hljs-number">1</span>;
    <span class="hljs-keyword">for</span> (n &gt; <span class="hljs-number">1</span>) {
        result *= n;
        n--;
    }
    <span class="hljs-keyword">return</span> result;
}
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>The factorial is a pretty important operator to know if you are interested in statistics and probabilities.</p>
<p>In this article you have learned a how to calculate a factorial, a simple application, and you have seen how to calculate it using JavaScript.</p>
<p>Have fun with it!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What Does // Mean in Python? Operators in Python ]]>
                </title>
                <description>
                    <![CDATA[ In Python, you use the double slash // operator to perform floor division. This // operator divides the first number by the second number and rounds the result down to the nearest integer (or whole number). In this article, I will show you how to use... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-does-double-slash-mean-in-python/</link>
                <guid isPermaLink="false">66adf24ff452caf50fb1fe26</guid>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kolade Chris ]]>
                </dc:creator>
                <pubDate>Thu, 21 Jul 2022 15:30:37 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/07/doubleSlash.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In Python, you use the double slash <code>//</code> operator to perform floor division. This <code>//</code> operator divides the first number by the second number and rounds the result down to the nearest integer (or whole number).</p>
<p>In this article, I will show you how to use the <code>//</code> operator and compare it to regular division so you can see how it works.</p>
<p>It doesn’t end there, though – you will also learn about a Python math method that is synonymous with the double slash <code>//</code> operator.</p>
<h2 id="heading-what-well-cover">What We'll Cover</h2>
<ul>
<li><a class="post-section-overview" href="#heading-the-basic-syntax-of-the-operator">The Basic Syntax of the <code>//</code> Operator</a></li>
<li><a class="post-section-overview" href="#heading-examples-of-floor-division">Examples of Floor Division</a></li>
<li><a class="post-section-overview" href="#heading-the-double-slash-operator-works-like-mathfloor">The Double Slash <code>//</code> Operator Works Like <code>math.floor()</code></a></li>
<li><a class="post-section-overview" href="#heading-how-the-double-slash-operator-works-behind-the-scenes">How the Double Slash <code>//</code> Operator Works Behind the Scenes</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-the-basic-syntax-of-the-operator">The Basic Syntax of the <code>//</code> Operator</h2>
<p>To use the double slash <code>//</code> operator, you do things almost like in regular division. The only difference is that instead of a single slash <code>/</code>, you use double slash <code>//</code>:</p>
<pre><code class="lang-py">firstNum // secondNum
</code></pre>
<h2 id="heading-examples-of-floor-division">Examples of Floor Division</h2>
<p>In the example below, the floor division of 12 by 5 resulted in 2:</p>
<pre><code class="lang-py">num1 = <span class="hljs-number">12</span>
num2 = <span class="hljs-number">5</span>
num3 = num1 // num2

print(<span class="hljs-string">"floor division of"</span>, num1, <span class="hljs-string">"by"</span>, num2, <span class="hljs-string">"="</span>, num3)
<span class="hljs-comment"># Output: floor division of 12 by 5 = 2</span>
</code></pre>
<p>Whereas, the regular division of 12 by 5 would be equal to 2.4. That is, 2 remainder 4:
```py’num1 = 12
num2 = 5
num3 = num1 / num2</p>
<p>print("normal division of", num1, "by", num2, "=", num3)</p>
<h1 id="heading-output-normal-division-of-12-by-5-24">Output: normal division of 12 by 5 = 2.4</h1>
<pre><code>
This shows you that the <span class="hljs-string">`//`</span> operator rounds down the result <span class="hljs-keyword">of</span> the division <span class="hljs-keyword">of</span> two numbers to the nearest whole number. 

Even <span class="hljs-keyword">if</span> the decimal point is <span class="hljs-number">9</span>, the <span class="hljs-string">`//`</span> operator would still round the result down to the nearest whole number.

<span class="hljs-string">``</span><span class="hljs-string">`py
num1 = 29 
num2 = 10 
num3 = num1 / num2
num4 = num1 // num2

print("normal division of", num1, "by", num2, "=", num3)
print("but floor division of", num1, "by", num2, "=", num4)

"""
Output:
normal division of 29 by 10 = 2.9
but floor division of 29 by 10 = 2
"""</span>
</code></pre><p>And if you perform floor division with a negative number, the result would still be rounded down.</p>
<p>To prepare your mind for the result, rounding down a negative number means going away from 0. So, -12 divided by 5 results in -3. Don’t get confused – even though at first glance it seems like the nubmer is getting "bigger", it's actually getting smaller (further from zero/a larger negative number).</p>
<pre><code class="lang-py">num1 = <span class="hljs-number">-12</span>
num2 = <span class="hljs-number">5</span>
num3 = num1 // num2

print(<span class="hljs-string">"floor division of"</span>, num1, <span class="hljs-string">"by"</span>, num2, <span class="hljs-string">"="</span>, num3)

<span class="hljs-comment"># floor division of -12 by 5 = -3</span>
</code></pre>
<h2 id="heading-the-double-slash-operator-works-like-mathfloor">The Double Slash <code>//</code> Operator Works Like <code>math.floor()</code></h2>
<p>In Python, <code>math.floor()</code> rounds down a number to the nearest integer, just like the double slash <code>//</code> operator does.</p>
<p>So, <code>math.floor()</code> is an alternative to the <code>//</code> operator because they do the same thing behind the scenes.</p>
<p>Here's an example:</p>
<pre><code class="lang-py"><span class="hljs-keyword">import</span> math

num1 = <span class="hljs-number">12</span>
num2 = <span class="hljs-number">5</span>
num3 = num1 // num2
num4 = math.floor(num1 / num2)

print(<span class="hljs-string">"floor division of"</span>, num1, <span class="hljs-string">"by"</span>, num2, <span class="hljs-string">"="</span>, num3)
print(<span class="hljs-string">"math.floor of"</span>, num1, <span class="hljs-string">"divided by"</span>, num2, <span class="hljs-string">"="</span>, num4)

<span class="hljs-string">"""
Output:
floor division of 12 by 5 = 2
math.floor of 12 divided by 5 = 2
"""</span>
</code></pre>
<p>You can see that <code>math.floor()</code> does the same thing as the <code>//</code> operator.</p>
<h2 id="heading-how-the-double-slash-operator-works-behind-the-scenes">How the Double Slash <code>//</code> Operator Works Behind the Scenes</h2>
<p>When you use the <code>//</code> operator to divide two numbers, the method that gets called behind the scenes is the <code>__floordiv__()</code>.</p>
<p>You can also use this <code>__floordiv__()</code> method directly in place of the <code>//</code> operator:</p>
<pre><code class="lang-py">num1 = <span class="hljs-number">12</span>
num2 = <span class="hljs-number">5</span>
num3 = num1 // num2
num4 = num1.__floordiv__(num2)

print(<span class="hljs-string">"floor division of"</span>, num1, <span class="hljs-string">"by"</span>, num2, <span class="hljs-string">"="</span>, num3)
print(<span class="hljs-string">"using the floordiv method gets us the same value of"</span>, num4)

<span class="hljs-string">"""
Output:
floor division of 12 by 5 = 2
using the floordiv method gets us the same value of 2
"""</span>
</code></pre>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, you’ve learned how you can use the double slash <code>//</code> operator and how it works behind the scenes.</p>
<p>In addition, you learned about two alternatives of the <code>//</code> operator – <code>math.floor()</code> and the <code>__floordiv__()</code> method.</p>
<p>Don’t be confused about which to use. The three ways you can perform floor division work the same way. But I would advise you to use the double slash <code>//</code> operator because you get to type less with it.</p>
<p>Thank you for reading.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Java Random Number Generator – How to Generate Numbers with Math.random() and Convert to Integers ]]>
                </title>
                <description>
                    <![CDATA[ By Sebastian Sigl In many applications, you need random numbers. You might need to throw dice in video games, create a private cryptography key, or create a user’s temporary password.  All these applications depend on random number creation. It’s som... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/java-random-number-generator-how-to-generate-with-math-random-and-convert-to-integer/</link>
                <guid isPermaLink="false">66d460fe73634435aafcefce</guid>
                
                    <category>
                        <![CDATA[ Java ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 19 Jul 2022 15:09:37 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/07/java-number-generators.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Sebastian Sigl</p>
<p>In many applications, you need random numbers. You might need to throw dice in video games, create a private cryptography key, or create a user’s temporary password. </p>
<p>All these applications depend on random number creation. It’s sometimes challenging to differentiate what to use when, and security is a deep topic. Without spending a few years digging into it, it’s hard to quickly understand the documentation about available implementations and pick the proper way for your use case. </p>
<p>So in this tutorial, I'll summarize the prominent use cases and how to choose the best-performing implementation based on your your Java code.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/07/brainstorming---Frame-1--1-.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In this article, you will learn:</p>
<ul>
<li>How to generate integers, floats, and booleans,</li>
<li>How generate random numbers for performance-critical use cases,</li>
<li>How generate random numbers for security-critical use cases,</li>
<li>How numbers generators work,</li>
<li>The differences between pseudo random number generators and true random number generators,</li>
<li>How to use a seed to your advantage.  </li>
</ul>
<p>All the code examples are minimal, and you can find the complete <a target="_blank" href="https://github.com/sesigl/random-number-generators-java">source code on GitHub</a>.</p>
<h2 id="heading-constraints-of-mathrandom">Constraints of Math.random()</h2>
<p><code>Math.random</code> did exist even before Java 6. It's easy to access and still widely used. With Java 17, a new common interface called <code>RandomGenerator</code> is available, which consolidates all random generator implementations in the current Java SDK. </p>
<p><code>Math.random()</code> nowadays simply delegates to <code>Random().nextFloat()</code>. But, it only returns a <code>double</code>. So it doesn't allow you to request different types of numbers or generate numbers between ranges. It also doesn't allow you to select from different implementations. </p>
<p>In the following sections, you will learn about a more flexible number generation and learn how to generate numbers optimized for efficiency or security.</p>
<h2 id="heading-common-interface-since-java-17">Common Interface Since Java 17</h2>
<p>With Java 17, a common interface is implemented by the available number generators in the Java SDK. You have methods available for all essential data types, and you can define the expected range you would like to generate numbers for:</p>
<pre><code class="lang-java">RandomGenerator randomGenerator = <span class="hljs-keyword">new</span> Random();

<span class="hljs-comment">// generate int between 0 - 9</span>
randomGenerator.nextInt(<span class="hljs-number">10</span>);

<span class="hljs-comment">// generate int between 1 - 9</span>
randomGenerator.nextInt(<span class="hljs-number">1</span>, <span class="hljs-number">9</span>);

<span class="hljs-comment">// generate long between 1 - 9</span>
randomGenerator.nextLong(<span class="hljs-number">1</span>, <span class="hljs-number">9</span>);

<span class="hljs-comment">// generate float between 1 - 9</span>
randomGenerator.nextFloat(<span class="hljs-number">1</span>, <span class="hljs-number">9</span>);

<span class="hljs-comment">// generate double between 1 - 9</span>
randomGenerator.nextDouble(<span class="hljs-number">1</span>, <span class="hljs-number">9</span>);

<span class="hljs-comment">// generate random boolean</span>
randomGenerator.nextBoolean();
</code></pre>
<h2 id="heading-performance-optimized-random-number-generation-in-a-single-threaded-environment">Performance Optimized Random Number Generation in a Single-Threaded Environment</h2>
<p>For many non-security-relevant cases, you do not care how predictable your random number is. Usually, you just want to have a reliable distribution. </p>
<p>More performant implementations than <code>Random</code> are available if your application is single-threaded. One very efficient alternative is called <code>SplittableRandom</code>:</p>
<pre><code class="lang-java"><span class="hljs-keyword">new</span> SplittableRandom().nextInt();
</code></pre>
<p>The <a target="_blank" href="https://github.com/sesigl/random-number-generators-java/blob/main/src/test/java/org/example/BenchmarkSingleThreadedTest.java">benchmark executed on a MacBook Pro comparing SplittableRandom and Random</a> shows the following results:</p>
<pre><code class="lang-sh">SingleThreaded.Random  116528253,100 ops/s
SingleThreaded.SplittableRandom  619630768,299  ops/s
</code></pre>
<p><code>SplittableRandom</code> performs about 5 times faster than <code>Random</code> in a single-threaded environment. </p>
<p>Additional advantages to <code>Random()</code> are deterministic behavior and splittable fork/join implementation. Summing up, you should prefer using <code>SplittableRandom</code> over <code>Random</code> in single-threaded environments.</p>
<h2 id="heading-performance-optimized-random-number-generation-in-a-multi-threaded-environment">Performance Optimized Random Number Generation in a Multi-Threaded Environment</h2>
<p>High throughput applications leverage multiple threads. So you want to use a number generator which is made for parallel usage. </p>
<p>The implementation of <code>Random</code> is thread-safe but is relatively slow and slows down even more because of locks. Because <code>SplittableRandom</code> is not thread-safe, it’s not an alternative here. </p>
<p>But, you gain better performance by using <code>ThreadLocalRandom</code> in a multi-threaded environment. It uses <code>SplittableRandom</code>, but ensures performant and secure usage in multiple threads:</p>
<pre><code class="lang-java">ThreadLocalRandom.current().nextInt();
</code></pre>
<p>The <a target="_blank" href="https://github.com/sesigl/random-number-generators-java/blob/main/src/test/java/org/example/BenchmarkMultiThreadedTest.java">benchmark executed on a MacBook Pro comparing ThreadLocalRandom and Random</a> generating numbers in parallel using 10 threads shows the following results:</p>
<pre><code class="lang-sh">MultiThreaded   Random                      8308724,791         ops/s
MultiThreaded   ThreadLocalRandom  3537955530,922   ops/s
</code></pre>
<p>As you can see, using <code>ThreadLocalRandom</code> is 425 times faster. <code>ThreadLocalRandom</code> is lock-free and, therefore, more performant than the thread-safe <code>Random</code> class.</p>
<h2 id="heading-security-optimized-random-number-generation">Security Optimized Random Number Generation</h2>
<p>The methods we just discussed are speedy and sufficient for most of your applications. But, they are creating so-called pseudo-random-generated numbers.</p>
<p>Instead of always creating a truly random number, they predict a new number based on the previously predicted number, which comes with a state and a severe problem of predictability. </p>
<p>Maybe you want to create long-living secrets for encryption, and you don't want others, by any chance, to be able to predict the next generated token. </p>
<p>In Java, you have <code>SecureRandom</code> for more security-relevant use cases:</p>
<pre><code class="lang-java">SecureRandom.getInstanceStrong().nextInt();
</code></pre>
<p><code>SecureRandom.getInstanceStrong()</code> gives you a provider, which creates secure tokens. In many Linux systems, you use <code>/dev/random</code>, generating numbers based on the random noise of real devices. </p>
<p>But, if you don't have enough random data being collected, so-called missing <a target="_blank" href="https://en.wikipedia.org/wiki/Entropy">entropy</a>, the execution can block and take an unexpectedly long time. Especially in machines with a lot of Docker containers, this can lead to a slow execution in practice.</p>
<p>As an alternative, <code>new SecureRandom()</code> does not block by default in case no entropy is available. It also uses a less secure way of number generation as a fallback.</p>
<h2 id="heading-how-to-use-seeds-to-your-advantage">How to Use Seeds to Your Advantage</h2>
<p>By default, a pseudo number generator uses a random seed, which reflects the start values used to generate values. So a seed is quite handy for testing, as it gives you control over predictions and allows you to reset how numbers are created. </p>
<p>Until now, we haven't talked about anything related to seeds.</p>
<pre><code class="lang-java"><span class="hljs-meta">@Test</span>
   <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">splittableRandomWithSeedIsDeterministic</span><span class="hljs-params">()</span> </span>{
   assertEquals(<span class="hljs-keyword">new</span> SplittableRandom(<span class="hljs-number">9999</span>).nextInt(), -<span class="hljs-number">788346102</span>);
}

<span class="hljs-meta">@Test</span>
   <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">randomWithSeedIsDeterministic</span><span class="hljs-params">()</span> </span>{
   assertEquals(<span class="hljs-keyword">new</span> Random(<span class="hljs-number">9999</span>).nextInt(), -<span class="hljs-number">509091100</span>);
}
</code></pre>
<p>This makes testing a lot easier. Otherwise, you would need to always <a target="_blank" href="https://site.mockito.org/">mock dependencies</a>. </p>
<h2 id="heading-why-number-generation-is-hard">Why Number Generation is Hard</h2>
<p>Understanding why number generation is hard to get a sense of security is essential. </p>
<p>Engineers write code, which is eventually compiled into machine-readable code executed in a real processing unit (CPU). A CPU is built upon electronic circuits, which consist of logic gates. </p>
<p>Long story short, there is no real randomness you can create with a traditional computer because output requires some input and, by definition, that can not be random. </p>
<p>This means that you need some kind of true random input from the real world, like <a target="_blank" href="https://en.wikipedia.org/wiki/Johnson-Nyquist_noise">Thermal noise</a> from a <a target="_blank" href="https://en.wikipedia.org/wiki/Resistor">resistor</a>. There are expensive <a target="_blank" href="https://en.wikipedia.org/wiki/Hardware_random_number_generator">hardware number generators</a> that use real-world physics to give you a lot of capacity for random number creation.</p>
<h2 id="heading-risks-of-unsafe-random-number-generation">Risks of Unsafe Random Number Generation</h2>
<p>Although many protocols are secure by design, they are not if an attacker can predict encryption keys. </p>
<p>Nowadays, a lot of applications require true random number generation behind the scenes. Otherwise, attackers might be able to predict generated numbers and, by doing so, infiltrate applications. </p>
<p>For example, security-related processing breakthroughs based on <a target="_blank" href="https://en.wikipedia.org/wiki/Quantum_computing#Cryptography">quantum computing</a> can be a real threat if suddenly attackers can solve encryptions in no time.</p>
<h2 id="heading-summary">Summary</h2>
<p>In this blog post, you learned how to generate numbers in Java efficiently. You also learned how to optimize towards performance or security, and you learned what a seed is and how it can be used. </p>
<p>Also, you should now understand the key differences between pseudo and truely random generated numbers, and you should be able to describe why secure random number generation is important.</p>
<p>I hope you enjoyed the article.</p>
<p>If you liked it and felt the need to give me a round of applause or just want to get in touch, <a target="_blank" href="https://twitter.com/sesigl">follow me on Twitter</a>.</p>
<p>By the way, <a target="_blank" href="https://www.ebay-kleinanzeigen.de/careers">we are hiring</a>!</p>
<h3 id="heading-references">References</h3>
<ul>
<li><a target="_blank" href="https://betterprogramming.pub/generating-random-numbers-is-a-lot-harder-than-you-think-b121c3e75d08">https://betterprogramming.pub/generating-random-numbers-is-a-lot-harder-than-you-think-b121c3e75d08</a></li>
<li><a target="_blank" href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html">https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html</a></li>
<li><a target="_blank" href="https://www.happycoders.eu/java/random-number/">https://www.happycoders.eu/java/random-number/</a></li>
<li><a target="_blank" href="https://www.baeldung.com/java-17-random-number-generators">https://www.baeldung.com/java-17-random-number-generators</a></li>
<li><a target="_blank" href="https://programmer.ink/think/61db978dde30a.html">https://programmer.ink/think/61db978dde30a.html</a></li>
<li><a target="_blank" href="https://www.baeldung.com/java-secure-random">https://www.baeldung.com/java-secure-random</a></li>
<li><a target="_blank" href="https://tersesystems.com/blog/2015/12/17/the-right-way-to-use-securerandom/">https://tersesystems.com/blog/2015/12/17/the-right-way-to-use-securerandom/</a></li>
<li><a target="_blank" href="https://en.wikipedia.org/wiki//dev/random">https://en.wikipedia.org/wiki//dev/random</a></li>
<li><a target="_blank" href="https://www.schutzwerk.com/en/43/posts/attacking_a_random_number_generator/">https://www.schutzwerk.com/en/43/posts/attacking_a_random_number_generator/</a></li>
<li><a target="_blank" href="https://en.wikipedia.org/wiki/Random_number_generator_attack">https://en.wikipedia.org/wiki/Random_number_generator_attack</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
