Post Reply 
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:

EXPORT PSOLVE()
BEGIN
LOCAL A,B,C:="",D:="";
// REPEAT 
 CHOOSE(B,"SOLVE EQ LIBRARY","SOLVE AN EQUATION","ADD AN EQUATION","EXIT");
  CASE
  IF B=1 THEN
   CHOOSE(A,"SOLVE EQ LIB", EQLIBNAME);
   E1:= EQLIB(A);
   STARTAPP("Solve");
   CHECK(1);
   UNCHECK(2);
   UNCHECK(3);
   UNCHECK(4);
   UNCHECK(5);
   UNCHECK(6);
   UNCHECK(7);
   UNCHECK(8);
   UNCHECK(9);
   UNCHECK(0);
   STARTVIEW(2,0);
  END;
  IF B=2 THEN
  INPUT({C,D},"INSERT AN EQ",{"EQ: ","EQ NAME:"},{"INSERT AN EQ. AS A STRING","INSERT AN EQ. NAME AS A STRING"});
  EQLIBNAME(0):=D;
  EQLIB(0):=C;
  END;
  END;
//UNTIL B=3;

END;

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
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP Prime programmable eq solver - Giancarlo - 01-04-2014 11:04 PM



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