Professional Documents
Culture Documents
Q3 PDF
Q3 PDF
Assignment 6
Due Nov. 28 2007
1. Let h = b − a/3, x 0 = a, x 1 = a + h, x 2 = b. Find the degree of precision of the quadrature formula
∫ a f x dx = 94 hf x 1 + 34 hf x 2 .
b
∫ a fxdx =
b
9 hf a + h + 3 hf a + 3h
4 4
∫a
a+3h
dx = x a+3h
a = 3h & [ 2 marks]
9 h + 3 h = 3h
4 4
∫a
a+3h
xdx = 3ah + 9 h 2 & [3 marks]
2
9 ha + h + 3 h a + 3h = 3ah + 9 h 2
4 4 2
∫a
a+3h
x 2 dx = 3a 2 h + 9ah 2 + 9h 3 & [4 marks]
9 ha + h 2 + 3 h a + 3h 2 = 3a 2 h + 9ah 2 + 9h 3
4 4
∫a
a+3h
x 3 dx = 3a 3 h + 27 a 2 h 2 + 27ah 3 + 81 h 4 & [ 5 marks]
2 4
9 ha + h 3 + 3 h a + 3h 3 = 3a 3 h + 27 a 2 h 2 + 27ah 3 + 45 h 4
4 4 2 2
Degree 2. [1 mark]
1
2. The quadrature formula ∫ f x dx = c 0 f−1 + c 1 f 0 + c 2 f 1 is exact for all polynomials of degree
−1
less than or equal to 2. Determine c 0 , c 1, and c 2 .
[10 marks]
∫ −1 1dx = 2 = c 0 + c 1 + c 2
1
∫ −1 xdx = 0 = −c 0 + 0 + c 2
1
∫ −1 x 2 dx =
1
2 = c0 + 0 + c2
3
From the last 2 we have c 2 = 1
3
and c 0 = 1
3
. so from the first c 1 = 4
3
.
1
3. The Midpoint rule for approximating ∫ f x dx gives the value 12, the Composite Midpoint rule with
−1
n = 2 gives 5, and the Composite Simpson.s rule gives 6. Use the fact that f−1 = f1 and
f −0.5 = f 0.5 to determine f−1, f−0.5, f0, f0.5, and f1
[10 marks]
Midpoint with h = 1 2hf 0 = 2f 0 = 12 so f 0 = 6
Composite midpoint h = 1/2 2hf −.5 + f 0.5 = 2f 0.5 = 5 or f .5 = 5/2 and f −0.5 = 5/2
Composite Simpson’s rule with h = 1/2
3 f−1
h
+ 4f−0.5 + 2f0 + 4f0.5 + f1 = 16 2f 1 + 20 + 12 = 16 2f 1 + 22 = 6 so f 1 = 2
1
4. Determine the values of n and h required to approximate
π
∫ 0 x 2 cos x dx
to within 10 −4 .
a) Use the Composite Trapezoidal rule.
[4 marks for the derivatives]
π
∫ x 2 cos x dx
0
fx = x 2 cos x
dx 2 cos x
= 2x cos x − x 2 sin x
dx
d 2 x 2 cos x
= 2 cos x − 4x sin x − x 2 cos x
dx 2
d 3 x 2 cos x
= −6 sin x − 6x cos x + x 2 sin x
dx 3
d 4 x 2 cos x
= −12 cos x + 8x sin x + x 2 cos x
dx 4
a) [8 marks] for Trap.
-4
-6
2
b) Use the Composite Simpson’s rule.
[10 marks] for Simps.
15
10
-10
3
5. a) Compute the Simpson’s rule approximations Sa, b, Sa, a + b/2, and Sa + b/2, b for
1
∫ x 2 e −x dx, and verify the estimate given in the approximation formula.
0
[25 marks]
1
∫ 0 x 2 e −x dx = 0.160 602 79
x 0 0.25 .5 .75 1 Sum S
fx 0 0.048675049 0 .15163266 0.26570618 0.36787944
h
1 4 1
0.5
0 0.60653064 0.36787944 0.97441008 S0, 1 = 0.97441008 .5
3
= 0.162401 68
h
0.25
1 4 1
0 0.1947002 0.15163266 0.34633286 S0, .5 = 0.34633286 .25
3
= 0.028861072
1 4 1
0.5163266 1.0628247 0.36787944 1.5823368 S.5, 1 = 1.5823368 .25
3
= 0.1318614
S0, .5, 1 = 0.16072247
Correct Value 0.16060279
Sa, a + b/2 + Sa + b/2, b − Sa, b = 0.16072247 − 0.16240168 = −.00167921
Sa, a + b/2 + Sa + b/2, b - Correct 0.16072247 − 0.16060279 = .00011968
Ratio .00167921/.00011968 = 14.030832
Sa, a + b/2 + Sa + b/2, b agrees with the correct value 14.03 times better than with Sa, b
1
5. a) Use adaptive quadrature (without the computer) to find approximations to within 10 −3 for ∫ x 2 e −x dx.
0
[5 marks]
From the above S0, 1/2 + S1/2, 1 − S0, 1 = −0.00167 921 < 15 ∗ 0.001 = 0.0 15
0. 160 722 47 is accepted (can be seen from correct value)
4
1
6. Approximate the integral ∫ x 2 e −x dx by using Gaussian quadrature with n = 2. Compare with the exact
0
value of the integral.
b − at + b + a
x= = t+1
2 2
2 −
t+1
∫ 0 x 2 e −x dx = ∫ −1
1 1
1 1 t + 1 e 2 dt
2 2
∫ −1 t + 1 2 exp ∫ −1 ftdt
1 1
= 1 − t+1 dt =
8 2
[9 marks]
∫ 0 x 2 e −x dx = f
1
− 1 +f 1
3 3
2 − 1 +1 2
1 +1
1 3 3
= − 1 +1 exp − + 1 +1 exp −
8 3 2 3 2
∫ 0 x 2 e −x dx = 0.1606028
1
1
7. Approximate the integral ∫ x 2 e −x dx by using Gaussian quadrature with n = 3. Compare with the exact
0
value of the integral.
1 2 − 3/5 + 1
= 0.555556 − 3/5 + 1 exp −
8 2
3/5 + 1
+0.88888890 + 1 exp − 0 + 1
2
+ 0.555556 3/5 + 1 exp −
2 2
∫ 0 x 2 e −x dx = 0.1606028
1