Post Reply 
User Defined Variables within SOLVE Application
12-27-2013, 05:28 AM
Post: #1
User Defined Variables within SOLVE Application
Hi all,

Have had my HP Prime for a few weeks now & just starting to migrate (manually) many of the equations I use on my HP50G & HP48 series calculators.

I am aware of a number of previous posts regarding issues with the creation & use of other variable names but none of them seem to adequately cover this topic & in particular what I am trying to do in the SOLVE application.

As per my past practice, I am trying to utilise variable names in equations that are meaningful & easy to remember so I first created/defined some USER variables in HOME via VARS>USER> such as: Ta, HC etc. This seemed to work fine & the variables now appear in MEMORY with an initial REAL value of 0. However, when I try to add the equation using these variables in the SOLVE application the equation is automatically altered such that variables like TC are converted to T*C (implied multiplication) & I can't seem to find a way around this. Whilst it is easy to stick with single capital letter variables in SOLVE, I would rather use more familiar terminology & hence have the following questions:

1) Is it possible to use variables consisting of 2 letters or a letter & number in applications such as SOLVE?
2) If the answer to 1) is yes, can these consist of a mix of upper & lower case letters?
3) How is it best to create these variables as my attempt to previously define USER variables didn't seem to work?

The above was all performed with the calculator in RPN within the HOME option & not CAS. Also, running latest firmware version 5447 (25/11/2013) on my calculator.

Any help would be much appreciated & the answers can also perhaps assist others that are just commencing their HP Prime journey.

Cheers,

Michael
Find all posts by this user
Quote this message in a reply
12-27-2013, 10:34 AM
Post: #2
RE: User Defined Variables within SOLVE Application
(12-27-2013 05:28 AM)Michael Lopez Wrote:  1) Is it possible to use variables consisting of 2 letters or a letter & number in applications such as SOLVE?
2) If the answer to 1) is yes, can these consist of a mix of upper & lower case letters?
3) How is it best to create these variables as my attempt to previously define USER variables didn't seem to work?

Any help would be much appreciated & the answers can also perhaps assist others that are just commencing their HP Prime journey.

Cheers,

Michael

Hi,
I believe you can achieve this only by pre-defining the variables prior to starting the solver. If you try to define them "on the fly" implied multiplication occurs. You need to be careful of letter/number combinations that might be interpreted as an inbuilt variable (M1, L1 etc.)

Cheers, Terje
Find all posts by this user
Quote this message in a reply
12-27-2013, 10:32 PM
Post: #3
RE: User Defined Variables within SOLVE Application
Hi Terje & thanks for the response.

I pre-defined the variables (in user variables as explained above) then opened the SOLVE application but unfortunately this didn't work. Hopefully there is another way of achieving what I would like to do.

Cheers,

Michael
Find all posts by this user
Quote this message in a reply
01-01-2014, 03:37 PM
Post: #4
RE: User Defined Variables within SOLVE Application
(12-27-2013 10:32 PM)Michael Lopez Wrote:  Hi Terje & thanks for the response.

I pre-defined the variables (in user variables as explained above) then opened the SOLVE application but unfortunately this didn't work. Hopefully there is another way of achieving what I would like to do.

Cheers,

Michael


Michael,

I am not sure what you mean when you say you pre-defined the variables in user variables. In any event this is what I did.

First pictures, trying to enter TA and TB in Solve

[Image: attachment.php?aid=100] [Image: attachment.php?aid=101]
(Implied multiplication happens)


Next pictures creating variable TB (Hit enter after putting TB on line)
[Image: attachment.php?aid=102] [Image: attachment.php?aid=103]

Entering the new variable into the solver
[Image: attachment.php?aid=104] [Image: attachment.php?aid=105]

Hope this helps

Cheers, Terje
Find all posts by this user
Quote this message in a reply
01-12-2014, 08:14 PM
Post: #5
RE: User Defined Variables within SOLVE Application
Hi Michael,

I've been looking at this as well. Im no expert, just learning from scratch.

It seems that although you can save an equation as a Home User Variable, say using F_P1:=fv=pv*(1+rate)^periods, you will have issues:
- You get a syntax error after you store the equation - even though it shows up in User Var properly
- If you try to assign it to a Solver APP with say Solve.E1:=F_P1 you will see 0 in E1: of the Solver App. Looks like its evaluating the variables ahead of time
- You get a syntax error if you try to type the equation (fv=pv*(1+rate)^periods) directly into Solver APP

So, I have tended to use CAS mode and saved equations in CAS variables:
- F_P1:=fv=pv*(1+rate)^periods // stores in Vars>CAS>All
- Solve.E1:=F_P1 // stores F_P1 contents into Solver APP E1:
- In Solve APP, will ask you to create new user vars fv, pv, rate, periods. say yes.
- Solver APP now works. Note - you can add multiple/simultaneous equations.
- You may want to delete the new User Variables just created after leaving Solve APP.

Best,
Carl
Find all posts by this user
Quote this message in a reply
01-15-2014, 10:09 AM
Post: #6
RE: User Defined Variables within SOLVE Application
Hi Terje & Carl,

Thank you very much for your comprehensive suggestions/examples & sorry to take a while to respond.

The fundamental (some might even say basic problem :-( ) I experienced at the beginning with the SOLVE application was that despite creating the multi-letter user variables before hand, when I typed them into SOLVE they were treated as separate variables. It did however dawn on me the day after I wrote the original post that the way to insert multi-letter (or letter-number) variables in equations within SOLVE was to press the VARS key & insert them from there instead of typing them in. This has worked fine & I've since used it many times.

Have now created quite a number of customised SOLVE applications with multiple equations & am still astonished by the speed of the PRIME which seems to be many times faster than my HP 50Gs. However, I have discovered some limitations in the SOLVE algorithm that I've never experienced in the HP 48 or HP50 series before (using their multiple equation solvers). I'll write a separate post on this as there are many things to like about the SOLVE implementation on the PRIME & it would be great if we can keep improving it.

In the meantime I hope this basic information on how to insert user defined variables helps others.

Cheers,

Michael
Find all posts by this user
Quote this message in a reply
02-28-2014, 07:28 AM (This post was last modified: 02-28-2014 08:58 AM by Stevetuc.)
Post: #7
RE: User Defined Variables within SOLVE Application
(01-01-2014 03:37 PM)Terje Vallestad Wrote:  
(12-27-2013 10:32 PM)Michael Lopez Wrote:  Hi Terje & thanks for the response.

I pre-defined the variables (in user variables as explained above) then opened the SOLVE application but unfortunately this didn't work. Hopefully there is another way of achieving what I would like to do.

Cheers,

Michael


Michael,

I am not sure what you mean when you say you pre-defined the variables in user variables. In any event this is what I did.

First pictures, trying to enter TA and TB in Solve

[Image: attachment.php?aid=100] [Image: attachment.php?aid=101]
(Implied multiplication happens)


Next pictures creating variable TB (Hit enter after putting TB on line)
[Image: attachment.php?aid=102] [Image: attachment.php?aid=103]

Entering the new variable into the solver
[Image: attachment.php?aid=104] [Image: attachment.php?aid=105]

Hope this helps

Cheers, Terje

Terje
How did you achieve the screens after the line
"Next pictures creating variable TB (Hit enter after putting TB on line)." ?
If I try that from home view I get T*B and if I try from CAS , the var is entered directly without the dialog.. I can't figure out what screen you are in (all soft keys blank)

Cheers,
Steve

Edit: just reread OP And realised the entry mode is set to RPN . It works differently in algebraic or textbook
Find all posts by this user
Quote this message in a reply
02-28-2014, 06:51 PM
Post: #8
RE: User Defined Variables within SOLVE Application
(02-28-2014 07:28 AM)Stevetuc Wrote:  Terje
How did you achieve the screens after the line
"Next pictures creating variable TB (Hit enter after putting TB on line)." ?
If I try that from home view I get T*B and if I try from CAS , the var is entered directly without the dialog.. I can't figure out what screen you are in (all soft keys blank)

Cheers,
Steve

I had the calculator set to RPN. Should probably have said so, sorry about that.

Cheers, Terje
Find all posts by this user
Quote this message in a reply
03-03-2014, 06:47 AM
Post: #9
RE: User Defined Variables within SOLVE Application
Hello

Quote:It seems that although you can save an equation as a Home User Variable, say using F_P1:=fv=pv*(1+rate)^periods, you will have issues:
- You get a syntax error after you store the equation - even though it shows up in User Var properly
- If you try to assign it to a Solver APP with say Solve.E1:=F_P1 you will see 0 in E1: of the Solver App. Looks like its evaluating the variables ahead of time

Correct, you can not do what you wrote above. The reason for it is that althrough you can Crate F_P1 (by doing: fv:=1; pv:=1; rate:=1; periods:=1 ENTER in the command line followed by 4 ENTER) and then typing fv=pv*(1+rate)^periods inthe define dialog box, you can not 'recal' the function to store it into Solve.E1.
Solve.E1 needs to contain an equation, BUT typing F_P1 will evalutate F_P1 (using whichever values are in the variables), and doinf quote(F_P1) will just keep F_P1 as is...

What you CAN do would be to enter F_P1 in E1 (using a quoted STO OR typing it in the symbolic view) and then press on the eval menu key in the solve symbolic view as this does a recall of funcions, but without evaluating them.

You could also do Solve.E1:=quote(fv=pv*(1+rate)^periods)

Regards, cyrille
Find all posts by this user
Quote this message in a reply
03-22-2014, 12:37 PM
Post: #10
RE: User Defined Variables within SOLVE Application
(03-03-2014 06:47 AM)cyrille de brĂ©bisson Wrote:  What you CAN do would be to enter F_P1 in E1 (using a quoted STO OR typing it in the symbolic view) and then press on the eval menu key in the solve symbolic view as this does a recall of funcions, but without evaluating them.

Regards, cyrille

Thank you Cyrille. I looked at this again. Assuming Solve App is active...

1. In CAS, I can enter F_P1:=fv=pv*(1+rate)^per to store F_P1 as a CAS var
2. E1:='F_P1' Enter or 'F_P1' STO>E1 both work to store the equation in Solve**
3. I can proceed to use Solve App E1 to numerically solve for any term after the app asks to create fv, pv, rate and per User Vars.

** Observation - it seems that CAS must be set to approx (not Exact) for the formula to show up in E1. With Exact checked, only F_P1 shows up in E1??

I'm working through this to see if I can store Engineering (or Finance) equations into say the Notes App and copy/paste them into CAS command line for (1) single or multi equation numerical solving in Solve App and (2) algebraic solving in CAS. An example Financial equaitno note might read in part:

F_P1:=fv=pv*(1+rate)^per;Solve.E1:='F_P1';

If other have better, easier ways to do this in the Prime then Im all ears.

Best,
Carl
Find all posts by this user
Quote this message in a reply
Post Reply 




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