<?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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mhmd Jawad Ahmad on Medium]]></title>
        <description><![CDATA[Stories by Mhmd Jawad Ahmad on Medium]]></description>
        <link>https://medium.com/@mhmdjahmad99?source=rss-cd4ebfcbba73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KLJ56ShWEz4lyaszVfkKHQ.jpeg</url>
            <title>Stories by Mhmd Jawad Ahmad on Medium</title>
            <link>https://medium.com/@mhmdjahmad99?source=rss-cd4ebfcbba73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 00:29:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mhmdjahmad99/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Machine Learning Lifecycle: An overview]]></title>
            <link>https://medium.com/munchy-bytes/machine-learning-lifecycle-an-overview-e3fc7d74350f?source=rss-cd4ebfcbba73------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3fc7d74350f</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Mhmd Jawad Ahmad]]></dc:creator>
            <pubDate>Sun, 19 Mar 2023 15:17:30 GMT</pubDate>
            <atom:updated>2023-03-19T15:33:39.629Z</atom:updated>
            <content:encoded><![CDATA[<h3>Machine Learning Lifecycle: an Overview</h3><p>Machine learning is the process of making systems learn and improve automatically. ML practitioners aim to design an algorithm that helps the system gather data and learn to decide independently. They want this system to think and act more like humans and have an intelligence that resembles the one in humans.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*W4xIPxOF04_meRwkMxJbvA.jpeg" /><figcaption>Reference: spectrum.ieee.org</figcaption></figure><p>There are existing machine learning models in the world being used for a vital decision like:</p><ul><li>Gmail categorizes emails if spam or not.</li><li>Fixing grammar and spelling mistakes, like Grammarly.</li><li>Self-driven cars like Tesla.</li><li>Interactive bots that help humans, like in Discord.</li><li>Detecting fake news.</li></ul><p>This article explains the different phases a machine learning model passes through before being deployed into production.</p><h3>Machine Learning lifecycle</h3><p>The process of building a machine learning model is broken down into 10 phases:</p><ol><li>Data Collection</li><li>Preliminary Data Analysis</li><li>Data Cleaning</li><li>Data Filtering</li><li>Feature Engineering</li><li>Choosing the model</li><li>Training the model</li><li>Testing the model</li><li>Tuning</li><li>Predicting</li></ol><h4>Data Collection</h4><p>When we start learning, we acquire data about a specific topic, which wouldn’t be enough. Then we learn something new about the same topic, which would vary from our other knowledge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ioWO2gAo9BdcNMQoxfWFew.png" /><figcaption>Data Collection (Reference: istockphoto.com)</figcaption></figure><p>This way, we start founding a big map around this topic in our heads. Still, we would need more time to learn about this topic which always seems never enough. The same thing goes for the machine; the machine we’re building should be aware of all the possible cases of this specific topic so it can give back to any input given. Thus, we need a large amount of data, and we’re not talking about hundreds or thousands. We’re talking about a hundred thousand, and if we sought a better model, we would reach millions. The data can be collected using surveys, questionnaires, polls, etc.</p><h4>Preliminary data analysis</h4><p>Although it is not so common to do, or some might not consider it as an independent step, its value is far greater than it seems. A fundamental rule about the model is that it should be unbiased, which means the collected data should be almost the same amount for all the classes we have. Otherwise, the model would give biased results. In addition, looking at how the data is distributed might change the course of building the model, especially when working with large data. It will give a better thought on how the data should be cleaned and filtered. Visualizing the data would give off much information that should not be taken carelessly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*YO4WLTU5mrsMkN2W1AEcFQ.png" /><figcaption>Data Visualization (Reference: boostlabs.com)</figcaption></figure><p>Data visualization has its tools, like using R or Python. The most common uses are plotting the data on histograms or pie charts etc.…</p><h4>Data Cleaning</h4><p>This step is crucial because all the work after this stage highly relies on it. The machine we are building should be to give decisions in real life on true cases, so the data we’re feeding it should be clear and genuine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*JkGdZ6NSl3sfmYbPRb-WNQ.png" /><figcaption>Data Cleaning (Reference: analyticsindiamag.com)</figcaption></figure><p>For example, feeding blurred, cropped, or labeled wrong images will have a huge negative impact on the results. We must use surveys that are correctly filled, keep data that have meaning, remove empty samples, drain excess symbols or letters that do not affect the decisions I want, etc.</p><h4>Data Filtering</h4><p>Data filtering is where we start arranging the cleaned data in their classes, like binding all data from the same class in a bag of words. We also divide our dataset mainly into two testing datasets, which will be a small portion of data that will help test whether the model I built is appropriately founded. A training dataset will have a more significant portion of the dataset so we can teach the machine as much as possible from the data we have. Still, we can use one more dataset called the development dataset, which will be even smaller than the testing dataset and be used to help me tune the model later.</p><h4>Feature Engineering</h4><p>Once the data is cleaned and divided, we should specify how the machine should learn from them. By now, we should include our data and what stands out in each class. We have to study the features that can help the model separate the unlabeled data in the class that most suits it while minimizing the feature vector as much as possible. The features we want to use must also be uncorrelated from each other, so we’d make it less complex by lowering the feature dimensions. For example, using the age of a person and his birth date, both of these features will give off the same kind of data, so using one of them would be better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*bsx8l-rltuKPh2IK3BJUZA.png" /><figcaption>Feature Engineering (Reference: analyticsvidhya.com)</figcaption></figure><h4>Choosing the model</h4><p>A model determines how the machines decide the output; we might even want to build a classifier, not a fitting model. It is essential to choose a model that is relevant to the case at hand. We have many methods founded over the years, but we try to choose what best suits our case. The model we choose should also be decisive for the data we have. For example, Naïve Bayes tends to be robust when the data tends to be significant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*8OC1ipi8IaU_JYn8XyqMVg.png" /><figcaption>Choosing Model (Reference: towardsdatascience.com)</figcaption></figure><h4>Training the model</h4><p>Now we prepare the model we chose to find the patterns in data using the feature vector we give it over the Training Dataset that we feed it. The more data we feed, the more it gets better at predicting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*s9KKONxcIVMAFDdjyj8QLQ.png" /><figcaption>Training the Model (Reference: medium.datadriveninvestor.com)</figcaption></figure><h4>Testing the model</h4><p>After training the model, we use it on the Testing Dataset to check its performance. The Testing Dataset is considered unseen data to the model, so after he classifies them, we’ll be able to evaluate its predictions and calculate its accuracy. Here we can decide whether the model passes or needs to be refactored. If its accuracy is low, this will lead to several possibilities why the results are coming out wrong, either a bad choice of model, weak features, or even data that is not cleaned correctly. While if the accuracy is high, we will have successfully built a model.</p><h4>Tuning</h4><p>Tuning is also essential since it helps increase the model’s accuracy. We previously reserved a small portion of data called the Development Dataset. As you know, each model has its parameters that we try to estimate. This dataset will help me pick suitable parameters by testing the model with different parameters on this dataset and checking what gives the highest accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*puVQEKjiuGjO60L_LpBzXA.png" /><figcaption>Parameter Tuning (Reference: developer.nvidia.com)</figcaption></figure><h4>Predicting</h4><p>And finally, the machine is ready to be used on unseen data to make almost accurate predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*4Dv6t_ONMhAnvibtFiyDVQ.png" /><figcaption>Model Prediction (Reference: medium.com)</figcaption></figure><h3>Conclusion</h3><p>This would have given the machine human-like knowledge and applied all the machine learning stages. It is also suitable to say that the number of stages might differ from one article to another, but it’s how people divide the stage; data visualization, data cleaning, data filtering, and feature engineering can all be considered as preparing the data. Still, I tried to break them down as much as possible. I hope it seemed clear and easy to understand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3fc7d74350f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/machine-learning-lifecycle-an-overview-e3fc7d74350f">Machine Learning Lifecycle: An overview</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euler’s Runge-Kutta]]></title>
            <link>https://medium.com/munchy-bytes/eulers-runge-kutta-8e2bd6a69f21?source=rss-cd4ebfcbba73------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e2bd6a69f21</guid>
            <category><![CDATA[runge-kutta]]></category>
            <category><![CDATA[numerical-analysis]]></category>
            <category><![CDATA[euler]]></category>
            <dc:creator><![CDATA[Mhmd Jawad Ahmad]]></dc:creator>
            <pubDate>Mon, 16 Jan 2023 21:21:45 GMT</pubDate>
            <atom:updated>2023-01-16T21:21:45.311Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the final article in Euler’s Runge Kutta series. After we explained the basic concepts in the previous articles, this article will focus on the Runge-Kutta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H099kd8m-zzGZEJx" /><figcaption>Image Reference: <a href="https://the-mathstutor.com/cropped-342656-math-background-2048x2048-image-1-jpg/">the-mathstutor.com</a></figcaption></figure><h3>Differential Equations</h3><p>Differential equations are used to model physical problems. As we stated before, modeling numerical data is done point by point. When we try to model this way, we start the model with a real initial point</p><p>Denote <em>y0, y1, y2, ..</em> as the approximations, and <em>y(t0), y(t1), y(t2), ..</em> as the real values</p><h4>Initial — value problem</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*JXG4UVVMxqZjgXNecG6-Mw.png" /></figure><p>The differential equation is of the function of y(t) because we are using each value, we get to compute the one after, and we start from with y0 equal to the real value because a value does not precede it.</p><p>We use one of Euler’s methods to solve this differential equation: Runge — Kutta. Using this method, our problems will be modeled as schemes that can be recursively to find the approximations. Let’s start with the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*E9VxyYdDvNNp2gAiq1XeMQ.png" /></figure><p>By applying the integral on both sides, we obtain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*g3f5OQml6cpkxjUKtDvy0w.png" /></figure><p>The right side of this equation looks familiar. It is numerical integration similar to the ones we saw above. This time we’ll not use trapezoidal or midpoint rectangular, instead assume</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*DMWEut5t4eAQrsR_sGixWw.png" /></figure><p>So this will look like a constant line. Thus, this will also result in a triangle made by two consecutive points, and its area would be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*1ou_EGmgjsLyQVFilSycmA.png" /></figure><p>We get</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2hK1WWgPEraKgg3Hlw7QHA.png" /></figure><p>Use approximation instead of real value notations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/309/1*npf8M46_YhAEbyhn0SRpGA.png" /></figure><p><em>f(ti,yi) </em>will be denoted as K1; therefore, we obtain the first order of the</p><h4>Runge-Kutta RK1 scheme</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*Shx1Y5Wz5ia5EiGo2M7yXA.png" /></figure><p>The second order of Runge Kutta is having <em>K = [K1, K2]</em>. We’ll apply the numerical integration over the trapezoidal rule this time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*DwT6vxzXV83ng2mB3Pvamw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*i463mrzk7zR-OoPWvMURlw.png" /></figure><p>Now what we ended with was a differential equation but of function of <em>yi+1</em> which is what we are trying to compute. Thus, let’s assume that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*-vI7m5yXuc_B7LwdyhO0Qg.png" /></figure><p>So, we use RK1 to solve this part of the equation, by substituting we obtain:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*B0hLJp4-tJ5EEFFQa_nSgA.png" /></figure><p>We get RK2 — Trapezoidal Rule scheme</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*u9zqk1EPJ0_jzScnWktegQ.png" /></figure><p>Second order of Runge-Kutta, applying the numerical integration over midpoint rectangular rule this time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*amk_6NNpWmzPsqP3QfRQAA.png" /></figure><p>Using RK1 we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*1mRnGfn9ENQlCkYX12HU7g.png" /></figure><p>We get RK2 — Midpoint Rectangular Rule scheme:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/326/1*rg85yumBedvuF66TE69EiQ.png" /></figure><p>Until now, we’ve seen the first and the second order of Runge-Kutta with both trapezoidal and midpoint rectangular integrations, but what if we had <em>mth</em> order of this differential equation?</p><p>Consider this initial value problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*adhr8cJ6jv5l_1xy_eG0KA.png" /></figure><p>What we need to do now is to transform this <em>mth</em> order differential equation into set of first order. Let</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/1*n1kAnIC0HNpmNDYa3JfGoA.png" /></figure><p>Differentiate both sides we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*1O5KGzfkzGtjxIno4uR_AA.png" /></figure><p>Substitute values from the first assumption:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*Cf6ZnBbcl6wifObne4qiBA.png" /></figure><p>Now we have the system independent of <em>w</em> and we derived the given IVP as part of it. We can now write the system as vectors since each equation has its own set of values. We obtain the Runge Kutta system:</p><h4>Euler Method RKS1</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*OM30Ee_lYez0xyapo4CbFA.png" /></figure><h4>RKS2 — T:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*O6zglqyB7YMuZ6sMDzpkNg.png" /><figcaption>77</figcaption></figure><h4>RKS2 — M</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*BX0Sn2cCYlW6zl-nOFJAEg.png" /></figure><p>Now</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*J2Yx4NFzDmduiPrkNVPJ4g.png" /></figure><h3>Conclusion</h3><p>Here we reach the end. Another great tool created by Euler deals with numerical data to estimate upcoming observations using approximations of the data. We also saw how to differentiate and integrate numerical functions, which is essential when dealing with functions. These two concepts are also what helped in deriving the Runge-Kutta.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e2bd6a69f21" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/eulers-runge-kutta-8e2bd6a69f21">Euler’s Runge-Kutta</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euler’s Runge-Kutta — Numerical Integration]]></title>
            <link>https://medium.com/munchy-bytes/eulers-runge-kutta-numerical-integration-56b0dc4925fc?source=rss-cd4ebfcbba73------2</link>
            <guid isPermaLink="false">https://medium.com/p/56b0dc4925fc</guid>
            <category><![CDATA[numerical-integration]]></category>
            <category><![CDATA[numerical-analysis]]></category>
            <category><![CDATA[discrete-mathematics]]></category>
            <category><![CDATA[euler]]></category>
            <category><![CDATA[runge-kutta]]></category>
            <dc:creator><![CDATA[Mhmd Jawad Ahmad]]></dc:creator>
            <pubDate>Mon, 16 Jan 2023 06:01:47 GMT</pubDate>
            <atom:updated>2023-01-16T06:36:50.834Z</atom:updated>
            <content:encoded><![CDATA[<h3>Euler’s Runge-Kutta — Numerical Integration</h3><p>After explaining numerical differentiation and Richardson exploration in this article series. This article illustrates numerical integration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y3xryIGtjdIjinwp.jpg" /><figcaption>Image Reference: <a href="https://www.precisionformedicine.com/blogs/clinical-data-management-data-integration-vs-data-reconciliation/">precisionformedicine.com</a></figcaption></figure><h3>Numerical Integration</h3><p>As we know, integrals are the area under the continuous curve. We want to estimate an area for our discrete data points when discussing numerical integration. To do so, we can use one of these two methods.</p><h4>Trapezoidal rule</h4><p>We connect the consecutive points and project each point on the x-axis. Hence, we obtain trapezoids next to each other. All we have to do now is to calculate the sum of all their areas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*1p_Si5lxxxJ9QLlkItExAQ.png" /><figcaption>Trapezoidal rule (Reference: <a href="https://pythonnumericalmethods.berkeley.edu/_images/21.03.1-Trapezoid_integral.png)">pythonnumericalmethods.berkeley.edu)</a></figcaption></figure><p>The area of a trapezoid is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*nUbBeAzQeJO_bCuAKfmLXg.png" /></figure><p>Area in our case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*WoMKREPBRqdez5BFRN365A.png" /></figure><p>Using this type of integration also means that the calculation will result in some errors, so the proper way to write this equation is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*wL2NvMQoGu-Q-hCAVCAxXA.png" /></figure><p>Having this error means we can also benefit from Richardson’s approximation to have better results, so we’ll use the same rule as the one derived before:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*9B321Ie5HtrFmnsEdVxFAQ.png" /></figure><h4>Midpoint Rectangular Rule</h4><p>We take a point that has a point before, and after making it the middle one, we draw a line parallel to the x-axis to reach the value of x of the previous point and the x of the point after. Then from the two points, before and after the point we chose, we project them on the x-axis, forming a rectangle from a midpoint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*mdRq7FW-Cw9Jh4KL3QTEPg.png" /><figcaption>Midpoint Rectangular rule (Reference: <a href="https://tutorial.math.lamar.edu/classes/calcii/approximatingdefintegrals.aspx)">tutorial.math.lamar.edu)</a></figcaption></figure><p>Area of rectangle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/89/1*mUpWEW-tFsTdV9rJcVbXow.png" /></figure><p>Since we have opposite side equal, we can use y of odd indices and multiply them by 2h</p><p>Area in our case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*S9-cFjEYWx4UvF-Q64uIFQ.png" /></figure><p>The error is also found here so Richardson also applies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*7uYkwt2s1-ypMYfy2l_9CQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*5L0_Fs7x_wpJenZvGStsJg.png" /></figure><p>The two methods we used previously (midpoint rectangular and trapezoidal) have errors due to how they obtain their shapes. The figure above shows how the shapes took either more or less area under the curve. That is why we can combine these two rules to form a method that takes the right amount of area from both rules to decrease the margin of error.</p><p>This new rule obtained is called Simpson’s Rule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*8Ts1ok1DfTKlK0-K_VDv0g.png" /></figure><p>Richardson has helped to find better approximations for both numerical differentiation and integration. We almost derived the same equation each time using it except when having a larger h in central difference. Therefore, we can derive a more generalized form of Richardson, dealing with the lag as well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*FLuw9nDKe8BTym2ebnMoIQ.png" /></figure><p>As we saw in the previous table where we took <em>[h=0.5, h=0.25, h=0.125] (article 2/4)</em>, that was because the difference of h we used to get Richardson with equation [a] and [b] was 2h. So, in general, when we use <em>q * h</em>, and start from lag = c, we use multiples of qc in our table.</p><p>Now with all of the numerical differentiation, Richardson extrapolation, and numerical integration being explained, we can combine this knowledge to comprehend the final piece in this series that will focus on the Runge-Kutta.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56b0dc4925fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/eulers-runge-kutta-numerical-integration-56b0dc4925fc">Euler’s Runge-Kutta — Numerical Integration</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euler’s Runge-Kutta — Richardson Extrapolation]]></title>
            <link>https://medium.com/munchy-bytes/eulers-runge-kutta-richardson-extrapolation-8e937b853071?source=rss-cd4ebfcbba73------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e937b853071</guid>
            <category><![CDATA[runge-kutta]]></category>
            <category><![CDATA[discrete-mathematics]]></category>
            <category><![CDATA[numerical-analysis]]></category>
            <category><![CDATA[taylor-series]]></category>
            <category><![CDATA[euler]]></category>
            <dc:creator><![CDATA[Mhmd Jawad Ahmad]]></dc:creator>
            <pubDate>Sun, 15 Jan 2023 06:02:21 GMT</pubDate>
            <atom:updated>2023-01-15T06:02:21.912Z</atom:updated>
            <content:encoded><![CDATA[<h3>Euler’s Runge-Kutta — Richardson Extrapolation</h3><p>After explaining numerical differentiation in the previously published article in this series, this article briefly explains Richardson Extrapolation, a method used to minimize errors obtained due to numerical differentiation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*2dW7TQ_CNtoK8Uj1" /><figcaption>Image Reference: <a href="https://www.facebook.com/me309numerical/">Facebook.com</a></figcaption></figure><h3>Taylor Series</h3><p>Linearization is when a nonlinear function is derived from becoming a function with linear characteristics, that can be applied using the Taylor Series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*bSrNdPiEpcxy4LycD860HA.png" /><figcaption>Taylor Series (Reference: <a href="https://pythonforundergradengineers.com/creating-taylor-series-functions-with-python.html)">pythonforundergradengineers.com)</a></figcaption></figure><p>Well, the good thing about the Taylor series is that it is applied to points, not the whole function so that we can use it on discrete points as well. Now let’s apply it to 3 cases: previous, current, and successor.</p><p><em>f(xi)</em> is the image of <em>xi</em> which is <em>yi</em>, and since the difference between all consecutive x is constant h then we can say instead of these:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*lD4VsYEXxmb9Rfo6sbM9eg.png" /></figure><p>We use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dn6B8PFbFABfPTrrGYvqNg.png" /></figure><p>Note that we changed these terms because they can be similar in the Taylor series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*PyGsg0gekqk02D3yd-a7ZA.png" /></figure><p>Transform this equation to the terms we are familiar with for , and we get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*ZekRKcUExUnxKHBsB4_wNw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*qEBp07goXzPjnPiknxOt5Q.png" /></figure><p>Divide by <em>h</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*BDStBvDiMLSf3rQU8YzwYg.png" /></figure><p>We know that in each term, we have h, a variable multiplied by a constant, so denote them as c1, c2, c3, …</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*mVsNyLnzg9Lbk2DZGPxNHA.png" /></figure><p>Now let the endless term. “c<em>1h + c2h + c3h +..”</em> be “<em>theta(h)”</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*EOXIBmtUXIk6RPRkbMsYEg.png" /></figure><p>The form we got from the Taylor series is the same as differentiation but with an additional term <em>theta(h)</em>. When we apply numerical differentiation, we should not dismiss that the error rises because of the difference we are computing from getting the average between consecutive points. Still, the Taylor series was capable of inserting these errors in the form of <em>theta(h)</em> in our equation, so we finally get:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*IBaRAPzYeUKxaDiZBBMnew.png" /></figure><h3>Richardson extrapolation</h3><p>Richardson extrapolation uses the approximations we got to improve results. Using it accelerates the convergence to value with negligible error.</p><p><strong>For Forward Differentiation:</strong> Denote</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*SWD9AsGvd1wKrUgHmCzssw.png" /></figure><p>Richardson implies: Let</p><p>equation [a] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*x_3lxEwbpB0qo6u506jOeg.png" /></figure><p>equation [b] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*r_2Icz-c7NwbqqPSgOCPUQ.png" /></figure><p>The new approximation will be: 2[a] — [b]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*q9YsUGNll4u93Xoc-IV3hQ.png" /></figure><p>Where</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PkxvUKLT5sXsJUHPnXCSTg.png" /></figure><p><strong>For Backward Differentiation: </strong>Denote</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*0RWJJuZ3115zXA1noh7sgg.png" /></figure><p>Richardson implies: Let</p><p>Equation [a] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*Hwx_fLo4imd86iYpvJTl9A.png" /></figure><p>Equation [b] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*bZ3HwPPwhtVMRnDIBhZShQ.png" /></figure><p>The new approximation will be: 2[a] — [b]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*E893GU2MEyyxVOr2eTfHmw.png" /></figure><p>Where</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*RtCLnDyOGRVbAjlF9Kbhwg.png" /></figure><p><strong>For Central Differentiation:</strong> Denote</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*BK68JQoNxqM-0eZI9YiZ2g.png" /></figure><p>Richardson implies: Let</p><p>Equation [a] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*foRpJyfqDWtx1G2iGIT-ng.png" /></figure><p>Equation [b] be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*pdosLHt3i8Jywj29YafTNA.png" /></figure><p>The new approximation will be: 4[a] — [b]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*vYS_qsE41zmpM5eehg-4lQ.png" /></figure><p>Where</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*5OIsp3hmjD-Jb_0ioD5S8w.png" /></figure><p>We derive a general rule:</p><p>Richardson Extrapolation general rule for forward and backward difference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*8eTc69UAAQ-q9yWfvs0iEQ.png" /><figcaption>36</figcaption></figure><p>Both forward and backward are indeed the same rule. Still, the difference is the points we are using, whether backward differencing or forward differencing.</p><p>Richardson Extrapolation general rule for central difference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*Nv564YSi_emwy66LPY6B0A.png" /></figure><p>The higher the degree of k in Richardson rules, the more accurate we get at a certain point.</p><p>Example:</p><p>Using the central difference of Richardson to find <em>f’(0.5)</em> with <em>h=0.5</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*Mk-zp9ydQmWoIWRQsmeUgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*o3VWmEkRaH-LFSwVBsKU9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*MiQDvPYyZRlRgSn3hbkVzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*CyRIk626d1ZGtgHs89YDyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*798oCEOtpn3yN_G030AO6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*QO_XEQ5u15JPuSA5q8_txQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/1*6CcL0DllKfbUNL5-dFBtdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*us2xo9-bHi3S9_aZ_jemdg.png" /></figure><p>Notice how we have three empty slots because Richardson relies on two previous values to get one. And the value we got in “f” is the best approximation for this data, and you can spot the convergence.</p><h3>Summary</h3><p>To wrap up this article, I introduced a tool that minimizes the error to a certain level “Richardson Extrapolation” and showed how it was also obtained using another famous tool for linearization “Taylor Series”. On next, we reach the final missing piece to begin with Runge-Kutta.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e937b853071" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/eulers-runge-kutta-richardson-extrapolation-8e937b853071">Euler’s Runge-Kutta — Richardson Extrapolation</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Euler’s Runge-Kutta — Numerical Differentiation]]></title>
            <link>https://medium.com/munchy-bytes/eulers-runge-kutta-numerical-differentiation-ab65cbfb99b0?source=rss-cd4ebfcbba73------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab65cbfb99b0</guid>
            <category><![CDATA[euler]]></category>
            <category><![CDATA[numerical-differentiation]]></category>
            <category><![CDATA[runge-kutta]]></category>
            <category><![CDATA[numerical-analysis]]></category>
            <category><![CDATA[discrete-mathematics]]></category>
            <dc:creator><![CDATA[Mhmd Jawad Ahmad]]></dc:creator>
            <pubDate>Sat, 14 Jan 2023 06:02:20 GMT</pubDate>
            <atom:updated>2023-01-14T06:02:20.501Z</atom:updated>
            <content:encoded><![CDATA[<h3>Euler’s Runge-Kutta — Numerical Differentiation</h3><p>Runge-Kutta is one of Euler’s tools found to use during research. Euler is famous for establishing all sorts of mathematical tools. Still, Runge-Kutta is somehow unique. It is a tool used for numerical data. <br>This article is the first of the “Euler’s Runge-Kutta” series that aims to explain the analytical origin of the Runge-Kutta and how to use it. This article briefly explains numerical data and how derivation could be applied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*0wqt7MO7hpyB5M7cmauIGg.jpeg" /><figcaption>numerical operations (Reference: <a href="https://medium.com/analytics-vidhya/data-beyond-perception-c1ceef95b231">medium.com</a>)</figcaption></figure><h3>Working with Numerical data</h3><p>When everyone is introduced to functions, we are taught that they are what give case problems meaning. What attracts us to them is their simplicity to work with and how they can satisfy us with values and answers but is this the case in real life? What happens in real life is that when we obtain data about a particular problem, we are bound by the gaps between points. Thus we can not obtain a smooth continuous curve, for this is impossible. This will force us to manipulate data to try and work with it, and here lies the motive for Runge-Kutta.</p><h4>Discrete Data</h4><p>Points represent observations and data collected about a specific topic. Still, we’d need an infinite number of data to create continuous functions. Hence, what is obtained is called numerical data, which means discrete points. So, what is often seen are these types of plots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*iRpTDU-j21ctqV6ct5RypQ.png" /><figcaption>Discrete Points (Reference: <a href="https://www.expii.com/t/discrete-data-defintion-examples-4328">expii.com</a>)</figcaption></figure><p>Usually, in a case study, we try to estimate a function that best fits the data and use it as our source of information, but sometimes we need to be foggier for there are a lot of missing values. Runge-Kutta is designed to estimate these points, but before we go on with it, we need to clarify some basic concepts.</p><h3>Numerical Differentiation</h3><p>A normal derivative cannot be applied to numerical points. That’s why we use one of the following cases:</p><p>In a plot of discrete plots 2D: <em>yi</em> is the image of <em>x</em> at <em>i</em> and <em>xi</em> is the time at <em>i</em></p><h4>Backward vs. Centered vs. Forward difference</h4><p>Assume lag <em>h = xi+1 — xi</em> where <em>0 &lt; h &lt; 1</em></p><p>The lag should be slight, so we don’t lose a lot of data and keep the margin of error as low as possible.</p><p><em>f’(x) </em>≈</p><p><strong>Forward differentiation</strong> is the difference between the current point at <em>i</em> and <em>i+1</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*_skz711LyOw8YBlxVKE01w.png" /></figure><p><strong>Backward differentiation</strong> is the difference between the current point <em>i</em> and <em>i-1</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*FeQSrD3wu55I6Z5ZNiGudw.png" /></figure><p><strong>Central differentiation</strong> is the difference between <em>i+1</em> and <em>i-1</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*u93G2l6YdfgvqN_NuFceww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*sBN71fM5Tlfv0AcrBea3QQ.png" /><figcaption>Backward vs. Centered vs. Forward difference (Reference: <a href="https://www.semanticscholar.org/paper/Finite-Difference-Method-for-the-Biharmonic-with-of-HaniyahA.-Hamdin/cbe28118f4e69733306b8a039cae7a24d800268b/figure/2)">semanticscholar.org)</a></figcaption></figure><p>When we have a set of points, and we want to find <em>f(n)(x) </em>with one of the differentiation methods, we use a recursive difference to find it. We have the base element, which is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*zjS20eaJcG5-z1OddCOpXg.png" /></figure><p>The thing with this method is that it applies to all three differentiations, but what differs them is how we choose the points where the backward difference is also the forward difference of the previous point; we get:</p><p><strong>For forward differentiation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*lWZ6FUZOBG-Boo4qxLjavA.png" /></figure><p><strong>For backward differentiation:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*6udLzp4yRQSOKH8f8gSAhQ.png" /></figure><p><strong>For central differentiation:</strong></p><p>· In case of an even number of points:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*WF6Su3BR2ErWcAEnP7XQbw.png" /></figure><p>· In case of an odd number of points:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ZCu8miopjgXQAU09Eh3HrA.png" /></figure><p>Example: get backward differentiation of <em>f’’’(1)</em> for <em>h = 0.25</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*h2Z3_aNT0ePPzUKF9JdyKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*NHE4SP5tzB0O4kE9SEOmDw.png" /></figure><p><strong>MATLAB code for this recursive function</strong></p><pre>Function d = diff(y,h)<br>  n=length(y)<br>  if(n==2)<br>    d = (y(2) - y(1))/h;<br>  else<br>    d=(diff(y(2:n-1),h) - diff(y(1:n-1),h))/((n-1)*h);<br>  end if<br>end</pre><h3>Summary</h3><p>This article explained how derivation is applied to numerical data. The following article in this series will focus on Richardson Extrapolation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab65cbfb99b0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/munchy-bytes/eulers-runge-kutta-numerical-differentiation-ab65cbfb99b0">Euler’s Runge-Kutta — Numerical Differentiation</a> was originally published in <a href="https://medium.com/munchy-bytes">Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>