Post Reply 
HP Prime programmable eq solver
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:

TYP:=1,EQ;
SET_DEFAULT();

EXPORT EQLib()
BEGIN
END;

VIEW "Start",START()
BEGIN
  IF SIZE(EQTYPE)==0 THEN
    //Init some default formula and names
    SET_DEFAULT(); 
  END;
  STARTVIEW(6,1);
  STARTVIEW(7,0);
END;

VIEW "Select EQ type",STYPE()
BEGIN
  CHOOSE(TYP,"Select EQ type",EQTYPE);
  STARTVIEW(7,0);
END;

VIEW "Solve EQ",SOLVE()
BEGIN
  LOCAL I;
  CHOOSE(EQ,"Solve "+EQTYPE(TYP)+" EQ",EQLIBNAME(TYP));
  E1:=EQLIB(TYP,EQ);
  FOR I := 0 TO 9 DO
    UNCHECK(I);
  END;
  CHECK(1);
  STARTVIEW(0,1);
  STARTVIEW(2,1);
END;

VIEW "Add new EQ type",ADD_TYPE()
BEGIN
  EDITLIST(EQTYPE); 
  STARTVIEW(7,0);
END;

VIEW "Add Equation",ADD()
BEGIN
  LOCAL Equation:="", EQname:="";
  IF INPUT({Equation,EQname},"Insert an "+EQTYPE(TYP)+" EQ",{"EQ: ","EQ Name: "},{"Insert an EQ as string","Insert EQ name as string"}) THEN
    EQLIBNAME(TYP,0):=EQname;
    EQLIB(TYP,0):=Equation;
  END;
  STARTVIEW(7,0);
END; 

SET_DEFAULT()
BEGIN
  EQTYPE:={"Area","Electric"};
  EQLIB:={{"S=A*B","S=A*B/2"},{"R=U/I","P=U*I"}};
  EQLIBNAME:={{"Area of an rectangle","Area of an triangle"},{"Ohms law","Effect"}}; 
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP Prime programmable eq solver - LarsF - 01-06-2014 09:04 PM



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