Professional Documents
Culture Documents
Week3 Roots of Eqs - Bracketing
Week3 Roots of Eqs - Bracketing
Week3 Roots of Eqs - Bracketing
Roots of Equations
1
Roots of Equations
Objective:
Solve for x, given that f(x) = 0
-or-
Equivalently, solve for x such that
b b 2 4ac
ax 2 bx c 0 x
2a
• But
ax 5 bx 4 cx3 dx 2 ex f 0 x ?
sin x x 0 x ?
ROOTS OF EQUATIONS
• Non-computer methods:
- Closed form solution (not always available)
- Graphical solution (inaccurate)
Modified Newton
Raphson
Roots of Muller
polynomials Method
Nonlinear Equation
Solvers
All Iterative
Graphical Solution
f(x)
roots
x
f(x)=0 f(x)=0
• The roots exist where f(x) crosses the x-axis.
Roots of Equations
• Graphical methods:
– Determine the friction coefficient c necessary for a
parachutist of mass 68.1 kg to have a speed of 40 m/s
at 10 seconds.
– Reorganizing.
Graphical Solution: Example
c
mg t
The parachutist velocity is v (1 e m
• )
c
• V = 40 m/s, m=68.1 kg, t =10 s, g= 9.8 m/s2
f(c)
c
mg t
f (c) (1 e m ) v
c
667.38 0.146843c
f (c) (1 e ) 40
c c
c=14.75 Check: f (14.75) = 0.059 ~ 0.0
v (c=14.75) = 40.06 ~ 40 m/s
Roots of Equations
Bracketing Methods
12
Bracketing Methods
Bisection Method
f(x) f(x)
xl xu
xr
2 f(xu) f(xu)
f(xr)
(x1) f(x1) f(xr) > 0 (x1)
(xu) x xr => x1 (xr)(xu) x
f(xr) f(x1)
f(x1)
1. Bisection Method
i=0
ea=1.1es
while False
ea> es &
i <maxi
Print: xr , f(xr ) ,ea ,
i
xu x r
xr
2
A i i 1 Stop
B
A B
xu+xl =0
True xu x l
ea 100%
xu x l
Test=f(xl). f(xr)
Test True
ea=0.0
=0
True
Test
xu=xr
<0
False
xl=xr
Bracketing Methods (Bisection method)
Bisection Method
Advantages:
1. Simple
xl xu
2. Estimate of maximum error: E max
2
1
3. Convergence guaranteed E imax 0.5 E imax
Disadvantages:
1. Slow
2. Requires two good initial estimates which define
an interval around root:
use graph of function,
incremental search, or
trial & error
How Many Iterations will It Take?
Lk
e a 100% ea es
x
• If the absolute magnitude of the error is
es x
104
100%
and Lo=2, how many iterations will you have to do to get
the required accuracy in the solution?
4 2
10 k 2k 2 104 k 14.3 15
2
Bracketing Methods
2. False-position Method
f(xu)
xl xr xu
x
f(xl) f(xr)
f ( xl ) f ( xu )
xr xl xr xu
f ( xu )( xl xu )
xr xu
f ( xl ) f ( xu )
False-position Method -Procedure
Step 1: Choose lower xl and upper xu guesses for
the root such that: f(xl).f(xu)<0
Step 2: The root estimate is:
f ( xu )( xl xu )
x r xu
f ( xl ) f ( xu )
False-position Method
f(x) f(x)
f (x u )(x1 x u )
xr xu
f (x1 ) f (x u )
(xr)
f(xu) f(xu)
f(x1) f(xr) > 0
(x1) x1 = x r (x1)
(xu) x (xu)
f(xr) f(x1)
f(x1) f(xr)
False position method: Example
c
mg t
• The parachutist velocity is v (1 e m
)
c
• What is the drag coefficient c needed to reach a velocity of
40 m/s if m =68.1 kg, t =10 s, g= 9.8 m/s2
f(c) c
mg t
f (c) (1 e ) v
m
c
667.38
f (c) (1 e 0.146843c ) 40
c
c
False position method: Example
1. Assume xl = 12 and xu=16 f(x)
i=0
ea=1.1es
while False
ea> es &
i <maxi
Print: xr , f(xr ) ,ea ,
i
f (x u )(x l x u )
x r xu
f (x l ) f (x u )
i i 1 Stop
A
B
A B
i=1
or
xr=0
True x r x r0
ea 100%
xr
Test=f(xl). f(xr)
Test True
ea=0.0
=0
True
Test
xu=xr
<0 xr0=xr
False
xl=xr
xr0=xr
• Why this method?
– Faster
– Always converges for a single root.
Advantages:
1. Simple
2. Brackets the Root
Disadvantages:
1. Can be VERY slow
2. Like Bisection, need an initial interval around the
root.
Problem 5.4
Function:
b. Bisection method
c. Regula-falsi method
Roots of Polynomials: Using Software Packages
MS Excel:Goal seek
f(x)=x-cos x
MS Excel: Solver
u(x,y)= x2+xy-10 =0
v(x,y)=y+3xy2-57=0