Shortening calculation time, Subdividing the interval of integration – HP 15c User Manual

Page 43

Advertising
background image

Section 2: Working with

f

43

mathematical operations—may not be accurate to all 10 digits that can be displayed. Note
that round-off error affects the evaluation of any mathematical expression, not just the
evaluation of a function to be integrated using f. (Refer to the appendix for additional
information.)

If f(x) is a function relating to a physical situation, its inaccuracy due to round-off typically is
insignificant compared to the inaccuracy due to empirical constants, etc. If f(x) is what we
have called a pure mathematical function, its accuracy is limited only by round-off error.
Generally, it would require a complicated analysis to determine precisely how many digits of
a calculated function might be affected by round-off. In practice, its effects are typically (and
adequately) determined through experience rather than analysis.

In certain situations, round-off error can cause peculiar results, particularly if you should
compare the results of calculating integrals that are equivalent mathematically but differ by a
transformation of variables. However, you are unlikely to encounter such situations in typical
applications.

Shortening Calculation Time

The time required for f to calculate an integral 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 reduced. Two such
techniques are subdividing the interval of integration and transformation of variables.

Subdividing the Interval of Integration

In regions where the slope of f(x) is varying appreciably, a high density of sample points is
necessary to provide an approximation that changes insignificantly from one iteration to the
next. However, in regions where the slope of the function stays nearly constant, a high
density of sample points is not necessary. This is because evaluating the function at
additional sample points would not yield much new information about the function, so it
would not dramatically affect the disparity between successive approximations.
Consequently, in such regions an approximation of comparable accuracy could be achieved
with substantially fewer sample points: so much of the time spent evaluating the function in
these regions is wasted. When integrating such functions, you can save time by using the
following procedure:

1. Divide the interval of integration into subintervals over which the function is

interesting and subintervals over which the function is uninteresting.

2. Over the subintervals where the function is interesting, calculate the integral in the

display format corresponding to the accuracy you would like overall.

3. Over the subintervals where the function either is not interesting or contributes

negligibly to the integral, calculate the integral with less accuracy, that is, in a display
format specifying fewer digits.

Advertising