User Tools

Site Tools


gibson:teaching:fall-2013:math445:lab5

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== 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 <latex> 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) </latex> Use a contour plot of the norm of $f$ over $x_1, x_2$ to find an initial guess for the search. **Problem 3:** 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 <latex> 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) </latex> 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?)

gibson/teaching/fall-2013/math445/lab5.1380300137.txt.gz · Last modified: 2013/09/27 09:42 by szeto