[comp.sys.handhelds] Matrix Operations in 48SX?

keho@quads.uchicago.edu (david kehoe) (04/19/91)

How do I program my 48SX to do operations within a matrix?
In other words, suppose I want to do a weighted average, e.g.
I own 20% of something worth $100, 30% of something worth $250,
and 50% of something worth $275.  The matrix would look like
this:

.20	100
.30	250
.50	275

I'd like a program that would do .2*100 + .3*250 + .5*275 = 232.5.
Of course, I actually want to do much more complicated things,
like the covariance of a portfolio of stocks.  This is easy with
a spreadsheet, but I don't see how to do it on the 48SX.

Also, I think I'll buy a cable to my SE/30 -- anything I should
know before I buy?  And has anyone seen business applications
cards for the 48SX?  I'd like the functions in my 19BII, plus
functions like covariance of portfolios.

BTW, if anyone is about to tell me that there is a covariance
function in the paired-sample statistics, stock portfolio
valuation calculates covariances in a different way.  They
also calculate variance and correlation differently.  Most
annoying.
-- 
"Why my thoughts are my own, when they are in, but when they are out
they are another's." - Susanna Martin, executed for witchcraft, 1681.
Dave Kehoe  keho@midway.uchicago.edu  (312) 753-0119

keho@quads.uchicago.edu (david kehoe) (04/20/91)

>.20	100
>.30	250
>.50	275
>
>I'd like a program that would do .2*100 + .3*250 + .5*275 = 232.5.

A friend just clued me into the DOT function.  But now to calculate
variances of stock portfolios, I have matrixes that look like this:

.081	.0137	.1
.081	.0137	.2
.014	.0137	.4
-.054	.0137	.2
-.054	.0137	.1

I need to calculate (.081-.0137)^2*.1 + (.081-.0137)^2*.2 etc.
In other words, subtract the 2nd column from the 1st column, square them,
multiply by the third column, and then sum the values.  Easy to do in
a spreadsheet -- can I write a program that will do this to
a matrix?
-- 
"Why my thoughts are my own, when they are in, but when they are out
they are another's." - Susanna Martin, executed for witchcraft, 1681.
Dave Kehoe  keho@midway.uchicago.edu  (312) 753-0119