1S3 (Timoney) Tutorial sheet 7 [Tutorials February 12–23, 2007] Name: Solutions R

advertisement
1S3 (Timoney) Tutorial sheet 7
[Tutorials February 12–23, 2007]
Name: Solutions
R3
1. An integral 1 f (x) dx is to be calculated based on experimental data for values of f (x).
Here is the data:
x
1
1.25
1.5 1.75
2
2.25
2.5
2.75
3
f (x) 0.235 0.561 0.862 0.634 0.214 −0.158 −0.517 −0.923 −1.342
Calculate the Riemann sum
P8
i=1
f (x∗i )(xi − xi−1 ) with x∗i = xi = 1 + 0.25i.
Solution: We have xi − xi−1 = 0.25 always and what we want is
8
X
f (x∗i )(xi
− xi−1 ) =
i=1
8
X
f (x∗i )(0.25)
i=1
= 0.25(f (1.25) + f (1.5) + f (1.75) + f (2)
+f (2.25) + f (2.5) + f (2.75) + f (3))
= 0.25(0.561 + 0.862 + 0.634
+0.214 − 0.158 − 0.517 − 0.923 − 1.342)
= −0.16725
2. For the same integral and the same data as in the previous example, find the result of
approximating the integral by the Trapezoidal rule formula with n = 8 steps.
Solution: The formula is
T8 =
1
1
y0 + y1 + y2 + · · · + y7 + y8 h
2
2
where h = (b − a)/n = (3 − 1)/8 = 1/4 = 0.25 and yi = f (a + ih) = f (1 + 0.25i)
(0 ≤ i ≤ 8) are the values tabulated.
1
f (1) + f (1.25) + f (1.5) + f (1.75) + f (2)
T8 =
2
1
+f (2.25) + f (2.5) + f (2.75) + f (3) (0.25)
2
= ((1/2)0.235 + 0.561 + 0.862 + 0.634
+0.214 − 0.158 − 0.517 − 0.923 − (1/2)1.342)(0.25)
= 0.029875
3. For the same integral and the same data again, find the result of approximating the integral
by Simpson’s rule formula with n = 8 steps.
Solution: The formula is
S8 =
1
4
2
4
1
y0 + y1 + y2 + · · · + y7 + y8 h
3
3
3
3
3
where h = (b − a)/n = (3 − 1)/8 = 1/4 = 0.25 and yi = f (a + ih) = f (1 + 0.25i)
(0 ≤ i ≤ 8) are again values tabulated.
1
4
2
4
2
S8 =
f (1) + f (1.25) + f (1.5) + f (1.75) + f (2)
3
3
3
3
3
2
4
1
4
+ f (2.25) + f (2.5) + f (2.75) + f (3) (0.25)
3
3
3
3
= ((1/3)0.235 + (4/3)0.561 + (2/3)0.862 + (4/3)0.634
+(2/3)0.214 − (4/3)0.158 − (2/3)0.517 − (4/3)0.923 − (1/3)1.342)(0.25)
= 0.0389167
R2
4. To calculate 0 cos(x2 ) dx via the trapezoidal rule formula Tn with n steps, and to be sure
that the value you get is within 0.1 of the correct value, how large should n be? [Hint:
Estimate M2 = largest value of |f 00 (x)| for 0 ≤ x ≤ 2 via |f 00 (x)| = | − 4x2 cos(x2 ) −
2 sin(x2 )| ≤ 4x2 + 2 ≤ 18, although M2 is actually smaller.]
Solution: We know the Theorem estimating the difference (for the worst case)
Z 2
b−a 2
2−0 2
2
≤
cos(x
)
dx
−
T
h M2 ≤
h (18) = 3h2
n
12
12
0
Since h = (b − a)/n = 2/n, it will be enough to have npbig enough√
so that 3(2/n)2 < 0.1.
Or 12/n2 < 0.1 or 12/0.1 < n2 . That comes to n > 12/0.1 = 120. So n = 11 will
work.
Richard M. Timoney
2
Download