Post Reply 
HP Prime: how to insert and save formulas in a sort of "Equation library"
02-10-2020, 07:49 AM (This post was last modified: 02-18-2020 12:07 PM by Gene.)
Post: #1
HP Prime: how to insert and save formulas in a sort of "Equation library"
Good morning,

I've recently bought an HP Prime.

I'm trying to insert and save some executable formulas in a sort of "equation library" where formulas are subdivided in categories: accounting formulas,economics formula ans so on...

I've seen that in the d HP50g it was possible to organize and save formulas...

However I've some difficulties with my HP Prime.

Can somebody help me in solving my problem please? I need it urgently...

Thank you very much for your supply.

Mark
Find all posts by this user
Quote this message in a reply
02-10-2020, 01:32 PM
Post: #2
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Here is a great subforums for solutions, you find it at https://www.hpmuseum.org/forum/forum-15....order=desc

For e.g. please have a look at
https://www.hpmuseum.org/forum/thread-11312.html
and
https://www.hpmuseum.org/forum/thread-7725.html

Maybe there a more solutions at hpcalc.org
Find all posts by this user
Quote this message in a reply
02-10-2020, 05:37 PM
Post: #3
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Dear Thomas thank you very much for your reply.
I'll have a look at the links..
Today to test solver, i tried to insert some formula in solver with long name variables,like Gains=Revenues-Costs.
However Solver app pops up a "synthax error" when wrinting the tree "economic" variables..and surprisingly Solver decomposes Gains in G*a*i*n*s and so on...creating a variable for each letter...instead of creating just 3"economic variables...
With old hp 17bll Solver automatically recognized the variables as long names instead of creating many letters
How can I solve this problem in HP Prime?
I hope it is only an entry mode error...

Thank you very much for your kind support..

Best regards,

Mark
Find all posts by this user
Quote this message in a reply
02-11-2020, 08:01 AM (This post was last modified: 02-11-2020 08:09 AM by pinkman.)
Post: #4
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
(02-10-2020 05:37 PM)marprime80 Wrote:  Dear Thomas thank you very much for your reply.
I'll have a look at the links..
Today to test solver, i tried to insert some formula in solver with long name variables,like Gains=Revenues-Costs.
However Solver app pops up a "synthax error" when wrinting the tree "economic" variables..and surprisingly Solver decomposes Gains in G*a*i*n*s and so on...creating a variable for each letter...instead of creating just 3"economic variables...
With old hp 17bll Solver automatically recognized the variables as long names instead of creating many letters
How can I solve this problem in HP Prime?
I hope it is only an entry mode error...

Thank you very much for your kind support..

Best regards,

Mark

Hello Mark,
No the Solver won't create vars on the fly, and math some math students might be helped by the translation of AB into A*B.

Two workarounds:

First (my prefered one): create a program, name it "AllMyVars" or whatever you want, and insert all the vars you need, ie:
Code:

EXPORT Gain, Revenues, Cost;
EXPORT GrossMargin, EBITDA;
// etc.
   

Second:
In Home view, create directly a var, by using the 'Sto' soft or hard key. This is usually done after a calculus.
Code:

Ans▶MyResult
   

You can then use all those created vars in the Solver. You can find them with the 'Vars' key, under the 'User' softkey menu.
Find all posts by this user
Quote this message in a reply
02-11-2020, 08:22 AM
Post: #5
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
(02-11-2020 08:01 AM)pinkman Wrote:  X
Hello Mark,
No the Solver won't create vars on the fly, and math some math students might be helped by the translation of AB into A*B.

Two workarounds:

First (my prefered one): create a program, name it "AllMyVars" or whatever you want, and insert all the vars you need, ie:
Code:

EXPORT Gain, Revenues, Cost;
EXPORT GrossMargin, EBITDA;
// etc.
X
You can then use all those created vars in the Solver. You can find them with the 'Vars' key, under the 'User' softkey menu.

OR - combining another post
refer them using AllMyVars.Gain, AllMyVars.Revenues, AllMyVars.Cost
I would rather save my own Solver app version
and use, say, 'Finance' main app to declare the variables
(among other things)
One can also use START() and RESET() in your own version of an app
I avoid polluting the name space
- -
VPN
Find all posts by this user
Quote this message in a reply
02-11-2020, 10:45 AM
Post: #6
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Dear Sir, thank you very much for your kind reply..
It is not really a trivial process as it was with the old one..
I would like to be able to program the calculator,but I'm more and more convinced that HP Prime is not an easy calculator for beginners..some programming knowledge are required even for some basic solver calculation..sometimes it is quite frustrating..
Is there any specific course on how to program the calculator or some teaching lessons?
I'm a beginner and I need some direct help..
Let me know...
Thank you very much

Marco Russo
Find all posts by this user
Quote this message in a reply
02-11-2020, 09:05 PM (This post was last modified: 02-11-2020 09:09 PM by pinkman.)
Post: #7
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Yes, despite the (receivable) arguments often debated here, HP Prime is a high level tool, but it is not a too high mountain to be climbed.

First, stay tuned here!

Then don’t be afraid by the programming module. You just need to write the names of a few vars in a text file from a module called ‘program’, you’re not yet into programming, so it will be easy.

Before programming, use the tools offered by the Prime, they are really powerful.

Then :
My advice for your library of functions is to create another program file, just to make your functions usable anywhere.

Code:

EXPORT FGains(theRevenues,theCosts)
BEGIN
RETURN theRevenues-theCosts;
END;

That’s a bit of programming, but I think you will recognize your original function.
I intentionally used other variable names to avoid confusion between these ones and the previous ones.

Then you can use the solver:
Code:

Gains=FGains(Revenues, Costs)

And here you are!
   
   
Find all posts by this user
Quote this message in a reply
02-11-2020, 10:15 PM (This post was last modified: 02-11-2020 10:16 PM by BruceH.)
Post: #8
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
There's a very good equation library for the Prime here.

You might like to look at the source to pick-up some tips or modify it to add any missing equations that you use.
Find all posts by this user
Quote this message in a reply
02-13-2020, 07:40 AM
Post: #9
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Sorry for my late response and sorry if this had been explained before.
I do this in the following way.
Open Apps Window, select Solve App and save it with a new name based on Solve.
In the App window select the new Solve App. The focus of the Prime is now focused on this new Solve App.
Go to Program Editor (Shift Program) and select your "new name (APP)" and type EXPORT VarName, VarName, ...; Possibly several EXPORTs. Close the Progam editor. You can now use your variables in your new Solve App. They are visible and selectable in Vars, App, "new name", Program.
In this way you can possibly use the same variable names for different Apps, while they are not the same variables.

— Dirk Hartland
Find all posts by this user
Quote this message in a reply
02-17-2020, 02:09 PM
Post: #10
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
See LibraryTut at link below.

https://www.hpmuseum.org/forum/thread-14522.html

BM
Find all posts by this user
Quote this message in a reply
02-18-2020, 06:03 AM
Post: #11
RE: Hp Prime: how to insert and save formulas in a sort of "Equation library"
Hello,

You can also create AVars (App Variables), which are not program variables...
a first call to
AVars("name"):=value
Will create the app variable. From there on, you can use it as a regular variable.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
02-18-2020, 04:33 PM (This post was last modified: 02-23-2020 09:34 PM by BERNARD MICHAUD.)
Post: #12
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
HI Cyrille
Since we are on this topic of vars and its use in programs, could I impose upon you with this question or perhaps experience I had with the use of polar_coordinates(); When used from the command line polar_coordinates(3+4*i) produces [5 53.13],
but when used from inside a program it produces [5,0.9273]. Of course, 53.13*pi/180 is 53.13. So due to this phenomenon, I undertook to use ABS() and ARG() to generate the proper result 5 < 53.13 in my EE_Analyses program which I will publish soon. Do you have any idea as to why that is ??

Thank you
Bernard Michaud
Find all posts by this user
Quote this message in a reply
02-18-2020, 09:26 PM
Post: #13
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(02-18-2020 06:03 AM)cyrille de brébisson Wrote:  Hello,

You can also create AVars (App Variables), which are not program variables...
a first call to
AVars("name"):=value
Will create the app variable. From there on, you can use it as a regular variable.

Cyrille

So I discover this functionality. Thanks, looks interesting.
A few questions:
- Why are AVars and DelAVars not mentioned in the catalog menu?
- Once an AVar is created, such as AVars(“vtest”):=123.456, what’s the difference between vtest:=654.321 and AVars(“vtest”):=654.321 ?
Find all posts by this user
Quote this message in a reply
02-19-2020, 08:28 AM
Post: #14
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(02-18-2020 09:26 PM)pinkman Wrote:  So I discover this functionality. Thanks, looks interesting.
A few questions:
- Why are AVars and DelAVars not mentioned in the catalog menu?
- Once an AVar is created, such as AVars(“vtest”):=123.456, what’s the difference between vtest:=654.321 and AVars(“vtest”):=654.321 ?

They are. They appear under the app var function menu as they are app specific. If you press the CATLG button however, do you see how it has a > on the side and a multi app icon? You will see a copy of each app there to pick a specific one.

Nothing essentially. The first will be slightly faster however.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
05-16-2020, 08:47 AM
Post: #15
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Good Morning and thank you to everybody who replied to my posts.

Attached below there are some examples of an Equation Library Tree created with the HP 50g, which I need to replicate with my HP Prime.

Basically, by creating an Equation Tree (you can see in the images there is a TREE buttom on the calculator to open the Formula Tree), it is then possible to select the needed formula from different subgroups (organized in hierarchial tree), and then calculate the formula by changing the parameters.
In this way you can have a huge amount of formula which are organized according to the related topic, and you can very easily access to the formula you need.

Now, I have some question:
1. How this hierarchic Equation Tree can be created on the HP Prime?
2. Is it possible to create a similar Equation Tree on the HP Prime using the Konnektivity kit, or I need to create it directly on my HP Prime?
3. Technically speaking, is this an Equation Library Tree or a FUNCTION Library Tree?
4. Is it possible to use the programming code stored in a SD Card on the HP50g on the HP Prime and change the synthax to make it "understandable" by HP Prime? (I know that the programming language changed from HP 50g to HP Prime...).

As you can understand, I have many many formula to organize in subgroups on my calculator and I hope it is possible to replicate on the HP Prime the excellent job which the HP50g did.

I've looked on the user manual but I still do know if it is possible to do this job and how. I hope you can help me...

Thank you very much for your kind reply and help.

Best regards.


Mark


Attached File(s) Thumbnail(s)
                   
Find all posts by this user
Quote this message in a reply
05-16-2020, 09:05 PM (This post was last modified: 05-16-2020 09:07 PM by Han.)
Post: #16
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Here is an old video on the app I wrote: https://www.youtube.com/watch?v=OFS_tKAf0tg

The app itself can be found here: https://www.hpmuseum.org/forum/thread-7725.html

You can create your own system of equations, solve them, save them, etc. It comes with its own set of equations so you can either add more to them, or create your own "library" if you wish. It comes with a manual as well, which I recommend you read for further details.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-17-2020, 04:16 PM (This post was last modified: 05-18-2020 03:37 PM by BERNARD MICHAUD.)
Post: #17
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-17-2020 03:48 PM)BERNARD MICHAUD Wrote:  
Quote:I've recently bought an HP Prime.

HI MARK
copy/paste the code below.
Start the Connectivity kit(CK) on your pc.
Connect your Prime calc. to the USB port, and turn ON.
In the CK click on the triple folder icon (top left corner).
Your Prime will show up in a list. Right click on Program.
In the pop-up box [New/Clear] click on New. In the box, below Program type [MLibrary] & Return.
A window will pop-up in the coding area with the following.
EXPORT MLibrary()
BEGIN

END;

DELETE those three lines and copy/paste the text from the Codewindow below over to the window where you erased those three line in the CK.
Next click on the Single disket icon to the right of the Blue icon and the program will be saved to your calculator.

On your calculator click [Shift] then [1/Program] key.
Your screen will display a list of all programs on your Prime.
Higlight MLibrary and press the [Run] key.

A small window will open on the screen with a Heading

[Finance]
[1 Accounting]
[2 Economic]

Click on [1 Accounting] a box will appear so just press the [ESC] key.
in the background appears the solver containing 5 of the equations from the Accounting section.
At this point select any one of the equations and tap the check mark [ ] on the soft menu below.
Next press the [Num] key. A new window will pop up with boxes with all the variables contained in the equation you selected. You can now enter values any values in the boxes except the box for which you want to solve. Select the box for which you want to solve and press [Solve] in the soft menu.

re: Variables. All the variables used by the equations that are not single Cap letters have to be declared with the EXPORT statement or will cause an error and your program terminates.
The single Cap. variables like T,F,C etc do not have to be declared since they are Global variables as explained by Tim above.

After you are through with this equation, press [Symb]key and return to the set of equations and
select another equation followed by [Num]. To evoke the other set of equation, (Economic),you will have to restart the program and repeat the process.

I tried to make this as explicit for you, assuming that you are a novice with the Prime and hope it's not over symplified.

Have fun

Code:


EXPORT Lib,int;
EXPORT SP,NP,TR,TC,TFC,TVC,VC;
EXPORT n,PMT1,PRV,FV1;

EXPORT MLibrary()
BEGIN

STARTAPP("Solve");

CHOOSE(Lib,"Finance ",
{   
"   Accounting",
"   Economic "
});

//Accounting
IF Lib==1 THEN
E1:="SP=C+M";
E2:="NP=TR-TC";
E3:="TR=P*Q";
E4:="TC=TFC+TVC";
E5:="TVC=Q*VC";
E6:="";
E7:="";
E8:="";
E9:="";
E0:="";
END;//End of Accounting routine.

//Economics
IF Lib==2 THEN
E1:="int=(FV1/PRV)^1/n-1";
E2:="PMT1=PV*(int)/(FV1)";
E3:="";
E4:="";
E5:="";
E6:="";
E7:="";
E8:="";
E9:="";
E0:="";
END;//End of Economics routine.
END;//End of BEGIN
Find all posts by this user
Quote this message in a reply
05-18-2020, 03:01 PM
Post: #18
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Dear Bernard,
thank you very much for reply and for the programming code, which helps me in understanding how to create a programming code to build my own libraries...Thank you very much also for making everything as explicit, given that I am a novice with Prime...

I copied your programming code into the Connectivity Kit and I then synchronized with my Prime.
With the routine "Accounting" everything is OK and the solver works.
However the calculator pops up a "Synthax Error" when clicking on the routine "Economics" on my calculator.
The problem seems to be either in the variable declaration (which I suppose is contained in the EXPORT Row), or in the Syntax of following Economics equation:
E2:="PM=PV*(int)/()";

1. Can you please help me with the syntax error when clicking on Economics routine please? What represent () in E2 row above?

2. I have some general question about your programming code:
2a "EXPORT Lib,int;"
=> Question: I do not understand why "int" (which is an equation under "Economics" is written here).
What represent this first EXPORT row represents and what must contain?

2b "EXPORT SP,NP,TR,TC,TFC,TVC,VC;"
=> Question: o SP,NP,TR,... represent the variables of routine "Accounting" that we have to declare?

EXPORT n,PM,PRV;
2c. do n,PM,PRV represent the variables of routine "Economics" that we have to declare?
Is the syntax error related to the fact that there are some variables missing here, like int,FV,PV?
Or is it because of ()?

3. For each routine "Accounting", "Economics",...is it possible to write more than 10 equation for each routine? OR I have to create more Routines "Accounting 1", "Accounting 2",...each containing a maximum of 10 equation each?

4. Where and how should variables be declared for each routine which contains equations?

5. If I do not remember in which routine I wrote an equation, is there a way on the calculator to look for the equation but digiting the equation in a "search..." buttom like in Microsoft Explorer? It could be difficult to remember the exact location of each equation.

I hope I've explained my doubts clearly to you.

Thank you very much in advance for your kind help. I'm looking forward to receive some information from you.

Best regards,

Mark
Find all posts by this user
Quote this message in a reply
05-18-2020, 05:16 PM
Post: #19
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Quote:1. Can you please help me with the syntax error when clicking on Economics routine please? What represent () in E2 row above?

HI MARK

I'VE UPDATED THE CODE. I omitted a variable within the () on line 33. I added (FV1) and FV1 on line 3.
Also I changed the PM to PMT1 on line 3 and line 33.

1- I know little about Finance, so those equations are partly fake, just for demonstration.
You will have to enter your own equations and declare your own variables with EXPORT lines 1, 2 and 3
you can put only 8 variables per EXPORT line.
2- Variables come in different forms. There are RESERVED variables, GLOBAL variables etc. Try changing
PMT1 on line 3 and PMT1 on line 33 to just PMT, and see what happens. Then press the [Vars] key followed by
1 Finance, 3 TVM and you'll see 3 PMT. PMT is a reserved variable, which is why I could not use it in the
program on line 3 and 33.
3 The label Lib on line 1 is a variable I have chosen arbitrarily. Its function as used on line 10, 17 and 31 is for the program to make a decision between Accounting and Economics. On line 17 IF Lib==1 then the program will execute 18 to 28 END; On line 31 IF Lib==2 then the program will execute line 32 to 42 END; The 1 and 2 comes from the selection you make after pressing [Run] 1 Accounting and 2 Economics. On line 10 CHOOSE Lib, "Finance", is a Title name at the top of 1 Accou.... 2 Econ.....
4- As you add more sections with new equations, only the new variables will need to be added with thwe EXPORT statements and only 8 max per line seperated with , and terminated with ;
5- You can't do search with CK editor. You can use other word processors like MS Word or TextEdit. I use BBEDIT but its a paid App.

Have Fun !

BM
Find all posts by this user
Quote this message in a reply
05-19-2020, 02:11 PM
Post: #20
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Dear Bernard,
thank you very much for your reply. Soon I will update the code and I'll see if I'll have some problems..

I still have some doubts about the programming code...

1. If I've understood well, variables should be declared besided "EXPORT" to a maximum of 8 variables per row.
Variables declaration MUST follow a specific order or could follow an arbitrary order in Export row?

2. What is the difference between declaring a variables as "GLOBAL" or as "RESERVED"?
In which specific section are Global variables resp Reserved variables written on the programming code?

3. For each routine "Accounting", "Economics",...is it possible to insert MORE than 10 Equation?

4. For the "search function" I meant directly on the calculator, NOT on the CK editor...In other words, how can I look for an Equation on the HP Prime calculator itself if I do NOT remember its exact location in my equation library? Suppose I created more libraries and more routines and I do not remember where the equation is...

Thank you very much for your kind reply.

Best regards,


Mark
Find all posts by this user
Quote this message in a reply
Post Reply 




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