Search All of the Math Forum:

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

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

Replies: 2   Last Post: May 7, 2011 10:15 PM

 Messages: [ Previous | Next ]
 Daniel Carrera Posts: 4 Registered: 3/3/11
Posted: Apr 29, 2011 8:32 AM

Hello,

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

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.

Daniel.

Date Subject Author
4/29/11 Daniel Carrera
5/1/11 Peter Spellucci
5/7/11 vjp2.at@at.BioStrategist.dot.dot.com