You are on page 1of 98

users.isc.tuc.gr/~adelis/ENG407.

html

Lectures 3-4
Dr A.I. Delis 2012 TUC Part 2 1

Roots of Equations
Part 2 P Motivation
Analytical solution:

f ( x ) = ax + bx + c = 0

b b 2 4ac x= 2a

But how about e x + 3sin x x log x + 4 = 0 ?


A Approximation i ti solution l ti (pre-computer): ( t )
f(x)

Plot method
x

Trial and error

An Example of Roots of Equation in Engineering


Parachutists velocity: v = gm ( 1 e ( c / m )t )

Problem: determine the drag coefficient c for a parachutist of a given mass m to attain a prescribed velocity in a set time period, that is,

Given v, m, g, and t, find c.


Approach 1: try to represent c as an explicit function c = f(v, m, g, t) (fails most of time) Approach 2: express the formula in an explicit form and solve for the zero root
f (c ) = gm ( 1 e ( c / m )t ) v = 0 c

Nonlinear Equation Solvers

Bracketing

Graphical

Open Methods

Bisection F l P False Position iti (Regula-Falsi)

Newton Raphson Secant

All Iterative
Dr A.I. Delis 2012 TUC Part 2 4

Bracketing Methods
(Or two point methods for finding roots) (Or, Chapter 3
T Two initial i iti l guesses for f the th root t are required. These guesses must bracket or be on either side id of f the th root. t == > Figure If one root of a real and continuous function, f(x)=0, is bounded by values x=xl, x =xu then f(xl).f(xu) <0. (The function changes
sign on opposite sides of the root Bolzano theorem)
TUC 5

Dr A.I. Delis 2012

Part 2

No answer ( (No root) )

Nice case (one root)

O !! (t Oops!! (two roots!!) t !!)

Three roots (Might work for a while!!)

Dr A.I. Delis 2012

TUC

Part 2

Two roots( Might work for a while!!)

Discontinuous function. Need special method

Dr A.I. Delis 2012

TUC

Part 2

MANY-MANY roots. What do we do?

f(x)=sin 10x+cos 3x

Dr A.I. Delis 2012

TUC

Part 2

The Bisection Method


For the arbitrary equation of one variable variable, f(x)=0 1. Pick xl and xu such that they bound the root of interest check if f(xl).f(x interest, ) f(xu) <0 <0. 2. Estimate the root by evaluating f[(xl+xu)/2]. 3. Find the pair
If f(xl). f[(xl+x xu)/2] )/2]<0, 0, root lies in the lower interval, then xu=(xl+xu)/2 and go to step 2.
TUC Part 2 9

Dr A.I. Delis 2012

If f(xl). f[(xl+xu)/2]>0, root lies i the in h upper interval, i l then h xl= (xl+xu)/2, go to step 2. If f(xl). f[(xl+xu)/2]=0, then root is (xl+xu)/2 and terminate. terminate
xl xl + xu 2 100% xl + xu 2 xl + xu 2 100% xl + xu 2

Compare s with a (s tolerance) 5 If a< s, stop. 5. t Otherwise Oth i repeat t the process. 4 4.

or xu

Dr A.I. Delis 2012

TUC

Part 2

10

Dr A.I. Delis 201

TUC

Part 2

11

Step 1
Choose x and xu as two guesses for the root such that f(x ) f(xu) < 0, 0 or in other words, words f(x) changes sign between x and xu. This was demonstrated in Figure 1.
f(x)

x xu x

Figure 1
12

Step 2
Estimate the root, xm of the equation f (x) = 0 as the mid point between x and xu as
f(x)

x + xu xm = 2
x xm xu x

Figure Estimate of xm

13

Step 3
Now check the following a) If f (xl ) f ( xm ) < 0 , then the root lies between x and xm; then x = x ; xu = xm. b) If f (xl ) f ( xm ) > 0 ,then the root lies between xm and xu; then x = xm; xu = xu. f (xl ) f ( xm ) = 0 c) If ; then the root is xm. Stop the algorithm if this is true.
14

Step 4
Find the new estimate of the root

xm =

x + xu 2
old x new x m m

Find the absolute relative approximate error

a =
where

new m

100

old xm = previous estimate of root


new xm = current estimate of root

15

Step 5
Compare the absolute relative approximate error a with the pre-specified error tolerance s .

Yes Is a >s ? No

Go to Step 2 using new upper and lower guesses guesses.

Stop the algorithm

Note one should also check whether the number of iterations is more than the maximum number of iterations allowed. If so, one needs to terminate the algorithm and notify the user about it.
16

Three ways in which the interval may bracket the root: (a) True value lies at center (b) ( ) and ( (c) ) True value lies near the extreme

Discrepancy p y between true value and solution never exceeds the interval length
Dr A.I. Delis 2012 TUC Part 2 17

Error estimate equivalence

Dr A.I. Delis 2012

TUC

Part 2

18

Evaluation of the Method


Pros Easy y Always find root Number of iterations required to attain an absolute error can be computed a priori. Cons Slow Know a and b that bound root Multiple roots N account t is i taken t k of f No f(xl) and f(xu), if f(xl) is closer l to t zero, it is i likely lik l that root is closer to xl .
19

Dr A.I. Delis 2012

TUC

Part 2

How Many Iterations will It Take?


Length of the first Interval After 1 iteration After 2 iterations After k iterations
t a Lk
and

Lo=b-a L1=L Lo/2 L2=Lo/4 Lk=L Lo/2k


a s

Sol e problem 3.1 Solve 3 1 for a proof


Dr A.I. Delis 2012 TUC Part 2 20

EXAMPLE

If the absolute magnitude of the error is

s = 10

and Lo=2, how many iterations will you have to do to get the required accuracy in the solution?
2 10 k 2k 2 104 k 14.3 = 15 2
4
Dr A.I. Delis 2012 TUC 21

Part 2

Dr A.I. Delis 2012

TUC

Part 2

22

Algorithm

Dr A.I. Delis 2012

TUC

Part 2

23

Dr A.I. Delis 2010

TUC

Part 2 (Chapters 5-6-7)

24

Example p 1
You are working for DOWN THE TOILET COMPANY that makes floats for ABC commodes. The floating ball has a specific ifi gravity it of f 0.6 0 6 and d has h a radius di of f 5.5 5 5 cm. You Y are asked to find the depth to which the ball is submerged when floating g in water.

Figure Diagram of the floating ball


25

Example p 1 Cont.
The equation that gives the depth x to which the ball is submerged under water is given by

x 3 0.165 x 2 + 3.993 10 4 = 0
a) Use the bisection method of finding roots of equations to find the depth x to which the ball is submerged under water. Conduct three iterations to estimate the root of the above equation. b) Find the absolute relative approximate error at the end of each iteration, and the number of significant digits at least correct at the end of each iteration.

26

Example 1 Cont.
From the physics of the problem, the ball would be submerged between x = 0 and x = 2R, where R = radius of the ball, that is
0 x 2R

0 x 2(0.055) 0 x 0.11

Diagram of the floating ball

27

Example 1 Cont.
Solution
To aid in the understanding of how this method works to find the root of an q , the g graph p of f(x) ( ) is shown to the equation, right, where

f ( x ) = x 3 0.165 x 2 + 3.993 10 - 4

Graph of the function f(x)

28

Example 1 Cont.
Let us assume

x = 0.00 xu = 0.11

Check if the function changes sign between x and xu .


f (xl ) = f (0) = (0) 0.165(0) + 3.993104 = 3.993104
3 2

f (xu ) = f (0.11) = (0.11) 0.165(0.11) + 3.993104 = 2.662104


3 2

Hence

f (xl ) f (xu ) = f (0) f (0.11) = 3.993104 2.662104 < 0


So there is at least one root between x and xu, that is between 0 and 0.11
29

)(

Example 1 Cont.

Graph demonstrating sign change between initial limits


30

Example 1 Cont.
Iteration 1

The estimate of the root is


3

x + xu 0 + 0.11 xm = = = 0.055 2 2
2

f ( xm ) = f (0.055) = (0.055) 0.165(0.055) + 3.993 10 4 = 6.655 10 5 f ( xl ) f ( xm ) = f (0) f (0.055) = 3.993 10 4 6.655 10 5 > 0

)(

Hence the root is bracketed between xm and xu, that is, between 0.055 and 0.11. So the lower and upper limits of the new bracket are So, At this point, point the absolute relative approximate error a cannot be calculated as we do not have a previous approximation.

xl = 0.055, xu = 0.11

31

Example 1 Cont.

Estimate of the root for Iteration 1


32

Example 1 Cont.
Iteration 2 The estimate of the root is x + xu 0.055 + 0.11 xm = = = 0.0825 2 2
3 2

f ( xm ) = f (0.0825) = (0.0825) 0.165(0.0825) + 3.993 10 4 = 1.622 10 4 f ( xl ) f ( xm ) = f (0.055) f (0.0825) = ( 1.622 10 4 )(6.655 10 5 ) < 0

Hence the root is bracketed between x and xm, that is, between 0.055 and 0.0825. So, the lower and upper limits of the new b k are bracket
xl = 0.055, xu = 0.0825
33

Example 1 Cont.

Estimate of the root for Iteration 2

34

Example 1 Cont.
The absolute relative approximate error a at the end of Iteration 2 is
new old xm xm a = 100 new xm

0.0825 0.055 = 100 0.0825 = 33.333%


None of N f the th significant i ifi t digits di it are at t least l t correct t in i the th estimate ti t root t of xm = 0.0825 because the absolute relative approximate error is greater than 5%.
35

Example 1 Cont.
Iteration 3 The estimate of the root is
3

x + xu 0.055 + 0.0825 xm = = = 0.06875 2 2


2

f ( xm ) = f (0.06875) = (0.06875) 0.165(0.06875) + 3.993 10 4 = 5.563 10 5 f ( xl ) f ( xm ) = f (0.055) f (0.06875) = 6.655 10 5 5.563 10 5 < 0

)(

Hence the root is bracketed between x and xm, that is, between 0.055 and 0.06875. So, the lower and upper limits of the new bracket are

xl = 0.055, xu = 0.06875
36

Example 1 Cont.

Estimate of the root for Iteration 3

37

Example 1 Cont.
The absolute relative approximate error a at the end of Iteration 3 is
new old xm xm a = 100 new xm

0.06875 0.0825 = 100 0.06875 = 20%


Still none of the significant digits are at least correct in the estimated root of the equation as the absolute relative approximate error is greater than 5%. S Seven more iterations it ti were conducted d t d and d these th it ti iterations are 38 shown in Table 1.

Table 1 for Example 1


Table 1 Root of f(x)=0 as function of number of iterations for bisection method.
Iteration 1 2 3 4 5 6 7 8 9 10 x 0.00000 0.055 0.055 0.055 0.06188 0 06188 0.06188 0.06188 0.06188 0.0623 0.0623 xu 0.11 0.11 0.0825 0.06875 0.06875 0 06531 0.06531 0.06359 0.06273 0.06273 0.06252 xm 0.055 0.0825 0.06875 0.06188 0.06531 0 06359 0.06359 0.06273 0.0623 0.06252 0.06241
a %

f(xm) 6.655105 1.622104 5.563105 4.484106 2.593105 1.080410 1 0804105 3.176106 6.497107 1.265106 3.0768107
39

---------33.33 20.00 11.11 5.263 2 702 2.702 1.370 0.6897 0.3436 0.1721

Table 1 Cont.
Hence the number of significant digits at least correct is given by the largest value or m for which

a 0.5 10 2 m 0.1721 0.5 10 2 m log(0.3442 ) 2 m 0.3442 10 2 m

m 2 log l (0.3442 ) = 2.463

So

m=2

The e number u be o of s significant g ca t d digits g ts at least east co correct ect in t the e est estimated ated root of 0.06241 at the end of the 10th iteration is 2. 40

See also example 3-1: for a MATLAB realization!!

Dr A.I. Delis 2012

TUC

Part 2

41

The False-Position Method


If a real root is bounded by xl and xu of f(x)=0, then we can approximate the solution by doing a linear interpolation between the points [xl, ( l)] and [ [xu, f(x ( u)] to f(x find the xr value such that l(xr)=0, l(x) is the pp linear approximation of f(x). == >

(Regula-Falsi)

Dr A.I. Delis 2012

TUC

Part 2

42

False-Position Method: derivation Based on two similar triangles, shown in Figure, one gets:

f ( xl ) f ( xu ) = xr xl xr xu

(1)

The signs for both sides of Eq. (1) is consistent, since:

f ( xl ) < 0; xr xl > 0 f ( xu ) > 0; xr xu < 0


43

False-Position Method: derivation From Eq. (1), one obtains

( xr xl ) f ( xu ) = ( xr xu ) f ( xl )
xu f ( xl ) xl f ( xu ) = xr { f ( xl ) f ( xu )}
The above equation can be solved to obtain the next xr , as predicted root

xr =

xu f ( xl ) xl f ( xu ) f ( xl ) f ( xu )
44

Procedure
1. Find a p pair of values of x, , xl and xu such that fl=f(xl) <0 and fu=f(xu) >0. 2 Estimate the value of the root from the following 2. formula

xl f u xu f l xr = fu fl
and evaluate f(x ( r) ).

Dr A.I. Delis 2012

TUC

Part 2

45

3. Use the new point to replace one of the original points, keeping the two points on opposite sides of the x axis. If f(xr)<0 then xl=xr If f(xr)>0 then xu=xr == > == > fl=f(xr) fu=f(xr)

If f(xr)=0 then you have found the root and need go no further!
Dr A.I. Delis 2012 TUC Part 2 46

4 See if the new xl and xu are close enough for 4. convergence to be declared. If they are not go back to step 2. 2 Why this method? Faster ( (but not always) y) Always converges for a single root.
Note: Always check by substituting estimated root in the original equation to determine whether f(xr) 0.

Dr A.I. Delis 2012

TUC

Part 2

47

Dr A.I. Delis 2010

TUC

Part 2 (Chapters 5-6-7)

48

An example of slow convergence

f ( x ) = x 10 1 = 0

Dr A.I. Delis 2012

TUC

Part 2

49

Table 2: Root of f ( x ) = x 3 0.165 x 2 + 3.993 10 4 = 0 for False-Position Method.


Iteration 1

Table 2 for Example 1

xL
0.0000

xU
0.1100

xm
0.0660

a %
N/A

f ( xm )
-3.1944x10-5

2 3

0.0000 0.0611

0.0660 0.0660

0.0611 0.0624

8.00 2.05

1.1320x10-5 -1.1313x10-7

0.0611

0.0624

0.0632377619

0.02

-3.3471x10-10

50

a 0.5 10 0.04 10
2 m

2 m 2 m

0.02 0.5 10

log(0.04) 2 m m 2 log(0.04) m 2 (1.3979) m 3.3979 So, m = 3


The number of significant digits at least correct in the estimated root of 0.062377619 0 062377619 at the end of 4th iteration 51 is 3.

Open Methods
Open methods are based on formulas that require q only y a single starting value of x or two starting values that do not necessarily bracket th root the t Open methods can either ith di diverge or converge (rapidly)
Dr A.I. Delis 2012 TUC Part 2 52

Simple S p e Fixed-point ed po t Iteration te at o


Rearrange the function so that x is on the l ft side left id of f the th equation: ti

f ( x) = 0 g ( x) = x xk = g ( xk 1 ) xo given, k = 1, 2, ...
Bracketing methods are convergent. Fixed-point methods may sometimes g , depending p g( (a) ) on the stating gp point diverge, (initial guess) and (b) how the function behaves behaves.
Dr A.I. Delis 2012 TUC Part 2 53

Example: p

f ( x) = x x 2
2

g ( x) = x 2
2

or g ( x) = x + 2 or 2 g ( x) = 1 + x
Dr A.I. Delis 2012 TUC Part 2 54

Convergence g
x=g(x) ( ) can be b expressed d as a pair of equations: y1=x y2=g(x) g( ) ( (component p equations) Plot them separately.

Dr A.I. Delis 2012

TUC

Part 2

55

Conclusion
Fixed-point iteration converges if
g ( x ) 1 (i.e. less than the slope of the line f(x) = x)
S also See l section ti 3.7 3 7 pages 76-77 76 77

When the method converges, the error is roughly proportional to or less than the error of previous step, p, therefore it is called linearly y the p convergent.
= 100%

a < s
56

. x o r p p a s u o i v e r p . x o r p p a t n e r r u c . x o r p p a t n e r r u c
TUC Part 2

Dr A.I. Delis 2012

0 g ( x ) 1

1 g ( x ) 0

1 g ( x )

g ( x ) 1

Dr A.I. Delis 2010

TUC

Part 2 (Chapters 5-6-7)

57

Dr A.I. Delis 2012

TUC

Part 2

58

Newton-Raphson p Method
Most widely y used method. Based on Taylor series expansion:
x 2 f ( xi +1 ) = f ( xi ) + f ( xi )x + f ( xi ) + Ox 3 2! The root is the value of x i +1 when f(x i +1 ) = 0 Rearranging, Solve for i )( xi +1 xi ) 0 = f(xi ) + f (x f ( xi ) xi +1 = xi f ( xi )
Dr A.I. Delis 2012 TUC

Newton-Raphson formula
Part 2 59

A convenient method for functions whose derivatives can be evaluated analytically. y y The number of correct decimal places doubles with each iteration == > quadratic convergence (if initial guess sufficiently close to root) It may not be convenient for functions whose derivatives cannot be evaluated analytically.

Dr A.I. Delis 2012

TUC

Part 2 (Chapters 5-6-7)

60

Cases where the NR exhibits poor convergence (a) f(x) has an inflection point near root

(b) NR oscillates around local min

(c) Jump from away from root

( f " ( x ) = 0) (d) Z Zero slope l

Dr A.I. Delis 2012

TUC

Part 2 (Chapters 5-6-7)

61

Example 1:NR Method


The floating ball has a specific gravity of 0.6 and has a radius of 5.5 cm. You are asked to find the depth to which th ball the b ll is i submerged b d when h floating fl ti in i water. t

Diagram of the floating ball The equation that gives the depth x to which the ball is submerged under water is given by 3 2 4 a) Use the NR method of finding roots of equations to find the depth x to which the ball is submerged under water. Conduct 3iterations to estimate the root of the above equation. b) Find the absolute relative approximate error at the end of each iteration, iteration and the number of significant digits at least correct at the end of each iteration.
62

x 0.165 x + 3.993 10 = 0

Example 1 Cont.
Solve for
f ' (x )

f ( x ) = x 3-0.165 x 2+3.993 10- 4 f ' ( x ) = 3x 2 -0.33 x


Let us assume the initial guess of the root of f ( x ) = 0 is .x0 = 0.05m . This is a reasonable guess (think why x = 0 and x = 0.11m are not good choices) as the extreme values of the depth x would be 0 and the diameter (0.11 m) of the ball.
63

Example 1 Cont.
Iteration 1 The estimate of the root is
f (x 0 ) x1 = x 0 f ' (x 0 )
3 2 ( 0 . 05 ) 0 . 165 (0 . 05 ) + 3 .993 10 4 = 0 . 05 2 3 (0 . 05 ) 0 . 33 (0 . 05 )

1 . 118 10 4 = 0.05 9 10 3 = 0.05 ( 0 . 01242 ) = 0 . 06242


64

Example 1 Cont.

Estimate of the root for the first iteration for the NR method.
65

Example 1 Cont.
The absolute relative approximate error is
a at the end of Iteration 1

x1 x 0 a = 100 x1 0 . 06242 0 . 05 = 100 0 . 06242 = 19 . 90 %


The number Th b of f significant i ifi t digits di it at t least l t correct t is i 0, 0 as you need d an absolute relative approximate error of 5% or less for at least one significant digits to be correct in your result. result
66

Example 1 Cont.
Iteration 2 The estimate of the root is

f ( x1 ) x 2 = x1 f ' ( x1 )

( 0.06242 ) 0.165 (0.06242 ) + 3.993 10 4 = 0.06242 2 3(0.06242 ) 0.33(0.06242 )


3 2

3.97781 10 7 = 0.06242 8.90973 10 3 = 0.06242 4.4646 10 5

= 0.06238
67

Example 1 Cont.

Estimate of the root for the Iteration 2 for the NR method.


68

Example 1 Cont.
The absolute relative approximate error a Iteration 2 is at the end of

x 2 x1 a = 100 x2 0 .06238 0 .06242 = 100 0 .06238 = 0 .0716 %


2m 0 . 5 10 The e maximum u value v ue of o m for o w which c is s 2.844. .8 . a

Hence, the number of significant digits at least correct in the answer is 2.


69

Example 1 Cont.
Iteration 3
The estimate of the root is

f ( x2 ) x3 = x2 f ' ( x2 )
3 2 ( 0.06238) 0.165(0.06238) + 3.993 104 = 0.06238 2 3(0.06238) 0.33(0.06238)

4.44 1011 = 0.06238 3 8.9117110 = 0.06238 4.9822 109 = 0.06238

)
70

Example 1 Cont.

Estimate of the root for the Iteration 3 for the NR method.


71

Example 1 Cont.
The absolute Th b l t relative l ti approximate i t error a at t the th end d of f Iteration It ti 3 is

x 2 x1 a = 100 x2 0 .06238 0 .06238 = 100 0 .06238 = 0%


The number of significant digits at least correct is 4, as only 4 significant digits are carried through all the calculations.
72

On the Drawbacks of NR
1. Divergence at inflection points Selection of the initial guess or an iteration value of the root that is close to the inflection point of the function f ( x ) may start diverging away from the root in the Newton-Raphson method.

For example, to find the root of the equation The Newton-Raphson method reduces to

f ( x ) = ( x 1) .+ 0.512 = 0
3

xi +1 = xi

(x

3 i

.1 + 0.512 2 3( xi 1)

Next table shows the iterated values of the root of the equation. The root starts to diverge at Iteration 6 because the previous estimate of 0.92589 0 92589 is close to the inflection point of x = 1 . Eventually after 12 more iterations the root converges to the exact value of x = 0.2.

73

NR Drawbacks Inflection Points


Table : Divergence near inflection point. Iteration Number 0 1 2 3 4 5 6 7 18 xi 5.0000 3.6560 2 7465 2.7465 2.1084 1 6000 1.6000 0.92589 30.119 19.746 0.2000 Divergence at inflection point for
3

f ( x ) = ( x 1) + 0.512 = 0
74

NR Drawbacks Division by Zero


2. Division by zero For the equation
f ( x ) = x 3 0.03 x 2 + 2.4 10 6 = 0

the Newton-Raphson method reduces to


xi3 0.03 xi2 + 2.4 10 6 xi +1 = xi 3 xi2 0.06 xi
Pitfall of division by zero or near a zero number

For x0 = 0 or x0 = 0.02 , the denominator will equal q zero.


75

NR Drawbacks Oscillations near local maximum and minimum


3 Oscillations near local maximum and minimum 3.

Results obtained from the Newton-Raphson p method may y oscillate about the local maximum or minimum without converging on a root but converging on the local maximum or minimum. Eventually, it may lead to division by a number close to zero Eventually and may diverge.
2 ( ) f x = x +2=0 For example for roots.

the equation has no real

76

NR Drawbacks Oscillations near local maximum and minimum


Oscillations near local maxima and mimima in Newton-Raphson method. Iteration Number 0 1 2 3 4 5 6 7 8 9
6

f(x)

xi
1.0000 0.5 1.75 0.30357 3.1423 1.2529 0.17166 5 7395 5.7395 2.6955 0.97678

f ( xi ) a %
3.00 2.25 5.063 2.092 11.874 3.570 2.029 34 942 34.942 9.266 2.954 300.00 128.571 476.47 109.66 150.80 829.88 102 99 102.99 112.93 175.96
3

11
4 0 -2

x
0

-1.75

-1

-0.3040
-1 1

0.5

3.142

Oscillations around local minima for f ( x ) = x 2 + 2

77

NR Drawbacks Root Jumping


4. Root Jumping In some cases where the function f ( x )is oscillating and has a number b of f roots, t one may choose h an initial i iti l guess close l t a to root. However, the guesses may jump and converge to some other root. root f(x)
1 .5 1

For example f ( x ) = sin x = 0

0.5

0 -2

x
0

-0.06307 006307
-0.5

05499 0.5499

4461 4.461

7539822 7.539822

1 0

Choose x0 = 2.4 = 7.539822 It will converge to x = 0 instead of x = 2 = 6.2831853

-1 1

-1 .5

Root R t jumping j i from f intended i t d d location l ti of f root t for f f ( x ) = sin . x=0 78

The Secant Method


A slight variation of Newtons method for functions whose derivatives are difficult to evaluate. For these cases the derivative can be approximated by a backward finite divided difference.

xi xi 1 1 f ( xi ) f ( xi ) f ( xi 1 ) xi xi 1 xi +1 = xi f ( xi ) f ( xi ) f ( xi 1 )
Dr A.I. Delis 2012 TUC Part 2

i = 1,2,3,
79

Requires q two initial estimates of x , e.g, xo, x1. However, because f(x) is not required to change signs between estimates it is not estimates, classified as a bracketing g method. The secant method has the same properties as Newtons method. Convergence is not guaranteed for all xo, f(x).
Dr A.I. Delis 2012 TUC Part 2 80

Dr A.I. Delis 2012

TUC

Part 2

81

Dr A.I. Delis 2012

TUC

Part 2

82

Multiple Roots
Example: f(x) =(x-3)(x-1)(x-1)(x-1) Pose some difficulties: 1 Function does not change sign at 1. even roots (can use only open methods) 2. In NR and secant f(x) goes to zero (at the root) 3. NR and secant are now linearly convergent (have to modify them) See
Dr A.I. Delis 2012 TUC Part 2 83

Multiple p Roots
None of the methods deal with multiple roots efficiently however, efficiently, however one way to deal with problems is as follows:
Set f ( xi ) u ( xi ) = f ( xi )
This function has roots at all the same locations as the original function

Alternative form of Newton - Raphson u ( xi ) xi +1 = xi u( xi ) f ' ( x) f ' ( x) f ( x) f ' ' ( x) u ' ( x) = [ f ' ( x)]2 f ( xi ) f ' ( xi ) xi +1 = xi [ f ' ( xi )]2 f ( xi ) f ' ' ( xi )
TUC Part 2

Dr A.I. Delis 2012

84

Note: Always check by substituting estimated root in the original equation to determine whether f(xr) 0.

ASSIGMENT 1 PROBLEMS:

Dr A.I. Delis 2012

TUC

Part 2

85

Systems of Non Non-Linear Linear Equations

f1 ( x1 , x2 , x3 , , xn ) = 0 f 2 ( x1 , x2 , x3 , , xn ) = 0 f n ( x1 , x2 , x3 , , xn ) = 0
Dr A.I. Delis 2012 TUC Part 2 86

T Taylor l series i expansion i of f a function f ti of f more than th one variable

ui ui ui +1 = ui + ( x1i +1 x1i ) + ( yi +1 yi ) x y vi vi vi +1 = vi + ( x1i +1 x1i ) + ( yi +1 yi ) x y

The root of the equation occurs at the value of x and y where ui+1 and vi+1 equal to zero. zero
Dr A.I. Delis 2012 TUC 87

Part 2

ui ui ui ui xi +1 + yi +1 = ui + xi + yi x y x y vi vi vi vi xi +1 + yi +1 = vi + xi + yi x y x y

A set of two non-linear non linear equations with two unknowns that can be solved for.

Dr A.I. Delis 2012

TUC

Part 2

88

vi ui ui vi y y xi +1 = xi ui vi ui vi x y y x vi ui ui vi x x yi +1 = yi ui vi ui vi x y y x

Determinant of th Jacobian the J bi of f the system.


89

Dr A.I. Delis 2012

TUC

Part 2

Roots of Polynomials y
Chapter 7 The roots of polynomials such as

fn ( x) = ao + a1x + a2 x ++ an x
2

Follow these rules: 1. For an nth order equation, there are n real or complex p roots. 2. If n is odd, there is at least one real root. 3. If complex root exist in conjugate pairs (that is, +i and -i), where i=sqrt(-1). q ( )
Dr A.I. Delis 2012 TUC Part 2 90

Conventional Methods
The efficacy y of bracketing g and open p methods depends on whether the problem being solved p roots. If only y real roots involves complex exist, these methods could be used. However,
Finding good initial guesses complicates both the open and bracketing methods, also the open methods could be susceptible p to divergence. g

Special methods have been developed to find the real and complex roots of polynomials Mller and Bairstow methods.
Dr A.I. Delis 2012 TUC Part 2 91

Mller Method
Mllers method obtains a root estimate by y projecting a parabola to the x axis through three function values.

Dr A.I. Delis 2012

TUC

Part 2

92

Mller Method (cont)


The method consists of deriving the coefficients of p parabola that g goes through g the three points:
1. Write the equation in a convenient form:

f 2 ( x) = a( x x2 ) + b( x x2 ) + c
2
Dr A.I. Delis 2012 TUC Part 2 93

2. The parabola should intersect the three points [xo, f(xo)], [x1, f(x1)], [x2, f(x2)]. The coefficients of the polynomial can be estimated by substituting three points to give

f ( xo ) = a ( xo x2 ) 2 + b( xo x2 ) + c f ( x1 ) = a ( x1 x2 ) 2 + b( x1 x2 ) + c f ( x2 ) = a ( x 2 x2 ) 2 + b ( x2 x2 ) + c
2. Three equations can be solved for three unknowns, d equation a, b, c. Since two of the terms in the 3rd are zero, it can be immediately solved for c=f(x2).

f ( xo ) f ( x2 ) = a ( xo x2 ) 2 + b( xo x2 ) f ( x1 ) f ( x2 ) = a( x1 x2 ) 2 + b( x1 x2 )
Dr A.I. Delis 2012 TUC Part 2 94

If h o = x1 - x o

h1 = x 2 - x1

f ( x1 ) f ( xo ) f ( x2 ) f ( x1 ) o = 1 = x1 xo x2 x1 (ho + h1 )b (ho + h1 ) 2 a = ho o + h11 h1b h12 a = h11 a=


Solved for a and b

1 o
h1 + ho
TUC

b = ah h1 + 1 c = f ( x2 )
95

Dr A.I. Delis 2012

Part 2

Roots can be found by applying an alternative form of quadratic formula:

x3 = x2 +

2c b b 4ac
2

The error can be calculated as

x3 x2 a = 100% x3
term yields two roots, roots the sign is chosen to agree with b. This will result in a largest denominator, and will give root estimate that is closest to x2.
Dr A.I. Delis 2012 TUC Part 2 96

Once x3 is determined, the process is repeated using the following guidelines:


1. If only real roots are being located, choose the two original points that are nearest the new root estimate, x3. 2 If both 2. b th real l and d complex l roots t are estimated, ti t d employ a sequential approach just like in secant method, th d x1, x2, and d x3 to t replace l xo, x1, and d x2. See

Dr A.I. Delis 2012

TUC

Part 2

97

Dr A.I. Delis 2012

TUC

Part 2

98

You might also like