5.5: 2, 4, 6, 7

`` ``

2)  When Newton introduced his method, he did so with the example .  Show that this equation has only one root, and find it. I started at and it took 6 steps to stabilize all 11 decimal places:

`` ``

from visual.graph import *
from math import *

start = 1.5
numberofsteps = 10
x = start
for n in range(0,numberofsteps):
print n, x
g = (x**3)-2*x-5
gprime = 3*(x**2)-2
x = x-(g/gprime)

`` ``

4)  Using Newton's method to find a solution of :

`` ``  I started at and it took 5 steps to stabilize all 11 decimal places:

`` ``

from visual.graph import *
from math import *

start = 1.5
numberofsteps = 10
x = start
for n in range(0,numberofsteps):
print n, x
g = (x**3)+3*(x**2)-5
gprime = 3*(x**2)+6*x
x = x-(g/gprime)

`` ``

6)  One of the more surprising applications of Newton's method is to compute reciprocals.  To make things more concrete, we will compute .  Note that this number is the root of the equation .

`` ``
`` ``
`` ``  `` ``
`` ``

a)  Show that the formula of Newton's method gives us:

`` ``

So starting with Newton's formula:    (p284)

`` ``
`` ``

b)  Using and the formula from (a), compute to a high degree of accuracy:

It took 7 steps stabilize all 11 decimal places:

`` ``

from visual.graph import *
from math import *

start = 0.5
numberofsteps = 10
x = start
for n in range(0,numberofsteps):
print n, x
g = (1.0/x)-3.4567
gprime = -1/(x**2)
deltax = -(g/gprime)
x = x+deltax

c)  Try starting with .  What happens?  Explain graphically what goes wrong:

With we very quickly diverge to .  If we look at the graph as we follow a few steps of the Newton' method we can see that the slope and at , so .  If we do one more step we see that and we just keep getting farther away from our target.  This happens because we jumped over to the other part of the function with and their are no roots in that direction.  Even though their are no roots Newton's method still keeps trying to find one, but never succeeds.  from visual.graph import *
from math import *

start = 1.0
numberofsteps = 10
x = start
for n in range(0,numberofsteps):
print n, x
g = (1.0/x)-3.4567
gprime = -1/(x**2)
deltax = -(g/gprime)
x = x+deltax

`` ``

7)  In this problem we will determine the maximum value of the function:

`` ``

a)  Graph and convince yourself that the maximum value occurs somewhere around , where . b)  Compute :

`` ``
`` ``
`` ``
`` ``
`` ``

c)  Since the answer to (b) is a fraction, it vanishes when its numerator does.  Setting the numerator equal to gives a fourth-degree equation.  Use Newton's method to find a solution near .

`` `` `` ``

from visual.graph import *
from math import *

start = 0.5
numberofsteps = 10
x = start
for n in range(0,numberofsteps):
print n, x, deltax
g = -3*(x**4)-4*(x**3)+1
gprime = -12*(x**3)-12*(x**2)
deltax = -(g/gprime)
x = x+deltax

d)  Compute the maximum value of :

`` ``

Converted by Mathematica      April 19, 2004