View
43
Download
4
Category
Preview:
DESCRIPTION
Part 2 Roots of Equations. Why? But. All Iterative. Chapter 5 Bracketing Methods (Or, two point methods for finding roots). Two initial guesses for the root are required. These guesses must “bracket” or be on either side of the root. == > Fig. 5.1 - PowerPoint PPT Presentation
Citation preview
1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Part 2
Roots of Equations
•Why?
•But
a
acbbxcbxax
2
40
22
?0sin
?02345
xxx
xfexdxcxbxax
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
3
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Nonlinear Equation Solvers
Bracketing Graphical Open Methods
BisectionFalse Position (Regula-Falsi)
Newton Raphson
Secant
All Iterative
4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 5 Bracketing Methods
(Or, two point methods for finding roots)• Two initial guesses for the
root are required. These guesses must “bracket” or be on either side of the root.
== > Fig. 5.1
• 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)
5
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 5.2
6
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure 5.3
7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Bisection MethodFor the arbitrary equation of one variable, f(x)=0
1. Pick xl and xu such that they bound the root of interest, check if f(xl).f(xu) <0.
2. Estimate the root by evaluating f[(xl+xu)/2].
3. Find the pair • If f(xl). f[(xl+xu)/2]<0, root lies in the lower interval,
then xu=(xl+xu)/2 and go to step 2.
8
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• If f(xl). f[(xl+xu)/2]>0, root lies in the upper interval, then xl= [(xl+xu)/2, go to step 2.
• If f(xl). f[(xl+xu)/2]=0, then root is (xl+xu)/2 and terminate.
4. Compare s with a
(5.2, p. 118)
5. If a< s, stop. Otherwise repeat the process.
%100
newr
oldr
newr
ax
xx
Step f (x ) = 2 - e -x x R = -ln(2) = a
t
XL -1 XR -0.5 XU 0
f(XL) -0.71828 f(XR) 0.351279 f(XU) 1
f(XL)*f(XR) -0.25232 f(XL)*f(XR) 0.351279
XL -1 XR -0.75 XU -0.5
f(XL) -0.71828 f(XR) -0.117 f(XU) 0.351279
f(XL)*f(XR) 0.084039 f(XL)*f(XR) -0.0411
XL -0.75 XR -0.625 XU -0.5
f(XL) -0.117 f(XR) 0.131754 f(XU) 0.351279
f(XL)*f(XR) -0.01542 f(XL)*f(XR) 0.046282
XL -0.75 XR -0.6875 XU -0.625
f(XL) -0.117 f(XR) 0.011263 f(XU) 0.131754
f(XL)*f(XR) -0.00132 f(XL)*f(XR) 0.001484
-0.69314718
1
2 0.333333
4 0.090909 0.005647
0.056853
3 0.2 0.068147
10
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Evaluation of Method
Pros• Easy• 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• No account is taken of
f(xl) and f(xu), if f(xl) is closer to zero, it is likely that root is closer to xl .
11
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
How Many Iterations will It Take?
• Length of the first Interval Lo=b-a
• After 1 iteration L1=Lo/2
• After 2 iterations L2=Lo/4
• After k iterations Lk=Lo/2k
saR
ka x
L %100
12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• If the absolute magnitude of the error is
and Lo=2, how many iterations will you have to do to get the required accuracy = 10-4 in the solution?
dan
na E
Ln
LE
,
02
0 log2
153.14)2log(
102
log 4
nn
13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The False-Position Method(Regula-Falsi)
• 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, f(xl)] and [xu, f(xu)] to find the xr value such that l(xr)=0, l(x) is the linear approximation of f(x).
== > Fig. 5.12
14
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Procedure
1. Find a 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 formula (Refer to Box 5.1)
and evaluate f(xr).
lu
luulr ff
fxfxx
15
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
3. Use the new point to replace one of the original points, keeping the two points on opposite sides of the x axis.
Use the same selecting rules as the bisection method.
If f(xr)=0 then you have found the root and need go no further.
16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
4. See if the new xl and xu are close enough for convergence to be declared. If they are not go back to step 2.
• Why this method?– Usually faster– Always converges for a single root.
See Sec.5.3.1, Pitfalls of the False-Position Method
Note: Always check by substituting estimated root in the original equation to determine whether f(xr) ≈ 0.
• One-sidedness: Watch out (p. 128)
Step f (x ) = 2 - e -x x R = -ln(2) = a
t
XL -1 XR -0.58198 XU 0
f(XL) -0.71828 f(XR) 0.210428 f(XU) 1
f(XL)*f(XR) -0.15115 f(XL)*f(XR) 0.210428
XL -1 XR -0.67669 XU -0.58198
f(XL) -0.71828 f(XR) 0.03264 f(XU) 0.210428
f(XL)*f(XR) -0.02344 f(XL)*f(XR) 0.006868
XL -1 XR -0.69075 XU -0.67669
f(XL) -0.71828 f(XR) 0.004797 f(XU) 0.03264
f(XL)*f(XR) -0.00345 f(XL)*f(XR) 0.000157
XL -1 XR -0.6928 XU -0.69075
f(XL) -0.71828 f(XR) 0.000699 f(XU) 0.004797
f(XL)*f(XR) -0.0005 f(XL)*f(XR) 3.36E-06
4 0.002962 0.00035
0.016454
3 0.020345 0.002402
-0.69314718
1
2 0.139969
18
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 6
Open Methods• Open methods
are based on formulas that require only a single starting value of x or two starting values that do not necessarily bracket the root.
Figure 6.1
19
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simple Fixed-point Iteration
... 2, 1,k ,given )(
)(0)(
1
okk xxgx
xxgxf
•Bracketing methods are “convergent”.
•Fixed-point methods may sometime “diverge”, depending on the stating point (initial guess) and how the function behaves.
•Good for calculators.
•Rearrange the function so that x is on the left side of the equation:
20
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
xxg
or
xxg
or
xxg
xxxxf
21)(
2)(
2)(
02)(2
2
Example:
g(x) = 1+2/x g(x) = x2-2 g(x) =
xold xnew xold xnew xold xnew
1 3 1 -1 1 1.7323 1.667 -1 -1 1.732 2.155
1.667 2.2 -1 -1 2.155 1.9282.2 1.909 -1 -1 1.928 2.037
1.909 2.048 -1 -1 2.037 1.9822.048 1.977 -1 -1 1.982 2.0091.977 2.012 -1 -1 2.009 1.9952.012 1.994 -1 -1 1.995 2.0021.994 2.003 -1 -1 2.002 1.9992.003 1.999 -1 -1 1.999 2.0011.999 2.001 -1 -1 2.001 2
(x+2) 0̂.5
22
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
g(x) = 1+2/x g(x) = x2-2 g(x) =
xold xnew xold xnew xold xnew
0 ##### 0 -2 0 1.414##### ##### -2 0 1.414 2.414##### ##### 0 ##### 2.414 1.828##### ##### ##### ##### 1.828 2.094##### ##### ##### ##### 2.094 1.955##### ##### ##### ##### 1.955 2.023##### ##### ##### ##### 2.023 1.989##### ##### ##### ##### 1.989 2.006##### ##### ##### ##### 2.006 1.997##### ##### ##### ##### 1.997 2.001##### ##### ##### ##### 2.001 1.999
(x+2) 0̂.5
23
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Convergence
• x=g(x) can be expressed as a pair of equations:
y1=x
y2=g(x) (component equations)
• Plot them separately.
Figure 6.2
24
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Conclusion
• Fixed-point iteration converges if
x)f(x) line theof (slope 1)( xg
•When the method converges, the error is roughly proportional to or less than the error of the previous step, therefore it is called “linearly convergent.”
25
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Newton-Raphson Method
• Most widely used method.• Based on Taylor series expansion:
)(
)(
)(0
g,Rearrangin
0)f(x when xof value theisroot The!2
)()()()(
1
1
1i1i
32
1
i
iii
iiii
iiii
xf
xfxx
xx)(xf)f(x
xOx
xfxxfxfxf
Newton-Raphson formula
Solve for
26
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• A convenient method for functions whose derivatives can be evaluated analytically. It may not be convenient for functions whose derivatives cannot be evaluated analytically.
Fig. 6.5
27
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 6.6
28
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Secant Method• A slight variation of Newton’s method for
functions whose derivatives are difficult to evaluate. For these cases the derivative can be approximated by a backward finite divided difference.
,3,2,1)()(
)(
)()()(
1
11
1
1
ixfxf
xxxfxx
xx
xfxfxf
ii
iiiii
ii
iii
29
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Requires two initial estimates of x , e.g, xo, x1. However, because f(x) is not required to change signs between estimates, it is not classified as a “bracketing” method.
• The scant method has the same properties as Newton’s method. Convergence is not guaranteed for all xo, f(x).
Fig. 6.7
30
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 6.8
31
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Multiple Roots
• None of the methods deal with multiple roots efficiently, however, one way to deal with problems is as follows:
)(
)(1xfindThen
)(
)()(Set
ii
i
i
ii
xu
xu
xf
xfxu
This function has
roots at all the same locations as the original function
32
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 6.10
33
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• “Multiple root” corresponds to a point where a function is tangent to the x axis.
• Difficulties– Function does not change sign at the multiple root,
therefore, cannot use bracketing methods.– Both f(x) and f′(x)=0, division by zero with
Newton’s and Secant methods.
34
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Systems of Linear Equations
0),,,,(
0),,,,(
0),,,,(
321
3212
3211
nn
n
n
xxxxf
xxxxf
xxxxf
35
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Taylor series expansion of a function of more than one variable
)()(
)()(
11111
11111
iii
iii
ii
iii
iii
ii
yyy
vxx
x
vvv
yyy
uxx
x
uuu
•The root of the equation occurs at the value of x and y where ui+1 and vi+1 equal to zero.
36
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
y
vy
x
vxvy
y
vx
x
v
y
uy
x
uxuy
y
ux
x
u
ii
iiii
ii
i
ii
iiii
ii
i
11
11
•A set of two linear equations with two unknowns that can be solved for.
37
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
xv
yu
yv
xu
xu
vxv
uyy
xv
yu
yv
xu
yu
vyv
uxx
iiii
ii
ii
ii
iiii
ii
ii
ii
1
1
Determinant of the Jacobian of the system.
38
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 7
Roots of Polynomials• The roots of polynomials such as
nnon xaxaxaaxf 2
21)(
Follow these rules:
1. For an nth order equation, there are n real or complex 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).
39
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Conventional Methods
• The efficacy of bracketing and open methods depends on whether the problem being solved involves complex roots. If only real roots 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 to divergence.
• Special methods have been developed to find the real and complex roots of polynomials – Müller and Bairstow methods.
40
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Müller Method• Müller’s method obtains a root estimate by
projecting a parabola to the x axis through three function values. Figure 7.3
41
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Müller Method
cxxbxxaxf )()()( 22
22
• The method consists of deriving the coefficients of parabola that goes through the three points:
1. Write the equation in a convenient form:
42
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
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
3. Three equations can be solved for three unknowns, a, b, c. Since two of the terms in the 3rd equation are zero, it can be immediately solved for c=f(x2).
cxxbxxaxf
cxxbxxaxf
cxxbxxaxf ooo
)()()(
)()()(
)()()(
222
222
212
211
22
2
)()()()(
)()()()(
212
2121
22
22
xxbxxaxfxf
xxbxxaxfxf ooo
43
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
)(
)()(
)()()()(
x-xhx-xh
If
2111
1
112
11
112
11
12
121
1
1
121o1o
xfcahbhh
a
hahbh
hhahhbhh
xx
xfxf
xx
xfxf
o
o
oooo
o
oo
Solved for a and b
44
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Roots can be found by applying an alternative form of quadratic formula:
• The error can be calculated as
• ±term yields two 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.
acbb
cxx
4
2223
%1003
23
x
xxa
45
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• 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 real and complex roots are estimated, employ a sequential approach just like in secant method, x1, x2, and x3 to replace xo, x1, and x2.
46
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Bairstow’s Method• Bairstow’s method is an iterative approach loosely
related to both Müller and Newton Raphson methods.• It is based on dividing a polynomial by a factor x-t:
2 to1
iprelationsh recurrenceby calculated
are tscoefficien the,bRreminder awith
)(
)(
1
o
23211
221
nitbab
ab
xbxbxbbxf
xaxaxaaxf
iii
nn
nnn
nnon
47
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• To permit the evaluation of complex roots, Bairstow’s method divides the polynomial by a quadratic factor x2-rx-s:
02
iprelationsh recurrence simple a Using
)(
)(
21
11
1
231322
ton-isbrbab
rbab
ab
brxbR
xbxbxbbxf
iiii
nn-n-
nn
o
nn
nnn
48
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• For the remainder to be zero, bo and b1 must be zero. However, it is unlikely that our initial guesses at the values of r and s will lead to this result, a systematic approach can be used to modify our guesses so that bo and b1 approach to zero.
• Using a similar approach to Newton Raphson method, both bo and b1 can be expanded as function of both r and s in Taylor series.
49
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ooo
oooo
bss
br
r
b
bss
br
r
b
ss
br
r
bbssrrb
ss
br
r
bbssrrb
111
1111
as estimated
be willguessesour improve toneededr and sin
changes The roots.at s andr of values the toclose
adequately are guesses initial that theassuming
),(
),(
50
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• If partial derivatives of the b’s can be determined, then the two equations can be solved simultaneously for the two unknowns r and b.
• Partial derivatives can be obtained by a synthetic division of the b’s in a similar fashion the b’s themselves are derived:
31
21
1
21
11
22
cs
bc
r
b
s
bc
r
b
where
toniscrcbc
rcbc
bc
oo
iiii
nnn
nn
51
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Then
• At each step the error can be estimated as
obscrc
bscrc
21
132 Solved for r and s, in turn are employed to improve the initial guesses.
%100
%100
,
,
r
r
r
r
sa
ra
52
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2
42 srrx
• The values of the roots are determined by
• At this point three possibilities exist:
1. The quotient is a third-order polynomial or greater. The previous values of r and s serve as initial guesses and Bairstow’s method is applied to the quotient to evaluate new r and s values.
2. The quotient is quadratic. The remaining two roots are evaluated directly, using the above eqn.
3. The quotient is a 1st order polynomial. The remaining single root can be evaluated simply as x=-s/r.
Refer to Tables pt2.3 and pt2.4
Recommended