Lecture 6 Numerical Analysis. Solution of Non-Linear Equations Chapter 2.

41
Lecture 6 Numerica l Analysis

Transcript of Lecture 6 Numerical Analysis. Solution of Non-Linear Equations Chapter 2.

Lecture 6Lecture 6

Numerical Analysis

Numerical Analysis

Solution of Non-Linear Equations

Solution of Non-Linear Equations

Chapter 2Chapter 2

IntroductionBisection MethodRegula-Falsi MethodMethod of iterationNewton - Raphson MethodSecant MethodMuller’s MethodGraeffe’s Root Squaring Method

IntroductionBisection MethodRegula-Falsi MethodMethod of iterationNewton - Raphson MethodSecant MethodMuller’s MethodGraeffe’s Root Squaring Method

Bisection Method

(Bolzano)

Bisection Method

(Bolzano)

Regula-Falsi Method

Regula-Falsi Method

Method of false Method of false positionposition

Method of false Method of false positionposition

Method of Iteration

Method of Iteration

Let Let x = a x = a is the desired is the desired root root

Suppose Suppose xx00 is its initial is its initial approximation. The first approximation. The first and successive and successive approximations to the approximations to the root can be obtained asroot can be obtained as

( )x x

1 0

2 1

1

( )

( )

( )n n

x x

x x

x x

Newton -Raphson Method

Newton -Raphson Method

An approximation to An approximation to the root is given bythe root is given by

01 0

0

( )

( )

f xx x

f x

Better and successive Better and successive approximations approximations xx22, , xx33, …, , …, xxnn

to the root are obtained from to the root are obtained from

1

( )

( )n

n nn

f xx x

f x

N-R Formula

Example Example

Find a real root of the Find a real root of the equation equation xx33 – – xx – 1 = 0 using – 1 = 0 using Newton - Raphson method, Newton - Raphson method, correct to four decimal correct to four decimal places. places.

SolutionSolutionLet Let ff ( (xx) = ) = xx3 3 ––xx – 1, – 1, Then Then ff (1) = – 1, (1) = – 1,

ff (2) = 5 (2) = 5Therefore, the root lies Therefore, the root lies in the interval (1, 2). in the interval (1, 2).

Further Further f’ (x) = 3xf’ (x) = 3x22 – 1, – 1, f” (x) =6xf” (x) =6x

(1) 1, (1) 6,

(2) 5, (2) 12

f f

f f

Since Since f f (2)(2) and and f”(2)f”(2) are of the same are of the same sign, we choose sign, we choose xx00 = 2 as the first = 2 as the first

approximation to the root.approximation to the root.

The second approximation is The second approximation is computed using Newton-Raphson computed using Newton-Raphson method asmethod as

and and

01 0

0

( ) 52 1.54545

( ) 11

f xx x

f x

1( ) 1.14573f x

2 2

1.145731.54545 1.35961, ( ) 0.15369

6.16525x f x

33 3

0.153691.35961 1.32579, ( ) 4.60959 10

4.54562x f x

The successive approximations areThe successive approximations are

35

4 4

4.60959 101.32579 1.32471, ( ) 3.39345 10

4.27316x f x

57

5 5

3.39345 101.32471 1.324718, ( ) 1.823 10

4.26457x f x

Hence, the required Hence, the required

root is 1.3247.root is 1.3247.

Note !Note !Methods such as bisection Methods such as bisection method and the false position method and the false position method of finding roots of a method of finding roots of a nonlinear equation nonlinear equation f( x ) = 0f( x ) = 0 require bracketing of the root require bracketing of the root by two guesses. Such methods by two guesses. Such methods are called bracketing methods. are called bracketing methods.

These methods are These methods are always convergent always convergent since they are based on since they are based on reducing the interval reducing the interval between the two between the two guesses to guesses to zero inzero in on on the root.the root.

In the Newton-Raphson In the Newton-Raphson method, the root is not method, the root is not bracketed. Only one initial bracketed. Only one initial guess of the root is needed guess of the root is needed to get the iterative process to get the iterative process started to find the root of an started to find the root of an equation. Hence, the method equation. Hence, the method falls in the category of open falls in the category of open methods.methods.

Newton - Raphson method is Newton - Raphson method is based on the principle that if the based on the principle that if the initial guess of the root of initial guess of the root of f( x ) = 0f( x ) = 0 is at xis at xii, then if one draws the , then if one draws the

tangent to the curve at tangent to the curve at f( xf( xi i )), the , the

point xpoint xi+1i+1 where the tangent where the tangent

crosses the x-axis is an improved crosses the x-axis is an improved estimate of the rootestimate of the root

f(x)

f(xi)

f(xi+1)

xi+2 xi+1 xi

X

,i ix f x

Draw backs of N-R Draw backs of N-R MethodMethod

Divergence at inflection points: Divergence at inflection points: If the selection of a guess or an If the selection of a guess or an iterated value turns out to be close iterated value turns out to be close to the inflection point of to the inflection point of f ( x )f ( x ), , [where [where f”( x ) = 0 f”( x ) = 0 ], ], the roots start to diverge away from the roots start to diverge away from the root. the root.

Division of zero or near zero:Division of zero or near zero:

If an iteration, we come across If an iteration, we come across the division by zero or a near-the division by zero or a near-zero number, then we get a zero number, then we get a large magnitude for the next large magnitude for the next value, xvalue, xi+1i+1. .

1i

i ii

f(x )x x

f (x )

Root jumping: Root jumping: In some case where the In some case where the function function f (x)f (x) is oscillating is oscillating and has a number of roots, and has a number of roots, one may choose an initial one may choose an initial guess close to a root. guess close to a root. However, the guesses may However, the guesses may jump and converge to some jump and converge to some other root.other root.

Oscillations near local Oscillations near local maximum and minimummaximum and minimum: : Results obtained from N-R Results obtained from N-R method may oscillate about method may oscillate about the local max or min without the local max or min without converging on a root but converging on a root but converging on the local max or converging on the local max or min. Eventually, it may lead min. Eventually, it may lead to division to a number close to division to a number close to zero and may diverge.to zero and may diverge.

Convergence of N-R MethodConvergence of N-R Method

Let us compare the N-R formula Let us compare the N-R formula

with the general iteration formulawith the general iteration formula

1

( )

( )n

n nn

f xx x

f x

1 ( ),n nx x ( )

( )( )n

n nn

f xx x

f x

( )

( )( )

f xx x

f x

The iteration method converges if The iteration method converges if

Therefore, N-R formula converges, Therefore, N-R formula converges, providedprovided

in the interval considered. in the interval considered.

2( ) ( ) ( )f x f x f x

( ) 1.x

Newton-Raphson formula Newton-Raphson formula therefore converges, therefore converges, provided the initial provided the initial approximation approximation xx0 0 is chosen is chosen

sufficiently close to the root sufficiently close to the root and are continuous and and are continuous and bounded in any small interval bounded in any small interval containing the root.containing the root.

DefinitionDefinition

LetLet

where is a root of f (x) = 0. where is a root of f (x) = 0.

If we can prove that If we can prove that

where K is a constant and is the error where K is a constant and is the error

involved at the n - th step, while finding involved at the n - th step, while finding

the root by an iterative method, then the the root by an iterative method, then the

rate of convergence of the method israte of convergence of the method is p p..

1 1,n n n nx x

1 ,pn nK

n

The N-R method converges The N-R method converges quadratic allyquadratic ally

1 1

,n n

n n

x

x

where is a root of where is a root of ff ( (xx) = 0 and is ) = 0 and is the error involved at the the error involved at the nn-th step, while -th step, while finding the root by N-R formulafinding the root by N-R formula

n

1

( )

( )n

n nn

f

f

1

( ) ( ) ( )

( ) ( )n n n n

n nn

f f f

f n f

Using Taylor’s expansion, we getUsing Taylor’s expansion, we get

1

1[ ( ) ( ) ]

( ) ( )n n nn

f ff f

2

( ) ( ) ( )2n

nf f f

Since is a root, Therefore, the above Since is a root, Therefore, the above expression simplifies toexpression simplifies to

( ) 0.f

2

1

1( )

2 ( ) ( )n

nn

ff f

12 ( ) ( )

12 ( ) ( )n

n

f f

f f

2 ( ) ( )

12 ( ) ( )n

n

f f

f f

23

1

( )( )

2 ( )n

n n

fO

f

On neglecting terms of order and On neglecting terms of order and higher powers, we obtainhigher powers, we obtain

WhereWhere

It shows that N-R method has It shows that N-R method has second order convergence or second order convergence or converges quadratic ally.converges quadratic ally.

3n

21n nK

( )

2 ( )

fK

f

Example Example Set up Newton’s Set up Newton’s scheme of iteration scheme of iteration for finding the square for finding the square root of a positive root of a positive number number NN..

Solution Solution The square root of The square root of NN can be carried can be carried out as a root of the equation out as a root of the equation

Let Let 2( ) .f x x N

2 0.x N

By Newton’s method, we haveBy Newton’s method, we have

In this ProblemIn this Problem

ThereforeTherefore2

1

1

2 2n

n n nn n

x N Nx x x

x x

1

( )

( )n

n nn

f xx x

f x

2( ) , ( ) 2 .f x x N f x x

ExampleExampleEvaluate , by Newton’s Evaluate , by Newton’s formula.formula.

SolutionSolution

Since Since

we take we take

12

9 3, 16 4,

0 (3 4) / 2 3.5.x

Hence

1 00

1 1 123.5 3.4643

2 2 3.5

Nx x

x

2

1 123.4643 3.4641

2 3.4643x

3

1 123.4641 3.4641

2 3.4641x

12 3.4641.

Lecture 6Lecture 6

Numerical Analysis

Numerical Analysis