238 Appendix D: A Detailed Look at _
Examine the behavior of the deflated function at x-values near the
known root. If the function’s calculated values cross the x-axis
smoothly, either another root or a greater multiplicity is indicated.
Analyze the original function and its derivatives algebraically. It
may be possible to determine its behavior for x-values near the
known root. (A Taylor series representation, for example, may
indicate the multiplicity of a root.)
Limiting the Estimation Time
Occasionally, you may desire to limit the time used by _ to find a
root. You can use two possible techniques to do this—counting iterations
and specifying a tolerance.
Counting Iterations
While searching for a root, _ typically samples your function at
least a dozen times. Occasionally, _ may need to sample it one
hundred times or more. (However, _ will always stop by itself.)
Because your function subroutine is executed once for each estimate that
is tried, it can count and limit the number of iterations. An easy way to do
this is with an I instruction to accumulate the number of iterations in
the Index register (or other storage register).
If you store an appropriate number in the register before using _,
your subroutine can interrupt the _ algorithm when the limit is
exceeded.
Specifying a Tolerance
You can shorten the time required to find a root by specifying a tolerable
inaccuracy for your function. Your subroutine should return a function
value of zero if the calculated function value is less than the specified
tolerance. This tolerance that you specify should correspond to a value
that is negligible for practical purposes or should correspond to the
accuracy of the computation. This technique eliminates the time required
to define the estimate more accurately than is justified by the problem.
(The example on page 224 uses this method.)