252 Appendix E: A Detailed Look at f

The graph is a spike very close to the origin. (Actually, to illustrate f(x) the width of the spike has been considerably exaggerated. Shown in actual scale over the interval of integration, the spike would be indistinguishable from the vertical axis of the graph.) Because no sample point happened to discover the spike, the algorithm assumed that f(x) was identically equal to zero throughout the interval of integration. Even if you increased the number of sample points by calculating the integral in i9, none of the additional sample points would discover the spike when this particular function is integrated over this particular interval. (Better approaches to problems such as this are mentioned at the end of the next topic, Conditions That Prolong Calculation Time.)

You've seen how the falgorithm can give you an incorrect answer when f(x) has a fluctuation somewhere that is very uncharacteristic of the behavior of the function elsewhere. Fortunately, functions exhibiting such aberrations are unusual enough that you are unlikely to have to integrate one unknowingly.

Functions that could lead to incorrect results can be identified in simple terms by how rapidly it and its low-order derivatives vary across the interval of integration. Basically, the more rapid the variation in the function or its derivatives, and the lower the order of such rapidly varying derivatives, the less quickly will the f algorithm terminate, and the less reliable will the resulting approximation be.