Create an account on the HP Community to personalize your profile and ask a question
11-23-2017 07:38 PM
Hello HP Community ,
I wanna know how to write and store matrix using LIBEVAL function ( or command ) , or some other function ( command ) if possible , in ALGEBRAIC Calculator mode .
But in the End , I want that function or command whatever to me , works in RPN mode and Algebraic mode , or if possible only in Algebraic mode , of course .
If You did not understand me , I , of course , write that code in RPN mode , but i want for that program to work properly (when I am excecuting him) in Algebraic mode , not getting an error or something else.
I know thath when I'm in RPN Calculator mode i write that like , let's use my matrix is AAA , :
<< # A2012h LIBEVAL
5 AAA * 'B' STO
Let's suppose that B is matrix multiplied with factor ( number ) 5 , and stored like matrix.
When I use that code I did not get any ERROR at all , because I work in RPN Calculator mode , but when i switched my Calculator mode into Algebraic , problems started for me .
How to solve that problem ?
I will purchase some pictures , that you Can see that
If anyone have an answer please reply !!
Thank you .
I get error , i dont get it , everything looks well in RPN mode but now ...
Excuse me error is ...
I dont know how to solve that ...
Anyone If anyone knows thanks a lot !!!
Solved! Go to Solution.
11-24-2017 07:22 AM
#A2012h LIBEVAL activates the same functionality as if you pressed LS ' (MTRW key). Your program works in RPN mode because the result is returned to stack level 1 in that mode. In algebraic mode, MTRW simply returns the matrix to the command line in string form, awaiting any further key presses (further editing, ENTER, or CANCEL). As such, in that mode there's nothing yet "on the stack" ready to be stored. Hence the error.
The easiest way to avoid this problem is simply not to use algebraic mode. If for some reason you must, you could encapsulate the LIBEVAL call within a "forced RPN block" as follows:
« PUSH -95 CF #A2012h LIBEVAL POP 'AAA' STO 5 AAA * 'B' STO »
PUSH saves the current flag settings, -95 CF sets the calculator to RPN mode, then POP restores the flag settings. This makes sure that the LIBEVAL call will always be run in RPN mode, regardless of the calculator's current setting.
11-24-2017 07:47 AM
As you are using LIBEVAL, I would suggest you continue using RPN mode.
(similarly if you use SYSEVAL or FLASHEVAL, as these xEVAL commands access functions directly and bypass error traps - this can lead to memory corruption or calculator crash if done incorrectly)
Several differences in syntax between RPN and ALG modes.
The syntax to execute a program:
for example a program named MYPRG that takes variables A and B as inputs
then execute MYPRG
on the stack enter:
then press ENTER to execute
Other differences with respect to your program:
The syntax for storing a variable differs for ALG mode.
To store value in variable A
RPN: value 'A' STO
ALG: value STO> A
The syntax for operators is different, multiplication example:
To multiply value 1 & 2
RPN: value1 value2 *
ALG: value1 * value2
11-24-2017 10:11 AM
thank you college ,
I wanna know also how to write , as example when I'm going to calculate addition of number one and two in one cell of matrix ( or maybe more of them ) , when I'm going to function that You write in code frame I Can go to the Algebraic mode and store the result matrix , but when I want to calculate the addition ( or multiplication ) of two numbers I must enter that numbers and operator between
them like I am in RPN mode ( 1 2 + ) , so how to calculate 1+2 in one cell of matrix without using sign '1+2' , i want to calculate that number directly in Algebraic mode as 1+2 .
I will show You my procedure in down picture ...
11-24-2017 01:28 PM
Perhaps you're starting to understand why mixing operating modes is a messy concept on the 50g. The program in my previous reply sets RPN mode exclusively before the matrix writer is invoked (regardless of your current mode), so the data entry it accepts is limited to valid RPN expressions.
A different approach can be used that leaves the mode intact (therefore allowing algebraic expressions while in that mode), but I haven't tested it thoroughly and it may present other problems. It attempts to simulate the ENTER key being pressed after the matrix writer is invoked in algebraic mode, which may not even be a reasonable thing to do (depends on what the user did). I haven't done extensive testing with this, but it appears to work in the case where you simply add some entries in the matrix writer and press enter to continue:
IF -95 FS? THEN
5 AAA * 'B' STO
I also avoided the use of the LIBEVAL by using KEYEVAL, which is generally safer.
I still recommend that you simply stick with RPN mode, though. You seem to be the type of person who wants to customize and automate your use of the 50g, and you will ultimately find more success sticking with RPN operations.
11-24-2017 04:07 PM
Thank you David_M you show me the best answer , now I am going to calculate a squareroot , inverse , square , ... i don't know what else I can do with your "advice" ,..., and with no any problem in Algebraic calculator mode.
Ok I now that is very complicated to work with mixing calculator modes .
It is very useful to do some operations ( for me ) in Algebraic mode because when I am going to write some "heavy" equation ... as example squareroot of a squared plus b squared ... or some heavier function , the easy way to do this is with Algebraic calculator mode.
Anyway thank you , thank you , thank you , you give me an answer on question which I thought for solution at least two weeks