MATH 497/597 Fall 2002

Homework due September 3, 2002

It is recommended that you use Matlab for the programming components of your homework throughout the semester. Therefore, this homework assignment was developed to ensure you know how to program in Matlab. Hand in your Matlab code for both problems, and please condense it onto as few pieces of paper as possible.

1.
Write a function newton(f,df,x0,tol) that implements Newton's method for finding solutions of f(x)=0:

\begin{displaymath}x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.\end{displaymath}

The first two inputs are functions f and f', and the third input is an initial solution estimate. Continue the iteration until either |f(xn+1)| or |xn+1-xn| is less than tol.

Find the largest root of f(x)=x6-x-1using the initial estimate x=2. Hand in a plot of x vs. f(x) and clearly indicate the value of the largest root to 9 decimal places.

2.
Write a function that implements Newton's method on a vector of initial guesses x0.

Find all roots of f(x)=-4+x(9.1389+x(-5.56+x)) using initial estimates $x=0,0.01,0.02,0.03,\ldots 4$ (i.e. you will input 401 initial estimates), and tol $=1.0{\rm E}-11$. Use subplot to put a graph of f(x) vs. x `on top of' a graph of root vs. initial estimates. Hand in this graph, clearly indicating the values of all roots to 9 decimal places, and describe the graph of root vs. initial estimates.

Graduate Students

3.
Consider the equation f(x)=0 where

\begin{displaymath}f(x)=\left\{ \begin{array}{ll} x^{1/2} & x \geq 0 \\
-(-x)^{1/2} & x < 0 \end{array} \right. .\end{displaymath}

What is the behavior of the Newton iterates for various initial estimates? Hand in your results from 3 well chosen initial estimates.