Add problem 3

This commit is contained in:
Cory Balaton 2023-09-07 14:38:46 +02:00
parent 9a6eaddf8e
commit 91cc7583af
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B

View File

@ -1,4 +1,37 @@
\section*{Problem 3}
% Show how it's derived and where we found the derivation.
To derive the discretized version of the Poisson equation, we first need
the taylor expansion for $u(x)$ around $x + h$ and $x - h$.
\begin{align*}
u(x+h) &= u(x) + u'(x) h + \frac{1}{2} u''(x) h^2 + \frac{1}{6} u'''(x) h^3 + \mathcal{O}(h^4)
\end{align*}
\begin{align*}
u(x-h) &= u(x) - u'(x) h + \frac{1}{2} u''(x) h^2 - \frac{1}{6} u'''(x) h^3 + \mathcal{O}(h^4)
\end{align*}
If we add the equations above, we get this new equation:
\begin{align*}
u(x+h) + u(x-h) &= 2 u(x) + u''(x) h^2 + \mathcal{O}(h^4) \\
u(x+h) - 2 u(x) + u(x-h) + \mathcal{O}(h^4) &= u''(x) h^2 \\
u''(x) &= \frac{u(x+h) - 2 u(x) + u(x-h)}{h^2} + \mathcal{O}(h^2) \\
u_i''(x) &= \frac{u_{i+1} - 2 u_i + u_{i-1}}{h^2} + \mathcal{O}(h^2) \\
\end{align*}
We can then replace $\frac{d^2u}{dx^2}$ with the RHS (right-hand side) of the equation:
\begin{align*}
- \frac{d^2u}{dx^2} &= 100 e^{-10x} \\
\frac{ - u_{i+1} + 2 u_i - u_{i-1}}{h^2} + \mathcal{O}(h^2) &= 100 e^{-10x} \\
\end{align*}
And lastly, we leave out $\mathcal{O}(h^2)$ and change $u_i$ to $v_i$ to
differentiate between the exact solution and the approximate solution,
and get the discretized version of the equation:
\begin{align*}
align* \frac{ - u_{i+1} + 2 u_i - u_{i-1}}{h^2} &= 100 e^{-10x} \\
\end{align*}