Euler's methods

The slope of the secant through $y(t)$ and $y(t+h)$ can be approximated by $y'(t)$, $y'(t+h)$, or, more accurately, the average of the two: $(y'(t)+y'(t+h))/2$. Correspondingly, we have the following methods:

In summary, here is how the three methods find the increment of function $y(t)$:

$\displaystyle \Delta y
=h\,f'(t+ch) \approx h\,\left\{\begin{array}{ll}
y'(t) & O(h^2) \\ y'(t+h) & O(h^2) \\
(y'(t)+y'(t+h))/2 & O(h^3)
\end{array}\right.$ (195)

which can be implemented iteratively from the known initial condition $y_0=y(0)$

$\displaystyle y_{n+1}=y_n+h\,\left\{\begin{array}{l}
y'_n \\ y'_{n+1} \\ (y'_n+...
...n)\\ f(t_{n+1},y_{n+1})\\
(f(t_n,y_n)+f(t_{n+1},y_{n+1}))/2
\end{array}\right.$ (196)

Example: Consider a simple first order constant coefficient DE:

$\displaystyle y'(t)+\lambda y(t)=0,\;\;\;\;\;$i.e.$\displaystyle \;\;\;\;\;\;
y'(t)=f(t,\,y(t))=-\lambda y(t)$ (197)

with $\lambda>0$ and initial condition $y(0)=y_0$. The closed form solution of this equation is known to be $y(t)=y_0 e^{-\lambda t}$, which decays exponentially to zero when $t\rightarrow \infty$. This DE can be solved numerically by each of the three methods. The results of all three methods are shown together with the ground truth solution $y(t)=y_0 e^{-\lambda t}$ with $y_0=1$ and $\lambda=1$. The four plots correspond to five different step sizes $h=0.5,\;0.83,\;1.67,\;2.0,\;2.2$.

FirstOrderDecay4.png

We make the following observations:

As can be seen from the above, there are in general two approaches to estimate the future, such as the next value $y_{n+1}$ of a function $y(t)$: