You are on page 1of 17

1

CHAPTER 21
21.1 (a) Analytical solution:
( ) [ ] 500168 . 3 5 . 0 0 5 . 0 4 5 . 0 1
) 0 ( 2 ) 4 ( 2
4
0
2
4
0
2
+ +

e e e x dx e
x x
(b) Trapezoidal rule (n = 1):
999329 . 1
2
999665 . 0 0
) 0 4 (
+
I
% 88 . 42 % 100
500168 . 3
999329 . 1 500168 . 3

(c) Trapezoidal rule (n = 2):


% 35 . 15 963033 . 2
4
999665 . 0 ) 981684 . 0 ( 2 0
) 0 4 (
+ +

t
I
Trapezoidal rule (n = 4):
% 47 . 4 343703 . 3
8
999665 . 0 ) 997521 . 0 981684 . 0 864665 . 0 ( 2 0
) 0 4 (
+ + + +

t
I
(d) Simpsons 1/3 rule:
% 17 . 6 284268 . 3
6
999665 . 0 ) 981684 . 0 ( 4 0
) 0 4 (
+ +

t
I
(e) Simpsons rule (n = 4):
% 84 . 0 470592 . 3
12
999665 . 0 ) 981684 . 0 ( 2 ) 997521 . 0 864665 . 0 ( 4 0
) 0 4 (
+ + + +

t
I
(f) Simpsons 3/8 rule:
% 19 . 3 388365 . 3
8
999665 . 0 ) 995172 . 0 930517 . 0 ( 3 0
) 0 4 (
+ + +

t
I
(g) Simpsons rules (n = 5):
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
2
% 41 . 0 485876 . 3 378769 . 2 107107 . 1
8
999665 . 0 ) 998338 . 0 99177 . 0 ( 3 959238 . 0
) 6 . 1 4 (
6
959238 . 0 ) 798103 . 0 ( 4 0
) 0 6 . 1 (
+
+ + +
+
+ +

t
I

21.2 (a) Analytical solution:


[ ] 42478 . 12 0 ) /2 sin( 3 ) /2 ( 6 sin 3 6 ) 3cos (6
/2
0
/2
0
+ + +

x x dx x
(b) Trapezoidal rule (n = 1):
78097 . 11
2
6 9
) 0 570796 . 1 (
+
I % 182 . 5 % 100
42478 . 12
78097 . 11 42478 . 12

(c) Trapezoidal rule (n = 2):


% 254 . 1 26896 . 12
4
6 ) 12132 . 8 ( 2 9
) 0 570796 . 1 (
+ +

t
I
Trapezoidal rule (n = 4):
% 311 . 0 38613 . 12
8
6 ) 14805 . 7 12132 . 8 771639 . 8 ( 2 9
) 0 570796 . 1 (
+ + + +

t
I
(d) Simpsons 1/3 rule:
% 055 . 0 43162 . 12
6
6 ) 12132 . 8 ( 4 9
) 0 570796 . 1 (
+ +

t
I
(e) Simpsons rule (n = 4):
% 0032 . 0 42518 . 12
12
6 ) 12132 . 8 ( 2 ) 14805 . 7 771639 . 8 ( 4 9
) 0 570796 . 1 (
+ + + +

t
I
(f) Simpsons 3/8 rule:
% 024 . 0 42779 . 12
8
6 ) 5 . 7 598076 . 8 ( 3 9
) 0 570796 . 1 (
+ + +

t
I
(g) Simpsons rules (n = 5):
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
3
% 002 . 0 42503 . 12 891665 . 6 533364 . 5
8
6 ) 927051 . 6 763356 . 7 ( 3 427051 . 8
) 628319 . 0 570796 . 1 (
6
427051 . 8 ) 85317 . 8 ( 4 9
) 0 628319 . 0 (
+
+ + +
+
+ +

t
I

21.3 (a) Analytical solution:


1104
3 2
) 2 4 1 (
4
2
6
4
2
4
2
5 3

1
]
1

+ +

x
x
x
x dx x x x
(b) Trapezoidal rule (n = 1):
5280
2
1789 29
)) 2 ( 4 (
+
I % 26 . 378 % 100
1104
5280 1104

(c) Trapezoidal rule (n = 2):


% 59 . 138 2634
4
1789 ) 2 ( 2 29
)) 2 ( 4 (
+ +

t
I
Trapezoidal rule (n = 4):
% 398 . 37 875 . 1516
8
1789 ) 3125 . 131 2 9375 . 1 ( 2 29
)) 2 ( 4 (
+ + +

t
I
(d) Simpsons 1/3 rule (n = 2):
% 7 . 58 1752
6
1789 ) 2 ( 4 29
)) 2 ( 4 (
+ +

t
I
(e) Simpsons 3/8 rule:
% 087 . 26 1392
8
1789 ) 31 1 ( 3 29
)) 2 ( 4 (
+ + +

t
I
(f) Booles rule (n = 5):
% 0 1104
90
) 1789 ( 7 ) 3125 . 131 ( 32 ) 2 ( 12 ) 9375 . 1 ( 32 ) 29 ( 7
)) 2 ( 4 (
+ + + +

t
I
21.4 Analytical solution:
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
4
33333 . 8
4
4
3
) 2 (
2
1
3
2
1
2

1
]
1

+ +

x
x
x
dx /x x
Trapezoidal rule (n = 1):
9
2
9 9
) 1 2 (
+

The results are summarized below:


n Integral
t
1 9 8%
2 8.513889 2.167%
3 8.415185 0.982%
4 8.379725 0.557%
21.5 Analytical solution:
2056 ) 3 4 (
16
1
) 3 4 (
5
3
4
5
3
3

1
]
1

x dx x
Simpsons rule (n = 4):
% 0 2056
12
4913 ) 1 ( 2 ) 729 343 ( 4 3375
)) 3 ( 5 (
+ + + +

t
I
Simpsons rules (n = 5):
% 0 2056 598 . 5218 6 . 3162
8
4913 ) 016 . 1191 088 . 74 ( 3 648 . 10
) 2 . 0 5 (
6
648 . 10 ) 056 . 636 ( 4 3375
)) 3 ( 2 . 0 (
+
+ + +
+
+

t
I

Because Simpsons rules are perfect for cubics, both versions yield the exact result for this
cubic polynomial.
21.6 Analytical solution:
[ ] 42768 . 98 ) 2 2 (
3
0
2
3
0
2
+

x x
e x x dx e x
Trapezoidal rule (n = 4):
% 062 . 14 2684 . 112
8
7698 . 180 ) 03166 . 48 0838 . 10 190813 . 1 ( 2 0
) 0 3 (
+ + + +

t
I
Simpsons rule (n = 4):
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
5
% 046 . 1 45683 . 99
12
7698 . 180 ) 0838 . 10 ( 2 ) 03166 . 48 190813 . 1 ( 4 0
) 0 3 (
+ + + +

t
I
21.7 Analytical solution:
2301 . 517 14
14 ln 2
1
14
5 . 1
5 . 0
2
1.5
0.5
2

1
]
1

x x
dx
(a) Trapezoidal rule (n = 1):
1379
2
2744 14
) 5 . 0 5 . 1 (
+
I % 612 . 166 % 100
2301 . 517
1379 2301 . 517

(b) Simpsons 1/3 rule (n = 2):


% 134 . 14 3333 . 590
6
2744 ) 196 ( 4 14
) 5 . 0 5 . 1 (
+ +

t
I
(c) Simpsons 3/8 rule:
% 798 . 6 3916 . 552
8
2744 ) 3879 . 472 323 . 81 ( 3 14
) 5 . 0 5 . 1 (
+ + +

t
I
(d) Booles rule:
% 5397 . 0 0215 . 20 5
90
) 2744 ( 7 ) 3648 . 733 ( 32 ) 196 ( 12 ) 3832 . 52 ( 32 ) 14 ( 7
) 5 . 0 5 . 1 (
+ + + +

t
I
(e) Midpoint method:
% 106 . 62 196 196 ) 5 . 0 5 . 1 (
t
I
(f) 3-segment-2-point open integration formula:
% 473 . 46 8554 . 276
2
3879 . 472 323 . 81
) 5 . 0 5 . 1 (
+

t
I
(g) 4-segment-3-point open integration formula:
% 355 . 11 4987 . 458
3
) 3648 . 733 ( 2 196 ) 3832 . 52 ( 2
) 5 . 0 5 . 1 (
+

t
I
21.8 Analytical solution:
( ) [ ] 42336 . 15 sin 3 5 cos 3 5
3
0
3
0
+ +

x x dx x
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
6
(a) Trapezoidal rule (n = 1):
04503 . 15
2
030023 . 2 8
) 0 3 (
+
I % 453 . 2 % 100
42336 . 15
04503 . 15 42336 . 15

(b) Simpsons 1/3 rule (n = 2):


% 104 . 0 43943 . 15
6
030023 . 2 ) 212212 . 5 ( 4 8
) 0 3 (
+ +

t
I
(c) Simpsons 3/8 rule:
% 045 . 0 43028 . 15
8
030023 . 2 ) 751559 . 3 620907 . 6 ( 3 8
) 0 3 (
+ + +

t
I
(d) Simpsons rules (n = 5):
% 014 . 0 42126 . 15 62304 . 6 79822 . 8
8
030023 . 2 ) 787819 . 2 318394 . 4 ( 3 087073 . 6
) 2 . 1 3 (
6
087073 . 6 ) 476007 . 7 ( 4 8
) 0 2 . 1 (
+
+ + +
+
+ +

t
I

(e) Booles rule:


% 0014 . 0
42314 . 15
90
) 030023 . 2 ( 7 ) 115479 . 3 ( 32 ) 212212 . 5 ( 12 ) 195067 . 7 ( 32 ) 8 ( 7
) 0 3 (

+ + + +

t
I

(f) Midpoint method:


% 383 . 1 63663 . 15 212212 . 5 ) 0 3 (
t
I
(g) 3-segment-2-point open integration formula:
% 877 . 0 5587 . 15
2
751559 . 3 620907 . 6
) 0 3 (
+

t
I
(h) 4-segment-3-point open integration formula:
% 094 . 0 40888 . 15
3
) 115479 . 3 ( 2 212212 . 5 ) 195067 . 7 ( 2
) 0 3 (
+

t
I
21.9 Analytical solution:
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
7
t
d
d
t
d
d
t
m
gc
c
m
dt t
m
gc
c
gm
t z

0

0
cosh ln tanh ) (
1
1
]
1

1
1
]
1

,
_

,
_

9262 . 333 ) 10 (
1 . 68
) 25 . 0 ( 8 . 9
cosh ln
25 . 0
1 . 68
) 10 (
10
0

1
1
]
1

1
1
]
1

,
_

z
Thus, the result to 3 significant digits is 334. Here are results for various multiple-segment
trapezoidal rules:
n I
1 246.9593
2 314.4026
3 325.4835
4 329.216
5 330.9225
6 331.8443
7 332.3984
8 332.7573
9 333.0031
10 333.1788
11 333.3087
12 333.4074
13 333.4842
14 333.5452
Thus, a 14-segment application gives the result to 4 significant digits.
21.10
(a) Trapezoidal rule (n = 5):
15 . 2
10
1 ) 5 5 . 3 4 8 ( 2 1
) 0 5 . 0 (
+ + + + +
I
(b) Simpsons rules (n = 5):
377083 . 2 14375 . 1 233333 . 1
8
1 ) 5 5 . 3 ( 3 4
) 2 . 0 5 . 0 (
6
4 ) 8 ( 4 1
) 0 2 . 0 ( +
+ + +
+
+ +
I
21.11
(a) Trapezoidal rule (n = 6):
65
12
20 ) 3 5 2 10 5 ( 2 35
)) 2 ( 10 (
+ + + + +
I
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
8
(b) Simpsons rules (n = 6):
66667 . 56
18
20 ) 5 10 ( 2 ) 3 2 5 ( 4 35
)) 2 ( 10 (
+ + + + + +
I
21.12 (a) A graph suggests that the mean value is about 80.

y = -0.075x
4
+ 2x
3
- 14x
2
+ 45x - 46
0
50
100
150
200
250
300
0 2 4 6 8 10 12
80
(b) Analytical solution:
[ ]
89333 . 81
8
1467 . 655
2 10
015 . 0 5 . 0 6667 . 4 5 . 22 46

2 10
075 . 0 2 14 45 46
10
2
5 4 3 2
10
2
4 3 2

+ +

+ +

x x x x x
dx x x x x
(c) Numerical solution:
2292 . 654 046 . 601 18315 . 53
8
254 ) 1645 . 156 14368 . 81 ( 3 81888 . 35
) 2 . 5 10 (
6
81888 . 35 ) 27488 . 15 ( 4 8 . 2
) 2 2 . 5 (
+
+ + +
+
+ +
I
% 14 . 0 % 100
89333 . 81
81.77865 89333 . 81
81.77865
2 10
2292 . 654
Average

21.13 (a) Analytical solution:


[ ] 79124 . 0 ) 33333 . 1 ( 54209 . 0 33333 . 1 2
6 . 0
0
5 . 1
0.6
0
5 . 1

x x
e dx e
(b) Trapezoidal rule
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
9
79284 . 0
2
8131 . 0 9808 . 0
) 475 . 0 6 . 0 (
2
9808 . 0 1831 . 1
) 35 . 0 475 . 0 (
2
1831 . 1 3746 . 1
) 25 . 0 35 . 0 (
2
3746 . 1 597 . 1
) 15 . 0 25 . 0 (
2
597 . 1 8555 . 1
) 05 . 0 15 . 0 (
2
8555 . 1 2
) 0 05 . 0 (

+
+
+
+
+
+
+
+
+
+
+
I
% 2022 . 0 % 100
79124 . 0
79284 . 0 79124 . 0

(c) Trapezoidal/Simpsons rules


791282 . 0
6
8131 . 0 ) 9808 . 0 ( 4 1831 . 1
) 35 . 0 6 . 0 (
8
1831 . 1 ) 3746 . 1 597 . 1 ( 3 8555 . 1
) 05 . 0 35 . 0 (
2
8555 . 1 2
) 0 05 . 0 (

+ +
+
+ + +
+
+
I
% 0052 . 0 % 100
79124 . 0
791282 . 0 79124 . 0

t

21.14 (a) Analytical solution:
dy
x
y x y
x
dy dx xy y x
2
2
3
) 2 (
2
0
1
1
2
3 2
3
1
1
2
0
3 2 2


1
]
1

+ +
666667 . 2
2
1
3
4
3
8
2 4
3
8

1
1
4 3
1
1
3 2

1
]
1

+ +

y y y dy y y
(b) Sweeping across the x dimension:
y = 1:
3
4
0 ) 2 ( 2 2
) 0 2 (
+ +
I
y = 0:
3
4
4 ) 1 ( 2 0
) 0 2 (
+ +
I
y = 1:
1
4
4 ) 0 ( 2 2
) 0 2 (
+ +
I
These values can then be integrated along the y dimension:

PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
10
2
4
1 ) 3 ( 2 3
)) 1 ( 1 (
+ +
I
% 25 % 100
666667 . 2
2 666667 . 2

t

(c) Sweeping across the x dimension:
y = 1:
33333 . 3
6
0 ) 2 ( 4 2
) 0 2 (
+ +
I
y = 0:
666667 . 2
6
4 ) 1 ( 4 0
) 0 2 (
+ +
I
y = 1:
666667 . 0
6
4 ) 0 ( 4 2
) 0 2 (
+ +
I
These values can then be integrated along the y dimension:

% 0 666667 . 2
6
666667 . 0 ) 666667 . 2 ( 4 33333 . 3
)) 1 ( 1 (
+ +

t
I
21.15 (a) Analytical solution:
dz dy yzx
x
dz dy dx yz x 3
4
) 3 (
1
3
4
2
2
2
0
2
2
2
0
1
3
3


1
]
1



[ ] dz z dz z y y dz dy yz 24 40 6 20 12 20
2
2
2
0
2
2
2
2
2
2
0



[ ] 160 12 40
2
2
2


z z
(b) For z = 2, sweeping across the x dimension:
z = 2; y = 0:
20
6
1 ) 1 ( 4 27
)) 3 ( 1 (
+ +
I
z = 2; y = 1:
4
6
7 ) 5 ( 4 21
)) 3 ( 1 (
+ +
I
z = 2; y = 2:
28
6
13 ) 11 ( 4 15
)) 3 ( 1 (
+ +
I
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
11
These values can then be integrated along the y dimension:

8
6
28 ) 4 ( 4 20
) 0 2 (
+ +
I
For z = 0, similar calculations yield
z = 0; y = 0: I = 20
z = 0; y = 1: I = 20
z = 0; y = 2: I = 20
These values can then be integrated along the y dimension:

40
6
20 ) 20 ( 4 20
) 0 2 (
+
I
For z = 2, similar calculations yield
z = 2; y = 0: I = 20
z = 2; y = 1: I = 44
z = 2; y = 2: I = 68
These values can then be integrated along the y dimension:

88
6
68 ) 44 ( 4 20
) 0 2 (
+
I
Finally, these results can be integrated along the z dimension,
% 0 160
6
88 ) 40 ( 4 8
)) 2 ( 2 (
t

+
I
21.16 Here is a VBA program that is set up to duplicate the computation performed in Example
21.2.
Option Explicit
Sub TestTrapm()
Dim n As Integer, i As Integer
Dim a As Double, b As Double, h As Double
Dim x(100) As Double, f(100) As Double
'Enter data and integration parameters
a = 0
b = 0.8
n = 2
h = (b - a) / n
'generate data from function
x(0) = a
f(0) = fx(a)
For i = 1 To n
x(i) = x(i - 1) + h
f(i) = fx(x(i))
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
12
Next i
'invoke function to determine and display integral
MsgBox "The integral is " & Trapm(h, n, f)
End Sub
Function Trapm(h, n, f)
Dim i As Integer, sum As Double
sum = f(0)
For i = 1 To n - 1
sum = sum + 2 * f(i)
Next i
sum = sum + f(n)
Trapm = h * sum / 2
End Function
Function fx(x)
fx = 0.2 + 25 * x - 200 * x ^ 2 + 675 * x ^ 3 - 900 * x ^ 4 + 400 * x ^ 5
End Function
21.17 Here is a VBA program that is set up to duplicate the computation performed in Example
21.5.
Option Explicit
Sub TestSimpm()
Dim n As Integer, i As Integer
Dim a As Double, b As Double, h As Double
Dim x(100) As Double, f(100) As Double
'Enter data and integration parameters
a = 0
b = 0.8
n = 4
h = (b - a) / n
'generate data from function
x(0) = a
f(0) = fx(a)
For i = 1 To n
x(i) = x(i - 1) + h
f(i) = fx(x(i))
Next i
'invoke function to determine and display integral
MsgBox "The integral is " & Simp13m(h, n, f)
End Sub
Function Simp13m(h, n, f)
Dim i As Integer
Dim sum As Double
sum = f(0)
For i = 1 To n - 2 Step 2
sum = sum + 4 * f(i) + 2 * f(i + 1)
Next i
sum = sum + 4 * f(n - 1) + f(n)
Simp13m = h * sum / 3
End Function
Function fx(x)
fx = 0.2 + 25 * x - 200 * x ^ 2 + 675 * x ^ 3 - 900 * x ^ 4 + 400 * x ^ 5
End Function
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
13
21.18 Here is a VBA program that is set up to duplicate the computation performed in Example
21.8.
Option Explicit
Sub TestUneven()
Dim n As Integer, i As Integer
Dim label As String
Dim a As Double, b As Double, h As Double
Dim x(100) As Double, f(100) As Double
'Enter data
Sheets("Sheet1").Select
Range("a6").Select
n = ActiveCell.Row
Selection.End(xlDown).Select
n = ActiveCell.Row - n
'Input data from sheet
Range("a6").Select
For i = 0 To n
x(i) = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
f(i) = ActiveCell.Value
ActiveCell.Offset(1, -1).Select
Next i
'invoke function to determine and display integral
MsgBox "The integral is " & Uneven(n, x, f)
End Sub
Function Uneven(n, x, f)
Dim k As Integer, j As Integer
Dim h As Double, sum As Double, hf As Double
h = x(1) - x(0)
k = 1
sum = 0#
For j = 1 To n
hf = x(j + 1) - x(j)
If Abs(h - hf) < 0.000001 Then
If k = 3 Then
sum = sum + Simp13(h, f(j - 3), f(j - 2), f(j - 1))
k = k - 1
Else
k = k + 1
End If
Else
If k = 1 Then
sum = sum + Trap(h, f(j - 1), f(j))
Else
If k = 2 Then
sum = sum + Simp13(h, f(j - 2), f(j - 1), f(j))
Else
sum = sum + Simp38(h, f(j - 3), f(j - 2), f(j - 1), f(j))
End If
k = 1
End If
End If
h = hf
Next j
Uneven = sum
End Function
Function Trap(h, f0, f1)
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
14
Trap = h * (f0 + f1) / 2
End Function
Function Simp13(h, f0, f1, f2)
Simp13 = 2 * h * (f0 + 4 * f1 + f2) / 6
End Function
Function Simp38(h, f0, f1, f2, f3)
Simp38 = 3 * h * (f0 + 3 * (f1 + f2) + f3) / 8
End Function
Function fx(x)
fx = 0.2 + 25 * x - 200 * x ^ 2 + 675 * x ^ 3 - 900 * x ^ 4 + 400 * x ^ 5
End Function
To run the program, the data is entered in columns A and B on a worksheet labeled Sheet1.
After the macro is run, a message box displays the integral estimate as shown.
21.19 (a) Analytical solution:
[ ] 9167 . 165 0.083333 5 0.25 5
11
0
3
11
0
2
+ +

x x dx x M
(b) Trapezoidal rule:
375 . 166
2
6 25 . 5
) 1 2 (
2
25 . 5 5
) 0 1 ( +
+
+
+
I
(c) Simpsons rule:
9167 . 165
6
9 ) 25 . 7 ( 4 6
) 2 4 (
6
6 ) 25 . 5 ( 4 5
) 0 2 ( +
+ +
+
+ +
I
21.20 Trapezoidal/Simpsons rules
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
15
192 . 2681
2
6 . 165 6 . 193
) 10 11 (
8
6 . 193 ) 6 . 249 5 . 260 ( 3 8 . 260
) 4 10 (
6
8 . 260 ) 4 . 266 ( 4 4 . 294
) 2 4 (
2
4 . 294 336
) 5 . 0 2 (

+
+
+ + +
+
+ +
+
+
I
21.21 (a) Trapezoidal rule
m 5 . 622 , 3
min
s 60
s
min m
375 . 60
2
5 . 5 6
) 2 25 . 3 (
2
6 5
) 1 2 (

+
+
+
+
I
(b) Trapezoidal/Simpsons rules
m 25 . 596 , 3
min
s 60
s
min m
9375 . 59
6
5 ) 7 ( 4 7
) 9 10 (
8
7 ) 6 8 ( 3 5 . 8
) 6 9 (
2
5 . 8 7
) 5 . 4 6 (
6
7 ) 5 . 5 ( 4 6
) 2 5 . 4 (
2
6 5
) 1 2 (

+ +
+
+ + +
+
+
+
+ +
+
+
I
(c) We can use regression to fit a quadratic equation to the data
y = -0.1117x
2
+ 1.3526x + 3.4447
R
2
= 0.5742
0
5
10
0 2 4 6 8 10 12
This equation can be integrated to yield
[ ]
m 594 . 645 , 3
min
s 60
s
min m
7599 . 60
3.4447 + 0.6763 + 03723 . 0 3.4447 + 1.3526 + 0.1117
10
1
2 3
10
1
2

x x x dx x x M
We can use regression to fit a cubic equation to the data
y = -0.01646x
3
+ 0.16253x
2
+ 0.07881x + 4.85467
R
2
= 0.63442
0
5
10
0 2 4 6 8 10 12
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
16
This equation can be integrated to yield
[ ]
m 184 . 634 , 3
min
s 60
s
min m
56973 . 60
4.85467 + 0.039405 + 0.054177 + 00412 . 0
4.85467 0.07881x + 0.16253 + 0.01646
10
1
2 3 4
10
1
2 3

x x x x
dx x x M
21.22 We can set up a table that contains the values comprising the integrand
x, cm , g/cm
3
Ac, cm
2
Ac,
g/cm
0 4 100 400
200 3.95 103 406.85
300 3.89 106 412.34
400 3.8 110 418
600 3.6 120 432
800 3.41 133 453.53
1000 3.3 150 495
We can integrate this data using a combination of the trapezoidal and Simpsons rules,
kg 430.8779 g 9 . 877 , 430
8
495 ) 53 . 453 432 ( 3 418
) 400 1000 (
6
418 ) 34 . 412 ( 4 85 . 406
) 200 400 (
2
85 . 406 400
) 0 200 (

+ + +
+
+ +
+
+
I
21.23 We can set up a table that contains the values comprising the integrand
t, hr t, d
rate
(cars/4 min)
rate
(cars/d)
7:30 0.312500 18 6480
7:45 0.322917 24 8640
8:00 0.333333 14 5040
8:15 0.343750 24 8640
8:45 0.364583 21 7560
9:15 0.385417 9 3240
We can integrate this data using a combination of Simpsons 3/8 and 1/3 rules. This yields the
number of cars that go through the intersection between 7:30 and 9:15,
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.
17
cars 511.875 292.5 219.375
6
3240 ) 7560 ( 4 8640
) 34375 . 0 385417 . 0 (
8
8640 ) 5040 8640 ( 3 6480
) 3125 . 0 34375 . 0 (
+
+ +
+
+ + +
I
The number of cars going through the intersection per minute can be computed as
min
cars
875 . 4
min 60
hr
hr 1.75
cars 511.875

21.24 We can use Simpsons 1/3 rule to integrate across the y dimension,
x = 0:
3333 . 17
6
8 ) 4 ( 4 2
) 0 4 (
+
I
x = 4:
14
6
8 ) 3 ( 4 1
) 0 4 (
+
I
x = 8:
3333 . 1
6
6 ) 1 ( 4 4
) 0 4 (
+
I
x = 12:
28
6
4 ) 7 ( 4 10
) 0 4 (
+ +
I
These values can then be integrated along the x dimension with Simpsons 3/8 rule:

41
8
28 ) 3333 . 1 14 ( 3 3333 . 17
) 0 12 (
+ + +
I
PROPRIETARY MATERIAL. The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may
be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the
publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual
course preparation. If you are a student using this Manual, you are using it without permission.

You might also like