I am trying to understand the stability of the forward Euler method. I read there's a model problem to see the stability.
$$y'(t) = \lambda y(t) \qquad t \in (0, \infty)$$ $$y(0) = 1$$
then the book shows this:
$$u_0 = 1 \qquad \text{does this come from the initial condition?}$$
then
$$u_{n+1}=u_n(1+\lambda h) = (1+\lambda h)^{n+1}, \qquad n ≥ 0$$
I cannot understand how $(1+\lambda h)^{n+1}$ appeared
then the book concludes $ -1 < h\lambda < 1 \quad \text{iff} \quad h < 2/|\lambda|$
for the inequallity the thing I get is $\frac{-2}{\lambda} < h$ but still don't know how they get the absolute value of $\lambda$.
how does the book arrive to this conclusion? I don't expect a very complex answer (which is appreciated) but a simple way to understand the intermediate steps not shown.
$\endgroup$1 Answer
$\begingroup$You are right with your remark, that $u_0=1$ comes from the initial condition. Apperently, the numerical solution is donated by $u$, whereas the analytical solution is $y$.
The forward Euler method for $y'(t) = f(t,y(t)) $ reads $$ u_{n+1} = u_n + h\cdot f(t_n,u_n)$$ You have $y'(t) =\lambda y(t)$, so $f(t_n,u_n)= \lambda u_n$. Now we plug this into the equation above and obtain
$$u_{n+1} = u_n + h\cdot f(t_n,u_n) = u_n+ h\lambda u_n = u_n\cdot (1+h\lambda)$$ But we can furthermore express $u_n$ in terms of $u_{n-1}$ and so on, up to $u_0$
\begin{align}u_{n+1} &= u_n\cdot (1+h\lambda) \\ &=u_{n-1}\cdot (1+h\lambda)\cdot (1+h\lambda) \\ &= ... \\ &=u_0\cdot (1+h\lambda)\cdot (1+h\lambda) \cdot ...\cdot (1+h\lambda) \\ &=u_0 (1+h\lambda)^n = (1+h\lambda)^n\end{align} Since $u_0=1$.
Now assuming you mean $\lambda <0$ which makes sense, because otherwise your solution would diverge and that would be a bad model problem.
Furthermore I assume you mean $ -1<(1+\lambda h) <1 $ iff $ h < 2/|\lambda|$ and not $ -1<(\lambda h) <1 $ iff $ h < 2/|\lambda|$ as you want to show that your solution reaches zero if $n\rightarrow \infty$.
So to get $1+h\lambda<1$ you get $h\lambda < 0 \Rightarrow h>0$ as $\lambda <0$.
For $-1<1+h\lambda$ you now have $-2<h \lambda \Rightarrow -2/\lambda > h$. With $\lambda<0$ you get $-2/\lambda = 2/|\lambda|$ So finally you have $0<h<2/|\lambda|$.
Please let me know, if my assumptions ($\lambda<0$ and the different inequality) were correct.
$\endgroup$ 3