Is there any way or a formula to calculate the error of Euler's method and Runge-Kutta 4

98 Views Asked by At

When modeling a system with a step h1 using the simple Euler method, the error a1 was obtained, and the 4th order Runge-Kutta method obtained the error b1. How can i determine the values ​​of errors a2 and b2 that will be obtained by modeling this system with a step of h2.

I tried formulas a2 = a1(h1 / h2), b2 = b1(h1 / h2)⁴ But I'm not sure if these formulas are correct. I have

h1 = 10^-5
a1 = 3.0 * 10^-3
b1 = 0.2 * 10^-12
h2 = 5 * 10^-3
1

There are 1 best solutions below

9
Lutz Lehmann On

You are not calculating the error, but estimating from one error to the next. Or calculating an estimate for the error.

Mainly, your formulas need to be the other way around, h2/h1. You are using the model

error a = C_a * h + O(h^2)
      b = C_b * h^4 + O(h^5)

The flow of information is: from a1and h1 determine guess for C_a, and with that compute the guess for a2. Thus

a2 ~= C_a*h2 ~= (a1/h1)*h2 = a1*(h2/h1)
b2 ~= C_b*h2^4 ~= (b1/h1^4)*h2^4 = b1 *(h2/h1)^4

The error as function of the step size usually has a V shape in a loglog plot, falling like 1/h for small step sizes, then rising linearly as per the order, then becoming wavy then chaotic for step sizes near the stability boundary. See for example

So to get a correct estimate one needs that h1 and h2 are both in the second or middle segment where the error behaves as per the error order of the method.