256 Appendix E: A Detailed Look at f
If the interval of integration were (0, 10) so that the algorithm needed to
sample the function only at values where it was interesting but relatively
smooth, the sample points after the first few iterations would contribute
no new information about the behavior of the function. Therefore, only a
few iterations would be necessary before the disparity between
successive approximations became sufficiently small that the algorithm
could terminate with an approximation of a given accuracy.
On the other hand, if the interval of integration were more like the one
shown in the graph on page 252, most of the sample points would capture
the function in the region where its slope is not varying much. The few
sample points at small values of x would find that values of the function
changed appreciably from one iteration to the next. Consequently the
function would have to be evaluated at additional sample points before
the disparity between successive approximations would become
sufficiently small.
In order for the integral to be approximated with the same accuracy over
the larger interval as over the smaller interval, the density of the sample
points must be the same in the region where the function is interesting. To
achieve the same density of sample points, the total number of sample
points required over the larger interval is much greater than the number
required over the smaller interval. Consequently, several more iterations
are required over the larger interval to achieve an approximation with the
same accuracy, and therefore calculating the integral requires
considerably more time.
Because the calculation time depends on how soon a certain density of
sample points is achieved in the region where the function is interesting,
the calculation of the integral of any function will be prolonged if the
interval of integration includes mostly regions where the function is not
interesting. Fortunately, if you must calculate such an integral, you can
modify the problem so that the calculation time is considerably reduced.
Two such techniques are subdividing the interval of integration and
transformation of variables. These methods enable you to change the
function or the limits of integration so that the integrand is better
behaved over the interval(s) of integration. (These techniques are
described in the HP 15c Advanced Functions Handbook.)