numerical methods - an overviebaskar/mumbai_jul2009.pdf · s. baskar (iitb) numerical methods - an...

74
Numerical Methods - An Overview S. Baskar 1 1 Department of Mathematics Indian Institute of Technology Bombay Powai, Mumbai 400076. Workshop on Second Year B.Sc. Course on Computational Mathematics, Smt. Chandibai Himathmal Mansukhani College, 9th July, 2009 S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 1 / 28

Upload: others

Post on 10-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Numerical Methods - An Overview

S. Baskar1

1Department of MathematicsIndian Institute of Technology Bombay

Powai, Mumbai 400076.

Workshop on Second Year B.Sc. Course on Computational Mathematics,Smt. Chandibai Himathmal Mansukhani College, 9th July, 2009

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 1 / 28

Page 2: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Outline

1 Theory of Numerical MethodsWhy to learn theory for numerical methods?

2 Errors in Numerical ComputationSources of ErrorLoss of Significant DigitsSome Disasters Caused by Numerical Errors

3 Root FindingNonlinear EquationsLinear SystemsOrdinaty Differential Equations

4 Conclusion

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 2 / 28

Page 3: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Why to learn theory for numerical methods?

Why should we bother learning numerical methods, when they arealready available in professionally crafted, ready-to-use code?

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 3 / 28

Page 4: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Why to learn theory for numerical methods?

Why should we bother learning numerical methods, when they arealready available in professionally crafted, ready-to-use code?

Can we get rid of theory?

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 3 / 28

Page 5: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Why to learn theory for numerical methods?

Why should we bother learning numerical methods, when they arealready available in professionally crafted, ready-to-use code?

Can we get rid of theory?

1 Without a sound background, you cannot go on developing yourown solutions when the available methods are not enough.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 3 / 28

Page 6: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Why to learn theory for numerical methods?

Why should we bother learning numerical methods, when they arealready available in professionally crafted, ready-to-use code?

Can we get rid of theory?

1 Without a sound background, you cannot go on developing yourown solutions when the available methods are not enough.

2 Without a sound background, you cannot choose the mostappropriate algorithm when alternatives are given.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 3 / 28

Page 7: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Why to learn theory for numerical methods?

Why should we bother learning numerical methods, when they arealready available in professionally crafted, ready-to-use code?

Can we get rid of theory?

1 Without a sound background, you cannot go on developing yourown solutions when the available methods are not enough.

2 Without a sound background, you cannot choose the mostappropriate algorithm when alternatives are given.

3 Without a sound background, you cannot use methods properlyand, most important, you cannot understant what is going wrongwhen results are not reasonable.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 3 / 28

Page 8: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Sources of Error

1 Modeling errors:

Physical problem ⇒ Mathematical model

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 4 / 28

Page 9: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Sources of Error

1 Modeling errors:

Physical problem ⇒ Mathematical model

2 Approximation errors:

Mathematical model ⇒ Approximate methods

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 4 / 28

Page 10: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Sources of Error

1 Modeling errors:

Physical problem ⇒ Mathematical model

2 Approximation errors:

Mathematical model ⇒ Approximate methods

3 Machine representation and arithmetic errors

Approximate methods ⇒ Computer implementations

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 4 / 28

Page 11: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Types of Error

1 Absolute Error:

Absolute Error = |True Value − Approximate Value|.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 5 / 28

Page 12: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Types of Error

1 Absolute Error:

Absolute Error = |True Value − Approximate Value|.

2 Relative Error:

Relative Error =Absolute Error|True Value| .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 5 / 28

Page 13: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Types of Error

1 Absolute Error:

Absolute Error = |True Value − Approximate Value|.

2 Relative Error:

Relative Error =Absolute Error|True Value| .

3 Percentage Error

Percentage Error = Relative Error × 100.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 5 / 28

Page 14: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits

Loss of significant digit is well understood by the following example.

Let x = 7.6545428 = 0.76545428× 101,y = 7.6544201 = 0.76544201× 101.

The corresponding approximate numbers arexA = 7.6545421 = 0.76545421× 101,yA = 7.6544200 = 0.76544200× 101

correct to seven and eight significant digits, respectively.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 6 / 28

Page 15: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits

Loss of significant digit is well understood by the following example.

Let x = 7.6545428 = 0.76545428× 101,y = 7.6544201 = 0.76544201× 101.

The corresponding approximate numbers arexA = 7.6545421 = 0.76545421× 101,yA = 7.6544200 = 0.76544200× 101

correct to seven and eight significant digits, respectively.In eight-digit floating-point arithmetic,

zA = xA − yA = 0.12210000× 10−3

z = x − y = 0.12270000× 10−3

Error: z − zA = 0.6 × 10−6 < 0.5 × 10−5

Hence zA has only three significant digits with respect to z.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 6 / 28

Page 16: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (contd.)

Thus, we started with two approximate numbers xA and yA which arecorrect to seven and eight significant digits with respect to x and yrespectively, but their difference zA has only three significant digits withrespect to z and there is a loss of significant digits in the process ofsubtraction.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 7 / 28

Page 17: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (contd.)

Thus, we started with two approximate numbers xA and yA which arecorrect to seven and eight significant digits with respect to x and yrespectively, but their difference zA has only three significant digits withrespect to z and there is a loss of significant digits in the process ofsubtraction.A simple calculation shows that

Relative Error in zA ≈ 53472 × Relative Error in xA,

and similarly for y .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 7 / 28

Page 18: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (contd.)

Thus, we started with two approximate numbers xA and yA which arecorrect to seven and eight significant digits with respect to x and yrespectively, but their difference zA has only three significant digits withrespect to z and there is a loss of significant digits in the process ofsubtraction.A simple calculation shows that

Relative Error in zA ≈ 53472 × Relative Error in xA,

and similarly for y .

Loss of significant digits is therefore dangerous if we wish to minimizethe relative error.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 7 / 28

Page 19: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (Contd.)

Another Example:Let f (x) = x(

√x + 1 −

√x).

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 8 / 28

Page 20: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (Contd.)

Another Example:Let f (x) = x(

√x + 1 −

√x).

On a six-digit decimal calculator, we have

f (100000) = 100

whereas the true value is 158.113.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 8 / 28

Page 21: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (Contd.)

Another Example:Let f (x) = x(

√x + 1 −

√x).

On a six-digit decimal calculator, we have

f (100000) = 100

whereas the true value is 158.113.

Reason: As x increases, the terms√

x + 1 and√

x comes closer toeach other and therefore loss of significant digit in their computedvalue increases.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 8 / 28

Page 22: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Significant Digits (Contd.)

Another Example:Let f (x) = x(

√x + 1 −

√x).

On a six-digit decimal calculator, we have

f (100000) = 100

whereas the true value is 158.113.

Reason: As x increases, the terms√

x + 1 and√

x comes closer toeach other and therefore loss of significant digit in their computedvalue increases.Alternate Expression:

f (x) =x√

x + 1 +√

x.

With this new definition, we see that on a six-digit calculator, we havef (100000) = 158.114000.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 8 / 28

Page 23: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Some Disasters Caused by Numerical Errors

1 Patriot Missile Failure:On February 25, 1991, during the Gulf War,an American Patriot Missile battery in Dharan,Saudi Arabia, failed to intercept an incomingIraqi Scud missile. The Scud struck anAmerican Army barracks and killed 28 soldiers.A report of the General Accounting officereported that cause was an inaccuratecalculation of the time since boot due tocomputer arithmetic errors.

Reference: http://ta.twi.tudelft.nl/users/vuik/wi211/disasters.html

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 9 / 28

Page 24: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Numerical Methods: Non-linear Equations

Problem: For a given function f (x), to find a root of the equation

f (x) = 0.

Commonly used methods are:1 Bisection Method: Needs two initial points either side of the root.

Always converges with 1st order.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28

Page 25: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Numerical Methods: Non-linear Equations

Problem: For a given function f (x), to find a root of the equation

f (x) = 0.

Commonly used methods are:1 Bisection Method: Needs two initial points either side of the root.

Always converges with 1st order.2 Fixed-point Iteration Method: Needs one initial guess and a

good iteration function g which is a self-map and |g′(x)| < 1 forconvergence. The order of convergence is 1.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28

Page 26: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Numerical Methods: Non-linear Equations

Problem: For a given function f (x), to find a root of the equation

f (x) = 0.

Commonly used methods are:1 Bisection Method: Needs two initial points either side of the root.

Always converges with 1st order.2 Fixed-point Iteration Method: Needs one initial guess and a

good iteration function g which is a self-map and |g′(x)| < 1 forconvergence. The order of convergence is 1.

3 Secant Method: Needs two initial points not necessarily eitherside of the root. Mostly converges with order (approximately) 1.62.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28

Page 27: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Numerical Methods: Non-linear Equations

Problem: For a given function f (x), to find a root of the equation

f (x) = 0.

Commonly used methods are:1 Bisection Method: Needs two initial points either side of the root.

Always converges with 1st order.2 Fixed-point Iteration Method: Needs one initial guess and a

good iteration function g which is a self-map and |g′(x)| < 1 forconvergence. The order of convergence is 1.

3 Secant Method: Needs two initial points not necessarily eitherside of the root. Mostly converges with order (approximately) 1.62.

4 Newton-Raphson Method: Needs one initial guess and f ′ shouldnot vanaish at any of the iterated point. Order of convergence is 2.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28

Page 28: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems

Problem: For a given n × n non-singular matrix A and a vector b, tofind a solution of the system

Ax = b.

Gaussian Elimination Method:

a11x1 + a12x2 + a13xn = b1 a11x1 + a12x2 + a13xn = b1

a21x1 + a22x2 + a23xn = b2 ⇒ a(2)22 x2 + a(2)

23 xn = b(2)2

a31x1 + a32x2 + a33xn = b3 a(2)32 x2 + a(2)

33 xn = b(2)3

a(2)ij = aij − mi1a1j , and b(2)

i = bi − mi1b1, i = 2, 3 with m21 = a21a11

, m31 = a31a11

.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 11 / 28

Page 29: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems

Problem: For a given n × n non-singular matrix A and a vector b, tofind a solution of the system

Ax = b.

Gaussian Elimination Method:

a11x1 + a12x2 + a13xn = b1 a11x1 + a12x2 + a13xn = b1

a21x1 + a22x2 + a23xn = b2 ⇒ a(2)22 x2 + a(2)

23 xn = b(2)2

a31x1 + a32x2 + a33xn = b3 a(2)32 x2 + a(2)

33 xn = b(2)3

a(2)ij = aij − mi1a1j , and b(2)

i = bi − mi1b1, i = 2, 3 with m21 = a21a11

, m31 = a31a11

.

a11x1 + a12x2 + a13xn = b1 a11x1 + a12x2 + a13xn = b1

a(2)22 x2 + a(2)

23 xn = b(2)2 ⇒ a(2)

22 x2 + a(2)23 xn = b(2)

2

a(2)32 x2 + a(2)

33 xn = b(2)3 a(3)

33 xn = b(3)3

a(3)33 = a(2)

33 − m32a(2)23 , b(3)

3 = b(2)3 − m32b(2)

2 .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 11 / 28

Page 30: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems

Problem: For a given n × n non-singular matrix A and a vector b, tofind a solution of the system

Ax = b.

Gaussian Elimination Method:

a11x1 + a12x2 + a13xn = b1 a11x1 + a12x2 + a13xn = b1

a21x1 + a22x2 + a23xn = b2 ⇒ a(2)22 x2 + a(2)

23 xn = b(2)2

a31x1 + a32x2 + a33xn = b3 a(2)32 x2 + a(2)

33 xn = b(2)3

a(2)ij = aij − mi1a1j , and b(2)

i = bi − mi1b1, i = 2, 3 with m21 = a21a11

, m31 = a31a11

.

a11x1 + a12x2 + a13xn = b1 a11x1 + a12x2 + a13xn = b1

a(2)22 x2 + a(2)

23 xn = b(2)2 ⇒ a(2)

22 x2 + a(2)23 xn = b(2)

2

a(2)32 x2 + a(2)

33 xn = b(2)3 a(3)

33 xn = b(3)3

a(3)33 = a(2)

33 − m32a(2)23 , b(3)

3 = b(2)3 − m32b(2)

2 .

Solution is now obtained by back substitution.S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 11 / 28

Page 31: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Most of the cost of Gaussian elimination is in the elimination step.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 12 / 28

Page 32: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Most of the cost of Gaussian elimination is in the elimination step.For instance, the number of multiplication/division needed forelimination process is

n(n − 1)(2n − 1)

6+

n(n − 1)

2=

13(n3 − n) =

13

n3(1 − 1/n2) ≈ 13

n3,

whereas the remaining steps counts only

Multiplication/Division =n(n − 1)

2+

n(n + 1)

2= n2

Hence, once the elimination part is completed, it is much lessexpensive to solve the linear system.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 12 / 28

Page 33: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization

Imagine that we have to solve a set of linear systems

Ax = bi

where i = 1, 2, · · · , N. Here the LHS matrix A is same but differentRHS vectors.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 13 / 28

Page 34: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization

Imagine that we have to solve a set of linear systems

Ax = bi

where i = 1, 2, · · · , N. Here the LHS matrix A is same but differentRHS vectors.

In such cases, it is more expensive to use Gaussian eliminationmethod as we will be spending most of computation time in eliminationprocess, which in this case is same for all the systems that we solve.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 13 / 28

Page 35: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization

Imagine that we have to solve a set of linear systems

Ax = bi

where i = 1, 2, · · · , N. Here the LHS matrix A is same but differentRHS vectors.

In such cases, it is more expensive to use Gaussian eliminationmethod as we will be spending most of computation time in eliminationprocess, which in this case is same for all the systems that we solve.

LU factorization is more preferable in this case.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 13 / 28

Page 36: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization

In the Gaussian elimination, the linear system was reduced to theupper triangular system Ux = g with

U =

u11 u12 · · · u1n

0 u22 · · · u2n

. · · · .

. · · · .

. · · · .0 · · · 0 unn

and uij = a(i)ij and g = (b1, b(2)

2 , · · · , b(n)n ).

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 14 / 28

Page 37: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization

Introduce an auxiliary lower triangular matrix L based on the multipliersmij as

L =

1 0 · · · 0m21 1 · · · 0

. · · · .

. · · · .

. · · · .mn1 · · · mnn−1 1

in such a way thatA = LU.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 15 / 28

Page 38: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization Method:

Ax = b ⇒ LUx = b.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 16 / 28

Page 39: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization Method:

Ax = b ⇒ LUx = b.

The above system is equivalent to solving the following two systems:

Lg = b, Ux = g.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 16 / 28

Page 40: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

LU Factorization Method:

Ax = b ⇒ LUx = b.

The above system is equivalent to solving the following two systems:

Lg = b, Ux = g.

Once the LU factorization is done, the first system can be solved usingforward substitution and the second system can be solved bybackward substitution.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 16 / 28

Page 41: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Iterative Methods

1 Jacobi Method2 Gauss-Seidel Method3 Successive Over Relaxation Method4 Conjugate Gradient Method

and so on.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 17 / 28

Page 42: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Error in Solving Linear SystemsLet xA denote the computed solution using some method. Define

r = b − AxA

This is called the residual in the approximation of b by AxA.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 18 / 28

Page 43: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Error in Solving Linear SystemsLet xA denote the computed solution using some method. Define

r = b − AxA

This is called the residual in the approximation of b by AxA.Since b = Ax , we have

r = b − AxA = Ax − AxA = A(x − xA).

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 18 / 28

Page 44: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Error in Solving Linear SystemsLet xA denote the computed solution using some method. Define

r = b − AxA

This is called the residual in the approximation of b by AxA.Since b = Ax , we have

r = b − AxA = Ax − AxA = A(x − xA).

If we denote the error e = x − xA, then the above identity can bewritten as

Ae = r

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 18 / 28

Page 45: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

Error in Solving Linear SystemsLet xA denote the computed solution using some method. Define

r = b − AxA

This is called the residual in the approximation of b by AxA.Since b = Ax , we have

r = b − AxA = Ax − AxA = A(x − xA).

If we denote the error e = x − xA, then the above identity can bewritten as

Ae = r

This shows that the error e satisfies a linear system with the samecoefficient matrix A as in the orginal system Ax = b.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 18 / 28

Page 46: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method:Step 1: Let x0 = xA be the initial computed value for the solution ofthe system Ax = b, generally obtained by using Gaussian elimination.Define

r0 = b − Ax0.

The error defined by e0 = x − x0 is obtained (approximately) bysolving the system

Ae0 = r0

using Gaussian elimination.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 19 / 28

Page 47: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method:Step 1: Let x0 = xA be the initial computed value for the solution ofthe system Ax = b, generally obtained by using Gaussian elimination.Define

r0 = b − Ax0.

The error defined by e0 = x − x0 is obtained (approximately) bysolving the system

Ae0 = r0

using Gaussian elimination.Step 2: Define

x1 = x0 + e0

and repeat step 1 to calculate

r1 = b − Ax1, x2 = x1 + e1

where e1 = x − x1 is the approximate solution of the system Ae1 = r1.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 19 / 28

Page 48: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method:Step 1: Let x0 = xA be the initial computed value for the solution ofthe system Ax = b, generally obtained by using Gaussian elimination.Define

r0 = b − Ax0.

The error defined by e0 = x − x0 is obtained (approximately) bysolving the system

Ae0 = r0

using Gaussian elimination.Step 2: Define

x1 = x0 + e0

and repeat step 1 to calculate

r1 = b − Ax1, x2 = x1 + e1

where e1 = x − x1 is the approximate solution of the system Ae1 = r1.Continue this process untill there is no further decrease in the size of ek , k ≥ 0.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 19 / 28

Page 49: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method: Example Use a computer withfour digit floating-point decimal arithmetic with rounding, and useGaussian elimination with pivoting, the system to be solved is

x1 + 0.5x2 + 0.3333x3 = 1

0.5x1 + 0.3333x2 + 0.25x3 = 0

0.3333x1 + 0.25x2 + 0.2x3 = 0

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 20 / 28

Page 50: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method: Example Use a computer withfour digit floating-point decimal arithmetic with rounding, and useGaussian elimination with pivoting, the system to be solved is

x1 + 0.5x2 + 0.3333x3 = 1

0.5x1 + 0.3333x2 + 0.25x3 = 0

0.3333x1 + 0.25x2 + 0.2x3 = 0

Exact Solution: x2 = (9.062, −36.32, 30.30)T .Computed Solution: x0 = (8.968, −35.77, 29.77)T .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 20 / 28

Page 51: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method: Example Use a computer withfour digit floating-point decimal arithmetic with rounding, and useGaussian elimination with pivoting, the system to be solved is

x1 + 0.5x2 + 0.3333x3 = 1

0.5x1 + 0.3333x2 + 0.25x3 = 0

0.3333x1 + 0.25x2 + 0.2x3 = 0

Exact Solution: x2 = (9.062, −36.32, 30.30)T .Computed Solution: x0 = (8.968, −35.77, 29.77)T .

r0 = b − Ax0 = (−0.005341, −0.004359, −0.0005344)T

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 20 / 28

Page 52: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method: Example Use a computer withfour digit floating-point decimal arithmetic with rounding, and useGaussian elimination with pivoting, the system to be solved is

x1 + 0.5x2 + 0.3333x3 = 1

0.5x1 + 0.3333x2 + 0.25x3 = 0

0.3333x1 + 0.25x2 + 0.2x3 = 0

Exact Solution: x2 = (9.062, −36.32, 30.30)T .Computed Solution: x0 = (8.968, −35.77, 29.77)T .

r0 = b − Ax0 = (−0.005341, −0.004359, −0.0005344)T

e0 = x − x0 is obtained by solving the system Ae0 = r0.

e0 = (0.09216, −0.5442, 0.5239)T

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 20 / 28

Page 53: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Linear Systems (contd.)

The Residual Correction Method: Example Use a computer withfour digit floating-point decimal arithmetic with rounding, and useGaussian elimination with pivoting, the system to be solved is

x1 + 0.5x2 + 0.3333x3 = 1

0.5x1 + 0.3333x2 + 0.25x3 = 0

0.3333x1 + 0.25x2 + 0.2x3 = 0

Exact Solution: x2 = (9.062, −36.32, 30.30)T .Computed Solution: x0 = (8.968, −35.77, 29.77)T .

r0 = b − Ax0 = (−0.005341, −0.004359, −0.0005344)T

e0 = x − x0 is obtained by solving the system Ae0 = r0.

e0 = (0.09216, −0.5442, 0.5239)T

x1 = (9.060, −36.31, 30.29)T

r1 = (−0.0006570, −0.0003770, −0.0001980)T

e1 = (0.001707, −0.01300, 0.01241)T

x2 = (9.062, −36.32, 30.30)T

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 20 / 28

Page 54: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Problem: To solve the initial value problem

y ′ = f (x , y), y(x0) = y0,

where x is an independent variable and y is a dependent variable.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 21 / 28

Page 55: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Problem: To solve the initial value problem

y ′ = f (x , y), y(x0) = y0,

where x is an independent variable and y is a dependent variable.

Single Step Methods: yn ≈ y(xn).1 Euler Method: yn+1 = yn + hf (xn, yn). The method is single step

because to obtain yn, we need to know the value of y at xn. This methodis of order 1.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 21 / 28

Page 56: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Problem: To solve the initial value problem

y ′ = f (x , y), y(x0) = y0,

where x is an independent variable and y is a dependent variable.

Single Step Methods: yn ≈ y(xn).1 Euler Method: yn+1 = yn + hf (xn, yn). The method is single step

because to obtain yn, we need to know the value of y at xn. This methodis of order 1.

2 Taylor’s Method: To achieve higher order, we need to take higher orderterms in the Taylor’s expansion, which involves higher order partialderivatives of the right hand function f .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 21 / 28

Page 57: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Problem: To solve the initial value problem

y ′ = f (x , y), y(x0) = y0,

where x is an independent variable and y is a dependent variable.

Single Step Methods: yn ≈ y(xn).1 Euler Method: yn+1 = yn + hf (xn, yn). The method is single step

because to obtain yn, we need to know the value of y at xn. This methodis of order 1.

2 Taylor’s Method: To achieve higher order, we need to take higher orderterms in the Taylor’s expansion, which involves higher order partialderivatives of the right hand function f .

3 Runge-Kutta Method: Idea in this method is to get higher order methodwithout using higher order partial derivatives of f . General form is

yn+1 = yn + ak1 + bk2, k1 = hf (xn, yn), k2 = hf (xn + αh, yn + βk1),

where a, b, α and β are constants to be determinded so that this formulawill agree with the Taylor algorithm of as high an order as possible.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 21 / 28

Page 58: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Multi-Step Method (Predictor-Corrector): Unlike the single stepmethods, multi-step methods use more than one previous steps tocalculate the next value of y .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 22 / 28

Page 59: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Multi-Step Method (Predictor-Corrector): Unlike the single stepmethods, multi-step methods use more than one previous steps tocalculate the next value of y .

General Form:

yn+m + am−1yn+m−1 + · · · + a0yn

= h(bmf (xn+m, yn+m) + bm−1f (xn+m−1, yn+m−1) + · · · + b0f (xn, yn)).

where ai , (i = 0, 1, · · · , m − 1) and bi (i = 0, 1, · · · , m) are constants tobe determined. Most of the known methods take a0 = −1 anda1 = · · · = am−1 = 0.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 22 / 28

Page 60: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Multi-Step Method (Predictor-Corrector): Unlike the single stepmethods, multi-step methods use more than one previous steps tocalculate the next value of y .

General Form:

yn+m + am−1yn+m−1 + · · · + a0yn

= h(bmf (xn+m, yn+m) + bm−1f (xn+m−1, yn+m−1) + · · · + b0f (xn, yn)).

where ai , (i = 0, 1, · · · , m − 1) and bi (i = 0, 1, · · · , m) are constants tobe determined. Most of the known methods take a0 = −1 anda1 = · · · = am−1 = 0.

Explicit Method: bm = 0. Implicit Method: bm 6= 0.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 22 / 28

Page 61: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations

Multi-Step Method (Predictor-Corrector): Unlike the single stepmethods, multi-step methods use more than one previous steps tocalculate the next value of y .

General Form:

yn+m + am−1yn+m−1 + · · · + a0yn

= h(bmf (xn+m, yn+m) + bm−1f (xn+m−1, yn+m−1) + · · · + b0f (xn, yn)).

where ai , (i = 0, 1, · · · , m − 1) and bi (i = 0, 1, · · · , m) are constants tobe determined. Most of the known methods take a0 = −1 anda1 = · · · = am−1 = 0.

Explicit Method: bm = 0. Implicit Method: bm 6= 0.An explicit multistep method (called Adams-Bashforth Method) is used to"predict" the value of yn+m. That value is then used in an implicit multistepmethod (called Adams-Moulton Method) to "correct" the value. The result is aPredictor-Corrector method.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 22 / 28

Page 62: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Single Step Predictor-Corrector Method:

Predictor: y (0)n+1 = yn + f (xn, yn) (Euler Method)

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 23 / 28

Page 63: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Single Step Predictor-Corrector Method:

Predictor: y (0)n+1 = yn + f (xn, yn) (Euler Method)

Corrector: y (k+1)n+1 = yn + h

2 [f (xn, yn) + f (xn+1, y (k)n+1)], k = 0, 1, · · ·

(Trapezoidal Method)

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 23 / 28

Page 64: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Single Step Predictor-Corrector Method:

Predictor: y (0)n+1 = yn + f (xn, yn) (Euler Method)

Corrector: y (k+1)n+1 = yn + h

2 [f (xn, yn) + f (xn+1, y (k)n+1)], k = 0, 1, · · ·

(Trapezoidal Method)

Convergence of Corrector Sequence: We have

|yn+1 − y (k+1)n+1 | =

h2|f (xn+1, yn+1) − f (xn+1, y (k)

n+1)|

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 23 / 28

Page 65: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Single Step Predictor-Corrector Method:

Predictor: y (0)n+1 = yn + f (xn, yn) (Euler Method)

Corrector: y (k+1)n+1 = yn + h

2 [f (xn, yn) + f (xn+1, y (k)n+1)], k = 0, 1, · · ·

(Trapezoidal Method)

Convergence of Corrector Sequence: We have

|yn+1 − y (k+1)n+1 | =

h2|f (xn+1, yn+1) − f (xn+1, y (k)

n+1)|

≈ h2

∂f (xn+1, yn+1)

∂z

|yn+1 − y (k)n+1|

Thus, whenh2

∂f (xn+1, yn+1)

∂z

< 1,

this sequence converges.S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 23 / 28

Page 66: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

To find bm’s: Integrate the equation y ′ = f (x , y) over the interval[xn, xn+1] where xn+1 = xn + h to get

y(xn+1) − y(xn) =

∫ xn+1

xn

f (x , y(x))dx .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 24 / 28

Page 67: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

To find bm’s: Integrate the equation y ′ = f (x , y) over the interval[xn, xn+1] where xn+1 = xn + h to get

y(xn+1) − y(xn) =

∫ xn+1

xn

f (x , y(x))dx .

The idea of a general mutistep method is to replace f (x , y(x)) by aninterpolation polynomial p(x) so that the later can be integrated. Thisgives approximations yn+1 of y(xn+1) and yn of y(xn),

yn+1 = yn +

∫ xn+1

xn

p(x)dx .

Different choices of p(x) will produce different methods.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 24 / 28

Page 68: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Two-Step Method (Predictor-Corrector): Let p2(x) denote thequadratic polynomial that interpolates f (x , y(x)) = g(x) at xn, xn−1,x‘n−2. Then use

∫ xn+1

xn

g(x)dx ≈∫ xn+1

xn

p2(x)dx .

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 25 / 28

Page 69: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Two-Step Method (Predictor-Corrector): Let p2(x) denote thequadratic polynomial that interpolates f (x , y(x)) = g(x) at xn, xn−1,x‘n−2. Then use

∫ xn+1

xn

g(x)dx ≈∫ xn+1

xn

p2(x)dx .

The final expression together with truncation error is∫ xn+1

xn

g(x)dx =h12

[23g(xn) − 16g(xn−1) + 5g(xn−2)] +38

h4g′′′(ξn),

where xn−2 < ξn < xn+1.

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 25 / 28

Page 70: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Two-Step Predictor (Adams-Bashforth Method):

yn+1 = yn +h12

[23fn − 16fn−1 + 5fn−2], n ≥ 2,

where fn = f (xn, yn).

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 26 / 28

Page 71: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Two-Step Predictor (Adams-Bashforth Method):

yn+1 = yn +h12

[23fn − 16fn−1 + 5fn−2], n ≥ 2,

where fn = f (xn, yn).

Two-Step Corrector (Adams-Moulton Method):

yn+1 = yn +h12

[5fn+1 + 8fn − fn−1], n ≥ 1,

where fn = f (xn, yn).

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 26 / 28

Page 72: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Adams-Bashforth Methods (Predictor):

Steps Order Method Error0 1 yn+1 = yn + hfn 1

2 h2y ′′(ξn)

1 2 yn+1 = yn + h2 [3fn − fn−1]

512 h3y ′′′(ξn)

2 3 yn+1 = yn + h12 [23fn − 16fn−1 + 5fn−2]

38 h4y (4)(ξn)

3 4 yn+1 = yn + h24 [55fn − 59fn−1 + 37fn−2 − 9fn−3]

251720 h5y (5)(ξn)

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 27 / 28

Page 73: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

Ordinary Differential Equations (contd.)

Adams-Bashforth Methods (Predictor):

Steps Order Method Error0 1 yn+1 = yn + hfn 1

2 h2y ′′(ξn)

1 2 yn+1 = yn + h2 [3fn − fn−1]

512 h3y ′′′(ξn)

2 3 yn+1 = yn + h12 [23fn − 16fn−1 + 5fn−2]

38 h4y (4)(ξn)

3 4 yn+1 = yn + h24 [55fn − 59fn−1 + 37fn−2 − 9fn−3]

251720 h5y (5)(ξn)

Adams-Moulton Methods (Corrector):

Steps Order Method Error0 1 yn+1 = yn + hfn+1 −

12 h2y ′′(ξn)

1 2 yn+1 = yn + h2 [fn+1 + fn] −

112 h3y ′′′(ξn)

2 3 yn+1 = yn + h12 [5fn+1 + 8fn − fn−1] −

124 h4y (4)(ξn)

3 4 yn+1 = yn + h24 [9fn+1 + 19fn − 5fn−1 + fn−2] − 19

720 h5y (5)(ξn)

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 27 / 28

Page 74: Numerical Methods - An Overviebaskar/Mumbai_Jul2009.pdf · S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 10 / 28. Numerical Methods: Non-linear Equations

-

THANK YOU

S. Baskar (IITB) Numerical Methods - An Overview CHM College (Jul 2009) 28 / 28