HP 48gII Advanced User's Reference Manual Page 90

Graphing calculator.

Techniques used in MEDIAN
Arrays, lists, and stack elements. MEDIAN extracts a column of data from DAT in vector form. To
!
convert the vector to a list, MEDIAN puts the vector elements on the stack and combines them into a list.
From this list the median is calculated using %TILE.
The median for the mth column is calculated first, and the median for the first column is calculated last. As
each median is calculated, ROLLD is used to move it to the top of the stack.
After all medians are calculated and positioned on the stack, they're combined into a vector.
FOR...NEXT (definite loop with counter). MEDIAN uses a loop to calculate the median of each
!
column. Because the medians are calculated in reverse order (last column first), the counter is used to reverse
the order of the medians.
Required Program
%TILE (page 2-10) sorts a list and returns the value of a specified percentile.
!
MEDIAN program listing (Note: Use approximate mode for this program and example).
Program:
«
RCL...
DUP SIZE
OBJ DROP
 s n m
«
2-12 RPL Programming Examples
'...DAT' TRN
1 m
FOR j
...-
Puts a copy of the current
statistics matrix DAT on the
stack.
Puts the list { n m }on the stack,
where n is the number of rows in
DAT and m is the number of
columns.
Puts n and m on the stack, and
drops the list size.
Creates local variables for s, n,
and m.
Begins the defining procedure.
Recalls and transposes DAT.
Now n is the number of columns
in DAT and m is the number of
rows. (To key in the ... character,
press @½, then delete the
parentheses.)
Specifies the first and last rows.
For each row, does the following:
Extracts the last row in DAT.
Initially this is the mth row, which
corresponds to the mth column in
the original DAT.
(To key in the
command, use
@µ.) 49g+

Comments to this Manuals

Symbols: 0 