$24
The goal of this homework is to study what \local" means for convergence of Newton’s method. Consider the function
f(x) =
1
1
;
x 2 [ 5; 5]:
(1)
1 + exp(x)
2
The true root of this function is r = 0. (You’re welcome to check this.) You want to nd an interval (a; b) containing r = 0 where any Newton’s method will converge for any initial guess x0 2 [a; b]. You’ll determine the interval endpoints a and b using a computer experiment.
Here are some steps to follow.
1. Compute the derivative of f(x). Tell me how you got it.
2. Write a function (eg, Python/Numpy or Matlab) that implements Newton’s method. To get started, think about what the interface should look like. That is, what do you need to run Newton’s method? (Watch the Matlab section of the Week 5:Lecture 1) for hints. Submit the code for your function for this problem.
3. Choose an interval around r = 0. Set up a grid in that interval. (This is like the linspace you used in Homework 1.) Use each point in the grid as an initial guess for Newton’s method, and check whether the method converges to the root r = 0. Submit your code for this problem.
4. Report the interval in which all initial guesses converged.
Show any graphics or tables you used along the way.
Here are some opportunities for bonus points.
1. 10 EXTRA POINTS: Make a plot showing the interval of convergent initial guesses along with the function. Any insight as to what might trigger the transition from convergent to divergent ?
2. 10 EXTRA POINTS: Try to derive the exact interval endpoints using pencil-paper math. If you can nd them, how do they compare to the interval you reported in Problem 4 above?
3. 10 EXTRA POINTS: Make a plot showing the number of iterations (vertical axis) that Newton’s method needed to converge for each initial guess in the interval (horizontal axis). How does the number of iterations needed to converge vary over the interval? You probably need a small tolerance for this experiment to see much of a di erence.
4. 10 EXTRA POINTS: Repeat the process above with a new function of your choice. However, to get the bonus points, the function must have an interval with at least one nite endpoint. No fair cooking up a function where all initial guesses converge and then saying: the whole real line.
1