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

Check out the new Numerical Analysis Projects page.

 

Runge-Kutta Method of Order 4.  To approximate the solution of the initial value problem [Graphics:Images/RungeKuttaMod_gr_1.gif]  with  [Graphics:Images/RungeKuttaMod_gr_2.gif]  over  [Graphics:Images/RungeKuttaMod_gr_3.gif].  Start with the initial point  [Graphics:Images/RungeKuttaMod_gr_4.gif]  and generate the sequence of approximations  [Graphics:Images/RungeKuttaMod_gr_5.gif]  by using the formula  

    [Graphics:Images/RungeKuttaMod_gr_6.gif],  
where
    [Graphics:Images/RungeKuttaMod_gr_7.gif]  

 

Animations (Runge-Kutta Method of Order 4  Runge-Kutta Method of Order 4).  Internet hyperlinks to animations.

 

Program (Runge-Kutta Method)  To compute a numerical approximation for the solution of the initial value problem [Graphics:Images/RungeKuttaMod_gr_8.gif] with [Graphics:Images/RungeKuttaMod_gr_9.gif] over [Graphics:Images/RungeKuttaMod_gr_10.gif] at a discrete set of points using the formula  [Graphics:Images/RungeKuttaMod_gr_11.gif], where [Graphics:Images/RungeKuttaMod_gr_12.gif], [Graphics:Images/RungeKuttaMod_gr_13.gif], [Graphics:Images/RungeKuttaMod_gr_14.gif], and [Graphics:Images/RungeKuttaMod_gr_15.gif].

Mathematica Subroutine (Runge-Kutta Method).

[Graphics:Images/RungeKuttaMod_gr_16.gif]

Example 1.  Solve the I.V.P.   [Graphics:Images/RungeKuttaMod_gr_17.gif]  over  [Graphics:Images/RungeKuttaMod_gr_18.gif].  Use the Runge-Kutta method with  2  subintervals of  [0, 0.4]  to get a numerical approximation to the solution.  Show the calculations for  [Graphics:Images/RungeKuttaMod_gr_19.gif]  for each step.  Compare the Runge-Kutta solution with the known analytic solution  [Graphics:Images/RungeKuttaMod_gr_20.gif].
Solution 1.

 

Example 2.  Solve the I.V.P.   [Graphics:Images/RungeKuttaMod_gr_48.gif]  over  [Graphics:Images/RungeKuttaMod_gr_49.gif].  Use the Runge-Kutta method with  10  subintervals of  [0, 10]  to get a numerical approximation to the solution.  Plot the solution using the 11 points you just computed in the window {{0,10},{0,1}}.  Report the last point which is the numerical approximation to  (10, y(10)).
Solution 2.

 

Example 3.  Solve the I.V.P.   [Graphics:Images/RungeKuttaMod_gr_54.gif]  over  [Graphics:Images/RungeKuttaMod_gr_55.gif].  Use the Runge-Kutta method with  20  subintervals of  [0, 10]  to get a numerical approximation to the solution.  Plot the solution using the 21 points you just computed in the window {{0,10},{0,1}}.  Report the last point which is the numerical approximation to  (10, y(10)).
Solution 3.

 

Example 4.  Solve the I.V.P.   [Graphics:Images/RungeKuttaMod_gr_60.gif]  over  [Graphics:Images/RungeKuttaMod_gr_61.gif].  Use the Runge-Kutta method with  50  subintervals of  [0, 10]  to get a numerical approximation to the solution.  Plot the solution using the 51 points you just computed in the window {{0,10},{0,1}}.  Report the last point which is the numerical approximation to  (10, y(10)).
Solution 4.

 

Example 5.  Solve the I.V.P.   [Graphics:Images/RungeKuttaMod_gr_66.gif]  over  [Graphics:Images/RungeKuttaMod_gr_67.gif].  Use the Runge-Kutta method with  100  subintervals of  [0, 10]  to get a numerical approximation to the solution.  Plot the solution using the 101 points you just computed in the window {{0,10},{0,1}}.  Report the last point which is the numerical approximation to  (10, y(10)).
Solution 5.

 

Example 6.  Use Mathematica to find the analytic solution to the D.E.
Solution 6.

 

Example 7.  Experiment with  [Graphics:Images/RungeKuttaMod_gr_83.gif]  and try to feel good about this new function.
Solution 7.

 

Example 8.  Plot the solution in 6. 

Solution 8.

 

Example 9.  Plot the error in exercise 5 using the "true solution" function in exercise 8.
Remark. You must make sure that the Runge Kutta solution in exercise 5 is the "last one" that was computed, so that the values that are actually resident in the variables  T  and  Y  are the ones we need to use.
Solution 9.

 

Example 10.  Error analysis.  The Runge-Kutta method of order N = 4 allegedly has a Final Global Error (FGE) of order  [Graphics:Images/RungeKuttaMod_gr_101.gif].  Hence, the error at the right endpoint should appear to decrease by 1/16 when the number of sub-intervals is doubled. Use the D.E. in exercise 1 and investigate this behavior for m = 15, 30, 60, 120 and 240 sub-intervals of [0,3].  
Notice. The subroutine Runge  stores the values in a list starting with subscript 1 and ending with subscript m+1. We need only check this last point with the value obtained from the analytic solution.  To explore the error we will need to execute things in the following order.
Solution 10.

 

Old Lab Project (Runge-Kutta Method of order 4  Runge-Kutta Method of order 4).  
Internet hyperlinks to an old lab project.  

 

Research Experience for Undergraduates

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

 

Downloads (Runge-Kutta Method of order 4  Runge-Kutta Method of order 4).  
Download this Mathematica notebook.  

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2003