Sei sulla pagina 1di 12

~ Roots of Equations ~

Open Methods
Chapter 6

Credit: Prof. Lale Yurttas, Chemical Eng., Texas A&M University


1
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Open Methods
Generally use a single starting value or two starting values that do not
need to bracket the root.

Open Method (convergent) (divergent)

2
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simple Fixed-point Iteration
Rearrange the function so that x is on the left-hand side of the equation:

f ( x) 0 g ( x) x EXAMPLE:

xk g ( xk 1 ) xo is given, k 1, 2, ... f ( x) x 2 x 2 0
Rewrite it as : x g ( x)
Bracketing methods are convergent if you
x x2 2
have a bracket to start with
or
Fixed-point methods may sometimes
converge, depending on the starting point x x2
(initial guess) and how the function behaves. or
2
x 1
x

3
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Newton-Raphson Method
Most widely used formula
for locating roots.

Can be derived using


Taylor series or the
geometric interpretation
of the slope in the figure
f ( xi ) 0
f (xi )
( xi xi 1 )
rearrange to obtain :

f ( xi )
xi 1 xi
f ( xi )

Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
f ( xi )
xi 1 xi
f ( xi )
Newton-Raphson is a convenient
method if f(x) (the derivative) can be
evaluated analytically
Rate of convergence is quadratic, i.e.
the error is roughly proportional to the
square of the previous error
Ei+1=O(Ei2)
(proof is given in the Text)
But:
it does not always converge

There is no convergence criterion

Sometimes, it may converge very very


slowly (see next slide)
5
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example : Slow Convergence
Find the positive roots of : Iteration x

0 0.5
1 51.65
f(x) x10 1 2 46.485
3 41.8365
N - R Formula : 4 37.65285
5 33.887565

xi10 1 .
xi 1 xi use xo 0.5
10 xi9 .
38 1.083

W:\228\MATLAB\6\newtraph.m & func2 1.0000000

6
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Secant Method
If derivative f(x) can not be computed analytically then we need to compute
it numerically (backward finite divided difference method)

RESULT: N-R becomes SECANT METHOD

f ( xi )
Newton - Raphson : x i 1 x i
f ' ( xi )
df f ( x i ) f ( x i 1 )
f ( x i )
dx x i x i 1

x i x i 1
Secant : x i 1 x i f ( x i ) i 1,2,3,
f ( x i ) f ( x i 1 )
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Secant Method
xi xi 1
xi 1 xi f ( xi )
f ( xi ) f ( xi 1 )
Requires two initial estimates
x o , x1 .
However, it is not a
bracketing method.
The Secant Method has the
same properties as Newtons
method.
Convergence is not guaranteed
for all xo, f(x).

8
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Modified Secant Method
f ( xi )
Newton - Raphson : x i 1 x i
f ' ( xi )

x i x i 1
Original Secant : xi 1 xi f ( xi )
f ( x i ) f ( x i 1 )
Use a small perturbation fraction to compute
f ( x i x i ) f ( x i )
f ' ( xi ) in the original N - R formula :
xi

x i
Modified Secant : x i 1 x i f ( x i )
f ( x i x i ) f ( x i )
9
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Systems
Systemsof
of Nonlinear Equations
Nonlinear Equations
Locate the roots of a set of simultaneous nonlinear equations:

f1 ( x1 , x2 , x3 , , xn ) 0
f 2 ( x1 , x2 , x3 , , xn ) 0

f n ( x1 , x2 , x3 , , xn ) 0
Example:
x12 x1 x2 10 f1 ( x1 , x2 ) x12 x1 x2 10 0
x2 3x1 x2 2 57 f 2 ( x1 , x2 ) x2 3 x1 x2 2 57 0
10
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
First-order Taylor series expansion of a function with more than one variable:
f f
f1(i 1) f1( i ) 1(i ) ( x1( i 1) x1( i ) ) 1( i ) ( x2( i 1) x2( i ) ) 0
x1 x2
f 2(i ) f 2( i )
f 2( i 1) f 2( i ) ( x1(i 1) x1(i ) ) ( x2( i 1) x2( i ) ) 0
x1 x2

The root of the equation occurs at the value of x1 and x2 where f1(i+1) =0 and f2(i+1) =0
Rearrange to solve for x1(i+1) and x2(i+1)
f1(i ) f1(i ) f1(i ) f1(i )
x1(i 1) x2(i 1) f1(i ) x1(i ) x2( i )
x1 x2 x1 x2
f 2(i ) f 2(i ) f 2( i ) f 2( i )
x1(i 1) x2( i 1) f 2(i ) x1( i ) x2( i )
x1 x2 x1 x2

f1(i ) f1(i ) f1(i ) f1(i )


x f1(i ) x1 x
1( i 1)
x1 x2
x
x2 1( i )

f 2( i ) f 2(i ) 2(i 1) f 2( i ) f 2(i ) f 2 (i ) x


2(i )
x x2 x x2
1 1

Since x1(i), x2(i), f1(i), and f2(i) are all known at the ith iteration, this represents a set of two
linear equations with two unknowns, x1(i+1) and x2(i+1)
You may use several techniques to solve these equations
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
General Representation for the solution of
Nonlinear Systems of Equations
f1 f1 f1
f1 ( x1 , x2 , x3 , , xn ) 0 x Jacobian Matrix
x2 xn
1
f 2 ( x1 , x2 , x3 , , xn ) 0 f 2 f 2

f 2
Solve this set of linear
J x1 x2 xn
equations at each iteration:

f f n f n
n
f n ( x1 , x2 , x3 , , xn ) 0 x1 x2 xn [ J i ]{ X i 1} {Fi } [ J i ]{ X i }

f1 f1 f1 f1 f1 f1
x x1 f1 ( x1 , x2 , x3 , , xn ) x1
x2 xn
x x2 xn
1 1
f 2 f 2 f 2 f 2 f 2 f 2
x2 f ( x , x , x , , xn ) x2
x1 x2 xn 2 1 2 3 x1 x2 xn


f f n f n f f n f n
n xn f n ( x1 , x2 , x3 , , xn ) n xn
x1 x2 xn i
i 1 i x1 x2 xn i
i

{X}(i+1) values are found by solving this system of linear equations.


These iterations will continue until the convergence is reached;
which will happen when the approximate relative error (defined on the vector of values) falls below the desired error tolerance tol 12
Copyright 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Potrebbero piacerti anche