HP Forums
HP-50g - Define functions with matrices inside - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP-50g - Define functions with matrices inside (/thread-21819.html)



HP-50g - Define functions with matrices inside - slavhp - 05-31-2024 12:50 AM

Just buy a HP-50g, so i'm still a newbie here.

I need to define some functions with matrices inside, but it seem impossible.

An example:

DEFINE(A(M,R)=M*[[COS(R),1][1,COS(R)]])
or anything that contains a matrix inside, like:
DEFINE(A(B)=B*[[1,1][1,1]])

I'm writing the matrices with matrix writer.
Algebric mode
The "define" works well with every operation so far, but when I try to put any matrix inside, it shows "Bad argument type" error.

Thanks and sorry for the newbie question!


RE: HP-50g - Define functions with matrices inside - roem76 - 05-31-2024 02:52 PM

I couldn't make it work in ALG-mode either but I have to say I'm not used to ALG-mode.

But it's rather easy to create a small RPN-program that takes two arguments (M and R) from the stack and does what you want. Not sure how to program that in ALG-Mode though.

Program listing in RPN

\<< \-> M R
\<< [[ 'COS(R)' 1 ][ 1 'COS(R)' ]] M * \->NUM \>>
\>>

'A'
STO // store the program in A

How to use it in RPN-mode:
1.5 // M
30.0 // R
[A] // with softmenu, press [VAR] and [NXT] till you see [A]

Output:
[[ 1.2990 1.5000 ][ 1.5000 1.2990]]

But once created it will work in ALG-mode as well:
'->NUM(A(1.5,30.0))' // ->NUM from the cat menu

HTH
Roman