hw12 - x ). Suppose we want to compute the derivative 1 at...

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

MAE 107 Assignment 2 Due Thursday, 7 Oct., 2010 Problems to hand in (Not all problems may be graded.) 1. Epperson, Section 2.1 problems: 1d, 4 (for 1d), 9 (for 1d). 2. Epperson, Section 2.2 problems: 2c, 3c, 5 ,8, 9 (for 3c), 14b. 3. Epperson, Section 2.3 problems: 2, 10a. 4. You need to compute sin( x ) for x [0 ] on a low-level processor/compiler. Only the operations + , - , × , ÷ are available. You’ve been told that it only has “roughly 6 digits” of accuracy. Your coworker has written the following pseudo-code (essentially MATLAB). input x; x 3 = x * x * x ; x 5 = x 3 * x * x ; x 7 = x 5 * x * x ; x 9 = x 7 * x * x ; x 11 = x 9 * x * x ; f 3 = 6; f 5 = 5 * 4 * f 3; f 7 = 7 * 6 * f 5; f 9 = 9 * 8 * f 7; f 11 = 11 * 10 * f 9; sinx = x - x 3 /f 3 + x 5 /f 5 - x 7 /f 7 + x 9 /f 9 - x 11 /f 11; This code will run many, many times, and so needs to be fast. Us- ing what you know about Taylor series and Horner’s Method, can you improve on your coworker’s code? (Do not go so far as table look ups and/or if/then logic.) Indicate what you would do. How many additions and multiplications are needed? Note the update to 6 digits! 5. Consider f ( x ) = e x cos(

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x ). Suppose we want to compute the derivative 1 at x = 0 using ﬁnite diﬀerences. Let D 1 ( h ) = f ( x + h )-f ( x ) h and D 2 ( h ) = f ( x + h )-f ( x-h ) 2 h . Let D 3 ( h ) denote the method from Problem 8 of Section 2.2 in the text-book. Compute all of these for h = 10-j , for j ∈ { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } . Let e k ( h ) denote the error in D k ( h ) for k ∈ { 1 , 2 , 3 } . Plot log 10 ( e k ( h )) versus log 10 ( h ) for k ∈ { 1 , 2 , 3 } . What does the slope tell you? Can you say anything about the minimums of the curves? All the above problems (if graded) are worth 5 points each, except the ﬁnal two problems which are worth 10 points each. Study Problems (Will not be graded.) • Epperson, Section 2.1 problems: 1b, 4 (for 1b), 9 (for 1b). • Epperson, Section 2.2 problems: 2a, 2b, 3a, 3b, 9 (for 3a and 3b), 12, 14a. • Epperson, Section 2.3 problems: 1. 2...
View Full Document

This note was uploaded on 01/15/2012 for the course MAE 107 taught by Professor Rottman during the Spring '08 term at UCSD.

Page1 / 2

hw12 - x ). Suppose we want to compute the derivative 1 at...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online