Adaptive Quadrature 19
Similarly,
s(1.74938) = Z1.74938
0
sin π
2t2dt ≈0.50000179149
and
s(1.74939) = Z1.74939
0
sin π
2t2dt ≈0.49999183638.
Thus, to four decimal places, the two smallest positive values for xsuch that
s(x) = 0.5are x= 1.0622 and x= 1.7494.
20. Consider the integral
Zx
0
sin t
tdt.
(a) Use the adaptive two-point Gaussian quadrature scheme to tabulate the
value of this integral for xranging from 0 through 10 in increments of 0.5.
Each tabulated value should be accurate to six decimal places.
(b) What happens if you try to use the adaptive Simpson’s rule to tabulate the
values of this integral? Can you think of a way to alleviate this problem?
(a) Using the adaptive two-point Gaussian quadrature rule with ǫ= 5 ×10−7, we
generate the table
xRx
0
sin t
tdt xRx
0
sin t
tdt
0.0 0.000000
1.0 0.946083 6.0 1.424688
2.0 1.605413 7.0 1.454597
3.0 1.848652 8.0 1.574187
4.0 1.758203 9.0 1.665040
(b) The adaptive Simpson’s rule will attempt to evaluate the integrand at t= 0.
Unfortunately, the integrand is not defined at t= 0 due to division by zero, so
a divide by zero exception will be generated. Because