Section 14: Numerical Integration 197
Before calling the subroutine you provide to evaluate f (x), the f
algorithm—just like the _ algorithm—places the value of x in the
X-, Y-, Z-, and T-registers. Because every stack register contains the x-
value, your subroutine can calculate with this number without having to
recall it from a storage register. The subroutines in the next two examples
take advantage of this feature. (A polynomial evaluation technique that
assumes the stack is filled with the value of x is discussed on page 79.)
Note: Since the calculator puts the value of x into all stack
registers, any numbers previously there will be replaced by x.
Therefore, if the stack contains intermediate results that you’ll
need after you calculate an integral, store those numbers in
storage registers and recall them later.
Occasionally you may want to use the subroutine that you wrote
for the f operation to merely evaluate the function at some
value of x. If you do so with a function that gets x from the stack
more than once, be sure to fill the stack manually with the value
of x, by pressing v v v, before you execute
the subroutine.
Example: The Bessel function of the first kind of order 1 can be expressed
as
J
1
(x) =
1
0
cos (θ − x sin θ) dθ.
Find J
1
(1) =
1
0
cos (θ − sin θ) dθ.
Key in the following subroutine that evaluates the function
f(θ) = cos (θ − sin θ).
Keystrokes Display
| ¥
000-
Program mode.
´ b 1
001-42,21, 1
Begin subroutine with a label.