Jump to content

Adams-Bashforth and Adams-Moulton methods

From Wikiversity
Subject classification: this is a mathematics resource.

Definitions

[edit | edit source]

Linear multistep methods are used for the numerical solution of ordinary differential equations, in particular the initial value problem

y′=f(t,y)withy(t0)=y0.

The Adams-Bashforth methods and Adams-Moulton methods are described on the Linear multistep method page.

Derivation

[edit | edit source]

There 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

[edit | edit source]

From the w:Fundamental theorem of Calculus we can get

y(tn+1)=y(tn)+∫tntn+1y′(t)dt.

 

 

 

 

(1)

Set

A=∫tntn+1y′(t)dt=∫tntn+1f(t,y(t))dt.

 

 

 

 

(2)

To get the value of A, we can use an interpolating polynomial P(t) as an approximation of f(t,y(t)). The interpolation polynomial in the Lagrange form is a linear combination

L(x):=∑j=0kyjℓj(x)

where

ℓj(x):=∏0≤m≤km≠jx−xmxj−xm.

Then the interpolation can be

P(t)=f(tn,yn)t−tn−1tn−tn−1+f(tn−1,yn−1)t−tntn−1−tn.

Thus, (2) becomes

A=∫tntn+1f(t,y(t))dt≈∫tntn+1P(t)dt=∫tntn+1f(tn,yn)t−tn−1tn−tn−1+f(tn−1,yn−1)t−tntn−1−tndt

 

 

 

 

(3)

Integrating and simplifying, the right hand side of equation (3) becomes

12(tn+tn+1)(f(tn,yn)−f(tn−1,yn−1))−tn−1f(tn,yn)+tnf(tn−1,yn−1)=12(tn+tn+1−2tn−1)f(tn,yn)+12(2tn−tn+1−tn)f(tn−1,yn−1).

Since tn−1, tn and tn+1 are equally spaced, then tn−tn−1=tn+1−tn=h. Therefore, the value of A is

A=32hf(tn,yn)−12hf(tn−1,yn−1)

Putting this value back to (1) yields

y(tn+1)≈y(tn)+32hf(tn,yn)−12hf(tn−1,yn−1).

Thus, the equation yn+1=yn+32hf(tn,yn)−12hf(tn−1,yn−1) is the two-step Adams-Bashforth method.

Derive the two-step Adams-Bashforth method by using Taylor's theorem

[edit | edit source]

To simplify, let's set fk=f(tk,yk). Then the general form of Adams-Bashforth method is

yn+r=yn+r−1+h∑k=1rλkfn+r−k

 

 

 

 

(4)

where ∑k=1rλk=1. For the two-step Adams-Bashforth method, let's set λ1=1−λ,λ2=λ. Then (4) becomes

yn+2=yn+1+h((1−λ)fn+1+λfn)=y(tn+1)+h((1−λ)y′(tn+1)+λy′(tn)).

By using Taylor's theorem, expand y′(tn) at tn+1 to get

yn+2=y(tn+1)+h((1−λ)y′(tn+1)+λ(y′(tn+1)−hy″(tn+1)+O(h2)).

Thus, the simplified form is

yn+2=y(tn+1)+hy′(tn+1)−λ(h2)y″(tn+1)+O(h3)

 

 

 

 

(5)

Expanding y(tn+2) at y(tn+1) yields

y(tn+2)=y(tn+1)+hy′(tn+1)+12(h2)y″(tn+1)+O(h3).

 

 

 

 

(6)

Subtracting (5) from (6) and then requiring the h^2 term to cancel makes λ=−12. The two-step Adams-Bashforth method is then

yn+2=yn+1+32hf(tn+1,yn+1)−12hf(tn,yn)

Since

y(tn+2)−yn+2=O(h3).

the local truncation error is of order O(h3) and thus the method is second order. (See w: Linear multistep method#Consistency and order and w:Truncation error)

Exercises

[edit | edit source]

1. Derive three-step Adams-Bashforth method by using polynomial interpolation

2. Derive the second-order Adams-Moulton method by using Taylor's theorem

Predictor–corrector method

[edit | edit source]

To 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

[edit | edit source]

Let's start from the two-step Adams method. The prediction step is to use two-step Adams-bashforth:

Pn+1=yn+32hf(tn,yn)−12hf(tn−1,yn−1)

Then, by using two-step Adams-moulton the corrector step can be:

yn+1=yn+12h(f(tn+1,Pn+1)+f(tn,yn))

Also, by using four-step Adams-bashforth and Adams-moulton methods together, the predictor-corrector formula is:

{Pn+1=yn+h24(55f(tn,yn)−59f(tn−1,yn−1)+37f(tn−2,yn−2)−9f(tn−3,yn−3))yn+1=yn+h24(9f(tn+1,Pn+1)+19f(tn,yn)−5f(tn−1,yn−1)+f(tn−2,yn−2))

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

[edit | edit source]

Four-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'

References

[edit | edit source]