RPL Programming Examples 2-13
Program: Comments:
LS_#!4KL2!
!
G!#E6D:!
!
Q8!{:6E<!
!
^!KLEE4!
!
=<T:!
Puts the row elements on the
stack. Drops the index list { n }.
Makes an n-element list.
Sorts the list and calculates its
median.
Moves the median to the proper
stack level.
Increments j and repeats the loop.
o!#BKKP!
!
!
Z!D:L\!
!
»!
Combines all the medians into an
m-element vector.
Restores
Σ
DAT to its previous
value.
Ends the defining procedure.
»
`OMEDIAN K
Stores the program in MEDIAN.
Checksum: # 50773d
Bytes: 136
Example: Calculate the median of the following data.
18 12
47
32
11 1
31 48
20 17
There are two columns of data, so MEDIAN will return a two-element vector.
Enter the matrix.
‚Ù%OK% %EDIT
18 `12 `˜šš
4 `7 `
3 `2 `
11 `1 `
31 `48 `
20 `17 `
` %OK%
The matrix is now stored in
Σ
DAT.
Calculate the median.
J %MEDIA%
Clear approximate mode (set exact mode) before going on to the next example.