I am looking at the effect of the step size (h) on the size of the error for Euler's method. I am using the following ODE:


With the following conditions:

y(0) = 0, solving for x = pi

I get the errors shown below for each step size.


\(\pi/20 \)-0.00411


I checked my calculations were correct using this online calculator:


On the wikipedia page for Euler's Method (https://en.wikipedia.org/wiki/Euler_method#Global_truncation_error), it states that the error should be approximately proportional to h because it is a 1st order method, but in my data it is approximately proportional to h squared! This only happens for this particular ODE. The other ODEs I tested gave errors proportional to h squared, but I can't find any explanation for why this ODE is different.

Thank you for ay help!

Will85237  Apr 14, 2018
edited by Will85237  Apr 14, 2018

It's been a while since I dealt with this sort of stuff, but I think that this is the likely explanation.

For the ode 

\(\displaystyle y'=f(x,y) ,\)

the local truncation error is

\(\displaystyle \frac{h^{2}}{2!}f'(x_{0},y_{0}),\)

which, for the given equation will be

\(\displaystyle \frac{h^{2}}{2!}\cos(x_{0}).\)

Since we are working over the range 0 to pi, what will happen is that the errors to the left of pi/2 will, in some way, cancel out with the errors to the right of pi/2, (because the cosines will be equal in magnitude but opposite in sign).

That means that the truncation errors don't build up in the usual way. Looking at the truncation errors for each step will probably give a clearer picture.



Guest Apr 15, 2018

A further thought.

Repeat your calculations for x = 0 to x = pi/2 and see if the errors behave as they should.



Guest Apr 15, 2018

It's the max error that is linear with h:



Alan  Apr 15, 2018

22 Online Users


New Privacy Policy

We use cookies to personalise content and advertisements and to analyse access to our website. Furthermore, our partners for online advertising receive information about your use of our website.
For more information: our cookie policy and privacy policy.