Trying to solve exercise about Euler method

47 Views Asked by At

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
1

There are 1 best solutions below

0
On BEST ANSWER

Please note your $y_{\rm real}$ is not correct:

t_i y_real y_euler
0 1 1
0.02 1.0559 1.05436
0.04 1.11511 1.11177
0.06 1.17805 1.17257
0.08 1.24521 1.23717
0.1 1.31722 1.30609
0.12 1.39481 1.37993
0.14 1.47894 1.45942
0.16 1.5708 1.54549
0.18 1.67195 1.63929
0.2 1.78451 1.74233

Calculated using Mathematica:

Table[Log[E/(1 - E* 0.02*i)], {i, 0, 10}]