Appendix D: A Detailed Look at _ 239

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 justify by the problem. The example on page 224 uses this method.)

For Advanced Information

In the HP-15C Advanced Functions Handbook, additional, advanced techniques and applications for using _ are presented. These topics include:

Using _with polynomials.

Solving a system of equations.

Finding local extremes of a function.

Using _for financial problems.

Using _in Complex mode.

Solving an equation for its complex roots.

Page 239
Image 239
HP 15c Scientific manual For Advanced Information, Counting Iterations, Specifying a Tolerance