Adams-Bashforth and Adams-Moulton methods
Subject classification: this is a mathematics resource. |
Definitions
editLinear multistep methods are used for the numerical solution of ordinary differential equations, in particular the initial value problem
The Adams-Bashforth methods and Adams-Moulton methods are described on the Linear multistep method page.
Derivation
editThere are (at least) two ways that can be used to derive the Adams-Bashforth methods and Adams-Moulton methods. We will demonstrate the derivations using polynomial interpolation and using Taylor's theorem for the two-step Adams-Bashforth method.
Derive the two-step Adams-Bashforth method by using polynomial interpolation
editFrom the w:Fundamental theorem of Calculus we can get
-
(
)
Set
-
(
)
To get the value of , we can use an interpolating polynomial as an approximation of . The interpolation polynomial in the Lagrange form is a linear combination
where
Then the interpolation can be
Thus, (2) becomes
-
(
)
Integrating and simplifying, the right hand side of equation (3) becomes
Since , and are equally spaced, then . Therefore, the value of is
Putting this value back to (1) yields
Thus, the equation is the two-step Adams-Bashforth method.
Derive the two-step Adams-Bashforth method by using Taylor's theorem
editTo simplify, let's set . Then the general form of Adams-Bashforth method is
-
(
)
where . For the two-step Adams-Bashforth method, let's set . Then (4) becomes
By using Taylor's theorem, expand at to get
Thus, the simplified form is
-
(
)
Expanding at yields
-
(
)
Subtracting (5) from (6) and then requiring the h^2 term to cancel makes . The two-step Adams-Bashforth method is then
Since
the local truncation error is of order and thus the method is second order. (See w: Linear multistep method#Consistency and order and w:Truncation error)
Exercises
edit1. Derive three-step Adams-Bashforth method by using polynomial interpolation
Solution:
The initial problem is Then we can get:
-
(
)
let's set:
-
(
)
Then,we can use P(t) as an interpolation of f(t,y(t)). To derive the three-step Adams-bashforth method, the interpolation polynomial is:
Since , , and are equally spaced, then
.
So the integral of each part of P(t) is :
Thus the approximate value of A is
Put this value back to (8)
Thus, the three-step Adams-Bashforth method is
2. Derive the second-order Adams-Moulton method by using Taylor's theorem
Solution:
To simplify, note to represent .From Taylor expansion of the binary function (w:Taylor's theorem):
Then by using:
-
(
)
can get:
Therefore, simplify this equation to get:
Thus, subtitute into (10):
Combining the equation:
and Taylor expansion:
can get . Therefore, the second-order Adams-moulton method is:
Predictor–corrector method
editTo solve an ordinary differential equation (ODE), a w:Predictor–corrector method is an algorithm that can be used in two steps. First, the prediction step calculates a rough approximation of the desired quantity, typically using an explicit method. Second, the corrector step refines the initial approximation using another means, typically an implicit method.
Here mainly discuss about using Adams-bashforth and Adams-moulton methods as a pair to construct a predictor–corrector method.
Example: Adams predictor–corrector method
editLet's start from the two-step Adams method. The prediction step is to use two-step Adams-bashforth:
Then, by using two-step Adams-moulton the corrector step can be:
Also, by using four-step Adams-bashforth and Adams-moulton methods together, the predictor-corrector formula is:
Note, the four-step Adams-bashforth method needs four initial values to start the calculation. It needs to use other methods, for example Runge-Kutta, to get these initial values.
Matlab programs
editFour-step Adams predictor-corrector method:
function [x y]=maadams4(dyfun,xspan,y0,h)
% use four-step Adams predictor-corrector method to solve an ODE y'=f(x,y), y(x0)=y0
% inputs: dyfun -- the function f(x,y), as an inline
% xspan -- the interval [x0,xn]
% y0 -- the initial value
% h -- the step size
% output: x, y -- the node and the value of y
x=xspan(1):h:xspan(2);
% use Runge-Kutta method to get four initial values
[xx,yy]=marunge(dyfun,[x(1),x(4)],y0,h);
y(1)=yy(1);y(2)=yy(2);
y(3)=yy(3);y(4)=yy(4);
for n=4:(length(x)-1)
p=y(n)+h/24*(55*feval(dyfun,x(n),y(n))-59*feval(dyfun,x(n-1),y(n-1))+37*feval(dyfun,x(n-2),y(n-2))-9*feval(dyfun,x(n-3),y(n-3)));
y(n+1)=y(n)+h/24*(9*feval(dyfun,x(n+1),p)+19*feval(dyfun,x(n),y(n))-5*feval(dyfun,x(n-1),y(n-1))+feval(dyfun,x(n-2),y(n-2)));
end
x=x';y=y';
Runge-Kutta method:
function [x y]=marunge(dyfun,xspan,y0,h)
x=xspan(1):h:xspan(2);
y(1)=y0;
for n=1:(length(x)-1)
k1=feval(dyfun,x(n),y(n));
k2=feval(dyfun,x(n)+h/2,y(n)+h/2*k1);
k3=feval(dyfun,x(n)+h/2,y(n)+h/2*k2);
k4=feval(dyfun,x(n+1),y(n)+h*k3);
y(n+1)=y(n)+h*(k1+2*k2+2*k3+k4)/6;
end
x=x';y=y'