This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Due: October 30, 2008 CS 257 (Luke Olson): Homework #8 Solutions Problem 1 Problem 1 Consider the integral Z 2 1 3 xe x 2 dx a. We want to approximate the integral using: (i) basic midpoint rule (ii) basic trapezoid rule (iii) basic Simpsons rule Compute the absolute and relative errors for (i)(iii) using the analytic solution to the integral and comment on the results. b. Compare the absolute error with the theoretical bounds for (ii) and (iii) Solution 1. Calculating the integral using the different rules: (i) basic midpoint rule (2 1) 3 3 2 e ( 3 2 ) 2 = 9 2 e 9 4 (ii) basic trapezoid rule 1 2 (3(1) e (1) 2 + 3(2) e (2) 2 ) = 3 2 e + 3 e 4 (iii) basic Simpsons rule 1 / 2 3 3(1) e 1 2 + 4 3 3 2 e ( 3 2 ) 2 + 3(2) e 2 2 = 1 2 e + 3 e 9 / 4 + e 4 The True Value of the integral Z 2 1 3 xe x 2 dx = 3 2 e x. 2 2 1 = 3 2 ( e 4 e 1 ) Call this value I . Let I M , I T and I S , be the results given by the midpoint, trapezoid, and Simpsons rule. Using these, we can calculate the relative and absolute errors for the above three methods. (i) basic midpoint rule E abs = I I M 35 . 1 E r = E abs /I . 45 (ii) basic trapezoid rule E abs = I I T  90 . 1 E r = E abs /I  1 . 2 (iii) basic Simpsons rule E abs = I I S  6 . 60 E r = E abs /I  . 085 Note that the Simpsons more accurate than either the trapezoid or midpoint. Problem 1 [Solution] continued on next page... Page 1 of 6 Due: October 30, 2008 CS 257 (Luke Olson): Homework #8 Solutions Problem 1 [Grading] Grading 1 point for each correct answer (total 3 points). 2. We can calculate the theoretical error bounds using the formulas on page 225 and the derivatives of 3 xe x 2 f ( x ) = 3 xe x 2 f ( x ) = 3 e x 2 ( 1 + 2 x 2 ) f 00 ( x ) = 6 xe x 2 ( 3 + 2 x 2 ) f (3) ( x ) = 6 e...
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