Runge-Kutta Method for Second Order Differential Equations

Description

The classical Runge-Kutta method applied to the second order differential equation y''(x) = f(x, y, y') with initial conditions y(x0) = y0 and y'(x0) = y'0 evaluates the function f(x,y,y') four times per step and can be derived by transforming the problem to a coupled system of first order differential equations.

The algorithm for the implicit central difference method is derived by using the central difference approximations for y'(x) and y''(x):

y'(x) = (y(x+h) - y(x-h) ) / 2h,
and
y''(x) = (y(x+h) - 2y(x) + y(x-h)) / h2.

Let xn = x0 + nh, yn be the approximation to y(xn), and fn = f(xn, yn, (yn + 1 - yn - 1 ) / 2h ), the procedure proceeds recursively via the implicit equation for yn + 1 as follows:

yn + 1 = 2 yn - yn - 1 + h2 fn.

Function List

C Source