![Contents](../../images/content.png)
![Previous Chapter](../../images/backback.png)
![Start of Chapter](../../images/backstop.png)
![Previous Topic](../../images/back.png)
![Next Topic](../../images/fwd.png)
![Next Chapter](../../images/fwdfwd.png)
Example 1
As an example of Newton's method, suppose we wish to find a root of the function f(x) = cos(x) + 2 sin(x) + x2. A closed form solution for x does not exist so we must use a numerical technique. We will use x0 = 0 as our initial approximation. We will let the two values εstep = 0.001 and εabs = 0.001 and we will halt after a maximum of N = 100 iterations.
From calculus, we know that the derivative of the given function is f(1)(x) = -sin(x) + 2 cos(x) + 2x.
We will use four decimal digit arithmetic to find a solution and the resulting iteration is shown in Table 1.
Table 1. Newton's method applied to f(x) = cos(x) + 2 sin(x) + x2.
n | xn | xn + 1 | |f(xn + 1)| | |xn + 1 - xn| |
---|---|---|---|---|
0 | 0.0 | -0.5000 | 0.1688 | 0.5000 |
1 | -0.5000 | -0.6368 | 0.0205 | 0.1368 |
2 | -0.6368 | -0.6589 | 0.0008000 | 0.02210 |
3 | -0.6589 | -0.6598 | 0.0006 | 0.0009 |
Thus, with the last step, both halting conditions are met, and therefore, after four iterations, our approximation to the root is -0.6598 .
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.