Skip to main content

Exploring Calculus with Maple Introductory Calculus

Section 1.14 Newton’s Method

Subsection 1.14.1 Recommended Tutorials

Before starting on these exercises, you should familiarize yourself with the material covered in the following tutorials:

Subsection 1.14.2 Introduction

Newton’s method is a numerical technique that can be used to approximate the roots of a continuous function. Suppose \(f(x)\) is a differentiable function and you know that \(f(x)=0\) at some root \(x=r\text{.}\) However, you are unable to solve for \(r\) algebraically and so you need to approximate \(r\) numerically.
Newton’s method relies on using linear approximation of the function at a point close to the desired root \(r\text{.}\) You can begin by choosing a value \(x_0\) relatively close to \(r\text{,}\) and constructing the linear approximation of \(f(x)\) at \(x_0\text{:}\)
\begin{equation*} L(x) = f'(x_0) (x-x_0) + f(x_0)\text{.} \end{equation*}
Because \(f(x) \approx L(x)\) near \(x_0\text{,}\) the \(x\)-intercept of \(L(x)\) should be very close to \(r\text{.}\) We can solve for this \(x\)-intercept by setting \(L(x)\) equal to zero:
\begin{align*} f'(x_0) (x-x_0) + f(x_0) \amp = 0 \\ x \amp = x_0 - \frac{f(x_0)}{f'(x_0)} \end{align*}
Assuming that this \(x\)-intercept is even closer to \(r\) than our initial value \(x_0\text{,}\) we could use this new value \(x_1\) and repeat these same steps: find the new linear approximation of \(f(x)\) at \(x_1\text{,}\) solve for its \(x\)-intercept, and call the value \(x_2\text{.}\)
\begin{align*} x_1 \amp = x_0 - \frac{f(x_0)}{f'(x_0)} \\ x_2 \amp = x_1 - \frac{f(x_1)}{f'(x_1)} \end{align*}
In this way, we only need one simple formula for Newton’s method, that can be applied in repetition until we get our desired accuracy:
\begin{align} x_{new} \amp = x_{old} - \dfrac{f(x_{old})}{f^{\prime}(x_{old})} \tag{1.4} \end{align}
Be warned though - there is always the possibility of finding a point on \(f(x)\) where equation (1.4) is undefined!

Aside

A visual example of Newton’s method is shown in Figure 1.3.
Figure 1.3. Using three iterations of Newton’s method to approximate the root \(r\text{.}\)
In this activity, you will be using the NewtonsMethod() command, which automates this process. It is part of the Student[Calculus1] package, which you will need to include at the top of your Maple worksheet. In the last exercise, you are encouraged to try to write a loop for Newton’s method.

Exercises 1.14.3 Exercises

1.

In this exercise, you will use Newton’s method to numerically approximate the roots of the function \(f(x) = x^2 - 2\text{.}\) It is simple enough to solve for the two roots algebraically, but this example should help give you a basic understanding of how the method works.
(a)
Use Maple’s NewtonsMethod() command to determine the value of the root of the function \(f(x) = x^2 - 2\) using an initial value of \(2\text{.}\) Determine how many iterations are required until you get \(10\) decimal places of accuracy.
Hint.
Adding the optional iterations parameter to the NewtonsMethod() command allows you to choose how many iterations are performed. By default, NewtonsMethod() carries out \(5\) iterations. You can set the parameter output=sequence to show the value after each iteration.
See Section 12.6 for an example.
(b)
Apply Newton’s method to determine the value of the root of the function \(f(x) = x^2 - 2\text{.}\) This time, use an initial value of \(-2\text{.}\) Determine how many iterations are required until you get \(10\) decimal places of accuracy.
(c)
Try to apply Newton’s method to determine the value of the root of the function \(f(x) = x^2 - 2\) using an initial value of \(0\text{.}\) Determine why the NewtonsMethod() command gives an error for this particular value.
Hint.
You may wish to graph \(f(x)\) to see the behaviour of the function around \(x=0\text{.}\)

2.

In the last exercise, you used Newton’s method to numerically approximate the values of the two roots, \(\pm\sqrt{2}\text{.}\) In this example, you will use Newton’s method to numerically approximate \(\sqrt{7}\text{.}\)
(a)
Assign a function \(g(x)\) that has a known root of \(\sqrt{7}\text{.}\)
(b)
Apply Newton’s method to the function from part (a) with an initial value for \(x\) that is close to \(\sqrt{7}\text{.}\) Then, evaluate \(\sqrt{7}\) to \(15\) digits using evalf() and verify that the values agree.

3.

Newton’s method converges with “quadratic convergence”, which roughly means that you will get twice as many correct digits for \(x_{new}\) as you did for \(x_{old}\text{.}\) Iterate Newton’s method for
\begin{equation*} h(x) = x^2 - \sin(x) - 0.5 \end{equation*}
with an initial guess of \(x = 2\text{.}\) Find the value of the zero of \(h(x)\) to \(16\) decimal places.

4.

(Optional) Write a "while" loop that allows you to solve exercises 1 and 2.
Hint.
Examples of loops can be found in Chapter 18.