Post Reply 
HP 41C Matrix Sort X-memory
10-11-2015, 11:44 PM
Post: #1
HP 41C Matrix Sort X-memory
I know it is possible to sort data registers, i.e. R01-Rnn. The matrix functions in the Advantage Pac provide read/write access in extended memory. I wonder if it can be done on a matrix stored in extended memory? There is no direct sort function, maybe a sort using the stack?
Find all posts by this user
Quote this message in a reply
10-12-2015, 05:28 AM (This post was last modified: 10-12-2015 05:39 AM by Ángel Martin.)
Post: #2
RE: HP 41C Matrix Sort X-memory
(10-11-2015 11:44 PM)mbrethen Wrote:  I know it is possible to sort data registers, i.e. R01-Rnn. The matrix functions in the Advantage Pac provide read/write access in extended memory. I wonder if it can be done on a matrix stored in extended memory? There is no direct sort function, maybe a sort using the stack?

Function MSORT in the SandMatrix does the job. You could also write a short FOCAL program that takes advantage of the SORTFL function from the OS/X module (originally also available in the CCD Module) - but that would probably mess up the header registers. The SandMatrix code is compatible with main and X-Mem locations for the matrix as well.
Find all posts by this user
Quote this message in a reply
10-12-2015, 03:49 PM
Post: #3
RE: HP 41C Matrix Sort X-memory
Thanks, I'll take a look.
Find all posts by this user
Quote this message in a reply
10-17-2015, 01:59 AM (This post was last modified: 10-17-2015 01:55 PM by mbrethen.)
Post: #4
RE: HP 41C Matrix Sort X-memory
My 41CL doesn't have the SandMatrix module, but I wrote a focal program that uses the 'S2' program on the PPC module:

Code:
LBL "SAS"       ;; small array sort
SIZE?
DIM?
INT
1

X>Y?
PSIZE 
DSE X
ASTO Z
"R"
MATDIM
CLA
ARCL Z
>",R"
CLST
MMOVE 
DIM? 
INT
1 E-3
*
ISG X
XROM "S2"
CLA
END

I used this to sort the residuals from a multiple linear regression,

-21.5
-21.26
-20.53
-16.43
-12.12
-4.15
-2.08
-1.04
0.09
7.11
9.71
10.23
11.54
11.94
23.05
25.43

Using the standard normal table to calculate the z value for each point, my goal is to create an x-y scatter plot to see how normal are the residuals.
Find all posts by this user
Quote this message in a reply
10-17-2015, 03:25 PM (This post was last modified: 10-17-2015 04:43 PM by mbrethen.)
Post: #5
RE: HP 41C Matrix Sort X-memory
If I'm not mistaken, the graphing calculators (HP-28, HP-48, etc.) can handle X-Y scatter plots, but I don't know how they accomplish this. Has anyone tried this on a 41C using the plotting functions available? PRAXIS, REGPLOT and STKPLOT give the user control over how data points are plotted.

The purpose of a scatter plot is to visually show the relationship between two sets of data. Considering the data above, and given the limited resolution of, say the HP 82240B printer, it might suffice to round each point to the nearest integer. The smallest resolution then would be a unit step. Using a unit step on the rounded values yields ~47 data points. Points for which no data is given could be assigned a function, or y, value of zero. Alternately, the "MP" program on the PPC module has an overflow mode such that they "disappear" off the edge of the plot. The algorithm would determine the appropriate step size for the general case. Does this sound like a reasonable approach?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)