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 Simpson’s 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 Simpson’s 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 Simpson’s 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
≈
0
.
45
(ii)
basic trapezoid rule
E
abs
=
I

I
T
≈ 
90
.
1
E
r
=
E
abs
/I
≈ 
1
.
2
(iii)
basic Simpson’s rule
E
abs
=
I

I
S
≈ 
6
.
60
E
r
=
E
abs
/I
≈ 
0
.
085
Note that the Simpson’s more accurate than either the trapezoid or midpoint.
Problem 1 [Solution] continued on next page. . .
Page 1 of 6
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
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
x e
x
2
f
0
(
x
)
=
3
e
x
2
(
1 + 2
x
2
)
f
00
(
x
)
=
6
xe
x
2
(
3 + 2
x
2
)
f
(3)
(
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Olson
 Polynomial interpolation, Luke Olson, basic trapezoid rule

Click to edit the document details