This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Due: October 16, 2008 CS 257 (Luke Olson): Homework #6 Problem 1 Problem 1 You are writing an API for a finance company which is in need of a solver for finding the roots of nonlinear equations (i.e. finding an x such that f ( x ) = 0). You decide to implement Newton’s method in MATLAB. (Newton’s method is given in Lecture 13.) The function takes as arguments f,f ,x ,maxiter where f is the function we want to find the zeros of, f its derivative, x the initial guess and maxiter is the maximum number of iterations. For each iteration, output the following table. Iteration number x i f ( x i ) f ( x i ) /f ( x i 1 ) 2 f ( x i ) /f ( x i 1 ) Run your program on the following test cases a. f ( x ) = e x cos( x ), x = π/ 2, maxiter = 10 b. f ( x ) = 2 x 3 9 x 2 + 12 x + 15, x = [2 . 99 , 3 , 3 . 01], maxiter = [20 , 4 , 20] c. f ( x ) = p  x  ,x = 0 . 5 ,maxiter = 10 hint: f ( x ) = sign ( x ) 2 √  x  and for each case, determine if the method converges. If so, is the convergence quadratic or linear? If is not quadratic explain why.quadratic explain why....
View
Full
Document
This note was uploaded on 07/10/2011 for the course CS 257 taught by Professor Olson during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Olson

Click to edit the document details