Post Reply 
HP Prime: how to insert and save formulas in a sort of "Equation library"
05-19-2020, 06:01 PM
Post: #21
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Quote: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...


1- First: The 'EXPORT' command is used to declare your personal variables which will be used by the program that follows and once declared can also be used in the command line in Home screen, like PMT1 once declared by the program. Go to the Home screen and type: 78 [Sto>]PMT1 Enter again Type 2*PMT1 Enter = 156. PMT1. if you open the Solver App, you can use PMT1 in the solver as well. In the Solver app tybe B=2*PMT1 Enter press [Num] you should see 78. Activate the B box and press [Solve] and the result is 156. PMT1 is from this point a Global variable and can be used anywhere on your Prime. Also variables declared by the EXPORT command do not have to be in any particular order, but you cannot declare more than 8 variables per EXPORT command which must be seperated by ',' and terminated by ';'

2- The difference between Global and Reserved is that Global variables can be declared by either the EXPORT command in a program or from the command line in the Home Screen. Go to the Home screen and type 45 [Sto] aa you'll get a window ?Do you want to create a variable called aa. If not press [Cancel]. Reserved variables like L0 to L9 are reserved for List, Variables Z0 to Z9 are reserved for Complex Numbers. eg. From Home type 3+4*i [Sto] Z1. But 3+4*i [Sto>
] B -> error:Bad argument type. A to Z are Global variables you can use and do not need to be declared. However a to b have to be declared.

3- Unfortunatly 10 Equations are the max for the solver, whether the Solver App is used directly or in a program. That is one thing that realy annoys me. I an engineering book for example, a chapter may contain way over 10 equations but in the solver you have to split them in section 1, section 2, and 3 and 4.

4- On the calculator as well as the CK you have to scroll through and I recommend using the 4 way navigation button. To go to the Top of the doc use [Shift] ^ and to the bottom use [Shift] down. You can also use [Shift] < and > .
Find all posts by this user
Quote this message in a reply
05-21-2020, 07:45 AM (This post was last modified: 05-21-2020 07:46 AM by Han.)
Post: #22
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-19-2020 02:11 PM)marprime80 Wrote:  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?

Variables are only "available for use" from the point they are declared. They do not have to be sorted/ordered within an EXPORT line.

Quote: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?

This small reference might be useful: https://www.hpmuseum.org/forum/thread-215.html

Another (possibly useful?) link: https://www.hpmuseum.org/forum/thread-216.html

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

Only if you create your own solver program.

Quote: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

You would need to create your equations and categorize them, and then create an interface to list the categories (to help you easily find your equations). Have you checked out the existing programs for the HP Prime? There are applications that already address your concerns, and more:
  • solver handles more than 10 equations
  • solver handles under-determined and over-determined systems
  • add your own collection of equations and categorize them
  • access your library of equations using a drop-down list of categories
  • delete/create/modify equations using a graphical interface (no programming)
  • include pictures (optional)
  • include long descriptions for each variable

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-21-2020, 02:16 PM (This post was last modified: 05-26-2020 08:35 PM by BERNARD MICHAUD.)
Post: #23
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Quote:solver handles more than 10 equations
solver handles under-determined and over-determined systems

Hello Han
Thanks for your informative description above.

Concerning "solver handles more than 10 equations". Obviously you do not mean that the Solver app handles more than 10 equations at a time, since the solver has a range of E1, E2 .... to E0. You are referring to when the Solver app is used within a program like a Library which I can understand by creating several categories. However in the EE_Library I encountered a situation where the program would not accept E0 as valid. I could only enter 9 equations per section or categories. Not being profficient in programing I assume that I am perhaps missing some knowledge regarding that situation

Thank Han

Bernard
Find all posts by this user
Quote this message in a reply
05-27-2020, 06:59 PM (This post was last modified: 05-27-2020 07:03 PM by Han.)
Post: #24
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-21-2020 02:16 PM)BERNARD MICHAUD Wrote:  
Quote:solver handles more than 10 equations
solver handles under-determined and over-determined systems

Hello Han
Thanks for your informative description above.

Concerning "solver handles more than 10 equations". Obviously you do not mean that the Solver app handles more than 10 equations at a time, since the solver has a range of E1, E2 .... to E0. You are referring to when the Solver app is used within a program like a Library which I can understand by creating several categories. However in the EE_Library I encountered a situation where the program would not accept E0 as valid. I could only enter 9 equations per section or categories. Not being profficient in programing I assume that I am perhaps missing some knowledge regarding that situation

Thank Han

Bernard

No, what I meant was that the app I wrote uses its own solving engine (Newton-Raphson method with backtracking line search), and that solve engine can handle more than 10 equations. The way it was programmed was to use "pages" of equations. The built-in Solver interface only allows up to 10 equations at a time (E0 through E9). But by organizing the equations into "pages" of 10 equations at a time, it is possible to use that interface to allow more than 10 equations. Once all equations are entered, it is passed to the solver engine (not the built-in one, but one I implemented).

In summary, the built-in Solver's "Sym View" interface is only used to display/enter/edit equations. Then a custom solver engine is used to actually do the solving. EDIT: My point was that you do not need to re-invent the wheel (program your own equation library and solver), as there are existing ones others have created that seem to address your needs. On the other hand, if you are doing so in order to learn programming, then my apologies for having misunderstood your intent.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-27-2020, 07:06 PM
Post: #25
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-21-2020 02:16 PM)BERNARD MICHAUD Wrote:  However in the EE_Library I encountered a situation where the program would not accept E0 as valid. I could only enter 9 equations per section or categories. Not being profficient in programing I assume that I am perhaps missing some knowledge regarding that situation

This is likely due to either a bug in EE_Library, or perhaps you used a variable in the equation/formula that does not exist or is a system variable that is not allowed. For example, G0 through G9 are system variables for graphics.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-27-2020, 08:55 PM
Post: #26
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-27-2020 07:06 PM)Han Wrote:  
(05-21-2020 02:16 PM)BERNARD MICHAUD Wrote:  However in the EE_Library I encountered a situation where the program would not accept E0 as valid. I could only enter 9 equations per section or categories. Not being profficient in programing I assume that I am perhaps missing some knowledge regarding that situation

This is likely due to either a bug in EE_Library, or perhaps you used a variable in the equation/formula that does not exist or is a system variable that is not allowed. For example, G0 through G9 are system variables for graphics.

Thanks Han I'll have to check that again (invalid variable).

Also I'm interested in "Then a custom solver engine is used to actually do the solving." do you have a link to that example?

Thanks Han
Find all posts by this user
Quote this message in a reply
05-27-2020, 09:40 PM
Post: #27
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
(05-27-2020 08:55 PM)BERNARD MICHAUD Wrote:  
(05-27-2020 07:06 PM)Han Wrote:  This is likely due to either a bug in EE_Library, or perhaps you used a variable in the equation/formula that does not exist or is a system variable that is not allowed. For example, G0 through G9 are system variables for graphics.

Thanks Han I'll have to check that again (invalid variable).

Also I'm interested in "Then a custom solver engine is used to actually do the solving." do you have a link to that example?

Thanks Han

You can find it here: https://www.hpmuseum.org/forum/thread-7725.html

Don't be scared off by the "beta" label -- I just never got around to packaging it up as an "official version" because the manual needs to be updated. You can find the manual inside the original release (version 1.00)

The source code is included, too, in case you wish to delve into the internal workings yourself.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
05-27-2020, 09:57 PM
Post: #28
RE: HP Prime: how to insert and save formulas in a sort of "Equation library"
Quote:You can find it here: https://www.hpmuseum.org/forum/thread-7725.html

Ok Thanks Han Looks interesting
Find all posts by this user
Quote this message in a reply
Post Reply 




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