RPL Programming Examples 2-29
Program: Comments:
<=4!*!'!
Append the function to the end of
the list.
1!
End the local variable defining
procedure.
<ED<!3!#E6D:!DYB2!4KL2
For functions with no arguments,
converts to a simple list.
<=4!
End the IF…THEN…
ELSE…END structure.
1!
`O"RPN K!
Stores the program in "RPN.
Checksum: # 1522d
Bytes: 181.0
Example: Convert the following algebraic expression to a series of objects in RPN syntax: !
+B.OLD-S'~-O,4//0TWV+.!
OA *TB +R!Ü
C /D ™™-X Q3 `%²RPN%
Bessel Functions
This section contains a program, BER, that calculates the real part Ber
n
(x) of the Bessel function Jn (xe
3
π
i/4
).
When n = 0,
Ber x() 1
x 2⁄()
4
2!
2
-----------------
–
x 2⁄()
8
4!
2
-----------------
…–+=
Level 1 " Level 1
z
"
Ber(z)
Techniques used in BER
! Local variable structure. At its outer level, BER consists solely of a local variable structure and so has two
properties of a user-defined function: it can take numeric or symbolic arguments from the stack, or it can take
arguments in algebraic syntax. However, because BER uses a DO…UNTIL…END loop, its defining
procedure is a program. (Loop structures are not allowed in algebraic expressions.) Therefore, unlike user-
defined functions, BER is not differentiable.
! DO…UNTIL…END loop (indefinite loop with counter). BER calculates successive terms in the series
using a counter variable. When the new term does not differ from the previous term to within the 12-digit
precision of the calculator, the loop ends.
! Nested local variable structures. The outer structure is consistent with the requirements of a user-defined
function. The inner structure allows storing and recalling of key parameters.