Let's say I have solved an ODE with Euler's forward method, and also solved it using RK4, in both cases for varying decreasing step sizes h. Is there any way to look at the graphs and "see" the order of accuracy of the methods?

Chaim Ferguson

Chaim Ferguson

Answered question

2022-10-23

Let's say I have solved an ODE with Euler's forward method, and also solved it using RK4, in both cases for varying decreasing step sizes h. Is there any way to look at the graphs and "see" the order of accuracy of the methods?

Answer & Explanation

Adalyn Pitts

Adalyn Pitts

Beginner2022-10-24Added 15 answers

Yes, graph the differences of the results for stepsizes h and 2 hh as double-logarithmic plot. The graph should be of lines, and the slopes correspond to the order of the method.

More precisely, the numerical result for step size h is in first order of approximation
y h = y + C · h p + D / h
where C accumulates the derivative factors for the method error and D accounts for the floating point errors in the evaluation of every single step.
Thus the mentioned difference gives
y 2 h y h = ( 2 p 1 ) · C · h p D / ( 2 h )
so that for moderately small h D / C p + 1 one gets
log ( y 2 h y h ) log ( ( 2 p 1 ) · C ) + p · log ( h )

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?