beautypg.com

HP 15c User Manual

Page 197

background image

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 vvv, before you execute the
subroutine.

Example: The Bessel function of the first kind of order 1 can be expressed
as

.

)

sin

-

(

cos

π

1

)

(

π

0

1

θ

x

x

J

Find

.

)

sin

-

(

cos

π

1

)

(

π

0

1

θ

1

J

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.