Runge-Kutta-Fehlberg Method for O.D.E.'s


Runge-Kutta-Fehlberg Method (RKF45)

    One way to guarantee accuracy in the solution of an I.V.P. is to solve the problem twice using step sizes
h and[Graphics:Images/RungeKuttaFehlbergMod_gr_1.gif] and compare answers at the mesh points corresponding to the larger step size.  But this requires a significant amount of computation for the smaller step size and must be repeated if it is determined that the agreement is not good enough. The Runge-Kutta-Fehlberg method (denoted RKF45) is one way to try to resolve this problem.  It has a procedure to determine if the proper step size h is being used.  At each step, two different approximations for the solution are made and compared.  If the two answers are in close agreement, the approximation is accepted. If the two answers do not agree to a specified accuracy, the step size is reduced.  If the answers agree to more significant digits than required, the step size is increased.

    Each Runge-Kutta-Fehlberg step requires the use of the following six values:


Then an approximation to the solution of the I.V.P. is made using a Runge-Kutta method of order 4:


And a better value for the solution is determined using a Runge-Kutta method of order 5:


The optimal step size
sh can be determined by multiplying the scalar s times the current step size h. The scalar s is


[Graphics:Images/RungeKuttaFehlbergMod_gr_6.gif] is the specified error control tolerance.

Proof  Runge-Kutta-Fehlberg Method  Runge-Kutta-Fehlberg Method  


Computer Programs  Runge-Kutta-Fehlberg Method  Runge-Kutta-Fehlberg Method  

Mathematica Subroutine (Runge-Kutta-Fehlberg Method RFK45)  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/RungeKuttaFehlbergMod_gr_7.gif] with [Graphics:Images/RungeKuttaFehlbergMod_gr_8.gif] over [Graphics:Images/RungeKuttaFehlbergMod_gr_9.gif] at a discrete set of points with an error control  [Graphics:Images/RungeKuttaFehlbergMod_gr_10.gif].  Start with the initial point  [Graphics:Images/RungeKuttaFehlbergMod_gr_11.gif]  and generate the sequence of approximations  [Graphics:Images/RungeKuttaFehlbergMod_gr_12.gif].  The step size is automatically adjusted.  Thus the number [Graphics:Images/RungeKuttaFehlbergMod_gr_13.gif] is determined by the subroutine.  At each step the final answer is computed using the formula   [Graphics:Images/RungeKuttaFehlbergMod_gr_14.gif].  


Remark.  The formula for adjusting the step size is a popular choice for numerical analysis textbooks.  

Remark.  Some textbooks are now promoting the use of the RK order five formula  [Graphics:Images/RungeKuttaFehlbergMod_gr_16.gif]  as the accepted value instead of  [Graphics:Images/RungeKuttaFehlbergMod_gr_17.gif]  from the order four formula.  The following subroutine includes these adjustments.  


Mathematica Subroutine (Runge-Kutta-Fehlberg Method RFK54)  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/RungeKuttaFehlbergMod_gr_18.gif] with [Graphics:Images/RungeKuttaFehlbergMod_gr_19.gif] over [Graphics:Images/RungeKuttaFehlbergMod_gr_20.gif] at a discrete set of points with an error control  [Graphics:Images/RungeKuttaFehlbergMod_gr_21.gif].  Start with the initial point  [Graphics:Images/RungeKuttaFehlbergMod_gr_22.gif]  and generate the sequence of approximations  [Graphics:Images/RungeKuttaFehlbergMod_gr_23.gif].  The step size is automatically adjusted.   Thus the number [Graphics:Images/RungeKuttaFehlbergMod_gr_24.gif] is determined by the subroutine.  At each step the final answer is computed using the formula   [Graphics:Images/RungeKuttaFehlbergMod_gr_25.gif].  


Remark.  One might question the wisdom of using the RKF54 instead of the RKF45, it is still being debated.  In some sense the "guarantee" of accuracy is diminished.  The RKF54 is given for you to explore.


Example 1.  Solve  [Graphics:Images/RungeKuttaFehlbergMod_gr_27.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_28.gif]  over  [Graphics:Images/RungeKuttaFehlbergMod_gr_29.gif].  Use the Runge Kutta methods.
Solution 1.


Example 2.  Solve  [Graphics:Images/RungeKuttaFehlbergMod_gr_44.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_45.gif]  over  [Graphics:Images/RungeKuttaFehlbergMod_gr_46.gif].  Use Mathematica's NDSolve procedure.
Solution 2.


Example 3.  Solve  [Graphics:Images/RungeKuttaFehlbergMod_gr_56.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_57.gif]  over  [Graphics:Images/RungeKuttaFehlbergMod_gr_58.gif].  Use Mathematica's DSolve procedure.
Solution 3.


Example 4.  Determine the error for the RKF45 solution that was found in Example 1.
Solution 4.


Example 5.  Determine the error for the RKF54 solution that was found in Example 1.  
Solution 5.


Example 6.  Solve  [Graphics:Images/RungeKuttaFehlbergMod_gr_103.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_104.gif]  over  [Graphics:Images/RungeKuttaFehlbergMod_gr_105.gif].   Use the Runge Kutta methods.
Solution 6.


Example 7.  Given  [Graphics:Images/RungeKuttaFehlbergMod_gr_120.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_121.gif]  over  [Graphics:Images/RungeKuttaFehlbergMod_gr_122.gif].  This D.E. is known to be a Riccati equation.  
The analytic solution is known to be  [Graphics:Images/RungeKuttaFehlbergMod_gr_123.gif];  compare it with the solutions that were found in Example 6.  
Solution 7.


Example 8.  Solve  [Graphics:Images/RungeKuttaFehlbergMod_gr_144.gif]  with  [Graphics:Images/RungeKuttaFehlbergMod_gr_145.gif].   Use Mathematica's DSolve procedure.
Solution 8.


Research Experience for Undergraduates

Runge-Kutta-Fehlberg Method  Runge-Kutta-Fehlberg Method  Internet hyperlinks to web sites and a bibliography of articles.  


Download this Mathematica Notebook Runge-Kutta-Fehlberg Method


Return to Numerical Methods - Numerical Analysis


















(c) John H. Mathews 2004