lecture 4
lecture 4
Lecture 4
Roots of Equations, Bracketing Methods
1
Roots of Equations
• Easy
2 − b ∓ b 2 − 4ac
ax + bx + c = 0 ⇒ x =
2a
4
Bisection Method
xrnew − xrold
Relative error estimate : ε= new
100%
x r
Lk
≤ error _ tolerance
xl
L0
k
≤ xl * ε es
2
k L0 ⎛ L0 ⎞
2 ≥ ⇒ k ≥ log 2 ⎜⎜ ⎟⎟
xl * ε es ⎝ xl * ε es ⎠
6
Bisection Method
Pros Cons
• Easy • Slow
• Always finds a root • Need to find initial
• Number of iterations guesses for xl and xu
required to attain an • No account is taken
absolute error can be of the fact that if f(xl)
computed a priori. is closer to zero, it is
likely that root is
closer to xl .
7
The False-Position Method (Regula-Falsi)
xl f u − xu f l
xr =
fu − fl
8
The False-Position Method
Works well, but not always!
çç Here is a pitfall L
Modified False-Position
One way to mitigate the “one-sided”
nature of the false position (i.e. the
pitfall case) is to have the algorithm
detect when one of the bounds is
stuck.
Problem:
if Δx is too small è search is very time consuming
if Δx is too large è could jump over two closely spaced roots
Ultimate solution:
Know the application and plot the function to see the location of the
roots, and pick xl and xu accordingly to start the iterations.
10