Copyright 2001
Department of Mathematics
University of Georgia
Athens, Georgia
Newton's Method
An important use of tangent lines is Newton's method for obtaining numerical solutions of an equation of the form
. Graphically, this means we want to determine the values of
x
where the graph of
f
touches the
x
-axis. Values of
x
with
are often called
roots
of the function
f
.
If we can solve the equation
algebraically
, then we know the root(s) exactly. However, many equations cannot be solved
algebraically
and we need a method for obtaining good approximations to the root(s). By plotting the graph of
f
we can usually get a rough approximation of a particular root. Zooming in on the graph can give us better approximations. Newton's Method is a procedure using calculus that starts with an
initial
approximation
for the root of a function
f
and then, under certain conditions, generates better and better approximations of the root.
In the above plot we have a function (in blue) that has a root around 1.4. We would like to get good numerical approximations to the root. Our first guess, 1.4, makes a good initial approximation for the root, but to make our point, we will take a worse initial approximation, we'll start with an initial guess of
. The idea behind Newton's method is to determine the tangent line (in red) to the function at the initial point, (
), and then determine the
x
-intercept of that tangent line. (We assume the function we are working with is differentiable.)
The
x
-intercept of the tangent line is our next approximation to the root of the function
in blue.
Project - Part 1
1.) Let
k
denote the number of letters in your last name. Let
. Make a plot of this function on the interval [0,1] and verify that the graph intersects the
x
-axis. The problem is to approximate this
x
-intercept of the function
f
(
x
). First execute the command
| > | Digits:=20: |
This will force Maple to display real number with 20 digits.
2.) Make an initial guess
of the
x
-intercept that is at least 0.2 units away from the apparent
x
-intercept indicated by the graph. The idea is that for purposes of this project we do not want to start too close to the solution. Enter your initial guess in the form
| > | x[0]:= |
3.) Determine the equation of the tangent line to the function
f
(
x
) at the point (
)
and then determine the
x
-intercept of this tangent line. Call the
x-
intercept of the tangent line
(entered as x[1]:= ...). This is your first approximation to the
x
-intercept of
f
(
x
). Make a plot of
f
(
x
) and the tangent line through (
). You may need to adjust the view so that you get a good picture.
The idea behind Newton's method is to repeat the process again this time using
as a "new" initial guess.
Project - Part 2
Use the value
as a new initial guess and repeat the procedure in Part 1. More precisely:
1.) Determine the equation of the line tangent to the graph of
f
(
x
) when at the point (
).
2.) Determine the
x
-intercept of this tangent line. Call the
x
-intercept of the tangent line
. This is your second approximation to the
x
-intercept of
f
(
x
).
3.) Make a plot of the graphs of f ( x ) and the second tangent line. Adjust the view so that you have a good picture.
Project - Part 3
We want to continue the above process many times. In order to do so, it will be convenient to develop a formula for the next approximation in the process from the previous one. For instance, our formula should give
as output if we plug in
as input, and it should give
as output when we plug in
for input, etc. To derive this formula, we will have to repeat the process above but without specifying the value of the input guess, so instead of choosing a number for the input guess, we will just call it c.
1.) For the function f(
x
) you are using above, start with the value
x
=
c
. Determine the tangent line to the graph of f(
x
) at the point (
)
.
Enter this in the form
| > | t[c]:=x-> |
2.) Use the solve command to determine d , the x -coordinate of the x -intercept of the tangent line. You should have a formula for d in terms of c . Use your formula to define a Maple function named newton:
| > | newton:=c->; |
3.) Check your formula by starting with your initial approximation in Part 1 and applying your function
newton
. Does it give you the value for
which you found in Part 1? If so, apply
newton
to
. It should give you the value for
which you found in Part 2.
4.) Continue to apply your function
newton
beginning with your initial value,
, a total of 5 times. Do the approximations appear to be converging to a limit?
5.) To make the repetition even simpler, we can use a do-loop. Enter the following do-loop to get 10 repetitions of the procedure. Enter your initial guess
in the first line, make sure that Maple still knows your newton function, and then run the loop.
| > | x[0]:= |
| > | for j from 1 to 10 do x[j]:=evalf(newton(x[j-1])); end do; |
6.) Change your initial guess to a number between 3 and 4 and repeat the iteration. Discuss your results.
Project - Part 4
Up to this point you have been working with a specific function f( x ). Now we want to develop an expression for newton( c ) when f( x ) is an arbitrary function. We start with an initial guess c for a root of f( x ) and we now want to approximate this root with a higher degree of accuracy by using Newton's Method.
1.) Calculate the equation of the line tangent to the graph of an arbitrary function f( x ) at the point ( c, f( c )) and then let d denote the x -intercept of that tangent line. Show that solving for d gives the formula
2.) Execute the restart command. Based on the formula above define a new function called newton that involves a general function f( x ).
3.) Define f(
x
) to be
. Notice that f has roots at
and -
.
4.) Iterate your
newton
function with the new function f
with initial guess
= 0.85. Do the iterations appear to have a limit? If so, how do the iterations compare with the numerical value of
returned by Maple?
5.) The following sequence of commands creates an animation of Newton's Method for the function
f
(
x
) with initial value
. You must define your function
f
(
x
) and your initial approximation
. The variables
left, right, high, low
are the bounds of the viewing window. You must give them values also.
| > | restart: |
| > | f:= |
| > | x[0]:= |
| > | newton:=x->x-f(x)/D(f)(x); |
| > | for j from 1 to 10 do x[j]:=newton(x[j-1]); end do: |
| > | left:= |
| > | right:= |
| > | low:= |
| > | high:= |
| > | with(plots):with(plottools): graph:=plot(f(x),x=left..right,y=low..high,color=blue): verticalpath:=i->plot([[x[i],0],[x[i],f(x[i])]], x=left..right,y=low..high,thickness=2,color=green): slidepath:=i->plot([[x[i],f(x[i])],[x[i+1],0]], x=left..right,y=low..high,thickness=2,color=red): display(seq(display([verticalpath(i),slidepath(i),graph,pointplot([x[i+1],0],symbol=circle)], insequence=false),i=0..8),insequence=true); |
Fill in the variables in the above set of commands and generate an animation of Newton's Method for approximating
with initial guess 0.85. Generate new animations with initial guesses 0.6 and 2.1. You may need to play around with the window settings to get a good picture. Rather than play the animations you will probably want to step through them. You may not see much beyond the first two or three approximations since the approximations get close to the root very quickly.
Project - Part 5
In the last part of this project we show that one must be careful when choosing initial guesses. Since Newton's Method involves division by the derivative of f ( x ), one must try to avoid getting close to points where the derivative vanishes.
1.) Execute the restart command. Copy the commands for creating an animation from the previous part. To see the approximations from Newton's Method, change the colon to a semi-colon at the end of your do-loop.
| > |
| > |
2.) Define
. Set the viewing window from
to
in the
x
direction and from -3 to 3 in the
y
direction. Attempt to approximate the first positive root of
f
with initial value 0.2. Generate the values from Newton's Method and the animation. Explain what happens.
3.) Attempt to approximate the first positive root of f ( x ) with the initial values 0.4, 0.42, and 0.45. Discuss your results.
Academic Honesty Statement:
Place the following statement (by copying and pasting) at the end of your report and sign it in ink. Your instructor will not grade your report unless this signed statement appears at the end of your report.
I understand that I may work with others if I give them credit in this statement. I also understand that I am required to write my report--that to copy all or part of someone else's report or to allow someone else to copy all or part of my report constitutes plagiarism, which is a serious violation of academic honesty.
I worked with (replace this parenthetical remark with first and last names of those with whom you worked) on this project. I wrote my own report. I did not copy any of this report from anyone else and I did not allow anyone else to copy any of this report.
Signed: