Roots of Equations: Bracketing Methodsjuiching/NMChap5.pdf · Bracketing Methods • Find roots...
Transcript of Roots of Equations: Bracketing Methodsjuiching/NMChap5.pdf · Bracketing Methods • Find roots...
Roots of Equations: Bracketing Methods
2
How to Solve?
v(t)' gmcd
tanhgcd
mt
t'4v'36g'9.81cd'0.25m'?
v(t)' gmcd
tanhgcd
mt
t'4v'36g'9.81cd'0.25m'?
3
Techniques for Finding Roots
• Graphical Methods• Bracketing Methods• Open Methods
4
Graphical Methods
• The best.• The worst.
5
Bracketing Methods
• Find roots between a lower bound xl and an upper bound xu such that f(xl)*f(xu)<0.
• Initial guess needed (incremental search).• Always work if roots exist between the two
limits.• Converge slower than open methods.
6
Conditions
a) f(xl)*f(xu)>0, no root.b) f(xl)*f(xu)<0, one root.c) f(xl)*f(xu)>0, even number
of roots.d) f(xl)*f(xu)<0, odd number
of roots.
7
Conditions (cont.)
a) f(xl)*f(xu)<0, repeated roots.
b) f(xl)*f(xu)<0, no root.
8
Incremental Search
• Goal: find xl and xu such that f(xl)*f(xu)<0.• Range of search must be decided. • Large step size may miss some roots.• Small step size increases computation time.
9
Example• Cases where roots could be missed because the incremental length
of the search procedure is too large.• Note that the last root on the right is multiple and would be missed
regardless of the increment length.
10
Example 5.2
• sin(10x)+cos(3x)• 50 steps:
3.2449, 3.30613.3061, 3.36733.7347, 3.79594.6531, 4.71435.6327, 5.6939
11
Example 5.2 (cont.)• sin(10x)+cos(3x)• 100 steps:
3.2424, 3.27273.3636, 3.39393.7273, 3.75764.2121, 4.24244.2424, 4.27274.6970, 4.72735.1515, 5.18185.1818, 5.21215.6667, 5.6970
12
Bisection
• Iterative.• Every iteration reduces the bound by half.• Algorithm: repeat the following
xr = ( xl + xu )/2if f(xr)*f(xu)<0
xl = xrelse
xu = xrend
13
Example 5.3
14
Converge Criteria
• Use relative approximate errora=| ( xr
new - xrold ) / xr
new ) | 100%.• Not suitable when the root is close to 0.• In that case, use approximate error.
a=| xrnew - xr
old |• Number of iteration can be determined if a is
specified.n'1%log2
Δx 0
Ea,d
Δx 0: initial boundEa,d: desired Ea
n'1%log2Δx 0
Ea,d
Δx 0: initial boundEa,d: desired Ea
15
False Position
• Iterative.• Similar to bisection but determine the next bound by line
equation.• Algorithm: repeat the following
xr'xu&f(xu)(xl&xu)f(xl)&f(xu)
if f(xr)f(xu)<0xl'xr
elsexu'xr
end
xr'xu&f(xu)(xl&xu)f(xl)&f(xu)
if f(xr)f(xu)<0xl'xr
elsexu'xr
end
16
False Position (cont.)
• Usually converge faster than bisection but not always.
• Example: f(x)=x10-1