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.
- void Runge_Kutta_2nd_Order( double (*f)(double,double,double), double x0, double y[ ], double c, double h, int number_of_steps )
This function uses the classical Runge-Kutta method to estimate the solution of the initial value problem, y'' = f(x,y,y'); y(x0) = y[0] and y'(x0) = c, at x0 + nh where for
n = 1, …, number_of_steps and h is the step size. On input, y[0] is the value of y(x) at x = x0. On output y[n] is the value of y(x) at x = x0 + n h for
n = 0, …, number_of_steps.