Post Reply 
RPN and result storage in a variable
10-07-2020, 04:48 PM
Post: #1
RPN and result storage in a variable
Hello!

I'm quite new on an HP Prime but work with HP calculators starting in 1985 or 1986. First one was an HP 15C, lateron an HP 28S. The 15 is still up and working, the 28 has now trouble with keys. Therefore I changed to the Prime.

Naturally I want to work with RPN only but have problems. LLet me describe what happens:

- I perform a RPN calculation.
- The calculator delivers a result.
- I triy to store the result in a variable.
- whatever I try this does not work for me. Either I get a syntax error message or the variable only contains the value "0".

In CAS mode storing results in a variable works fine.

What do I do wrong?

Thanks for any help!

Rolf
Find all posts by this user
Quote this message in a reply
10-07-2020, 06:48 PM
Post: #2
RE: RPN and result storage in a variable
The good old HP48 method works in Prime too.
1) Put a number in the stack.
2) Put a variable/char in the stack. Use <Shift> () to evoke ' '. Enter a character (e.g., 'A' by using <ALPHA>) in the little square. Interestingly, strings won't be accepted. They will be broken down to chars separated by '*'.
3) The number is now in Position #2, the variable in Position #1.
4) Press 'STO', i.e., <Shift> EEX.
5) The variable disappears from the stack.
6) Recall the variable by evoking, e.g., 'A'.
7) Calculations may be performed in algebraic form, e.g., 'A*2'. A*2 appears in the stack. Press <Eval> to execute the calculation.

Hope this helps!
Frido
Find all posts by this user
Quote this message in a reply
10-08-2020, 01:16 PM
Post: #3
RE: RPN and result storage in a variable
Thank you very much Frido! That helps.

I have a printout of a HP tutorial in German language. That tells me something completely different and the method shown does not work.

But I also need variables with "real" names, e.g. "ledtube" or "ledbulb". Can you give me an idea how to enter such strings?

Thanks in advance
Rolf
Find all posts by this user
Quote this message in a reply
10-08-2020, 09:29 PM (This post was last modified: 10-08-2020 09:44 PM by Guenter Schink.)
Post: #4
RE: RPN and result storage in a variable
(10-08-2020 01:16 PM)hatchcanyon Wrote:  But I also need variables with "real" names, e.g. "ledtube" or "ledbulb". Can you give me an idea how to enter such strings?

I'd really suggest to get rid of RPN on the Prime. It's really not well implemented.

As far as I have experienced you need to create a variable with a longer name first before you can use it. My solution is a bit cumbersome, but it seems to work.

1. It doesn't matter what you have in the stack - that even may be empty
2. enter your variable name BUT don't press "ENTER"
3. press Sto> that is "Shift EEX"
4. acknowledge "Do you want to create a variable called xxxx"
5. get rid of what's in the entry line
6. check with "VAR" "User Variables" that your new variable exists.

An alternative, less cumbersome method, would be to create a program from which you export those names you wish to work with. It doesn't need to do something meaningful. Then these variables are accessible also from the VAR menu.

In order to store something, put the name in single qoutes and execute Sto>
To get the contents of the var simply recall its name

HTH Günter

PS: Did I mention already that the Prime is not well suited for RPN?

Edit: added the alternative method
Find all posts by this user
Quote this message in a reply
10-08-2020, 10:55 PM (This post was last modified: 10-08-2020 10:56 PM by Joe Horn.)
Post: #5
RE: RPN and result storage in a variable
(10-08-2020 01:16 PM)hatchcanyon Wrote:  But I also need variables with "real" names, e.g. "ledtube" or "ledbulb". Can you give me an idea how to enter such strings?

In RPN mode, if the variable does not exist yet:

(1) Put the desired value on the stack.
(2) Type the desired name on the command line without quotes.
(3) Press Enter twice to create the variable.
(4) Press Shift parentheses to put two single quotes on the command line.
(5) Press Shift Paste (to fetch your variable name)
(6) Press Enter twice to put it on the stack.
(7) Press Sto.

The above looks long but it's fast when you get used to doing it.

In RPN mode, after the variable exists, use the Vars User menu to retype the variable name.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
10-09-2020, 12:38 PM
Post: #6
RE: RPN and result storage in a variable
Thanks Joe & Guenter, that works! The only thing to mention is that a '0' is pushed into the stack once you confirm that you want to create a new variable. Probably it is the value of the variable that is called into the stack when it is created. Indeed, RPN is not the forte of the HP Prime.
Find all posts by this user
Quote this message in a reply
10-09-2020, 08:53 PM
Post: #7
RE: RPN and result storage in a variable
(10-08-2020 09:29 PM)Guenter Schink Wrote:  
(10-08-2020 01:16 PM)hatchcanyon Wrote:  But I also need variables with "real" names, e.g. "ledtube" or "ledbulb". Can you give me an idea how to enter such strings?

An alternative, less cumbersome method, would be to create a program from which you export those names you wish to work with. It doesn't need to do something meaningful. Then these variables are accessible also from the VAR menu.

Even easier, to create a variable name beforehand - type the name and ENTER twice, there it is.

Günter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)