The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math.num-analysis

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Adaptive Runge-Kutta integrators
Replies: 2   Last Post: May 7, 2011 10:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Daniel Carrera

Posts: 4
Registered: 3/3/11
Adaptive Runge-Kutta integrators
Posted: Apr 29, 2011 8:32 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I'm making a personal library of ODE integrators. I want to have three

1) A traditional 4th-order Runge-Kutta integrator. Simplest method,
easiest to get right. Ideally, I'd like to add an adaptive step size.

2) A 4th+5th order adaptive step size integrator of the Runge-Kutta
family. Like the Dormand-Prince or similar.

3) A Bulirsch-Stoer method with Richardson extrapolation.

I have two questions pertaining the first two integrators:

1) I already have the basic 4th-order RK method implemented. I think
that the simplest reasonable way to give it an adaptive step size is
to use the mid-point method, like this:

! Variables needed for 4th-order Runge-Kutta
k1 = dY(t, Y)
k2 = dY(t + h/2, Y + k1*h/2)
k3 = dY(t + h/2, Y + k2*h/2)
k4 = dY(t + h , Y + k3*h)

! The second also gives me the mid-point method.
Y_rk4 = Y + (k1 + 2*k2 + 2*k3 + k4) * h/6
Y_mid = Y + k2 * h

! Error estimate and new step size.
error = abs(Y_rk4 - Y_mid) / ( abs(Y_rk4) * rtol )

h = h * (rtol / error) ** (1/2)

if (error > rtol) then
... go back and try again ...
end if

Does this look reasonable?

2) My second question is shorter. There are several 4th+5th order
methods of the Runge-Kutta family:

* Dormand-Prince
* Fehlberg
* Cash-Karp

Which one should I pick?

Thanks for the help.


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.