1
$\begingroup$

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[0]$$

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 ?

$\endgroup$
3
$\begingroup$

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$.

$\endgroup$
  • 2
    $\begingroup$ You mean $y(t = nT) \approx y[n]$. $\endgroup$ – John Barber Jun 17 '18 at 5:01
  • $\begingroup$ 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] = 0, does this method fail ? Because the IVP problem can have dy/dt = y with y(0) = 0... $\endgroup$ – rsadhvika Jun 17 '18 at 5:03
  • $\begingroup$ But if we let y[0] = 0 in the discrete form, we get all 0s hmm $\endgroup$ – rsadhvika Jun 17 '18 at 5:03
  • 1
    $\begingroup$ @rsadhvika: What is the solution to the IVP problem with $y(0)=0$? $\endgroup$ – Rahul Jun 17 '18 at 5:22
  • $\begingroup$ @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 :) $\endgroup$ – rsadhvika Jun 17 '18 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.