HP 50g User's Reference Manual
Download Advanced user's reference manual of HP 48gII Calculator for Free or View it Online on All-Guides.com.
Brand: HP
Category: Calculator
Type: Advanced user's reference manual
Model: HP 48gII , HP 49g+ , HP 50G
Pages: 693
RPL Programming Examples 2-19
MNX2 program listing
Program: Comments:
«
{{ "MAX"
« 10 SF CONT » }
{ "MIN"
« 10 CF CONT » }}
Defines the temporary option menu.
%MAX%
sets flag 10 and continues execution.
%MIN%
clears flag 10 and continues execution.
TMENU
"Sort for MAX or MIN?"
PROMPT
Displays the temporary menu and a
prompting message.
DUP OBJ→
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.
1
SWAP OBJ→
Sets the initial counter value.
Converts the list to individual elements on
the stack.
DROP * 1 -
Drops the list size, then calculates the final
counter value (nm - 1).
FOR n
Starts the FOR…NEXT loop.
DUP2
Saves the array elements to be tested (initially
the last two elements). Uses the last array
element as the current minimum or
maximum.
IF
> 10 FS? XOR
Tests the combined state of the relative value
of the two elements and the status of flag 10.
THEN
SWAP
END
If the new element is either less than the
current maximum or greater than the current
minimum, swaps the new element into level
1.
DROP
Drops the other element off the stack.
NEXT
Ends the FOR…NEXT loop.
0 MENU
Restores the last menu.
»
`O
MNX2 K
Stores the program in MNX2.
Checksum: # 6992d
Bytes: 188.5
Example: Use MNX2 to find the minimum element of the matrix from the previous example:
12 56
45 1
9 14
Enter the matrix (or retrieve it from the previous example).