NA10 Notes
NA10 Notes
Chapter 2
Solutions of Equations in One Variable
MOTIVATION: Given a function f that is continuous on [a,b] where a solution to f(x) = 0 is expected
to exist, the Bisection method begins with finding the functional values at the endpoints, namely, f(a)
and f(b) . If these functional values change sign, then we know that the graph will cross the x-axis at
least once on the interval [a,b]. That is, f(x) = 0 will have at least one solution on that interval.
1. Find the midpoint, c, of the interval [a,b] and check for sign changes between f(a), f(b) , and f(c) .
2. Let's assume, for illustration, that the functional values change sign at x = a and x = c . We then
modify the interval from [a,b] to [a,c] and begin the process again on the modified interval.
3. We continue this process until we reach an approximation to the solution of f(x) = 0 that is
accurate to within a specified tolerance.
bKa
The absolute error for the Bisection method is pn K p % , where p is a zero of f and n R 1. If
2n
bKa
we want to determine how many steps are needed to insure that pn K p % ! Tol then we use
2n
logarithms to find the value of n that will give us the tolerance we are looking for. In other words,
log10 b K a $Tol
2n O b K a $Tol or n O . A really nice animation of the Bisection algorithm
log10 2
can be seen by clicking on the following Bisection example found at:
http://mathfaculty.fullerton.
edu/mathews//a2001/animations/rootfinding/BisectionMethod/BisectionMethod.html
Chapter 2.2: Fixed-point Iteration*
The questions we would like to answer in this section are:
• What is a fixed point of a function?
• How do we find a fixed point of a function?
• What are fixed points used for?
A fixed point is a an invariant value, p, for which the functional value at p equals p. That is f p = p.
Not all functions have fixed points. Suppose f x = x2 K 2 x. We can easily see that x = 0 and x = 3 are
fixed points of f since f 0 = 0 and f 3 = 3. However, f x = x2 K 2 x C 3 has no fixed points since
there are no values, p, for which f p = p.
Example 1
If we solve x2 K 2 x = x for x, we see that x = 0 and x = 3. Plugging these values back into f will
show that f 0 = 0 and f 3 = 3.
solve x2 K 2 x = x
0, 3 (2.1.1)
2
Graphically, we see that the curve f x = x K 2 x and the straight line g x = x intersect at x = 0
and x = 3 indicating that these values are fixed points of f.
6 2
f x =x
4
2 g x =x
K2 K1 0 1 2 3 4
x
K2
Example 2
If we solve x2 K 2 x C 3 = x for x, we see that there are no real solutions, and hence, no fixed
points.
solve x2 K 2 x C 3 = x
3 1 3 1
C I 3, K I 3 (2.2.1)
2 2 2 2
Graphically, we see that the curve f x = x2 K 2 x C 3 and the straight line g x = x indicating that
there are no fixed points of f.
plot x2 K 2 x C 3, x , x =K2 ..4, axis = gridlines = colour = green, majorlines = 2
10 2
f x =x K2 x
8 C3
6
4
2
g x
=x
K2 K1 0 1 2 3 4
K2 x
Theorem 2.3 in this section gave sufficient conditions for the existence and uniqueness of a fixed point.
1
In Example 1, because f x is continuous on the interval K , 1 and f maps every x in that interval
4
back into the interval, theorem 2.3 guarantees at least one fixed point on the interval. We can also find a
similar interval about x = 3 for which this theorem applies. However, this clearly is not the case for the
second example.
Fixed points are important in many disciplines. In general, they describe points of equilibrium of a
process (function), if they exist, which can then be analyzed. The fixed point iteration generates a
sequence of values which, depending upon the starting value used, will converge to a fixed point if it
exists.
Example 3
How can we use the fixed point iteration to find the roots of the x2 K 2 x = 0? To do this, we solve
the equation for x2 and proceed as before. Of course, we know that the roots are x = 0 and x = 2.
Graphically, we see that the curve f x = x2 and the straight line g x = 2x intersect at the two fixed
points of f, namely, x = 0 and x = 2.
plot x2 , 2 x , x =K2 ..3, axis = gridlines = colour = green, majorlines = 2
8
6
4 g x
=
2
f x
2
=x
K2 K1 0 1 2 3
K2 x
K4
Several really nice animations of the fixed point method can be seen by clicking on the following URL:
http://mathfaculty.fullerton.edu/mathews//a2001/animations/rootfinding/FixedPoint/FixedPoint.html
Newton's Method:
Newton's method is derived from the first Taylor polynomial. As long as the function f is twice
continuously differentiable on a, b
and an approximation p0 2 a, b to the solution p is such that f' p0 s 0, Taylor's polynomial of
degree one expanded about p0 and evaluated at x = p
is given by
p K p0
f p = f p0 C p K p0 f' p0 C f'' z p
2
where z p lies between p and p0 . Recall that the last term is called the remainder and provides a
formula for the bound on the error for this method. Since p is a solution to the equation, f p = 0 and
we have
p K p0
0 = f p0 C p K p0 f' p0 C f'' z p
2
If we ignore the error term, solving for p, we then have that
f p0
p z p0 K .
f' p0
f p0
Thus, the initial approximation to the solution p is found by computing p1 = p0 K and this
f' p0
represents the point at which the tangent line at the point p0 , f p0 crosses the x-axis . We can
compute a second approximation p2 to p if we replace p0 with p1 in our computation. We can continue
this process until we achieve our desired accuracy.
As is stated in the text, the major drawback for this method is the need to know the value of the
derivative at each approximation.
Several nice animations of Newton's method can be found at the following URL:
http://mathfaculty.fullerton.edu/mathews//a2001/animations/rootfinding/NewtonMethod/Newtonee.html
Secant Method:
The secant is a slight modification of Newton's method. The definition of the first derivative is used to
replace the derivative in Newton's method.
This leads to the formula
f pn pn K 1 K pn K 2
pn = pn K 1 K
f pn K 1 K f pn K 2
which is, in fact, the equation of the secant line through pn K 1 , f pn K 1 and pn K 2 , f pn K 2
with x-intercept pn , 0 . Sequential application of the formula to successive approximations to p leads
to a sequence that hopefully converges to the root of f.
Several nice animations of the Secant method can be found at the following URL:
http://mathfaculty.fullerton.edu/mathews//a2001/animations/rootfinding/SecantMethod/SecantMethod.
html
This method differs from the Secant method only in the way the results are handled once we have them.
In the Secant method we simply compute successive approximations to the root using the formula until
we have reach the desired level of accuracy. In the method of False Position, we refine interval
pn K 2 , pn K 1 so that it always brackets the root, as we do with the with the Bisection method.
A nice animation of the method of False Position can be found at the following URL:
http://mathfaculty.fullerton.edu/mathews//a2001/animations/rootfinding/RegulaFalsi/RegulaFalsi.html
Chapter 2.4: Error Analysis for Iterative Methods*
The key questions we want to address in this section are:
• How do we determine the rate of convergence of a method?
• How do we determine the number of iterations necessary to achieve the desired level of
convergence?
N
To determine the convergence rate of a sequence of approximations pn to p, we look at the
n=0
following equation and two cases:
pn C 1 K p
l = n lim
pn K p a
/N
The Illustration in the text shows a good example as to how this computation is done.
To determine the number of iterations necessary to achieve the desired level of convergence, given that
we know the sequence formula in terms of N, we can solve the following inequality for N.
pn C 1 K p ! TOL
Theorem 2.8 from the last section implies that higher-order convergence for fixed-point methods of the
form g p = p can occur only when g' p = 0.
The method this discussed in this section is Aitken's Δ2 method. We begin by making an important
assumption, namely that the finite sequence pn N or the infinite sequence pn N linearly
n=0 n=0
converges to some limit p. We define a new sequence using the following formula:
2
pn C 1 Kpn
pn = pn K for n = 0, 1 ,..., N K 2
pn C 2 K2 pn C 1 C pn
or
2
pn C 1 Kpn
pn = pn K for n = 0, 1 ,...,N
pn C 2 K2 pn C 1 C pn
For instance, suppose we want to generate the first three terms of a sequence {pn} generated by using
Kp
nK1
Aitken's Δ2 method where pn = 3 and p0 = 0.5.
n pn pn
1 3K0.5 = 0.5773502692
0.5773502692 0.5303150046 K 0.5773502692 2
K
0.5584386128 K 2$0.5303150046 C 0.5773502692
= 0.5479150738
2 3K0.5773502692 = 0.5303150046
0.5303150046 0.5584386128 K 0.5303150046 2
K
0.5414483921 K 2$0.5584386128 C 0.5303150046
= 0.5478470419
3 3K0.5303150046 = 0.5584386128
0.5584386128 0.5414483921 K 0.5584386128 2
K
0.5516497984 K 2$0.5414483921 C 0.5584386128
= 0.5478225655
4 3K0.5584386128 =
0.5414483921
5 3K0.5414483921 =
0.5516497984
2
Applying Aitken's D method to a linearly convergent fixed point iteration yields Steffensen's method.
This method upgrades the convergence to quadratic. Recall that a fixed point iteration is one in which
p = g p . Steffensen's method proceeds as follows:
Horner's method:
Using the product rule, we see that the derivative with respect to x of P x = x K x0 Q x C b0 is
P' x = Q x .
P x0
x1 = x0 K .
P' x0
If we begin the entire process again, applying synthetic division on P x and Q x using the
approximation x1 as our divisor,
we will find our next approximation, x2 , to the zero of P x .
The procedure described above is called deflation and unfortunately, inaccuracy results from the
computation of the zeros of
successive polynomials.
..
Mullers method:
..
What do we do if the polynomial has complex zeros? Muller's, which is an extension of the Secant
method, is useful in this case.
We want to consider the zeros of a quadratic polynomial
2
P x = a x K p2 C b x K p2 C c
That is, we have the following system of equations that can be solved for a, b, and c:
f p0 = a p0 Kp2 2 C b p0 Kp2 C c:
2
f p1 = a p1 Kp2 C b p1 Kp2 C c:
2
f p2 = a p2 Kp2 C b p2 Kp2 C c = c :
to obtain:
2 2
p0 Kp2 f p1 Kf p2 K p1 Kp2 f p0 Kf p2
a= :
p0 Kp2 p1 Kp2 p0 Kp1
2
p1 Kp2 f p0 Kf p2 K p0 Kp2 f p1 Kf p2
b= :
p0 Kp2 p1 Kp2 p0 Kp1
c = f p2 :
Substituting the formulas for a, b, and c into P x and using the quadratic formula to solve P x = 0
for p3 yields:
2c
p3 = p2 K :
2
b C sgn b b K 4 ac
where the denominator is chosen as the largest in magnitude that will result in p3 being selected as the
closest zero of P to p2 . Table 2.12 of the text shows the values computed by the method for the
function below:
f d x / x4 K 3 x3 C x2 C x C 1
x/x4 K 3 x3 C x2 C x C 1 (6.1)
where p0 , p1 , p2 are given and f p0 , f p1 , f p2 are computed as follows:
So that the student can better appreciate the steps within the algorithm, the computations for the first
row of the table as defined in the algorithm are shown below:
The values are then reset and the process repeats to obtain the next row of the table.