HP 48gII Advanced User's Reference Manual page 97

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

MNX2 program listing
Program:
«
{{ "MAX"
« 10 SF CONT » }
{ "MIN"
« 10 CF CONT » }}
TMENU
"Sort for MAX or MIN?"
PROMPT
DUP OBJ
1
SWAP OBJ
DROP * 1 -
FOR n
DUP2
IF
> 10 FS? XOR
THEN
SWAP
END
DROP
NEXT
0 MENU
»
`OMNX2 K
Checksum: # 6992d
Bytes:
188.5
Example: Use MNX2 to find the minimum element of the matrix from the previous example:
Enter the matrix (or retrieve it from the previous example).
Comments:
Defines the temporary option menu. %MAX%
sets flag 10 and continues execution. %MIN%
clears flag 10 and continues execution.
Displays the temporary menu and a
prompting message.
Copies the array. Returns the individual array
elements to levels 2 through nm+1, and
returns the list containing n and m to level 1.
Sets the initial counter value.
Converts the list to individual elements on
the stack.
Drops the list size, then calculates the final
counter value (nm - 1).
Starts the FOR...NEXT loop.
Saves the array elements to be tested
(initially the last two elements). Uses the last
array element as the current minimum or
maximum.
Tests the combined state of the relative value
of the two elements and the status of flag 10.
If the new element is either less than the
current maximum or greater than the current
minimum, swaps the new element into level
1.
Drops the other element off the stack.
Ends the FOR...NEXT loop.
Restores the last menu.
Stores the program in MNX2.
12 56
45 1
9 14
RPL Programming Examples 2-19

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents