<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Scientific Computing on My Notes</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/</link><description>Recent content in Scientific Computing on My Notes</description><generator>Hugo</generator><language>en</language><atom:link href="https://peppyhare.github.io/r/notes/UWAMATH581/index.xml" rel="self" type="application/rss+xml"/><item><title>ODEs, PDEs, and the Need for Numerical Methods</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/01-intro/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/01-intro/</guid><description>&lt;h1 id="odes-pdes-and-the-need-for-numerical-methods"&gt;ODEs, PDEs, and the Need for Numerical Methods&lt;a class="anchor" href="#odes-pdes-and-the-need-for-numerical-methods"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;In this class we focus on solution methods for ordinary differential equations (ODEs) and partial differential equations (PDEs). An ODE involves functions of a single variable and their derivatives, while a PDE involves functions of multiple variables and their partial derivatives.&lt;/p&gt;&#10;&lt;h2 id="odes"&gt;ODEs&lt;a class="anchor" href="#odes"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A typical first-order ODE is&lt;/p&gt;&#10;&#10;&lt;link rel="stylesheet" href="https://peppyhare.github.io/r/katex/katex.min.css" /&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/katex.min.js"&gt;&lt;/script&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/auto-render.min.js" onload="loadKatex();"&gt;&lt;/script&gt;&#10;&#10;&lt;script&gt;&#10; function loadKatex() {&#10; renderMathInElement(document.body, {&#10; delimiters: [&#10; { left: "$$", right: "$$", display: true },&#10; { left: "\\[", right: "\\]", display: true },&#10; { left: "$", right: "$", display: false },&#10; { left: "\\(", right: "\\)", display: false }],&#10; throwOnError: false,&#10; trust: (context) =&gt; ['\\htmlId', '\\href'].includes(context.command),&#10; macros: {&#10; "\\lcm": "\\mathop{\\mathrm{lcm}}",&#10; "\\sen": '\\text{sen}\\,',&#10; "\\dd": "\\mathop{\\mathrm{d} #1}",&#10; "\\abs": "\\lvert #1 \\rvert",&#10; "\\dd": "\\text{d}",&#10; "\\cross": "\\times",&#10; "\\pdv": "\\frac{\\partial #1}{\\partial #2}",&#10; "\\curl": "\\nabla \\cross #1",&#10; "\\vu": "\\mathbf{\\hat{#1}}",&#10; "\\vdot": "\\dot",&#10; "\\div": "\\nabla \\cdot #1",&#10; "\\grad": "\\nabla",&#10; "\\dv": "\\frac{d\\,#1}{d\\,#2}",&#10; "\\gr": "\\gamma",&#10; "\\vec": "\\mathbf{#1}",&#10; "\\tagl": "\\tag{#1}",&#10; "\\eqref": "(#1)",&#10; "\\laplacian": "\\mathbf{\\nabla ^2}",&#10; "\\label": "{}",&#10; "\\negadelta": "\\nabla",&#10; "\\eqref": "\\href{###1}{(\\text{#1})}",&#10; "\\ref": "\\href{###1}{\\text{#1}}",&#10; "\\label": "\\htmlId{#1}{}",&#10; }&#10; });&#10; };&#10;&lt;/script&gt;&lt;span&gt;&#10; \[\dv{u}{t} = f(t, u)\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;where \( u : [a, b] \to \mathbb{R} \) is the unknown and \( f : [a, b] \times \mathbb{R} \to \mathbb{R} \) is given. We call \( f \) the right-hand side (RHS) of the ODE, or a forcing term in a physical context. Higher-order ODEs often take the form&lt;/p&gt;</description></item><item><title>IVPs and BVPs</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/02-ivps-and-bvps/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/02-ivps-and-bvps/</guid><description>&lt;h1 id="ivps-and-bvps"&gt;IVPs and BVPs&lt;a class="anchor" href="#ivps-and-bvps"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;In this class we first focus on two types of ODE problems: initial value problems (IVPs) and boundary value problems (BVPs). Back to our basic example, the harmonic oscillator&lt;/p&gt;&#10;&#10;&lt;link rel="stylesheet" href="https://peppyhare.github.io/r/katex/katex.min.css" /&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/katex.min.js"&gt;&lt;/script&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/auto-render.min.js" onload="loadKatex();"&gt;&lt;/script&gt;&#10;&#10;&lt;script&gt;&#10; function loadKatex() {&#10; renderMathInElement(document.body, {&#10; delimiters: [&#10; { left: "$$", right: "$$", display: true },&#10; { left: "\\[", right: "\\]", display: true },&#10; { left: "$", right: "$", display: false },&#10; { left: "\\(", right: "\\)", display: false }],&#10; throwOnError: false,&#10; trust: (context) =&gt; ['\\htmlId', '\\href'].includes(context.command),&#10; macros: {&#10; "\\lcm": "\\mathop{\\mathrm{lcm}}",&#10; "\\sen": '\\text{sen}\\,',&#10; "\\dd": "\\mathop{\\mathrm{d} #1}",&#10; "\\abs": "\\lvert #1 \\rvert",&#10; "\\dd": "\\text{d}",&#10; "\\cross": "\\times",&#10; "\\pdv": "\\frac{\\partial #1}{\\partial #2}",&#10; "\\curl": "\\nabla \\cross #1",&#10; "\\vu": "\\mathbf{\\hat{#1}}",&#10; "\\vdot": "\\dot",&#10; "\\div": "\\nabla \\cdot #1",&#10; "\\grad": "\\nabla",&#10; "\\dv": "\\frac{d\\,#1}{d\\,#2}",&#10; "\\gr": "\\gamma",&#10; "\\vec": "\\mathbf{#1}",&#10; "\\tagl": "\\tag{#1}",&#10; "\\eqref": "(#1)",&#10; "\\laplacian": "\\mathbf{\\nabla ^2}",&#10; "\\label": "{}",&#10; "\\negadelta": "\\nabla",&#10; "\\eqref": "\\href{###1}{(\\text{#1})}",&#10; "\\ref": "\\href{###1}{\\text{#1}}",&#10; "\\label": "\\htmlId{#1}{}",&#10; }&#10; });&#10; };&#10;&lt;/script&gt;&lt;span&gt;&#10; \[\frac{\dd^2 u}{\dd t^2} &amp;#43; u = 0 \quad \to \quad u(t) = A\cos(t) &amp;#43; B\sin(t)\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;By itself this ODE is not well-posed: any \( A, B \) give a solution. For the problem to be well-posed, we need to supply side information that constrains the general solution to a unique one. The general system is&lt;/p&gt;</description></item><item><title>Euler's Methods for Solving IVPs</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/03-euler-methods/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/03-euler-methods/</guid><description>&lt;h1 id="eulers-methods-for-solving-ivps"&gt;Euler&amp;rsquo;s Methods for Solving IVPs&lt;a class="anchor" href="#eulers-methods-for-solving-ivps"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;We begin with the two simplest and most widely used methods, both named after Leonhard Euler: the forward and backward Euler methods. Throughout, consider a first-order IVP&lt;/p&gt;&#10;&#10;&lt;link rel="stylesheet" href="https://peppyhare.github.io/r/katex/katex.min.css" /&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/katex.min.js"&gt;&lt;/script&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/auto-render.min.js" onload="loadKatex();"&gt;&lt;/script&gt;&#10;&#10;&lt;script&gt;&#10; function loadKatex() {&#10; renderMathInElement(document.body, {&#10; delimiters: [&#10; { left: "$$", right: "$$", display: true },&#10; { left: "\\[", right: "\\]", display: true },&#10; { left: "$", right: "$", display: false },&#10; { left: "\\(", right: "\\)", display: false }],&#10; throwOnError: false,&#10; trust: (context) =&gt; ['\\htmlId', '\\href'].includes(context.command),&#10; macros: {&#10; "\\lcm": "\\mathop{\\mathrm{lcm}}",&#10; "\\sen": '\\text{sen}\\,',&#10; "\\dd": "\\mathop{\\mathrm{d} #1}",&#10; "\\abs": "\\lvert #1 \\rvert",&#10; "\\dd": "\\text{d}",&#10; "\\cross": "\\times",&#10; "\\pdv": "\\frac{\\partial #1}{\\partial #2}",&#10; "\\curl": "\\nabla \\cross #1",&#10; "\\vu": "\\mathbf{\\hat{#1}}",&#10; "\\vdot": "\\dot",&#10; "\\div": "\\nabla \\cdot #1",&#10; "\\grad": "\\nabla",&#10; "\\dv": "\\frac{d\\,#1}{d\\,#2}",&#10; "\\gr": "\\gamma",&#10; "\\vec": "\\mathbf{#1}",&#10; "\\tagl": "\\tag{#1}",&#10; "\\eqref": "(#1)",&#10; "\\laplacian": "\\mathbf{\\nabla ^2}",&#10; "\\label": "{}",&#10; "\\negadelta": "\\nabla",&#10; "\\eqref": "\\href{###1}{(\\text{#1})}",&#10; "\\ref": "\\href{###1}{\\text{#1}}",&#10; "\\label": "\\htmlId{#1}{}",&#10; }&#10; });&#10; };&#10;&lt;/script&gt;&lt;span&gt;&#10; \[\dv{u}{t} = f(t, u) \qquad u(0) = c\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;where we want to estimate the solution on a finite interval \( [0, T] \). Everything here extends immediately to systems of ODEs, and hence to higher-order problems.&lt;/p&gt;</description></item><item><title>Extension to Nonlinear Systems of ODEs</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/04-nonlinear-systems/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/04-nonlinear-systems/</guid><description>&lt;h1 id="extension-to-nonlinear-systems-of-odes"&gt;Extension to Nonlinear Systems of ODEs&lt;a class="anchor" href="#extension-to-nonlinear-systems-of-odes"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;Last time we introduced forward and backward Euler and tried them on the test ODE. Now for the practical details of using them on nonlinear problems and systems, plus some examples that motivate more advanced methods and a theoretical framework for analyzing them.&lt;/p&gt;&#10;&lt;h2 id="solving-nonlinear-odes-with-backward-euler"&gt;Solving Nonlinear ODEs with Backward Euler&lt;a class="anchor" href="#solving-nonlinear-odes-with-backward-euler"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Consider a generic nonlinear (still scalar) ODE&lt;/p&gt;&#10;&lt;span&gt;&#10; \[\dv{u}{t} = f(t, u) \qquad u(0) = c \qquad f : [0, T] \times \mathbb{R} \to \mathbb{R}\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;Forward Euler doesn&amp;rsquo;t care: we only need to evaluate \( f \) at the known point &lt;span&gt;&#10; \( (t_n, u_n) \)&#10;&lt;/span&gt;&#10;.&lt;/p&gt;</description></item><item><title>Accuracy</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/05-accuracy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/05-accuracy/</guid><description>&lt;h1 id="accuracy"&gt;Accuracy&lt;a class="anchor" href="#accuracy"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;We&amp;rsquo;ve noticed some peculiar things about Euler&amp;rsquo;s methods: on the test ODE the numerical solutions deviated from the truth, and in some regimes forward Euler went unstable while backward Euler didn&amp;rsquo;t. Let&amp;rsquo;s dig deeper, starting with convergence and numerical accuracy.&lt;/p&gt;&#10;&lt;h2 id="convergence"&gt;Convergence&lt;a class="anchor" href="#convergence"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;At the very least, our numerical scheme should converge to the true solution as the resolution increases, i.e. as the discretization size goes to zero.&lt;/p&gt;&#10;&lt;blockquote class='book-hint note'&gt;&#10;&lt;h3 id="definition-convergence-of-an-ode-solver"&gt;Definition: &lt;strong&gt;Convergence of an ODE solver&lt;/strong&gt;&lt;a class="anchor" href="#definition-convergence-of-an-ode-solver"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Consider an ODE with a ground truth solution \( u : [0, T] \to \mathbb{R} \), and an ODE solver that, for an integer \( N \), produces a sequence of approximations&lt;/p&gt;&#10;&#10;&lt;link rel="stylesheet" href="https://peppyhare.github.io/r/katex/katex.min.css" /&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/katex.min.js"&gt;&lt;/script&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/auto-render.min.js" onload="loadKatex();"&gt;&lt;/script&gt;&#10;&#10;&lt;script&gt;&#10; function loadKatex() {&#10; renderMathInElement(document.body, {&#10; delimiters: [&#10; { left: "$$", right: "$$", display: true },&#10; { left: "\\[", right: "\\]", display: true },&#10; { left: "$", right: "$", display: false },&#10; { left: "\\(", right: "\\)", display: false }],&#10; throwOnError: false,&#10; trust: (context) =&gt; ['\\htmlId', '\\href'].includes(context.command),&#10; macros: {&#10; "\\lcm": "\\mathop{\\mathrm{lcm}}",&#10; "\\sen": '\\text{sen}\\,',&#10; "\\dd": "\\mathop{\\mathrm{d} #1}",&#10; "\\abs": "\\lvert #1 \\rvert",&#10; "\\dd": "\\text{d}",&#10; "\\cross": "\\times",&#10; "\\pdv": "\\frac{\\partial #1}{\\partial #2}",&#10; "\\curl": "\\nabla \\cross #1",&#10; "\\vu": "\\mathbf{\\hat{#1}}",&#10; "\\vdot": "\\dot",&#10; "\\div": "\\nabla \\cdot #1",&#10; "\\grad": "\\nabla",&#10; "\\dv": "\\frac{d\\,#1}{d\\,#2}",&#10; "\\gr": "\\gamma",&#10; "\\vec": "\\mathbf{#1}",&#10; "\\tagl": "\\tag{#1}",&#10; "\\eqref": "(#1)",&#10; "\\laplacian": "\\mathbf{\\nabla ^2}",&#10; "\\label": "{}",&#10; "\\negadelta": "\\nabla",&#10; "\\eqref": "\\href{###1}{(\\text{#1})}",&#10; "\\ref": "\\href{###1}{\\text{#1}}",&#10; "\\label": "\\htmlId{#1}{}",&#10; }&#10; });&#10; };&#10;&lt;/script&gt;&lt;span&gt;&#10; \[u_n \approx u(t_n) \qquad t_n = n \Delta t \qquad n = 0, 1, \ldots, N \qquad \Delta t = \frac{T}{N}\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;We say that the method is &lt;strong&gt;convergent&lt;/strong&gt; if&lt;/p&gt;&#10;&lt;span&gt;&#10; \[\lim_{\Delta t \to 0} \max_{0 \leq n \leq N} |u(t_n) - u_n| = 0\]&#10;&lt;/span&gt;&#10;&lt;/blockquote&gt;</description></item><item><title>Order of Convergence of Forward Euler and the Lax Equivalence Theorem</title><link>https://peppyhare.github.io/r/notes/UWAMATH581/06-convergence-and-lax/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://peppyhare.github.io/r/notes/UWAMATH581/06-convergence-and-lax/</guid><description>&lt;h1 id="order-of-convergence-of-forward-euler-and-the-lax-equivalence-theorem"&gt;Order of Convergence of Forward Euler and the Lax Equivalence Theorem&lt;a class="anchor" href="#order-of-convergence-of-forward-euler-and-the-lax-equivalence-theorem"&gt;#&lt;/a&gt;&lt;/h1&gt;&#10;&lt;p&gt;We&amp;rsquo;ve seen how to place bounds on the local truncation error \( \tau_n \)&lt;/p&gt;&#10;&#10;&lt;link rel="stylesheet" href="https://peppyhare.github.io/r/katex/katex.min.css" /&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/katex.min.js"&gt;&lt;/script&gt;&#10;&lt;script defer src="https://peppyhare.github.io/r/katex/auto-render.min.js" onload="loadKatex();"&gt;&lt;/script&gt;&#10;&#10;&lt;script&gt;&#10; function loadKatex() {&#10; renderMathInElement(document.body, {&#10; delimiters: [&#10; { left: "$$", right: "$$", display: true },&#10; { left: "\\[", right: "\\]", display: true },&#10; { left: "$", right: "$", display: false },&#10; { left: "\\(", right: "\\)", display: false }],&#10; throwOnError: false,&#10; trust: (context) =&gt; ['\\htmlId', '\\href'].includes(context.command),&#10; macros: {&#10; "\\lcm": "\\mathop{\\mathrm{lcm}}",&#10; "\\sen": '\\text{sen}\\,',&#10; "\\dd": "\\mathop{\\mathrm{d} #1}",&#10; "\\abs": "\\lvert #1 \\rvert",&#10; "\\dd": "\\text{d}",&#10; "\\cross": "\\times",&#10; "\\pdv": "\\frac{\\partial #1}{\\partial #2}",&#10; "\\curl": "\\nabla \\cross #1",&#10; "\\vu": "\\mathbf{\\hat{#1}}",&#10; "\\vdot": "\\dot",&#10; "\\div": "\\nabla \\cdot #1",&#10; "\\grad": "\\nabla",&#10; "\\dv": "\\frac{d\\,#1}{d\\,#2}",&#10; "\\gr": "\\gamma",&#10; "\\vec": "\\mathbf{#1}",&#10; "\\tagl": "\\tag{#1}",&#10; "\\eqref": "(#1)",&#10; "\\laplacian": "\\mathbf{\\nabla ^2}",&#10; "\\label": "{}",&#10; "\\negadelta": "\\nabla",&#10; "\\eqref": "\\href{###1}{(\\text{#1})}",&#10; "\\ref": "\\href{###1}{\\text{#1}}",&#10; "\\label": "\\htmlId{#1}{}",&#10; }&#10; });&#10; };&#10;&lt;/script&gt;&lt;span&gt;&#10; \[\begin{aligned}&#10;\text{Forward Euler: } \quad &amp;amp; \tau_n = \mathcal{O}(\Delta t) \\&#10;\text{Backward Euler: } \quad &amp;amp; \tau_n = \mathcal{O}(\Delta t) \\&#10;\text{Trapezoid method: } \quad &amp;amp; \tau_n = \mathcal{O}(\Delta t^2)&#10;\end{aligned}\]&#10;&lt;/span&gt;&#10;&#10;&lt;p&gt;and observed empirically that forward Euler is first-order convergent. But what we really care about is the global error &lt;span&gt;&#10; \( e_n \)&#10;&lt;/span&gt;&#10;. Ideally we want to show that if &lt;span&gt;&#10; \( \tau_n = \mathcal{O}(\Delta t^p) \)&#10;&lt;/span&gt;&#10; then &lt;span&gt;&#10; \( e_n = \mathcal{O}(\Delta t^p) \)&#10;&lt;/span&gt;&#10;. This is often much harder than computing the order of accuracy. In this lecture we prove it for forward Euler, then state a fundamental theorem of Lax that simplifies the analysis for more complex methods.&lt;/p&gt;</description></item></channel></rss>