====== Math 445 lab 5: Newton search ======
Helpful Matlab commands/functions/constructs for this lab:
''while-end'', ''abs'', ''plot'', ''grid on'', ''for-end'', ''%%\%%'', ''contour'', ''norm'', and anonymous functions.
**Problem 1:** Write a ''newtonsearch1d'' function that computes a zero of a
1-d function ''f'' using the Newton search method, starting from the initial
guess ''x''. Use a ''while'' loop to terminate the iteration when either
$|f(x)| < tolerance$ or when the Newton step is very small: $|dx| < tolerance$,
for some suitable choice of $tolerance$.
Use this function to solve the following problems. Check your answers by
plugging the answer ''x'' back into ''f'' and verifying that ''f(x)'' is
approximately zero.
**(a)** Find an ''x'' for which $x^2 - 8x + 5 = 0$.
**(b)** Find the cube root of 54. (Hint: devise an equation whose answer is $x = \sqrt[3]{54}$.)
**%%(c)%%** Find an ''x'' for which $\sqrt{4-x^2} = x \tan x$.
To find good initial guesses for the Newton search, plot ''f''
versus ''x'' and estimate where it crosses the ''x'' axis.
**Problem 2:** Write a ''newtonsearch2d'' function that finds a zero of
a 2-d function ''f'' starting from the initial guess ''x'', where both ''x''
and ''f(x)'' are two-dimensional vectors. Use this to find a zero of the
nonlinear 2-d function
f\left(\begin{array}{c} x_1 \\ x_2 \end{array}}\right) =
\left(\begin{array}{l} x_1^2 + x_2^2 - 7 \\ x_1^{-1} - x_2 \end{array} \right)
Use a contour plot of the norm of $f$ over $x_1, x_2$ to find an
initial guess for the search.
**Bonus (10 pts):** Write a ''newtonsearchNd'' function that finds a zero of
an N-dimensional function ''f'' starting from the initial guess ''x''.
Use this to find a zero of the nonlinear 3d function
f\left(\begin{array}{c} x \\ y \\ z \end{array}}\right) =
\left(\begin{array}{l} 10(y-x) \\ x(28-z) - y \\ xy - 8/3 \; z \end{array} \right)
Use the initial guess $[x,y,z] = [10, 10, 25]$. Verify your answer by applying it to the 3d function. What do you expect to get?
** Bonus (10 points): **
Give a brief explanation for the Newton's Search. Include the answers to the following questions.
** - ** Purpose: What is the Newton's method used for?
** - ** Method: How does it do this? (How is it related to the Taylor Series? Can you explain the equations used in the code?)