Midterm Review: 1 Root-Finding Methods
Midterm Review: 1 Root-Finding Methods
Root-Finding Methods
Rootfinding methods are designed to find a zero of a function f , that is, to find a value of
x such that
f (x) = 0.
1.1
Bisection Method
To apply Bisection Method, we first choose an interval [a, b] where f (a) and f (b) are of
different signs. We define a midpoint
a+b
.
2
If f (p) = 0, then p is a root and we stop.
Else if f (a)f (p) < 0, then a root lies in [a, p], and we assign b = p. Otherwise, a = p.
We then consider this new interval [a, b], and repeat the procedure.
p=
The formula for midpoint above generates values pn . We can bound an error of each
iterate pn for the bisection method:
ba
.
2n
Note, as n , pn p.
|pn p| =
Practice Problem: The function f (x) = sin x satisfies f (/2) = 1 and f (/2) = 1.
Using bisection method, how many iterations are needed to find an interval of length at
most 104 which contains a root of a function?
Solution: We need to find n such that:
ba
104 .
2n
We have
104 .
2n
,
104
104,
2n
2n
n log 2 log(104),
log 104
n
= 14.94.
log 2
That is, n = 15 iterations are needed to find an interval of length at most 104 which
contains the root.
See Problems 1 and 3 in Homework 1 for other examples of bisection method.
1
1.2
Newtons Method
Practice Problem: Suppose g(x), a smooth function, has a fixed point x ; that is g(x) =
x . Write a Taylor expansion of g(xn) around x .
Solution:
(xn x )2 00
g(xn) = g(x) + (xn x )g 0(x ) +
g (n ).
2
We can use the information that is given to us by the problem. A fixed point iteration is
defined as xn+1 = g(xn). Also, g(x) = x . Using this, we can rewrite the equation as
xn+1 = x + (xn x)g 0(x) +
(xn x )2 00
g (n ),
2
or
(xn x )2 00
g (n ).
2
Quite a few observations can be made using this equation if additional information is given
by a problem.
xn+1 x = (xn x)g 0(x) +
1.3
Secant Method
The Secant method is derived from Newtons method by replacing f 0 (pn1 ) with the
following approximation:
f (pn2 ) f (pn1 )
f 0(pn1 )
.
pn2 pn1
Then, the Newtons iteration can be rewritten as follows. This iteration is called the
Secant method.
f (pn1 )(pn2 pn1 )
pn = pn1
.
f (pn2 ) f (pn1 )
2
Computer Arithmetic
(1)
Interpolation
3.1
Lagrange Polynomials
L0(x) =
L1(x) =
x x1
,
x0 x 1
x x0
.
x1 x 0
Quadratic (second order) interpolation is achieved by constructing the Lagrange polynomial P2 of order 2, connecting the three points. We have:
P2 (x) = L0 (x)f (x0) + L1 (x)f (x1) + L2(x)f (x2),
where
L0(x) =
L1(x) =
L2(x) =
(x x1 )(x x2)
,
(x0 x1 )(x0 x2 )
(x x0 )(x x2)
,
(x1 x0 )(x1 x2 )
(x x0 )(x x1)
.
(x2 x0 )(x2 x1 )
3.2
The polynomial of degree n, interpolating n+1 points, can be written in terms of Newtons
divided differences:
Pn (x) = f [x0 ] + f [x0, x1](x x0 ) + f [x0 , x1, x2](x x0)(x x1 )
+ . . . + f [x0, x1, . . . , xn ](x x0)(x x1 ) (x xn1 ).
The zeroth divided difference of f with respect to xi is
f [xi ] = f (xi ).
The first divided difference of f with respect to xi and xi+1 is
f [xi , xi+1] =
f [xi+1 ] f [xi]
.
xi+1 xi