HP Forums
(49G) (50G) Matrix from HP —>Transform to Maxima software format - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49G) (50G) Matrix from HP —>Transform to Maxima software format (/thread-18880.html)



(49G) (50G) Matrix from HP —>Transform to Maxima software format - Gil - 09-26-2022 08:58 AM

New versions #2 and #3
included here
Improvement of the Matrix output in HP50G —> for instance, when integer, no points shown for the number
(for example 3 is simply noted 3, and not 3.); EXPAND command abandoned.

Suppose you want to check a Matrix with real numbers,
from what you have on your HP50G stack,
in MAXIMA software (or the reverse: from MAXIMA software to HP50G).

As the Matrixes formats are different in HP50G/MAXIMA, you have to adapt THEM (change double [[ by single [, add, between numbers instead o having blank spaces, etc., or the reverse).

Here are 2 small, elementary programs that might help you and do all the work (hand replacements/manipulations) for you.

For the above
(HP50G Matrix to command line in MAXIMA Matrix):
1) Put/leave your matrix — mandatory to be a real matrix — in stack level 1 of the HP50G.
2) Immediately after 1), run in your HP50G the attached program HP_MA.Doc
(you can save that program under HP_MA).
3) Immediately after 2), use "Copy Stack" instruction of the EMU48 application to copy the resulting string.
4) Go into MAXIMA software and paste "normally" the copied result in its command line.
5) Press then ; or ENTER, and you will see your former HP50G Matrix
appear under MAXIMA, nice & compatible format.

For the reverse operation
(MAXIMA Matrix to be used further in HP50G Stack level 1):
1) In MAXIMA software, position yourself on the requested Matrix and copy it (i.e. the full command line).
2) Go into HP50G and use "Paste Stack" instruction of the EMU48 application to paste the resulting string into HP50G stack level 1.
3) Immediately after 2, run in your HP50G the attached program MA_HP.Doc
(you can save that program under MA_HP).
Then you will see appear your former MAXIMA Matrix under HP50G, familiar & nice format.

Here are the codes

HP_MA
HPMAX
« "VERS 2

1)Matrix in
HP Stack as ARG
 Run here HPMA(XIMA)
3)Copy resulting
string into
MAXIMA software
" DROP RCLF  f
« STD -51 CF STR "[[ " "[" SREPL DROP " ]]" "]" SREPL DROP "[ " "[" SREPL DROP " ]
" "]," SREPL DROP " " "," SREPL DROP "'" "" SREPL DROP ")" + "matrix(" SWAP + "Copy string Stack1
 MAXIMA software" SWAP f STOF
»
»

Or
"\\<< \"VERS 2

1)Matrix in
HP Stack as ARG
\\-> Run here HP\\->MA(XIMA)
3)Copy resulting
string into
MAXIMA software
\" DROP RCLF \\-> f
\\<< STD -51 CF \\->STR \"[[ \" \"[\" SREPL DROP \" ]]\" \"]\" SREPL DROP \"[ \" \"[\" SREPL DROP \" ]
\" \"],\" SREPL DROP \" \" \",\" SREPL DROP \"'\" \"\" SREPL DROP \")\" + \"matrix(\" SWAP + \"Copy string Stack1
\\-> MAXIMA software\" SWAP f STOF
\\>>
\\>>

" MA_HP
« "VER 3c
1) Copy Matrix
from MAXIMA software
into HP Stack here
2) The resulting
string is the ARG
 Run hereMA(XIMA)HP
" DROP RCLF  f
« STD -3 CF -51 CF -105 CF ",[" "[" SREPL DROP "[" "['" SREPL DROP "]" "']" SREPL DROP "," "''" SREPL DROP ".]" "]" SREPL DROP "matrix(" "[" SREPL DROP "])" "]" SREPL DROP "./" "/" SREPL DROP ".'" "'" SREPL DROP ". " " " SREPL DROP OBJ DUP  m
« SIZE OBJ DROP * 1 SWAP
FOR i m i GET NUM DUP FP 0 ==
IF
THEN RI m i ROT PUT 'm' STO
ELSE DROP
END
NEXT m STR OBJ
» f STOF
»
» "

Or
\\<< \"VER 3c
1) Copy Matrix
from MAXIMA software
into HP Stack here
2) The resulting
string is the ARG
\\-> Run hereMA(XIMA)\\->HP
\" DROP RCLF \\-> f
\\<< STD -3 CF -51 CF -105 CF \",[\" \"[\" SREPL DROP \"[\" \"['\" SREPL DROP \"]\" \"']\" SREPL DROP \",\" \"''\" SREPL DROP \".]\" \"]\" SREPL DROP \"matrix(\" \"[\" SREPL DROP \"])\" \"]\" SREPL DROP \"./\" \"/\" SREPL DROP \".'\" \"'\" SREPL DROP \". \" \" \" SREPL DROP OBJ\\-> DUP \\-> m
\\<< SIZE OBJ\\-> DROP * 1 SWAP
FOR i m i GET \\->NUM DUP FP 0 ==
IF
THEN R\\->I m i ROT PUT 'm' STO
ELSE DROP
END
NEXT m \\->STR OBJ\\->
\\>> f STOF
\\>>
\\>>"


Regards,
Gil Campart


RE: HP49-50G : Matrix from HP —>Transform to Maxima software format - Gil - 09-28-2022 11:37 PM

Thanks a suggestion of DavidM, here is a slightly improved version.

From MA—>HP
\<< "VER 3d
1) Copy Matrix
from MAXIMA software
into HP Stack here
2) The resulting
string is the ARG
\-> Run hereMA(XIMA)\->HP
" DROP RCLF \-> f
\<< STD -3 CF -51 CF -105 CF ",[" "[" SREPL DROP "[" "['" SREPL DROP "]" "']" SREPL DROP "," "''" SREPL DROP ".]" "]" SREPL DROP "matrix(" "[" SREPL DROP "])" "]" SREPL DROP "./" "/" SREPL DROP ".'" "'" SREPL DROP ". " " " SREPL DROP OBJ\-> :: EVAL MAP f STOF
\>>
\>>

Regards,
Gil