Help to solve this exercise with Euler Method, my problem here problem is that the solutions I calculated are not close to the real values and they diverge. Thanks!
$$y'=e^y $$
with conditions $$ 0\leq t\leq0.2, y(0)=1$$
First of all, my solution for the ecd was $$y(t)=ln{\frac{e}{1-et}}$$ then for the Euler Method, I used h=0.02, We have the first iteration
$$f(t_i,y_i)=e^y$$ $$y_{i+1}=y_i+f(t_i,y_i)h$$ $$y(0.02)=1+e^{(1)}(0.02)=1.05436$$
| t_i | y_real | y_euler |
|---|---|---|
| 0 | 1 | 1 |
| 0.02 | 0.9456 | 1.05436 |
| 0.04 | 0.8912 | 1.11177 |
| 0.06 | 0.8369 | 1.17257 |
| 0.08 | 0.7825 | 1.23717 |
| 0.1 | 0.7281 | 1.30609 |
| 0.12 | 0.6738 | 1.37993 |
| 0.14 | 0.6194 | 1.45942 |
| 0.16 | 0.565 | 1.54549 |
| 0.18 | 0.5107 | 1.63929 |
| 0.2 | 0.4563 | 1.74233 |
Please note your $y_{\rm real}$ is not correct:
Calculated using Mathematica: