<?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 Rem Bahadur Gharti on Medium]]></title>
        <description><![CDATA[Stories by Rem Bahadur Gharti on Medium]]></description>
        <link>https://medium.com/@ghartirem072?source=rss-425c1562966d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*e4bjmaM0VUy3nFL7</url>
            <title>Stories by Rem Bahadur Gharti on Medium</title>
            <link>https://medium.com/@ghartirem072?source=rss-425c1562966d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:40:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ghartirem072/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[Computational Mathematics]]></title>
            <link>https://medium.com/@ghartirem072/computational-mathematics-91be4862821e?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/91be4862821e</guid>
            <category><![CDATA[sagemath]]></category>
            <category><![CDATA[computational-mathematics]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Mon, 14 Apr 2025 02:15:32 GMT</pubDate>
            <atom:updated>2025-04-14T02:16:28.514Z</atom:updated>
            <content:encoded><![CDATA[<p>Computational mathematics is when we use computers and math together to solve complex problems. It’s basically math done with computers to figure out stuff that would take forever to do by hand. People who work in this field write computer code and use special methods to handle things like weather predictions, engineering problems, or analyzing big sets of data. They mix computer science skills with mathematical ideas to tackle real-world issues. This field keeps growing as computers get better and we need to solve harder problems. Engineers, scientists, and researchers rely on computational math daily — whether they’re designing new products, studying climate patterns, or working on financial models. It’s really just about using computers as a tool to do complicated math faster and more accurately than humans can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bLtJvPFjINQasyIXwexng.png" /></figure><h3><strong>Python Basics</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91be4862821e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perturbation Method for Solving Differential Equations]]></title>
            <link>https://medium.com/@ghartirem072/perturbation-method-for-solving-differential-equations-b4b32a80fd11?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4b32a80fd11</guid>
            <category><![CDATA[differential-equations]]></category>
            <category><![CDATA[homotopy]]></category>
            <category><![CDATA[perturbation-theory]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 16:49:23 GMT</pubDate>
            <atom:updated>2024-02-19T16:49:23.600Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*FbYzvbUMRsLA-qTvGgGa2g.png" /></figure><p>The perturbation method represents a fundamental technique within the realm of mathematical analysis, specifically tailored for addressing the complexities inherent in differential equations that defy direct analytical resolution. By introducing a small parameter that characterizes deviations from known solutions, this method facilitates the systematic derivation of approximations through the utilization of series expansions. Through iterative refinement, these approximations converge toward solutions, illuminating the nuanced behavior of the underlying system and affording a nuanced understanding of phenomena spanning disciplines such as quantum mechanics and fluid dynamics. As a versatile tool, the perturbation method finds application across diverse scientific domains, offering a rigorous framework for dissecting intricate systems characterized by elusive analytical solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*IN3J-CnhE5QlL09tLDdlKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*URvadG6IRqoiujycGDsCrA.png" /></figure><p><strong>Meaning of Perturbation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*wujOKaqKaKzIJYZl_U3HVA.png" /></figure><p>Unperturbed and Perturbed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*FbYzvbUMRsLA-qTvGgGa2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*g4MbbM6RqOVxJk4fQ2M_WQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*Iji9SHbpwD8-X5OQdEnXuQ.png" /></figure><p><strong>Perturbation Solution</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*zLjWT8rAKA_HTbTK__cAzw.png" /></figure><p><strong>Example :- 1(ODE)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*AX34144zS75vyZ7xI2LbPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*7oY33qFGIIynJDjKkobHFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*zxl6Ej9s1Cvd7kNRPAuQnQ.png" /></figure><p><strong>Example :-2 (ODE)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*BBD8zHZheguSVZnD28HPmg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*zUCjjAoaK65OvHQYPHsqxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*9t7mEwJVqCB_NsK7FeVRuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*0-aX9KJw66IYD4c5YcNx7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*wfF3FAmGGi_nMuyyki5bwg.png" /></figure><p><strong>Example :- 3 (PDE)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*QguAnuj_vW9HRI4puZKsvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*17Y7acP05xdsOHbfBgkGMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*NGY2aBDPAJXmpJw3CPUk5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*b5AjMgjrudGspYanqYym6Q.png" /></figure><p><strong>[4]Homotopy Perturbation Method</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*eeaNQZRKxyL1yGEv4aLtZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*jNHwjvJDZmKuuB37CCNcgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*FJN0prOwmG0OPG21T-K-0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*2G31SbhUJyYgFHQNT28tKg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*O5VyCko4AyHpwprIBaPYVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*Lcmw7r1y7Ha2EBaDd6_ZnA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*IFTHGE0Cn9wNAB4sn1JtBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*JVBL0V9vfT-PrRCWTbmZiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*vaDSDknACtDf2NCMgtBO0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*KiQDrmiKqfTfRyPyVEIG0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwkQYk5-ELqq4XzGluOpFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwkQYk5-ELqq4XzGluOpFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*NYa_bukwVMfrF046QvBRzg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4b32a80fd11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Branches & Loops in MATLAB]]></title>
            <link>https://medium.com/@ghartirem072/branches-loops-in-matlab-90ac9ae2d7e3?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/90ac9ae2d7e3</guid>
            <category><![CDATA[for-and-while-loop]]></category>
            <category><![CDATA[loop-in-matlab]]></category>
            <category><![CDATA[conditional-statements]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 07:31:03 GMT</pubDate>
            <atom:updated>2024-02-19T15:37:41.468Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*Y9OL9291kDX0rgUp18pm4w.png" /></figure><p><strong>Branches</strong></p><p>Branches in MATLAB are used to create conditional logic, allowing different blocks of code to be executed based on specified conditions.The primary conditional statements used for branching in MATLAB are if, elseif, and else. Thse are also known as conditional statements.</p><ol><li><strong>if statement</strong></li></ol><p>Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*3hokyZSztPIoNv73XKGTfQ.png" /></figure><p>Example</p><pre>% Illustration of if statement<br>a = 50; % Variable declaration<br>if(a&gt;=50)<br>  disp(&#39;You are pass in the exam wher full mark is 100&#39;);<br>end</pre><p><strong>2. if … else statement</strong></p><p>Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*0y-2X73AwraKpEb6EUz5TQ.png" /></figure><p>Example</p><pre>% Illustration of if .. else statement<br>age = 19;  % varialble declaration<br>if(age &gt;=20)<br>  disp(&#39;You can go to party&#39;);<br>else<br>  disp(&#39;You can not go to party&#39;);<br>end</pre><p><strong>3. if … elseif Statement</strong></p><p>Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*yudNWyXjA0SLMppfkFDqhg.png" /></figure><p>Example</p><pre>%Illustration of if ... elseif Statment<br>% MATLAB Program for Simple Calculator<br>n1 = input(&#39;Enter first number:&#39;);<br>n2 = input(&#39;Enter second number:&#39;);<br>op = input(&#39;Enter operator + or - or * or /:&#39;,&#39;s&#39;);% s for character<br>if(op==&#39;+&#39;)<br>  fprintf(&#39;Addition is %f\n&#39;,n1+n1);<br>elseif(op==&#39;-&#39;)<br>  fprintf(&#39;Subtraction is %f\n&#39;,n1-n1);<br>elseif(op==&#39;*&#39;)<br>  fprintf(&#39;Multiplication is %f\n&#39;,n1*n1);<br>elseif(op==&#39;/&#39;)<br>  fprintf(&#39;Division is %f\n&#39;,n1/n1);<br>else<br>  disp(&#39;Invalid Operator&#39;);<br>end</pre><p><strong>4. Nested if statement</strong></p><p>Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*7GmEfDC3RnjEn9YYya1KxA.png" /></figure><p>Example</p><pre>% MATLAB Program for Simple Calculator where division by zero is not allowed<br>n1 = input(&#39;Enter first number:&#39;);<br>n2 = input(&#39;Enter second number:&#39;);<br>op = input(&#39;Enter operator + or - or * or /:&#39;,&#39;s&#39;);% s for character<br>if(op==&#39;+&#39;)<br>  fprintf(&#39;Addition is %f\n&#39;,n1+n1);<br>elseif(op==&#39;-&#39;)<br>  fprintf(&#39;Subtraction is %f\n&#39;,n1-n1);<br>elseif(op==&#39;*&#39;)<br>  fprintf(&#39;Multiplication is %f\n&#39;,n1*n1);<br>elseif(op==&#39;/&#39;)<br>  fprintf(&#39;Division is %f\n&#39;,n1/n1);<br>    if(n2==0)<br>    disp(&#39;Division by zeor is not allowed&#39;);<br>    end<br>else<br>  disp(&#39;Invalid Operator&#39;);<br>end</pre><p>Branches are commonly used to implement decision-making logic, such as determining whether to execute a certain block of code based on user input or the result of a calculation.</p><p><strong>Loops</strong></p><p>Branches are commonly used to implement decision-making logic, such as determining whether to execute a certain block of code based on user input or the result of a calculation.</p><p>MATLAB supports different types of loops:</p><p>for loop:</p><p>This loop iterate over a specified range of values. This can go up to less than infinity.</p><p><strong>Syntax;</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*92XfOzNHA7jBergPp_ZUag.png" /></figure><p>Example</p><pre>% Iterate 1 to 10 <br>for(i = 1:10)<br>  disp(i);<br>end</pre><p>Example</p><p>Q. Write a MATLAB Program for factorial of a given positive integer?</p><pre>% MATLAB Program for factorial of a number<br>n = input(&#39;Enter a positive number&#39;);<br>if(n==0 || n ==1)<br>  fprintf(&#39;Factorial of %d is %d\n&#39;,1);<br>end<br>fact = 1;<br>i = 1;<br>for(i = 1:n)<br>  fact = fact*i;<br>end<br>fprintf(&#39;Factorial of %d is %d\n&#39;,fact);</pre><p>While Loop</p><p>This loop continue executing a block of code as long as a specified condition is true. It can go up to infinity.</p><p>Syntax:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*twjFrouWFhFFybFbmhsLFg.png" /></figure><p>Example</p><pre>%Illustration of MATLAB  program for while loop<br>i = 0;<br>while(i&lt; = 10)<br>  disp(i);<br>  i = i+1<br>end</pre><p>Q. Write a MATLAB Program for factorial of a given positive integer by while loop?</p><pre>% Factorial of a number by while loop<br>n = input(&#39;Enter the positive integer:&#39;);<br>if(n==0 || n ==1)<br>  fprintf(&#39;Factorial of %d is %d\n&#39;,1);<br>end<br>fact = 1;<br>i = 1;<br>while(i==n)<br>  fact = fact*i;<br>  i = i+1;<br>end<br>disp(&#39;Factorial is %d\n&#39;,fact);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90ac9ae2d7e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Approximation of the Value of π (pi) by Monte Carlo Simulation in Python]]></title>
            <link>https://medium.com/@ghartirem072/approximation-of-the-value-of-%CF%80-pi-by-monte-carlo-simulation-in-python-a0f11169694c?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0f11169694c</guid>
            <category><![CDATA[simulation]]></category>
            <category><![CDATA[value-of-pi]]></category>
            <category><![CDATA[approximation-of-pi]]></category>
            <category><![CDATA[computing-in-python]]></category>
            <category><![CDATA[monte-carlo-simulation]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Sun, 18 Feb 2024 18:07:56 GMT</pubDate>
            <atom:updated>2024-02-18T18:07:56.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*2Qz07SbbCMn8zZSyj4L6GQ.png" /></figure><p>Simulation is a technique used to mimic the behavior of a real-world system or process by creating a model that represents its key characteristics and dynamics. This model can be implemented on a computer or in a physical environment to observe and analyze how the system would behave under different conditions or scenarios.</p><p>Monte Carlo simulation is a computational technique used to estimate the value of a mathematical function or to solve a problem through repeated random sampling. When used to approximate the value of π (pi), it involves randomly generating points within a square that circumscribes a circle, and then calculating the ratio of points that fall within the circle to the total number of points generated.</p><p>The mathematical constant π (pi), approximately equal to 3.14159, is a fundamental ratio that represents the circumference of a circle to its diameter. Since ancient times, mathematicians have sought ways to accurately calculate this irrational number. One modern computational method that has gained popularity is the Monte Carlo simulation. In this article, we will explore how to approximate the value of π using Monte Carlo simulation in Python.</p><p><strong>Understanding Monte Carlo Simulation</strong></p><p>Monte Carlo simulation is a computational technique that uses random sampling to approximate the solution to mathematical problems. It is named after the famous Monte Carlo Casino in Monaco, known for games of chance that rely on random outcomes. In the context of approximating π, Monte Carlo simulation involves randomly generating points within a square that circumscribes a circle and then using the ratio of points inside the circle to estimate π.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*2Qz07SbbCMn8zZSyj4L6GQ.png" /></figure><p><strong>Python Implementation</strong></p><pre>import random<br><br>def estimate_pi(num_points):<br>    inside_circle = 0<br>    for _ in range(num_points):<br>        x = random.uniform(-1, 1)<br>        y = random.uniform(-1, 1)<br>        if x**2 + y**2 &lt;= 1:<br>            inside_circle += 1<br>    return (inside_circle / num_points) * 4<br><br># Number of points for estimation<br>num_points = 1000000<br><br># Estimating pi<br>pi_estimate = estimate_pi(num_points)<br>print(&quot;Approximation of pi using Monte Carlo simulation:&quot;, pi_estimate)</pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWps16zYtoqE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWps16zYtoqE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWps16zYtoqE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a98e121df6603f12f6d2d13ba92ccebd/href">https://medium.com/media/a98e121df6603f12f6d2d13ba92ccebd/href</a></iframe><p><strong>Conclusion</strong></p><p>Monte Carlo simulation provides a practical and intuitive approach to approximating the value of π, highlighting the intersection of mathematics and computer science in solving real-world problems.</p><p><strong>References</strong></p><p>[1] Binder, K., &amp; Heermann, D. W. (2002). An Introduction to Monte Carlo Simulation of Statistical Physics.</p><p>[2] Press, W. H., Teukolsky, S. A., Vetterling, W. T., &amp; Flannery, B. P. (2007). Numerical Recipes: The Art of Scientific Computing.</p><p>[3] Monte Carlo Methods” by Art B. Owen — This book provides a comprehensive introduction to Monte Carlo methods and their applications in various fields, including mathematics and computational science.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0f11169694c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scientific Computing with Python(Application of Finite Difference Method)]]></title>
            <link>https://medium.com/@ghartirem072/scientific-computing-with-python-application-of-finite-difference-method-70fd9edff112?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/70fd9edff112</guid>
            <category><![CDATA[laplace-equation]]></category>
            <category><![CDATA[diffusion-equation]]></category>
            <category><![CDATA[wave-equation]]></category>
            <category><![CDATA[heat-equation]]></category>
            <category><![CDATA[scientific-computing]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Wed, 07 Feb 2024 04:12:31 GMT</pubDate>
            <atom:updated>2024-02-07T04:12:31.435Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The finite difference method is one of the technique to obtain the numerical solution of the partial differential as well as algebraic equations. In this method the solutions are approximated in the discrete form in the finite grid points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*2zDrorywta_HMIIA-x2REQ.png" /></figure><p>Divide [0,1]x[0,T] to MxN rectangles of size hxk. (<em>x</em>0​,<em>x</em>2​,…,<em>xm</em>​); <em>xm</em>​ = mh, m = 0,1,…,M and (t0,t1,…,tN); tn = nk, n= 0,1,2,…,N, for a function V defined on the grid, we write V_{m}^{n} for the value at the grid point (tn, xm) where u is defined and continuously varying (t, x), we use h = <strong>Δx and k</strong>= <strong>Δt.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*_qqHtmYJMd0XM6vxD_11uA.png" /></figure><p><strong>Definition(Grid level n)</strong></p><p>The set of points (tn, xn) for fixed value of n is called grid n.</p><p><strong>Definition(One step scheme)</strong></p><p>Those schemes that involve V at only two levels n and n+1 are called one step scheme.</p><p>Let us consider a Partial Differential Equation,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/1*04z4LraaMZjjQM7mdXRAxw.png" /></figure><ol><li>Forward Time Forward Space Scheme is given by</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*vTlcWC6h-LmmGvNEatx9yw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*H9O4uFTV41wuTW-gZDSYDA.png" /></figure><p>2. Forward Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*wuGi0MLuHeOgqu2fth2GxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*DhGLVQK_8QK48GjbuaeEfA.png" /></figure><p>3. Central Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*SPZc9ba2SBMUy3uLPV-tJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Vcx2fWe1TxDN4fKEBuWe4Q.png" /></figure><p>Let us consider a Partial Differential Equation,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Yp_oq5KEn9oeAlR6M2Nnjw.png" /></figure><p>The Forward Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*bGitrkAgNMpNjuUTs4mCJA.png" /></figure><ol><li><strong>Finite Difference Scheme for Heat Equation</strong></li></ol><ul><li>It is a Parabolic Equation,</li><li>General form of Heat Equation is given by,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*NdkVv6IA0CYzhg34SbK3fQ.png" /></figure><p><strong>Development of general Scheme</strong></p><p>Here,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Yp_oq5KEn9oeAlR6M2Nnjw.png" /></figure><p>Forward Time Central Space Scheme (FTCSS) is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*bGitrkAgNMpNjuUTs4mCJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*tKb5U8mlfiXp4oVhZH8hMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*-bC38pQTUhMzE00sRKQTPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ClqdyAE4ms85PjBnmjx5fw.png" /></figure><p>This is the required scheme for Heat equation,</p><p><strong>Problem:-1(Find the numerical solution of this problem by Python program)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*CO3P2b8-iUaIXQMCdBaDqA.png" /></figure><p>Python Program for this problem is given below,</p><pre>#Import Essential Libraries<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Parameters<br>L = 1  # Length of rod<br>T = 1  # Maximum time bound<br>m = 5  # No. of intervals in space<br>n = 5  # No. of intervals in time<br>h = L / m  # Step size in space<br>k = T / n  # Step size in time<br>b = 0.05  # Coefficient of diffusivity<br>mu = k / h**2  # k = k / h * h<br><br># Check stability<br>c = b * mu<br>if c &lt;= 0 or c &gt;= 0.5:<br>    print(&#39;Scheme is unstable&#39;)<br><br># Initialization of solution<br>v = np.zeros((m + 1, n + 1))<br><br># Initial condition<br>ic1 = lambda x: np.sin(np.pi * x)<br><br># Space discretization<br>for j in range(1, m + 2):<br>    v[0, j - 1] = ic1((j - 1) * h)<br><br># Boundary condition<br>b1 = lambda t: 0  # L.B.C<br>b2 = lambda t: 0  # R.B.C<br><br># Time discretization<br>for i in range(1, n + 2):<br>    v[i - 1, 0] = b1((i - 1) * k)<br>    v[i - 1, n] = b2((i - 1) * k)<br><br># Implementation of the scheme<br>for i in range(n):<br>    for j in range(1, m):<br>        v[i + 1, j] = (1 - 2 * b * mu) * v[i, j] + b * mu * v[i, j + 1] + b * mu * v[i, j - 1]<br><br># Visualization<br>x = np.linspace(0, L, m + 1)<br>t = np.linspace(0, T, n + 1)<br>X, T = np.meshgrid(x, t)<br><br>fig = plt.figure()<br>ax = fig.add_subplot(111, projection=&#39;3d&#39;)<br>ax.plot_surface(X, T, v, cmap=&#39;viridis&#39;)<br>ax.set_xlabel(&#39;Space X&#39;)<br>ax.set_ylabel(&#39;Time T&#39;)<br>ax.set_zlabel(&#39;V&#39;)<br>plt.title(&#39;Python Program for Heat Equation&#39;)<br>plt.show()</pre><p>Visualization of the Numerical solution is below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*2l0gwuEIJ8SLrkhAKEjh_A.png" /><figcaption>Variation of temperature distribution</figcaption></figure><p><strong>Problem:-2(Find the numerical solution of this problem by MATLAB program)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*RLd_OAGbViAp4n-5et81Gg.png" /></figure><p>Python Program for this problem is given below,</p><pre>#Importing Essential Libraries<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Parameters<br>L = 1  # Length of rod<br>T = 1  # Maximum time bound<br>m = 5  # No. of intervals in space<br>n = 5  # No. of intervals in time<br>h = L / m  # Step size in space<br>k = T / n  # Step size in time<br>b = 0.05  # Coefficient of diffusivity<br>mu = k / h ** 2  # k = k / h * h<br><br># Check stability<br>c = b * mu<br>if c &lt;= 0 or c &gt;= 0.5:<br>    print(&#39;Scheme is unstable&#39;)<br><br># Initialization of solution<br>v = np.zeros((m + 1, n + 1))<br><br># Initial condition<br>ic1 = lambda x: 2 * x<br>ic2 = lambda x: 2 * (1 - x)<br><br># Space Discretization<br>x = np.linspace(0, L, m + 1)<br># Space Discretization<br>x = np.linspace(0, L, m + 1)<br>for j in range(1, m + 2):<br>    if x[j - 1] &lt; 0.5:<br>        v[0, j - 1] = ic1(x[j - 1])  # x &lt; 0.5<br>    else:<br>        v[0, j - 1] = ic2(x[j - 1])  # otherwise<br><br># Boundary condition<br>b1 = lambda t: 0  # L.B.C<br>b2 = lambda t: 0  # R.B.C<br><br># Time discretization<br>for i in range(1, n + 2):<br>    v[i - 1, 0] = b1((i - 1) * k)<br>    v[i - 1, n] = b2((i - 1) * k)<br><br># Implementation of the scheme<br>for i in range(n):<br>    for j in range(1, m):<br>        v[i + 1, j] = (1 - 2 * b * mu) * v[i, j] + b * mu * v[i, j + 1] + b * mu * v[i, j - 1]<br><br># Visualization<br>x = np.linspace(0, L, m + 1)<br>t = np.linspace(0, T, n + 1)<br>X, T = np.meshgrid(x, t)<br><br>fig = plt.figure()<br>ax = fig.add_subplot(111, projection=&#39;3d&#39;)<br>ax.plot_surface(X, T, v, cmap=&#39;viridis&#39;)<br>ax.set_xlabel(&#39;Space X&#39;)<br>ax.set_ylabel(&#39;Time T&#39;)<br>ax.set_zlabel(&#39;V&#39;)<br>plt.title(&#39;Python Program for Heat Equation&#39;)<br>plt.show()</pre><p>Visualization of the Numerical solution is below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*2l0gwuEIJ8SLrkhAKEjh_A.png" /><figcaption>Variation of temperature distribution</figcaption></figure><p><strong>2. Finite Difference Method for Laplace Equation</strong></p><p>The homogenous part of the Poison’s equation is known as Laplace equation and it is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Ig1kgpn_q08xlB3CQ3RvvQ.png" /></figure><p>Note, it has not time parameter</p><p><strong>Scheme Development</strong></p><p>We have the central Space scheme in Y axis is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Q-ZnkoKXWAnIhy0TqKQ7Mw.png" /></figure><p>We have the central space scheme in X axis is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*pfiF3MzwY0ozPWjyOOAQSA.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Ig1kgpn_q08xlB3CQ3RvvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*lKcekGbAjOiWdukOzHzTgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*6GSEwaV9GeL3vnwI4LzkZg.png" /><figcaption>m — X axis, n — Y axis</figcaption></figure><p>This scheme is unconditionally stable.</p><p><strong>Problem:-1 Solve the given problem numerically by using MATLAB program,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*EFrokpZbsH_EimN74grTyw.png" /></figure><p>Python Program for this problem is given below,</p><pre>#Importing Essential Libraries<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Parameters<br>Lx = 1  # Length in X axis<br>Ly = 1  # Length in Y axis<br>m = 5  # No. of intervals in X axis<br>n = 5  # No. of intervals in Y axis<br><br># Step sizes<br>h = Lx / m  # Step size in X axis<br>k = Ly / n  # Step size in Y axis<br><br># Initialization of solution matrix<br>v = np.zeros((m + 1, n + 1))<br><br># Use condition for X axis<br>for j in range(m + 1):<br>    v[j, 0] = 0<br>    v[j, n] = -2  # Corrected index<br><br># Use condition for Y axis<br>for i in range(n + 1):<br>    v[0, i] = 0<br>    v[m, i] = 5<br><br># Implementation of scheme<br>for i in range(1, m):<br>    for j in range(1, n):<br>        v[i, j] = ((h**2) * (v[i, j + 1] + v[i, j - 1]) + (k**2) * (v[i + 1, j] + v[i - 1, j])) / (2 * (h**2 + k**2))<br><br># Visualization<br>x = np.linspace(0, Lx, m + 1)<br>y = np.linspace(0, Ly, n + 1)<br>X, Y = np.meshgrid(x, y)<br><br>fig = plt.figure()<br>ax = fig.add_subplot(111, projection=&#39;3d&#39;)<br>ax.plot_surface(X, Y, v, cmap=&#39;viridis&#39;)<br>ax.set_xlabel(&#39;Space X&#39;)<br>ax.set_ylabel(&#39;Space Y&#39;)<br>ax.set_zlabel(&#39;V&#39;)<br>plt.title(&#39;Python Program for Laplace Equation&#39;)<br>plt.show()</pre><p>Visualization of the Numerical solution is below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*D9pdzWD0gG_-PZ2Zaq2XRQ.png" /><figcaption>Numerical solution of Laplace equation</figcaption></figure><p><strong>3. Finite Difference Method for Advection Diffusion Equation</strong></p><p>Advection Diffusion Equation is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*K7pL8T-cRNwDr8HGu_d6kA.png" /></figure><p><strong>Scheme Development</strong></p><p>Forward Time Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*6k86N6kqN7VFxsOvI8Ja8A.png" /></figure><p>Forward Space Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*c6M7q3obcsJX0Yjz0-tqzg.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*KzWYvI5rpuoB-W7gI5vLWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Tik-YYYoRuFz7Yl5HTj9aA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*3kxeSA0PY3tAEDUc4jrk_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*MoZExIK5O9zQqztPSwxszA.png" /></figure><p>Hence the final scheme becomes,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*zuwx7U9WXDQKGJHGb0bTRg.png" /></figure><p><strong>Problem:-1 </strong>Derive the scheme for Advection Diffusion Equation and solve numerically by MATLAB Program,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ACsZxR6Dn3Wi9kL4PIpEVQ.png" /></figure><p>The required Scheme is shown above,</p><p>Python Program for this problem is given below,</p><pre>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Parameters<br>L = 100  # Total length<br>T = 1  # Maximum time bound<br>m = 5  # No. of intervals in space<br>n = 5  # No. of intervals in time<br>h = L / m  # Step size in space<br>k = T / n  # Step size in time<br>D = (1E-7) * 3600  # Coefficient of diffusion<br>V = (1E-6) * 3600  # Velocity<br><br># Coefficient calculation<br>G = (V * k) / h<br>F = (D * k) / (h ** 2)<br><br># Initialization of solution matrix<br>v = np.zeros((n + 1, m + 1))<br><br># Initial condition<br>for j in range(m + 1):<br>    v[0, j] = 100<br><br># Implementation of the scheme<br>for i in range(n):<br>    for j in range(1, m):<br>        v[i + 1, j] = (1 - G - 2 * F) * v[i, j] + (F - G) * v[i, j + 1] + F * v[i, j - 1]<br><br># Visualization<br>x = np.linspace(0, L, m + 1)<br>t = np.linspace(0, T, n + 1)<br>X, T = np.meshgrid(x, t)<br><br>fig = plt.figure()<br>ax = fig.add_subplot(111, projection=&#39;3d&#39;)<br>ax.plot_surface(X, T, v, cmap=&#39;viridis&#39;)<br>ax.set_xlabel(&#39;Space X&#39;)<br>ax.set_ylabel(&#39;Time T&#39;)<br>ax.set_zlabel(&#39;V&#39;)<br>plt.title(&#39;Python Program for Advection Diffusion Equation&#39;)<br>plt.show()</pre><p>Visualization of the numerical solution,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*Szx02jYkgZTclLsXcY7xcg.png" /><figcaption>Distribution of the Concentration of dissolved substance</figcaption></figure><p><strong>4. Finite Difference Method for 1D wave Equation</strong></p><p>The PDE of the form,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*ViL8VPjal0BvQfAweav3vQ.png" /></figure><p>In discrete form we have,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*2Vp05qkbdXGrIXUNNsQuuw.png" /></figure><p>Central Time Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*FGFLhHKS-s8_BgCNOA9SZA.png" /></figure><p>Central Space Scheme is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*7JisAedL60ckWTFQJgT97g.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*LBKhvx62c4ycts_X1JrNzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*CgW2_BPNRf94eYqA-Q_GDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*NFFoN8oL79kJI5qCDm3s_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*4u3WUxy9qosUu59JtAAIlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*FgzpbysfjdVkFyuJZMBULg.png" /></figure><p>This scheme is stable if</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*P1jDKQrDsN6en17WqIm5Bg.png" /></figure><p>This scheme is also known as 3 level scheme,</p><p><strong>Problem:-1 Solve the given problem numerically by using MATLAB Program,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*rRtCEUlkiaS8JEoopKQ4yg.png" /></figure><p>We have the scheme</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Ipui3JsuzX8STX-9Am6VdA.png" /></figure><p>Also we have the central difference in time is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*57sGGJKk5yRcasrJ6aibfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*tXFF6ZgN2i1Ftg0poXZwJw.png" /></figure><p>Put n = 0 we get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Ce9lzGVw10r8fHZBWUZ47w.png" /></figure><p>Put n = 0 in 1 we get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*nVaq8A5SjquhIMiz5RgyPg.png" /></figure><p>After solving 2 and 3 equation we get the scheme for initial condition of derivative type,</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*IX0njiBiBItnynhvEh8klQ.png" /></figure><p>Python Program for above problem to solve numerically,</p><pre>#Importing Essential Libraries<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br># Parameters<br>L = 1  # Length of string<br>T = 1  # Maximum time bound<br>m = 5  # No. of intervals in space<br>n = 5  # No. of intervals in time<br>h = L / m  # Step size in space<br>k = T / n  # Step size in time<br>b = 1  # Coefficient of wave velocity<br><br># Stability check<br>mu = k ** 2 / h ** 2<br>b = b ** 2<br>c = b * mu<br>if c &lt;= 0 or c &gt; 1:<br>    print(&#39;Scheme is unstable&#39;)<br><br># Initialization of solution<br>v = np.zeros((m + 1, n + 1))<br><br># Initial condition<br>ic1 = lambda x: 10 * np.sin(np.pi * x)<br>ic2 = lambda x: 0<br><br># Space discretization<br>for j in range(m + 1):<br>    v[0, j] = ic1((j) * h)<br><br># Derivative type initial condition<br>for j in range(1, m):<br>    v[1, j] = (1 - c) * v[0, j] + 0.5 * c * v[0, j + 1] + 0.5 * c * v[0, j - 1] + k * ic2((j) * h)<br><br># Boundary condition<br>b1 = lambda t: 0  # L.B.C<br>b2 = lambda t: 0  # R.B.C<br><br># Time discretization<br>for i in range(1, n + 1):<br>    v[i, 0] = b1((i) * k)<br>    v[i, m] = b2((i) * k)<br><br># Implementation of the scheme<br>for i in range(1, n):<br>    for j in range(1, m):<br>        v[i + 1, j] = 2 * (1 - c) * v[i, j] + c * v[i, j + 1] + c * v[i, j - 1] - v[i - 1, j]<br><br># Visualization<br>x = np.linspace(0, L, m + 1)<br>t = np.linspace(0, T, n + 1)<br>X, T = np.meshgrid(x, t)<br><br>fig = plt.figure()<br>ax = fig.add_subplot(111, projection=&#39;3d&#39;)<br>ax.plot_surface(X, T, v, cmap=&#39;viridis&#39;)<br>ax.set_xlabel(&#39;Space X&#39;)<br>ax.set_ylabel(&#39;Time T&#39;)<br>ax.set_zlabel(&#39;V&#39;)<br>plt.title(&#39;Python Program for 1D Wave Equation&#39;)<br>plt.show()</pre><p>Visualization of the numerical solution,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*_Wd7uWMd367cshDgVnCtqQ.png" /><figcaption>Numerical solution of 1D wave Equation</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70fd9edff112" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompt Engineering and its importance]]></title>
            <link>https://medium.com/@ghartirem072/prompt-engineering-and-its-importance-e5cc04ecca1e?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5cc04ecca1e</guid>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[content-creation]]></category>
            <category><![CDATA[content-writing]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 18:03:11 GMT</pubDate>
            <atom:updated>2024-02-05T18:03:11.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRCmQhD5uJQ_Q34hsgjMFQ.png" /></figure><p>Artificial Intelligence ( A.I.)</p><p>AI, or artificial intelligence, refers to the simulation of human intelligence processes by machines, especially computer systems. These processes include learning (the acquisition of information and rules for using the information), reasoning (using rules to reach approximate or definite conclusions), and self-correction.</p><p>AI is a broad field that encompasses various subfields, including machine learning, natural language processing, computer vision, robotics, and expert systems, among others. The goal of AI is to create systems that can perform tasks that would typically require human intelligence. These tasks can range from simple, such as recognizing patterns in data, to complex, such as understanding natural language or making decisions in uncertain environments.</p><p>AI systems can be classified into two main categories: narrow AI and general AI. Narrow AI, also known as weak AI, is designed to perform specific tasks or solve specific problems within a limited domain. Examples of narrow AI include virtual personal assistants like Siri or Alexa, recommendation systems used by online platforms, and image recognition software. In contrast, general AI, also known as strong AI or artificial general intelligence (AGI), would have the ability to understand, learn, and apply knowledge across a wide range of tasks, similar to human intelligence. While narrow AI has made significant advancements and is prevalent in various applications today, achieving general AI remains a long-term goal and a subject of ongoing research in the field of artificial intelligence.</p><p>Artificial intelligence (AI) can be broadly classified into two main types based on its capabilities and scope: narrow AI (also known as weak AI) and general AI (also known as strong AI or artificial general intelligence).</p><p>1. Narrow AI(Weak AI):</p><p>Narrow AI refers to AI systems that are designed and trained for specific tasks or domains within a limited scope. These systems excel at performing a particular task or solving a specific problem but lack the ability to generalize their intelligence beyond that task. Narrow AI is the most common form of AI in use today and encompasses various applications across different industries. Examples of narrow AI include:</p><p>- Virtual Personal Assistants: These AI-powered assistants, such as Siri, Alexa, and Google Assistant, are designed to perform tasks like setting reminders, answering questions, and providing personalized recommendations.</p><p>- Recommendation Systems: These AI algorithms analyze user data to provide personalized recommendations for products, services, or content, enhancing user experience and engagement on platforms like Netflix, Amazon, and Spotify.</p><p>- Image and Speech Recognition: AI systems capable of recognizing and analyzing images, videos, or speech, enabling applications such as facial recognition, object detection, and speech-to-text transcription.</p><p>- Autonomous Vehicles: AI technology is used in autonomous vehicles to perceive the environment, make driving decisions, and navigate safely without human intervention.</p><p>2. General AI (AGI):</p><p>General AI, or artificial general intelligence, refers to AI systems that exhibit human-like intelligence and are capable of understanding, learning, and applying knowledge across a wide range of tasks and domains. Unlike narrow AI, which is designed for specific tasks, AGI aims to replicate the breadth and depth of human intelligence. Achieving AGI remains a long-term goal and poses significant scientific and technical challenges. While narrow AI systems excel at specific tasks, they lack the versatility and adaptability of human intelligence. AGI would have the ability to generalize knowledge, learn from diverse experiences, reason across different domains, and exhibit creativity and problem-solving skills akin to human cognition.</p><p>In summary, narrow AI is designed for specific tasks within a limited domain and is prevalent in various applications today, while general AI represents the aspirational goal of developing machines with human-like intelligence capable of understanding, learning, and reasoning across diverse tasks and domains.</p><p><strong>Natural Language Processing (N.L.P.)</strong></p><p>Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) that focuses on enabling computers to understand, interpret, and generate human language in a way that is both meaningful and contextually relevant. NLP encompasses a range of techniques and methodologies aimed at bridging the gap between human communication and computer understanding.</p><p><strong>Prompt Engineering</strong></p><p>Prompt engineering refers to the process of designing and crafting prompts, questions, or inputs that effectively elicit desired responses or actions from artificial intelligence (AI) systems, particularly those involved in natural language processing (NLP) tasks. It involves carefully constructing the language and structure of prompts to guide user interactions with AI systems in a way that maximizes understanding, engagement, and effectiveness.</p><p><strong>Examples of Prompt Engineering</strong></p><p>Some examples of prompt engineering across different applications and scenarios:</p><p>1. Virtual Assistant Prompt Engineering:</p><p>- User Prompt: “What’s the weather forecast for tomorrow?”</p><p>- Prompt Engineering: Designing the prompt to be concise and contextually relevant to trigger the virtual assistant’s weather forecasting function.</p><p>2. Chabot Prompt Engineering:</p><p>- User Prompt: “I want to book a flight from New York to London.”</p><p>- Prompt Engineering: Crafting the prompt to include essential details such as departure city, destination, and travel date to initiate the flight booking process.</p><p>3. Search Engine Prompt Engineering:</p><p>- User Prompt: “Best Italian restaurants near me.”</p><p>- Prompt Engineering: Structuring the prompt with specific keywords and location information to retrieve relevant search results for Italian restaurants in the user’s vicinity.</p><p>4. Customer Service Chabot Prompt Engineering:</p><p>- User Prompt: “I’m having trouble accessing my account.”</p><p>- Prompt Engineering: Designing the prompt to prompt the chatbot to provide troubleshooting assistance for account access issues, guiding the user through the resolution process.</p><p>5. Educational Chabot Prompt Engineering:</p><p>- User Prompt: “Can you explain the concept of photosynthesis?”</p><p>- Prompt Engineering: Formulating the prompt to elicit an informative response from the educational Chabot, providing a clear and concise explanation of the photosynthesis process.</p><p>6. E-commerce Recommendation System Prompt Engineering:</p><p>- User Prompt: “I’m looking for a new laptop.”</p><p>- Prompt Engineering: Crafting the prompt to trigger the e-commerce recommendation system to generate personalized laptop recommendations based on the user’s preferences, budget, and specifications.</p><p>7. Appointment Scheduling Chabot Prompt Engineering:</p><p>- User Prompt: “I’d like to schedule a dental appointment.”</p><p>- Prompt Engineering: Structuring the prompt to initiate the appointment scheduling process with the Chabot, guiding the user through available appointment slots, and confirming the booking details.</p><p>8. Healthcare Chabot Prompt Engineering:</p><p>- User Prompt: “What are the symptoms of COVID-19?”</p><ul><li>Prompt Engineering: Designing the prompt to prompt the healthcare Chabot to provide accurate information about COVID-19 symptoms, prevention measures, and relevant resources.</li></ul><p><strong>Conclusion</strong></p><p>In summary, prompt engineering emerges as a pivotal aspect within the expansive domain of artificial intelligence, particularly in natural language processing. Serving as the linchpin that facilitates effective communication between users and AI systems, prompt engineering entails the meticulous design of prompts, questions, or inputs to optimize comprehension, engagement, and efficiency. By crafting prompts tailored to specific tasks or domains and considering contextual nuances, user preferences, and iterative optimization, prompt engineers strive to elevate user experiences across various AI-driven applications. As AI technologies continue to advance, embracing prompt engineering as a fundamental principle is essential for unlocking the full potential of natural language processing and fostering seamless, intuitive, and impactful interactions between humans and machines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5cc04ecca1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power and Relevance of Modern Mathematics in Practical Applications]]></title>
            <link>https://medium.com/@ghartirem072/the-power-and-relevance-of-modern-mathematics-in-practical-applications-18e3a34eb612?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/18e3a34eb612</guid>
            <category><![CDATA[science]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Mon, 05 Feb 2024 03:11:59 GMT</pubDate>
            <atom:updated>2024-02-05T03:18:08.479Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1fgS0kih4LpeYEk9epuqw.png" /></figure><p>Mathematics has come a long way since its inception, evolving into a powerful tool that is integral to various practical applications in today’s world. From the development of algorithms and problem-solving techniques to modeling complex systems and understanding the behavior of physical phenomena, modern mathematics plays a critical role in shaping our society. In this blog post, we will explore the significance of modern mathematics, its application in the digital era, engineering and technology, physical sciences, and social sciences.</p><p>Mathematics in the Digital Era</p><p>In the digital era, mathematics is invaluable for solving complex problems and developing innovative solutions. Algorithms, the backbone of many modern technologies, rely on mathematical principles to optimize data analysis, ensure secure communications through cryptography, and power artificial intelligence and machine learning algorithms. For instance, optimization techniques in data analysis help organizations leverage big data to gain insights, improve decision-making, and enhance operational efficiency.</p><p>Additionally, cryptography allows for secure communication and protects sensitive information, ensuring the confidentiality and integrity of digital interactions. Mathematical foundations underpinning algorithms used in artificial intelligence and machine learning enable autonomous systems to learn from data, make predictions, and perform complex tasks with remarkable accuracy.</p><p>Mathematical Modeling and Simulations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4vdfbiHu4FnrGPfbcfnOQ.png" /></figure><p>Mathematics plays a crucial role in understanding and modeling complex systems, allowing us to make predictions and gain insights into various domains. In finance and economics, predictive analysis utilizing mathematical modeling helps forecast market trends, optimize investment portfolios, and manage risks more effectively. Environmental modeling and climate prediction rely on mathematical simulations to understand climate change and its impacts, aiding policymakers in making informed decisions for a sustainable future.</p><p>Data Analysis and Statistics</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OjjkeYkJctdIbTcNuTFpYw.png" /></figure><p>With the advent of big data, mathematics has become indispensable in extracting meaningful insights from vast amounts of information. Big data analytics leverages advanced statistical techniques, such as regression analysis, hypothesis testing, and machine learning algorithms, to draw actionable conclusions. In business, predictive analytics utilizes statistical models to forecast customer behavior, optimize marketing strategies, and guide resource allocation. In medicine and healthcare, statistical analysis helps identify patterns, evaluate treatment effectiveness, and support evidence-based decision-making.</p><p>Mathematics in Engineering and Technology</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdKrPIHWsTfc4_aonKdfIw.png" /></figure><p>The influence of mathematics in engineering and technology is undeniable. In the field of robotics, mathematical foundations equip engineers with the tools necessary to design and control robotic systems. Control theory and optimization enable precise and efficient control of robotic movements, while autonomous systems and machine vision harness the potential of mathematics to guide decision-making and adapt to real-world environments.</p><p>Signal processing and communications rely on digital techniques rooted in mathematics to transform and analyze signals. Whether it is image and speech recognition, or the development of modern wireless communication systems, mathematics facilitates the efficient processing and transmission of information.</p><p>Furthermore, computer science and software development heavily rely on mathematical algorithms and complexity analysis to solve computational problems, ensure the security of sensitive data through cryptography, and verify the correctness of software systems through testing and verification techniques.</p><p>Mathematics in Physical Sciences</p><p>Mathematics serves as the common language connecting different branches of physical sciences. In quantum mechanics and particle physics, mathematical models and simulations facilitate the understanding of fundamental particles, quantum computing, and information theory, as well as the behavior of particles in high-energy accelerators and particle colliders. Mathematical modeling plays a key role in astrophysics, providing insights into cosmic phenomena, such as dark matter, black holes, and the formation of galaxies.</p><p>The study of fluid dynamics and computational physics requires mathematical formulations to simulate and analyze fluid flow. From aerodynamics in automotive design to weather forecasting and climate modeling, mathematics enables engineers and scientists to predict and optimize fluid behavior in various applications.</p><p>Chemistry also extensively relies on mathematics for molecular dynamics simulations, chemical kinetics, and reaction modeling. By accurately representing the behavior of molecules and chemical reactions through mathematical models, chemists gain insights into molecular structures, reaction rates, and spectroscopic properties.</p><p>Mathematics in Social Sciences</p><p>Mathematics continues to shape our understanding of human behavior and complex social interactions. In game theory and economics, strategic decision-making is analyzed mathematically, leading to insights in market analysis, pricing strategies, and the study of behavioral economics and social choice theory. By quantifying the impact of different choices and strategies mathematically, economists can predict outcomes and optimize decision-making.</p><p>Social network analysis and graph theory offer mathematical frameworks to study the dynamics of online social networks, understand patterns of influence propagation, and develop graph algorithms for recommender systems. By leveraging mathematical concepts, such as centrality measures, community detection, and connectivity analysis, researchers gain valuable insights into the structure and behavior of social networks.</p><p>Mathematical sociology and psychology focus on modeling social interactions, opinion dynamics, and collective behavior. By applying mathematical models to social phenomena, researchers explore various aspects of human behavior, ranging from the spread of information and ideas to the formation of opinions and decision-making processes.</p><p>Summary</p><p>The applications of modern mathematics in practical contexts are vast and diverse, spanning various fields and industries. From optimizing data analysis and solving complex problems to modeling physical phenomena and understanding human behavior, mathematics continues to inspire innovation and collaboration. As we move forward, the relevance and prospects of mathematics in shaping our world are boundless, driving us to explore new frontiers and uncover the hidden potential of this powerful discipline.</p><p>In conclusion, let us embrace the power of modern mathematics and appreciate its significance in the practical applications that shape our lives. By nurturing a curiosity for mathematics and its potential, we can contribute to the ongoing advancements and inspire future generations to harness the power of mathematics to tackle the challenges that lie ahead.</p><p>“Mathematics is the key that unlocks the door to a world of endless possibilities.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18e3a34eb612" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LaTeX Basic Commands]]></title>
            <link>https://medium.com/@ghartirem072/latex-basic-commands-e8f7a3750e95?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8f7a3750e95</guid>
            <category><![CDATA[professional-document]]></category>
            <category><![CDATA[scientific-writing]]></category>
            <category><![CDATA[latex]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 15:22:27 GMT</pubDate>
            <atom:updated>2024-02-05T03:55:07.670Z</atom:updated>
            <content:encoded><![CDATA[<p>Why LaTeX?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DKA4evj38iptKrHkG-bxw.png" /></figure><p>Basic Packages in LaTeX</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ohyZzuF-3WjOe62AqdyQAA.png" /></figure><p>Some special characters in LaTeX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9D_RU0yAZ-9jvMHDK82Eg.png" /></figure><p>Typing style and size in LaTex,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ukwPCOHZNaDC64A_0bJjOw.png" /></figure><p>Spacing in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z44n3cRDiRSPBfkOKx3_bQ.png" /></figure><p>Import the graphics or images in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CLqleOcVwZcEN03VyUon6A.png" /></figure><p>Some mathematical symbols in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PNVJeYARQWbUjyqfQGQ5bw.png" /></figure><p>Writing fraction in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zknrjESjOaXyfTRceRLsA.png" /></figure><p>Writing Derivative in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8U3WZMAtQXwbgoyu42XW1A.png" /></figure><p>Write antiderivative in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYwZq-7XjG-gm2ZSG9WfcA.png" /></figure><p>Writing Limits in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLK4ovgmR8faXTxwdWMpNg.png" /></figure><p>Writing summation in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m1p7FXAZ9OaNeGzBQUv36Q.png" /></figure><p>Writing matrix notation in LaTeX document,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0lFE2wdwt1v_tDqqBjMJKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IxySs-PMcE2Ap3uYmOBtkQ.png" /></figure><p>How to write mathematical function in LaTeX document,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Nor0637vti0mZlWhBqAGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pz9x-11IlQ324LsSpqKrFw.png" /></figure><p>How to write multiline equations in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xgFysO3k17e_wk4bxqWC3A.png" /></figure><p>Making a simple and fancy table in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSkEBoiu_5KBYX9U0PPZmQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SiS4pDIbNt2RtPNV6pa4EA.png" /></figure><p>Writing a bullets points in LaTeX,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FBWRWY_3BlE05uXyCiA4rQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jILKDX8DqIC5PMCMievDA.png" /></figure><p>Thank you for reading ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EyeGnGU70gJfT0Z54wzyA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8f7a3750e95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application of Finite Difference Schemes(Scientific Computing with MATLAB)]]></title>
            <link>https://medium.com/@ghartirem072/application-of-finite-difference-schemes-scientific-computing-with-matlab-b856c0fe75bd?source=rss-425c1562966d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b856c0fe75bd</guid>
            <category><![CDATA[matlab]]></category>
            <category><![CDATA[heat-equation]]></category>
            <category><![CDATA[scientific-computing]]></category>
            <category><![CDATA[parabolic-equation]]></category>
            <dc:creator><![CDATA[Rem Bahadur Gharti]]></dc:creator>
            <pubDate>Thu, 01 Feb 2024 05:00:17 GMT</pubDate>
            <atom:updated>2024-02-07T04:13:37.411Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>The finite difference method is one of the technique to obtain the numerical solution of the partial differential as well as algebraic equations. In this method the solutions are approximated in the discrete form in the finite grid points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*B253wQGhSM8euaBu4tiiUQ.png" /><figcaption>Mesh grid</figcaption></figure><p>Divide [0,1]x[0,T] to MxN rectangles of size hxk. (<em>x</em>0​,<em>x</em>2​,…,<em>xm</em>​); <em>xm</em>​ = mh, m = 0,1,…,M and (t0,t1,…,tN); tn = nk, n= 0,1,2,…,N, for a function V defined on the grid, we write V_{m}^{n} for the value at the grid point (tn, xm) where u is defined and continuously varying (t, x), we use h = <strong>Δx and k</strong>= <strong>Δt.</strong></p><p>V_{Space}^{Time} = V_{m}^{n} = u(tn, xm)</p><p><strong>Definition(Grid level n)</strong></p><p>The set of points (tn, xn) for fixed value of n is called grid n.</p><p><strong>Definition(One step scheme)</strong></p><p>Those schemes that involve V at only two levels n and n+1 are called one step scheme.</p><p>Let us consider a Partial Differential Equation,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/149/1*7ugu8MNB-tB36bgX6X1oPA.png" /></figure><ol><li>Forward Time Forward Space Scheme is given by</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*7dpQNqxCfTnkWQWzRDhthA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*H9O4uFTV41wuTW-gZDSYDA.png" /><figcaption>FTFSS</figcaption></figure><p>2. Forward Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*wuGi0MLuHeOgqu2fth2GxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*DhGLVQK_8QK48GjbuaeEfA.png" /><figcaption>FTCSS</figcaption></figure><p>3. Central Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*SPZc9ba2SBMUy3uLPV-tJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*Vcx2fWe1TxDN4fKEBuWe4Q.png" /><figcaption>CTCSS</figcaption></figure><p>Let us consider a Partial Differential Equation,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*Yp_oq5KEn9oeAlR6M2Nnjw.png" /></figure><p>The Forward Time Central Space Scheme is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*bGitrkAgNMpNjuUTs4mCJA.png" /></figure><ol><li><strong>Finite Difference Scheme for Heat Equation</strong></li></ol><ul><li>It is a Parabolic Equation,</li><li>General form of Heat Equation is given by,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*NdkVv6IA0CYzhg34SbK3fQ.png" /></figure><p><strong>Development of general Scheme</strong></p><p>Here,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*Yp_oq5KEn9oeAlR6M2Nnjw.png" /></figure><p>Forward Time Central Space Scheme (FTCSS) is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*bGitrkAgNMpNjuUTs4mCJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*tKb5U8mlfiXp4oVhZH8hMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*-bC38pQTUhMzE00sRKQTPQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*ClqdyAE4ms85PjBnmjx5fw.png" /><figcaption>This is the required scheme</figcaption></figure><p><strong>Problem:-1(Find the numerical solution of this problem by MATLAB program)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*CO3P2b8-iUaIXQMCdBaDqA.png" /></figure><p>MATLAB Program for this problem is given below,</p><pre>%MATLAB Program <br>% FTCSS is, V_{m}^{n+1} = (1-2b*mu)V_{m}^{n} + b*mu*V{m+1}^{n}+b*mu*V_{m-1}^{n}<br>%u_t = 0.05u_xx, b = 0.05<br>format short; % Result in 4 decimal place<br>clear all; % Clear workspace<br>close all; % Close figure window<br>clc; % Clear command window<br>%%%%%%%%%%%%<br>L = 1; % Length of rod<br>T = 1;% Maximum time bound<br>m = 5; % No. of intervals in space<br>n = 5; % No. of intervals in time<br>h = L/m; % Step size in space<br>k = T/n; % Step size in time<br>b = 0.05; % Coefficient of diffusivity<br>mu = k/h^2; % k = k/ h*h<br>% Check the stability<br>c = b*mu;<br>if(c&lt;=0 || c&gt;=0.5)<br>  disp(&#39;Scheme is unstable&#39;);<br>end<br>% Initialization of our solution<br>v = zeros(m+1,n+1); % m+1 by n+1 matrix<br>% Initial condition<br>ic1 = @(x) sin(pi.*x);<br>%Space Discretization<br>for j = 2:m+1<br>  v(1,j) = ic1((j-1).*h);<br>end<br>% Boundary condition<br>b1 = @(t) 0; % L.B.C<br>b2 = @(t) 0; % R.B.C<br>%Time discretization<br>for i = 2:n+1<br>  v(i,1) = b1((i-1).*k);<br>  v(i,n+1) = b1((i-1).*k);<br>end<br>% Implementation of he scheme<br>for i = 1:n<br>  for j = 2:m<br>    v(i+1,j) = (1-2*b*mu)*v(i,j) + b*mu*v(i,j+1) + b*mu*v(i,j-1);<br>%or<br>%v(i+1,j) = (1-2*c)*v(i,j) +c*v(i,j+1) + c*v(i,j-1);<br>end<br>end<br>disp(&#39;Value of v at each grid point is given below&#39;);<br>disp(v);<br>% For visualization<br>hold on;<br>[p,q] = meshgrid(0:h:L,0:k:T);<br>flipud(v);<br>surfc(p,q,v);<br>shading interp;<br>colorbar;<br>xlabel(&#39;Space X&#39;);<br>ylabel(&#39;Time T&#39;);<br>zlabel(&#39;V&#39;);<br>title(&#39;MATLAB Progam for heat equation&#39;);<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*cw5oYkv-O4Z0k2HxmOxW2A.png" /><figcaption>Numerical solution of 1D heat equation with FTCSS</figcaption></figure><p><strong>Problem:-2(Find the numerical solution of this problem by MATLAB program)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*RLd_OAGbViAp4n-5et81Gg.png" /></figure><p>Numerical solution for above problem with MATLAB is given below,</p><pre>%MATLAB Program <br>% FTCSS is, V_{m}^{n+1} = (1-2b*mu)V_{m}^{n} + b*mu*V{m+1}^{n}+b*mu*V_{m-1}^{n}<br>%u_t = 0.05u_xx, b = 0.05<br>format short; % Result in 4 decimal place<br>clear all; % Clear workspace<br>close all; % Close figure window<br>clc; % Clear command window<br>%%%%%%%%%%%%<br>L = 1; % Length of rod<br>T = 1;% Maximum time bound<br>m = 5; % No. of intervals in space<br>n = 5; % No. of intervals in time<br>h = L/m; % Step size in space<br>k = T/n; % Step size in time<br>b = 0.05; % Coefficient of diffusivity<br>mu = k/h^2; % k = k/ h*h<br>% Check the stability<br>c = b*mu;<br>if(c&lt;=0 || c&gt;=0.5)<br>  disp(&#39;Scheme is unstable&#39;);<br>end<br>% Initialization of our solution<br>v = zeros(m+1,n+1); % m+1 by n+1 matrix<br>% Initial condition<br>ic1 = @(x) 2*x;<br>ic2 = @(x) 2.*(1-x);<br>%Space Discretization<br>for j = 2:m+1<br>  x(j) = (j-1).*h;<br>    if(x(j) &lt;0.5)<br>       v(1,j) = 2.*x(j); % x&lt;0.5<br>    else<br>       v(1,j) = 2.*(1-x(j));% otherwise<br>    end<br>end<br>% Boundary condition<br>b1 = @(t) 0; % L.B.C<br>b2 = @(t) 0; % R.B.C<br>%Time discretization<br>for i = 2:n+1<br>  v(i,1) = b1((i-1).*k);<br>  v(i,n+1) = b1((i-1).*k);<br>end<br>% Implementation of he scheme<br>for i = 1:n<br>  for j = 2:m<br>    v(i+1,j) = (1-2*b*mu)*v(i,j) + b*mu*v(i,j+1) + b*mu*v(i,j-1);<br>%or<br>%v(i+1,j) = (1-2*c)*v(i,j) +c*v(i,j+1) + c*v(i,j-1);<br>end<br>end<br>disp(&#39;Value of v at each grid point is given below&#39;);<br>disp(v);<br>% For visualization<br>hold on;<br>[p,q] = meshgrid(0:h:L,0:k:T);<br>flipud(v);<br>surfc(p,q,v);<br>shading interp;<br>colorbar;<br>xlabel(&#39;Space X&#39;);<br>ylabel(&#39;Time T&#39;);<br>zlabel(&#39;V&#39;);<br>title(&#39;MATLAB Progam for heat equation&#39;);<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555555</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*cw5oYkv-O4Z0k2HxmOxW2A.png" /><figcaption>Numerical solution of 1D heat equation with FTCSS</figcaption></figure><p><strong>2. Finite Difference Method for Laplace Equation</strong></p><p>The homogenous part of the Poison’s equation is known as Laplace equation and it is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*Ig1kgpn_q08xlB3CQ3RvvQ.png" /></figure><p>Note, it has not time parameter</p><p><strong>Scheme Development</strong></p><p>We have the central Space scheme in Y axis is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/129/1*Q-ZnkoKXWAnIhy0TqKQ7Mw.png" /></figure><p>We have the central space scheme in X axis is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/126/1*pfiF3MzwY0ozPWjyOOAQSA.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*Ig1kgpn_q08xlB3CQ3RvvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*lKcekGbAjOiWdukOzHzTgg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/1*6GSEwaV9GeL3vnwI4LzkZg.png" /><figcaption>m — X axis, n — Y axis</figcaption></figure><p>This scheme is unconditionally stable.</p><p><strong>Problem:-1 Solve the given problem numerically by using MATLAB program,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*EFrokpZbsH_EimN74grTyw.png" /></figure><p>MATLAB Program</p><pre>% MATLAB Program to solve the Laplace Equation numerically<br>format short; % Result in 4 decimal place<br>clear all; % Clear workspace<br>close all; % Close figure window<br>clc; % Clear command window<br>%%%%%%%%%%%%<br>Lx = 1; % Lentgth in X axis<br>Ly = 1; % Length in Y axis<br>m = 5; % No. of interval in X axis<br>n = 5;% No. of intervals in Y axis<br>% not check stability<br>h = Lx/m; % Step size in X axis<br>k = Ly/n; % Step size in Y axis<br>v = zeros(m+1,n+1); % m+1 by n+1 zero matrix<br>% Use condition for X axis<br>for j = 1:m+1<br>    v(j,1) = 0;<br>    v(j,n+1) = -2; % Corrected index<br>end<br>% Use condition for Y axis<br>for i = 1:n+1<br>    v(1,i) = 0;<br>    v(m+1,i) = 5; <br>end<br>% Implementation of scheme<br>for i = 2:m <br>    for j = 2:n <br>        v(i,j) = ((h^2)*(v(i,j+1)+v(i,j-1)) + (k^2)*(v(i+1,j)+v(i-1,j))) / (2*(h^2+k^2)); % Corrected parentheses<br>    end<br>end<br>disp(v);<br>% For visualization<br>hold on;<br>[p,q] = meshgrid(0:h:Lx,0:k:Ly);<br>flipud(v);<br>surfc(p,q,v);<br>shading interp;<br>colorbar;<br>xlabel(&#39;Space X&#39;);<br>ylabel(&#39;Time T&#39;);<br>zlabel(&#39;V&#39;);<br>title(&#39;MATLAB Progam for Laplace Equation&#39;);<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555555</pre><p>3D Visualization of the solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*-gMB1BNMMBwWl4cc2tgrVA.png" /><figcaption>Numerical Solution of given problem 1</figcaption></figure><p><strong>3. Finite Difference Method for Advection Diffusion Equation</strong></p><p>Advection Diffusion Equation is given by,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*K7pL8T-cRNwDr8HGu_d6kA.png" /></figure><p><strong>Scheme Development</strong></p><p>Forward Time Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/85/1*6k86N6kqN7VFxsOvI8Ja8A.png" /></figure><p>Forward Space Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/152/1*c6M7q3obcsJX0Yjz0-tqzg.png" /></figure><p>Central Space Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/195/1*Zo471do-7iS83rkz-nq-mw.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/1*KzWYvI5rpuoB-W7gI5vLWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*Tik-YYYoRuFz7Yl5HTj9aA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*3kxeSA0PY3tAEDUc4jrk_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*MoZExIK5O9zQqztPSwxszA.png" /></figure><p>Hence the final scheme becomes,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*zuwx7U9WXDQKGJHGb0bTRg.png" /></figure><p><strong>Problem:-1 </strong>Derive the scheme for Advection Diffusion Equation and solve numerically by MATLAB Program,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*ACsZxR6Dn3Wi9kL4PIpEVQ.png" /></figure><p>The required Scheme is shown above,</p><p>MATLAB Program,</p><pre>format short; % Result in 4 decimal places<br>clear all; % Clear workspace<br>close all; % close figure window<br>clc; % Clear command window<br>L = 100; % Total length<br>T = 1; % Maximum time bound<br>m = 5; % No. of intervals in space<br>n = 5; % No. of intervals in time%<br>h = L/m; % Step size in space<br>k = T/n; % Step size in time<br>D = (1E-7)*3600; % Coefficient of diffusion<br>V = (1E-6)*3600; % Velocity<br>% Coefficient calclulation<br>G = (V*k)/h;<br>F = (D*k)/h^2;<br>% Initial condition<br>for j = 1:m+1<br>    v(1,j) = 100;<br>end<br>% Implement of our scheme<br>for j = 2:m<br>    for i = 1:n<br>        v(i+1,j) = (1-G-2*F)*v(i,j)+(F-G)*v(i,j+1) + F*v(i,j-1);<br>    end<br>end<br>disp(v);<br>% For visualization<br>hold on;<br>[p,q] = meshgrid(0:h:L,0:k:T);<br>flipud(v);<br>surfc(p,q,v);<br>shading interp;<br>colorbar;<br>xlabel(&#39;Space X&#39;);<br>ylabel(&#39;Time T&#39;);<br>zlabel(&#39;V&#39;);<br>title(&#39;MATLAB Progam for Advection Diffusion Equation&#39;);<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555555</pre><p>Visualization of numerical solution of the given problem is below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*oulpzh4aaYbniHOYZyCbLA.png" /></figure><p><strong>4. Finite Difference Method for 1D wave Equation</strong></p><p>The PDE of the form,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*ViL8VPjal0BvQfAweav3vQ.png" /></figure><p>In discrete form we have,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/127/1*2Vp05qkbdXGrIXUNNsQuuw.png" /></figure><p>Central Time Scheme is ,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*FGFLhHKS-s8_BgCNOA9SZA.png" /></figure><p>Central Space Scheme is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*7JisAedL60ckWTFQJgT97g.png" /></figure><p>Now,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/123/1*LBKhvx62c4ycts_X1JrNzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*CgW2_BPNRf94eYqA-Q_GDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*NFFoN8oL79kJI5qCDm3s_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*4u3WUxy9qosUu59JtAAIlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*FgzpbysfjdVkFyuJZMBULg.png" /></figure><p>This scheme is stable if</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/79/1*P1jDKQrDsN6en17WqIm5Bg.png" /></figure><p>This scheme is also known as 3 level scheme,</p><p><strong>Problem:-1 Solve the given problem numerically by using MATLAB Program,</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/249/1*rRtCEUlkiaS8JEoopKQ4yg.png" /></figure><p>We have the scheme</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Ipui3JsuzX8STX-9Am6VdA.png" /></figure><p>Also we have the central difference in time is,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/155/1*57sGGJKk5yRcasrJ6aibfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*tXFF6ZgN2i1Ftg0poXZwJw.png" /></figure><p>Put n = 0 we get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*Ce9lzGVw10r8fHZBWUZ47w.png" /></figure><p>Put n = 0 in 1 we get,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*nVaq8A5SjquhIMiz5RgyPg.png" /></figure><p>After solving 2 and 3 equation we get the scheme for initial condition of derivative type,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*IX0njiBiBItnynhvEh8klQ.png" /></figure><p><strong>MATLAB Program</strong></p><pre>%MATLAB Program <br>format short; % Result in 4 decimal place<br>clear all; % Clear workspace<br>close all; % Close figure window<br>clc; % Clear command window<br>%%%%%%%%%%%%<br>L = 1; % Length of string<br>T = 1;% Maximum time bound<br>m = 5; % No. of intervals in space<br>n = 5; % No. of intervals in time<br>h = L/m; % Step size in space<br>k = T/n; % Step size in time<br>b = 1; % Coefficient of wave velocity<br>%for stability<br>mu = k^2/h^2; % mu = k**/h*h<br>b = b*b; % b = b*b<br>c = b*mu;<br>if(c&lt;=0 || c&gt;1)<br>    disp(&#39;Scheme is unstable&#39;)<br>end<br>% Initialization of our solution<br>v = zeros(m+1,n+1); % m+1 by n+1 matrix<br>% Initial condition<br>ic1 = @(x) 10.*sin(pi.*x);<br>ic2 = @(x) 0;<br>%Space Discretization<br>for j = 1:m+1<br>  v(1,j) = ic1((j-1).*h);<br>end<br>%for derivative type initial condition<br>for j = 2:m<br>    v(2,j) = (1-c)*v(1,j)+0.5*c*v(1,j+1)+0.5*c*v(1,j-1)+k*ic2((j-1).*h);<br>end<br><br>% Boundary condition<br>b1 = @(t) 0; % L.B.C<br>b2 = @(t) 0; % R.B.C<br>%Time discretization<br>for i = 2:n+1<br>  v(i,1) = b1((i-1).*k);<br>  v(i,n+1) = b1((i-1).*k);<br>end<br>% Implementation of he scheme<br>for i = 2:n<br>  for j = 2:m<br>      v(i+1,j) = 2*(1-c)*v(i,j) + c*v(i,j+1)+c*v(i,j-1) - v(i-1,j);<br>  end<br>end<br><br>disp(&#39;Vale of v at each grid point is given below&#39;);<br>disp(v);<br>% For visualization<br>hold on;<br>[p,q] = meshgrid(0:h:L,0:k:T);<br>flipud(v);<br>surfc(p,q,v);<br>shading interp;<br>colorbar;<br>xlabel(&#39;Space X&#39;);<br>ylabel(&#39;Time T&#39;);<br>zlabel(&#39;V&#39;);<br>title(&#39;MATLAB Progam for 1D wave equation&#39;);<br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555555</pre><p>Visualization of numerical solution of above problem,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*hnQTGWz9RgROzMZpQFBezQ.png" /><figcaption>Numerical solution visualization</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b856c0fe75bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>