HP Forums
Basic operations with matrix in a program ... - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Basic operations with matrix in a program ... (/thread-15088.html)



Basic operations with matrix in a program ... - jtamezga - 05-29-2020 05:11 PM

How can you get the average or quartile1 or covariance of a matrix in a program?

Hp Prime can get special functions like eigenvalues of any matrix in a program, but simple stat commands gives a "undef" message ...

EXPORT Destats()
BEGIN
LOCAL mat, res;
res:=[[1],[1]];
IF M0=[[0]] THEN
mat:=EDITMAT(M0);
//RETURN M0;
ELSE
INPUT({{M0,[4]}},"Matrix");
mat:=M0;
//RETURN mat;
END;
res(1,1):=23;
res(2,1):=quartile1(mat);
EDITMAT(res);
END;


RE: Basic operations with matrix in a program ... - victorvbc - 05-29-2020 06:02 PM

These are CAS commands, you can execute them in PPL three ways, as far as I know.

1. Use a "CAS." prefix. Ex.: CAS.covariance();

2. Execute the comand as a string with CAS("");

3. Make your program a CAS function by checking the box when creating it, this will automatically add #cas and #end to it.


RE: Basic operations with matrix in a program ... - StephenG1CMZ - 05-29-2020 07:46 PM

If the built-ins don't help, you might find some of the Basic Linear Algebra Subprograms (BLAS Level 1) useful.

https://www.hpmuseum.org/forum/thread-13613.html