What is the error of $x_i$ at a fixed time $t_i$ when using Euler's method for the IVP $\frac{dx}{dt}=x$ with $x(0)=1$?

21 Views Asked by At

So we have Euler's method: $x_{i+1}=x_i+hf(t_i,x_i)$ where $x'=f(t,x)$ and $h$ is a small step size.

Applying this method to $x'=x$ gives $x_{i+1}=x_i+hx_i=(1+h)x_i$.

Solving this difference equation and using $x_0=1$ gives us $x_i=(1+h)^i$.

Clearly the actual solution to $x'=x, x(0)=1$ is $x(t)=e^t$. My problem is to explicitly find the first term of the error induced by Euler's method at a fixed time $t_i$. I.e. the problem is to calculate $e^{t_i}-(1+h)^i$ (the global error).

Obviously we have that $t_i=ih$ since $t\geq 0$.

I know that, since $h$ is small, $(1+h)^i=e^{i\ln(1+h)}=e^{i(h-\frac{h^2}{2}+\frac{h^3}{3}+...)}=e^{t_i}e^{i(-\frac{h^2}{2}+\frac{h^3}{3}+...)}=e^{t_i}e^{t_i(-\frac{h}{2}+\frac{h^2}{3}+...)}$

Expanding the exponential gives: $e^{t_i}\big[1+t_i(-\frac{h}{2}+\frac{h^2}{3}+...)+\frac{t_i^2}{2}(-\frac{h}{2}+\frac{h^2}{3}+...)^2+...\big]$.

And so $$e^{t_i}-(1+h)^i=e^{t_i}-e^{t_i}\big[1+t_i(-\frac{h}{2}+\frac{h^2}{3}+...)+\frac{t_i^2}{2}(-\frac{h}{2}+\frac{h^2}{3}+...)^2+...\big]=-e^{t_i}\big[t_i(-\frac{h}{2}+\frac{h^2}{3}+...)+\frac{t_i^2}{2}(-\frac{h}{2}+\frac{h^2}{3}+...)^2+...\big]$$.

So would I be correct in saying that the leading error term is $\frac{1}{2}e^{t_i}t_ih$ and so the error is $O(h)$?