Graphics Programs Reference
In-Depth Information
E
min
<
0
Therefore,
I
+
sin(
x
)
dx
<
I
+
E
max
,or
π
1
.
974 23
<
sin(
x
)
dx
<
2
.
014 60
0
The exact integral is, of course,
I
=
2.
Solution of Part (2)
The newnodes createdbythe doubling of panels are locatedat
midpoints of the old panels. Their abscissas are
16
+
1)
8
=
1)
16
,
x
j
=
(
j
−
(2
j
−
j
=
1
,
2
,...,
8
Using the recursivetrapezoidal rule in Eq. (6.9b), we get
8
1
.
974 23
2
16
sin
(2
j
−
1)
π
=
+
=
.
I
1
993 58
16
j
=
1
and the boundson the errorbecome(note that
E
isquarteredwhen
h
ishalved)
E
min
=
0,
E
max
=
0
.
040 37
/
4
=
0
.
01009. Hence
π
1
.
993 58
<
sin(
x
)
dx
<
2
.
00367
0
EXAMPLE 6.3
Estimate
2
.
5
0
f
(
x
)
dx
from the data
x
0
0
.
5
1
.
0
1
.
5
2
.
0
2
.
5
f
(
x
)
1
.
5000
2
.
0000
2
.
0000
1
.
6364
1
.
2500
0
.
9565
Solution
We will use Simpson's rules, since theyare more accurate than the trape-
zoidal rule.Because the number of panels isodd, wecompute the integralover the
first three panels by Simpson's 3/8rule, and use the 1/3rule for the last two panels:
5)]
3(0
.
5)
I
=
[
f
(0)
+
3
f
(0
.
5)
+
3
f
(1
.
0)
+
f
(1
.
8
0
5
3
.
+
[
f
(1
.
5)
+
4
f
(2
.
0)
+
f
(2
.
5)]
=
2
.
8381
+
1
.
2655
=
4
.
1036
EXAMPLE 6.4
Use the recursivetrapezoidal rule to evaluate
0
√
x
cos
x dx
to six decimal places.
Howmany function evaluations are required to achievethis result?
Solution
The program listedbelowutilizes the function
trapezoid
. Apartfrom the
valueoftheintegral, it displays the number of function evaluations usedinthe
computation.
Search WWH ::
Custom Search