# Why does the Euler method go bad when the time step $T$ is decreased?

Consider below differential eqn $$\dfrac{dy}{dt} = y$$

In discrete form, with a time step $T$, using forward euler, it becomes $$\dfrac{y[n+1]-y[n]}{T} = y[n]$$ Solving the difference eqn we get $$y[n] = (1+T)^ny$$

Intuitively if we decrease the time step $T$, the discrete form should approach more closely to the continuous form. But this doesn't seem to be the case as changing T moves the base of the $(1+T)^n$ away from $e$. Please look at the plot . Why did the euler method give this kind of solution which doesn't get better even if we decrease time step T ?

## 1 Answer

The relation between discrete numerical approximations $y[n]$ and the solution $y(t)$ is given by $y(t=n \cdot T) \approx y[n]$. In your plot you used the relation $y(t=n) \approx y[n]$.

If you plot $g\left(n\right)\ =\ \left(1+T\right)^{\frac{n}{T}}$ instead of $g\left(n\right)\ =\ \left(1+T\right)^{n}$, you will see convergence for small time steps $T$.

• You mean $y(t = nT) \approx y[n]$. – John Barber Jun 17 '18 at 5:01
• Ahh yes t = nT gives n = t/T, but I see my error now... Ty :) Also if I may ask another perhaps silly question, if we let the initial value y = 0, does this method fail ? Because the IVP problem can have dy/dt = y with y(0) = 0... – rsadhvika Jun 17 '18 at 5:03
• But if we let y = 0 in the discrete form, we get all 0s hmm – rsadhvika Jun 17 '18 at 5:03
• @rsadhvika: What is the solution to the IVP problem with $y(0)=0$? – Rahul Jun 17 '18 at 5:22
• @Rahul $$y(t) = Ce^t ; y(0) = 0 \implies 0 = Ce^0 \implies C = 0$$ Oh I see now the solution to IVP is also y = 0. It works just fine. Guess I should keep more faith in math in general haha.. Euler rocks! Thank you so much :) – rsadhvika Jun 17 '18 at 5:34