Finding global error in Modified Euler method

euler's methodnumerical methodsordinary differential equations

I am doing some questions on modified Euler method (=Heun, expl. trapezium) and would appreciate some help with this one.
The differential equation is
$$\frac{dy}{dx}+2y=e^{3t}, ~~0\leq t\leq 1,~~ y(0)=1.$$

I found out that the exact solution is $y(t)=\frac{e^{3t}}{5}+\frac{4e^{-2t}}{5}$.

The question requires me to find the numerical global error of the modified Euler method by using values of $y(1)$ found by using $h=1$ and $h=0.5$ in the modified Euler method.

So far I calculated

  • $y(1) \approx 5.8316$ using $h=0.5$ and
  • $y(1) \approx 10.5428$ using $h=1$.
  • Exact value at $t=1$ is $y_E(1)=4.1254$.

So the error when $h=0.5$ is $5.8316-4.1254=1.7062$ and that for $h=1$ is $6.4174$.

Next I assumed the error to be of order $h^a$. So, the error when order is $h^a$ is $6.4174$, then when error is ${\left (\frac{h}{2}\right )}^a$ error is $\frac{6.4174}{2^a}$ and evaluated this value to be equal to $1.706$ and found $a=1.9112$.

Is this the correct way or there is some formula for calculating error for modified Euler method. I could not find any so far.

Best Answer

I would write the assumptions about the error a little more explicitly, then you have less problems explaining what you do. That the error order is $a$ can be written explicitly as $$ y_h(t)=y_E(t)+C(t)h^a+\text{higher degree terms} $$ In the order estimate at $t=1$ the higher degree terms are disregarded, and 2 values of $h$ are used to eliminate $C(1)$ and compute $a$, 2 equations for 2 unknowns. Then you get exactly the computation you have done, $$ \frac{y_h(1)-y_E(1)}{y_{h/2}(1)-y_E(1)}\approx 2^a $$ from where you get the estimated value of the order $a$.

I get for a larger collection of step sizes the values

N= 1, h=1.0000, x=1.00, y=   10.54276846159383, a=   1.91118
N= 2, h=0.5000, x=1.00, y=    5.83159536458917, a=   2.10154
N= 4, h=0.2500, x=1.00, y=    4.52294038463724, a=   2.08881
N= 5, h=0.2000, x=1.00, y=    4.37414754577927, a=   2.07703
N=10, h=0.1000, x=1.00, y=    4.18433504965781, a=   2.04429

If you do the same for the explicit midpoint method (=improved Euler), then conversely the numerical values are better for the larger step sizes, but the order estimate converges slower towards $2$.

N= 1, h=1.0000, x=1.00, y=    4.48168907033806, a=   1.22604
N= 2, h=0.5000, x=1.00, y=    4.27769565474792, a=   1.55472
N= 4, h=0.2500, x=1.00, y=    4.17722465081606, a=   1.81270
N= 5, h=0.2000, x=1.00, y=    4.16044848001507, a=   1.86043
N=10, h=0.1000, x=1.00, y=    4.13503447502597, a=   1.94137