User Rpl Programming In Algebraic Mode - HP F2226A - 48GII Graphic Calculator User Manual

Graphing calculator
Table of Contents

Advertisement

IF trap-clause THEN error-clause END
IF trap-clause THEN error-clause ELSE normal-clause END
The operation of these logical constructs is similar to that of the IF ... THEN ...
END and of the IF ... THEN ... ELSE ... END constructs. If an error is
detected during the execution of the trap-clause, then the error-clause is
executed. Otherwise, the normal-clause is executed.
As an example, consider the following program (@ERR1) that takes as input two
matrices, A and b, and checks if there is an error in the trap clause: A b /
(RPN mode, i.e., A/b). If there is an error, then the program calls function
LSQ (Least SQuares, see Chapter 11) to solve the system of equations:
IFERR A b / THEN LSQ END »
»
«
«
A b
Try it with the arguments A = [ [ 2, 3, 5 ] , [1, 2, 1 ] ] and b = [ [ 5 ] , [ 6 ] ].
A simple division of these two arguments produces an error: /Error: Invalid
Dimension.
However, with the error-trapping construct of the program, @ERR1, with the
same arguments produces: [0.262295..., 0.442622...].

User RPL programming in algebraic mode

While all the programs presented earlier are produced and run in RPN mode,
you can always type a program in User RPL when in algebraic mode by using
function RPL>. This function is available through the command catalog. As
an example, try creating the following program in algebraic mode, and store
→ X '2.5-3*X^2' »
it into variable P2:
«
First, activate the RPL> function from the command catalog (‚N). All
functions activated in ALG mode have a pair of parentheses attached to their
name. The RPL> function is not exception, except that the parentheses must be
removed before we type a program in the screen. Use the arrow keys
(š™) and the delete key (ƒ) to eliminate the parentheses from the RPL>()
Page 21-66

Advertisement

Table of Contents
loading

This manual is also suitable for:

48gii

Table of Contents