Modified Midpoint (Gragg's) Method

Description

For approximating the solution of the initial value problem y ' = f(x, y), y(x0) = y0, the modified midpoint method begins by applying the midpoint method:
y0 = y(x0), y1 = y0 + h f(x0, y0)
yn+1 = yn-1 + 2 h f(xn, yn), n = 1, 2, ... .
Then at a certain step N, where N is an even integer, the oscillating error term is damped by redefining yN as
yN  := ½ (yN + yN - 1 + h f(xN, yN) ).
The method then proceeds as if solving the initial value problem y ' = f(x, y), y(xN) = yN .
The modified midpoint method is globally a second order method for which Richardson extrapolation may be applied to increase the order and accuracy.

Function List

C Source