11/5/2008
1
Root Finding
Nathan Friedman
Fall, 2008
Root Finding
±
Many applications involve finding the
roots of a function f(x).
±
That is we want to find a value or
2008
Root Finding
2
That is, we want to find a value or
values for x such that f(x)=0
Roots of a Quadratic
We have already seen an algorithm for
finding the roots of a quadratic
We had a closed form for the solution
2008
Root Finding
3
We had a closed form for the solution,
given by an explicit formula
There are a limited number of problems
for which we have such explicit
solutions
Root Finding
±
What if we don’t have a closed form for
the roots?
2008
Root Finding
4
Root Finding
±
What if we don’t have a closed form for
the roots?
±
We try to generate a sequence of
2008
Root Finding
5
We try to generate a sequence of
approximations
x
1
, x
2
, …,x
n
until we
(hopefully) obtain a value very close to
the root
Example: Firing a Projectile
Find the angle at which to fire a projectile
at a target
Given:
2008
Root Finding
6
±
the velocity, v
±
the distance to the base of the target, x
±
the height of the target, h
Find: the angle at which to aim, a
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document11/5/2008
2
Example: Firing a Projectile
The physics of the problem tells us that
h = v sin a t  ½ g t
2
2008
Root Finding
7
t = x / (v cos a)
where g is the gravitational constant.
Example: Firing a Projectile
Taking the equations:
h = v*sin(a)*t  ½ g*t
2
t =x/(v*cos(a))
2008
Root Finding
8
By substituting, we have
h = x*tan(a)  0.5*g*(x
2
/(v
2
cos
2
(a))
The angle a is a root of
f(a) = x*tan(a)0.5*g*(x
2
/(v
2
*cos
2
(a))h
The Bisection Method
±
Suppose we have an interval that we
know contains a root
±
The bisection method uses this
2008
Root Finding
9
The bisection method uses this
information to obtain better and better
approximations
The Bisection Method
±
We start with an interval that contains
exactly one root of the function
±
The function must change signs on that
2008
Root Finding
10
The function must change signs on that
interval.
±
(If the function changes signs, in fact
there must be an odd number of roots
in the interval)
The Bisection Method
±
To get started, we must bracket a root
±
How do we bracket the root?
From our knowledge of the function
2008
Root Finding
11
±
±
By searching along axis at fixed increments
until we find that the sign of f(x) changes
The Bisection Method
±
Once we have an interval containing the
root(s), we narrow down the search
±
Similar to binary search: divide the interval in
half and look for a sign change in one of the
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '04
 Vybihal
 Algorithms, Secant method, Rootfinding algorithm, root finding

Click to edit the document details