HP Prime programmable eq solver
|
01-04-2014, 11:04 PM
Post: #1
|
|||
|
|||
HP Prime programmable eq solver
Hello,
a first attempt in trying to create an equation library for the Prime. It has a lot of limitations. If you want to test it please create two lists: EQLIB:={"S=A*B", "S=A*B/2"} EQLIBNAME:={"Surface of a rectangle", "Surface of a triangle"} I created these list names just to prevent overwriting the L0-L9 by mistake. Anyway it was a good example for me to launch/use APPS like the SOLVE from the HPPL. Code:
As you can see i commented the REPEAT..UNTIL loop because there is no HALT..CONTINUE command like in the 48. When the solve APP is launched, the program doesn't stop showing a new session of CHOOSE before giving you the time to solve for a variable. Maybe here a GETKEY could do the trick. The other limitation is that i used only A...Z variables in order to avoid to declare the variable prior to RUN the program. There should be a way to retrieve a list of variables from a equation but i still didn't find it. Please suggest how i could improve it. I am sure it can be improved. Thanks Giancarlo |
|||
01-05-2014, 01:15 PM
Post: #2
|
|||
|
|||
RE: HP Prime programmable eq solver
Hi
I had the same idea, but I just had an ide before i saw your code, so I use it in an app instead. Create 3 variables, EQLIB:={{"S=A*B", "S=A*B/2"},{"R=U/I","P=U*I"}} EQLIBNAME:={{"Surface of a rectangle", "Surface of a triangle"},{"Ohms law","Effect"}} EQTYPE:={"Area","Electric"} Copy the solve app and name it EQLib Edit the program EQLib (App) Quote:TYP,EQ; |
|||
01-05-2014, 03:14 PM
Post: #3
|
|||
|
|||
RE: HP Prime programmable eq solver
Hello Lars,
interesting approach. i am curious to see how it looks like but unfortunately no way to go through.. I had an error in the: ...FOR I=0 TO 9... loop that i replaced by a ...FOR I FROM 0 TO 9... but now i have an error in the ...VIEW "Solve eq lib", SOLVE()... function. Could you please check it? i am interested on that solution, thanks Giancarlo |
|||
01-05-2014, 03:27 PM
Post: #4
|
|||
|
|||
RE: HP Prime programmable eq solver
In the for loop it should be I:= , and the first STARTVIEW should be STARTVIEW(0,1)
Have you create all variables? EQTYPE And in the ADD function it should be IF INPUT({Equation,EQname},EQTYPE(TYP) + " Insert an EQ",{"EQ: ","EQ Name: "},{"Insert an EQ as string","Insert EQ name as string"}) THEN EQLIBNAME(TYP,0):=EQname; EQLIB(TYP,0):=Equation; END; so we don't end up with empty names and equations |
|||
01-05-2014, 03:37 PM
Post: #5
|
|||
|
|||
RE: HP Prime programmable eq solver
I succeed to to download the code from calculator ( on a Mac!!!), so there should be no errors
And I use code tag instead of quote :-) Code:
|
|||
01-06-2014, 09:47 AM
Post: #6
|
|||
|
|||
RE: HP Prime programmable eq solver
I think I got some problem after creating this variables, if I try to enter LIST editor or MEM, then the calculator reboots!! I'm not sure if the EQLIB, EQLIBNAME and EQTYPE is cause of these problem but there are suspicious. Is there a way to delete these variables? I tried to do a EQLIB:={}, but the variable remains as a variable and the MEM and LIST editor still reboots calculator....
|
|||
01-06-2014, 11:19 AM
Post: #7
|
|||
|
|||
RE: HP Prime programmable eq solver
It was not the variables that was the problem, i did do a format and created the EQ... variables again, then there was no problem with MEM and LIST. There must have something else that was causing this problem.
|
|||
01-06-2014, 08:09 PM
Post: #8
|
|||
|
|||
RE: HP Prime programmable eq solver
Hello LarsF,
wow; it works pretty well now. I just modified a couple of things but it is definitely working well. Here is the procedure for anyone who'd like to use it: 1) Create the following 3 variables: EQLIB:={{"S=A*B", "S=A*B/2"},{"R=U/I","P=U*I"}} EQLIBNAME:={{"Surface of a rectangle", "Surface of a triangle"},{"Ohms law","Effect"}} EQTYPE:={"Area","Electric"} 2) Click on APPS, select the SOLVE, click on SAVE and name it EQLib 3) Edit the program EQLib (App) and copy the following code: Code:
Now you are ready to use it. Browse for the EQLib APP and launch it. Enjoy Giancarlo |
|||
01-06-2014, 09:04 PM
Post: #9
|
|||
|
|||
RE: HP Prime programmable eq solver
Hi Giancarlo
I have made some small changes too, possibility to add EQ-type, some default values for EQ.. variables, so you just need to create them with EQTYPE:={} EQLIB:={} and EQLIBNAME:={} I would be nice to be able to use some more descriptive names for variables in the formulas, but I don't know how to do that, maybe its not possible. Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)