Prof. Vladimir A. Dobrushkin
This tutorial contains many matlab scripts.
You, as the user, are free to use all codes for your needs, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. Any comments and/or contributions for this tutorial are welcome; you can send your remarks to
Another popular predictor-corrector scheme is known as the Milne or Milne--Simpson method. See
Milne, W. E., Numerical Solutions of Differential Equations, Wiley, New York, 1953.
Its predictor is based on integration of the slope function f(t, y(t)) over the interval \( \left[ x_{n-3} , x_{n+1} \right] \) and then applying the Simpson rule:
Example. Let us start with the Riccati equation \( y' = x^2 + y^2 \) subject to the initial condition \( y(0) =-1 . \) Its solution is expressed through Bessel functions:
Plot[d[x], {x, 0, 5.5}, PlotStyle -> Thick]

function M=milne(f,t,y)
% Input: f is the function entered as a string 'f'
% t is the vector of abscissas
% y is the vector of ordinates
% Remark: The first four coordinates of t and y must have
% starting values obtained with RK4
% Output: M=[t',y'] where t is the vector of abscissas
% y is the vector of ordinates
n=length(t);
if n < 5, break,end;
F=zeros(1,4);
F=feval(f,t(1:4),y(1:4));
h=t(2)-t(1);
pold=0;
yold=0;
for k=4:n-1
% Predictor
pnew=y(k-3)+(4*h/3)*(F(2:4)*[2 -1 2]');
% Modifier
pmod=pnew+28*(yold-pold)/29;
t(k+1)=t(1)+h*k;
F=[F(2) F(3) F(4) feval(f,t(k+1),pmod)];
% Corrector
y(k+1)=y(k-1)+(h/3)*(F(2:4)*[1 4 1]'));
pold=pnew;
yold=y(k+1);
F(4)=feval(f,t(k+1),y(k+1));
end
M=[t',y'];
Example. Milne's solution to \( y' = 30-5y, \quad y(0) =1 \) over interval [0,10] with N = 93 steps produces oscillations. It is stabilized when N = 110.
Complete