22
Scientific Computing Multi-Step and Predictor-Corrector Methods

Scientific Computing Multi-Step and Predictor-Corrector Methods

Embed Size (px)

Citation preview

Scientific Computing

Multi-Step andPredictor-Corrector

Methods

Overview

• One-Step Methods – use only info from previous step– Euler– Runge-Kutta

• Multistep Methods- use info from several prior steps– Adam Bashforth– Adam Moulton Method– Predictor-Corrector Method

Multi-Step Principle

• To solve

• We use an iteration scheme to find xi+1 in terms of previous values of xi, xi-1, xi-2, etc, and/or values of fi=f(ti, xi), fi-1, fi-2 , etc.

dx

dt f t,x

Multi-Step Principle

The method comes from integrating the derivative to get x(t).

1i

i

)(,

)(,

)(,

i1i

t

t

dttxtfxxdx

dttxtfdx

txtfdt

dx

1i

i

)(,i1i

t

t

dttxtfxx

One-Step vs Multi-Step

Multi-Step Example

• Midpoint rule:

• Another weighted average rule:

1i

i

)(,

t

t

dttxtf i1i2 ffh

1i

i

)(,

t

t

dttxtf i1i32

ffh

Multi-Step General Form

• The general form for a multi-step method is

• The parameters ak and bk are determined by polynomial interpolation.

• If bm =0, the method is called explicit, as this formula gives xi+1 explicitly in terms of previously found values.

• If bm ≠0, the method is called implicit, as xi+1 appears on both sides of the equals sign.

)],(),(),([ 110111

101211

mimiiimiim

miimimi

xtfbxtfbxtfbh

xaxaxax

Multi-Step Explicit Adams Method

• In this method we approximate the value of by interpolating f(t,x(t)) at the points (ti, xi), (ti-1, xi-1), …, (ti+1-m , xi+1-m).

We then integrate this polynomial exactly to use in

the formula for the next iterate:

1i

i

)(,

t

t

dttxtf

1i

i

)(,i1i

t

t

dttxtfxx

Example: 3-Step Adams-Bashforth

Want a formula of the type:

We use the three previous values of (ti, xi) for a

Lagrange interpolating polynomial for f

))((

))(()(,

))((

))(()(,

))((

))(()(

)(*)(*),()(

122

12

211

21

21

210

2

0

2

02

iiii

ii

iiii

ii

iiii

ii

kkki

kkkiki

tttt

tttttL

tttt

tttttL

tttt

tttttL

tLftLxtftp

)],(),(),([ 22011121 iiiiiiii xtfbxtfbxtfbhxx

Example: 3-Step Adams-Bashforth

Then,

After a change of variables: u=(ti+1 - t)/h we get

1i

i

1i

i

2)(,

t

t

t

t

dttpdttxtf

1

0

12211110

1

0

12

1i

i

)(,

duhutLfhutLfhutLfh

duhutphdttxtf

iiiiii

i

t

t

Example: 3-Step Adams-Bashforth

Then,

Now,

Likewise,

1

0

1

0

122

1

0

11110

i

1-i

)(, duhutLfduhutLfduhutLfhdttxtf iiiiii

t

t

12

23

21

)3)(2()(

1

0

1

0

10

du

uuduhutL i

12

5)(

3

4)(

1

0

12

1

0

11 duhutLandduhutL ii

Example: 3-Step Adams-Bashforth

So, we get,

Thus,

21 5162312

)(,i

1-i

iii

t

t

fffh

dttxtf

)],(5),(16),(23[12 22111 iiiiiiii xtfxtfxtfh

xx

Example: 4-Step Adams-Bashforth

]9375955[24 3i2i1ii1 ffffh

xx ii

Implicit Multi-Step Methods

• Implicit multi-step methods use the value of xi+1 to find the value of xi+1.

• Of course, this is impossible if we do not know xi+1, so in practice we use an explicit method to approximate (predict) xi +1 and then use an implicit method to improve (correct) the value of xi+1.

• These methods again rely on polynomial interpolation approximation of f(t,x(t))

Adams-Moulton Implicit Methods

Three-Point:

Four Point:

)],(),(8),(5[12 11111 iiiiiiii xtfxtfxtfh

xx

]5199[24 2111 iiiiii ffffh

xx

Predictor-Corrector Methods

• The Predictor-Corrector technique uses an explicit scheme (like the Adams-Bashforth Method) to estimate the initial guess for xi+1 and then uses an implicit technique (like the Adams-Moulton Method) to correct xi+1.

Predictor-Corrector Example

• Adams third order Predictor-Corrector scheme:• Use the Adams-Bashforth three point explicit scheme

for the initial value.

• Use the Adams-Moulton three-point implicit method to correct.

2i1iii1i 5162312

* fffh

xx

),(),(8),(512

11*

11i1i iiiiii xtfxtfxtfh

xx

Predictor-Corrector Example

• Consider Exact Solution

• Initial condition: x(0) = 1

• Step size: h = 0.1

• We will use the 3 Point Adams-Bashforth and 3 point Adams-Moulton. Both require 3 points to get started!

2txdt

dx t222 ettx

Predictor-Corrector Example

• From the 4th order Runge Kutta

• 3-point Adams-Bashforth Predictor Value:

340184.1121587.0218597.1

)1(5)094829.1(16)178597.1(2312

1.0 2

*3

xx

218597.1

178597.1218597.1,2.0

094829.1104829.1,1.0

0000.11,0

2

2.0

1.0

0

x

ff

ff

ff

Predictor-Corrector Example

• To correct, we need f(t3 , x3*)

• 3-point Adams-Moulton Corrector Value:

250184.1340184.1,3.0 f

340138.1

121541.0218597.1

094829.11178597.18250184.1512

1.0 23

xx

The values for the Predictor-Corrector Scheme

Three Point Predictor-Corrector Schemet x f A-B sum x* f* A-M sum0 1 1

0.1 1.104829 1.0948290.2 1.218597 1.178597 0.121587 1.340184 1.250184 0.1215410.3 1.340138 1.250138 0.128081 1.468219 1.308219 0.128030.4 1.468168 1.308168 0.133155 1.601323 1.351323 0.1330980.5 1.601266 1.351266 0.136659 1.737925 1.377925 0.1365970.6 1.737863 1.377863 0.138429 1.876291 1.386291 0.1383590.7 1.876222 1.386222 0.13828 2.014502 1.374502 0.1382040.8 2.014425 1.374425 0.136013 2.150438 1.340438 0.1359280.9 2.150353 1.340353 0.131404 2.281757 1.281757 0.131311 2.281663 1.281663 0.124206 2.405869 1.195869 0.124102

Predictor-Corrector Example

The predictor-corrector method produces a solution with nearly the same accuracy as the RK order 4 method.

Generally, the n-step method will have truncation error of order at least n.

-10

-8

-6

-4

-2

0

2

4

0 1 2 3 4

x V

alu

e

t Value

3 Point Predictor-Corrector Method

4th order Runge-Kutta

Exact

Adam Moulton

Adam Bashforth

Predictor-Corrector Example