# Euler's method on IVP, finding the global error.

I have the following system:

$$y'=y+e^x$$

$$y(0)=0$$

The problem asks for applying Euler's method and then finding an expression for the global error. Finally, supposing that

$$\lim_{h->0} \frac{1-(\frac{1+h}{e^h})^\frac{x}{h}}{\frac{x}{h}(e^h-(1+h))}=1$$

Check that the global error tends to $$0$$ as $$h$$ tends to $$0$$ as well.

Let's first apply Euler's method.

$$\eta_0=y_0=0$$

$$x_i=x_0+ih=ih$$

$$\eta_{i+1}=\eta_i+hf(x_i,\eta_i)$$

Since $$x_i=ih$$, we have $$\eta_{i+1}=\eta_i+h(\eta_i + e^{ih}$$). Factoring by $$\eta_i$$:

$$\eta_{i+1}=\eta_i(1+h)+he^{ih}$$

And now I don't how should I proceed. Should I solve the iteration? I've done problems where I can express $$\eta_{i+1}$$ in terms of $$\eta_0$$ by iterations, but here I can't do so because the $$he^{ih}$$ prevents that (or at least I haven't managed to do it).

I know that global error is defined as $$e(x,h)=\eta(x,h)-y(x)$$ but I don't know how exactly should I use that formula. My guess it that I have to solve the differential equation and use the solution $$y(x)$$, but I don't know how to solve that system or what exactly is $$\eta(x,h)$$.

Any help regarding to solving this problem will be highly appreciated.

Thanks!

The integrating factor for the exact solution is $$e^{-x}$$, so that $$(e^{-x}y(x))'=1\implies y(x)=y(0)e^x+xe^x.$$ This resonance behavior will make the analysis of the numerical solution a little more complicated.
The Euler approximations have the general form $$y_i=A(1+h)^i+Be^{ih}$$. Inserting into the recursion one finds $$Be^h=(1+h)B+h\implies B=\frac{h}{e^h-1-h}$$ and from the initial condition $$y_0=A+B\implies y_i=(y_0-B)(1+h)^i+Be^{ih}=y_0(1+h)^i+\frac{h((1+h)^i-e^{ih})}{e^h-1-h}$$
Now you can insert the expansions for $$(1+h)^i=\exp(i\ln(1+h))=\exp(ih-\tfrac12ih^2+\tfrac13ih^3+...)$$ to find the lower error order terms.of the difference to the exact solution.