{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw3_solutions - CS 257 Numerical Methods Homework 3 1[1pt...

This preview shows pages 1–3. Sign up to view the full content.

CS 257 Numerical Methods - Homework 3 September 20, 2006 1. [1pt] Section 3.2 #15 Solution: The first iteration of Newton’s method is: x 1 = x 0 - f ( x 0 ) f ( x 0 ) In this case x 0 = 1, f ( x 0 ) = 1, and f ( x 0 ) = 3 x 2 0 - 1 = 2. Therefore x 1 = 1 / 2. 2. [1pt] Section 3.2 #28 (use MATLAB if you wish) Solution: Beginning with x 0 = 1 we have the following sequence x 1 = 1 - f (1) f (1) = 1 - - 8 - 4 = - 1 x 2 = - 1 - f ( - 1) f ( - 1) = - 1 - 16 - 8 = 1 x 3 = 1 - f (1) f (1) = 1 - - 8 - 4 = - 1 In MATLAB one could solve the problem as follows (using the UP key to scroll through previous commands): >> x = 1 x = 1 >> x = x - (3*x^3 + x^2 -15*x + 3)/(9*x^2 + 2*x - 15) x = -1 >> x = x - (3*x^3 + x^2 -15*x + 3)/(9*x^2 + 2*x - 15) x = 1 >> x = x - (3*x^3 + x^2 -15*x + 3)/(9*x^2 + 2*x - 15) x = -1 >> x = x - (3*x^3 + x^2 -15*x + 3)/(9*x^2 + 2*x - 15) x = 1 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
3. [1pt] Using the MATLAB implementation of Newton’s method (see page 106) on the course webpage or one of your own, solve the following problems. Compute a zero of f ( x ) = x 4 - 5 x 3 + 9 x 2 - 7 x + 2 with x 0 = 2 . 2, call this value ˆ x . Now create a semilog plot (not to be turned in) with blue lines showing the error e i = | ˆ x - x i | at each iteration. Solution: See next problem 4. [1pt] Repeat the previous problem, but change x 0 = 0 . 8 and the line color to red. Create a single semilog plot titled Plot 1
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}