channelflow.org

Site Tools

gibson:teaching:fall-2013:math445:lab5

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 or when the Newton step is very small: , for some suitable choice of .

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 .

(b) Find the cube root of 54. (Hint: devise an equation whose answer is .)

(c) Find an x for which .

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

Use a contour plot of the norm of over 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

Use the initial guess . 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?)