Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
_____________________________________________
Associated Topics || Dr. Math Home || Search Dr. Math
_____________________________________________

Example of the Runge-Kutta Method


Date: 02/10/2001 at 04:37:22
From: Joel Mitre
Subject: Runge-Kutta Method

Please explain the Runge-Kutta method for solving ordinary 
differential equations of the form y' = f(x,y).


Date: 02/10/2001 at 05:48:56
From: Doctor Anthony
Subject: Re: Runge-Kutta Method

The Runge-Kutta method was developed as a step-by-step method for 
solving differential equations without recourse to Taylor series and 
the frequently very awkward calculation of first, second, third and 
higher derivatives.

The method is best illustrated by an example.

Use the 4th order Runge-Kutta method with h = 0.1 to find the 
approximate solution for y(1.1), working to 4 decimal places, for the 
initial value problem:

     dy/dx = 2xy,   y(1) = 1

We have dy/dx = f(x,y) = 2xy.

If you require the 4th order approximation the formula will be:

     y(x0 + h) = y(x0) + (1/6)[w1 + 2w2 + 2w3 + w4]

where:
     w1 = h*f(x0.y0)               = 0.1(2)(1)(1)          = 0.2
     w2 = h*f(x0 + h/2, y0 + w1/2) = 0.1(2)(1.05)(1.1)     = 0.231
     w3 = h*f(x0 + h/2, y0 + w2/2) = 0.1(2)(1.05)(1.1155)  = 0.234255
     w4 = h*f(x0 + h,   y0 + w3)   = 0.1(2)(1.1)(1.234255) = 0.2715361

and so:

     y(1.1) = 1 + (1/6)[0.2 + 2(0.231) + 2(0.234255) + 0.2715361]
            = 1.23367435
 
 
We can compare this with the exact solution to the problem.

     dy/y  = 2x dx

and integrating:

     ln(y) = x^2 + C

and y = 1 when x = 1

     0 = 1 + C

and so  C = -1. Therefore:

     ln(y) = x^2 - 1

         y = e^(x^2-1)

When x = 1.1 this gives:

     y = e^(1.1^2 -1)

       = e^0.21

       = 1.23367806

which is same as Runge-Kutta up to the 5th decimal place.

- Doctor Anthony, The Math Forum
  http://mathforum.org/dr.math/   
    
Associated Topics:
College Calculus

Search the Dr. Math Library:


Find items containing (put spaces between keywords):
 
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

_____________________________________
Math Forum Home || Math Library || Quick Reference || Math Forum Search
_____________________________________

Ask Dr. MathTM
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/