Chapter 21 programming in user rpl language, An example of programming, An example of programming ,21-1 – HP 50g Graphing Calculator User Manual
Page 648
Page 21-1
Chapter 21
Programming in User RPL language
User RPL language is the programming language most commonly used to
program the calculator. The program components can be put together in the
line editor by including them between program containers « » in the
appropriate order. Because there is more experience among calculator users in
programming in the RPN mode, most of the examples in this Chapter will be
presented in the RPN mode. Also, to facilitate entering programming
commands, we suggest you set system flag 117 to SOFT menus. The programs
work equally well in ALG mode once they have been debugged and tested in
RPN mode. If you prefer to work in the ALG mode, simply learn how to do the
programming in RPN and then reset the operating mode to ALG to run the
programs. For a simple example of User RPL programming in ALG mode, refer
to the last page in this chapter.
An example of programming
Throughout the previous Chapters in this guide we have presented a number of
programs that can be used for a variety of applications (e.g., programs CRMC
and CRMT, used to create a matrix out of a number of lists, were presented in
Chapter 10). In this section we present a simple program to introduce concepts
related to programming the calculator. The program we will write will be used
to define the function f(x) = sinh(x)/(1+x
2
), which accepts lists as argument
(i.e., x can be a list of numbers, as described in Chapter 8). In Chapter 8 we
indicated that the plus sign, , acts as a concatenation operator for lists and not
to produce a term-by-term sum. Instead, you need to use the ADD operator to
achieve a term-by-term summation of lists. Thus, to define the function shown
above we will use the following program:
«
'x' STO x SINH 1 x SQ ADD / 'x' PURGE
»
To key in the program follow these instructions:
Keystroke sequence:
Produces:
Interpreted as:
‚å
«
Start an RPL program
[']
~„x™K
'x' STO
Store level 1 into variable x
~„x
x
Place x in level 1
„´
@)HYP @SINH
SINH
Calculate sinh of level 1
1
#~„x „º
1 x SQ
Enter 1 and calculate x
2