05-05-2014, 10:59 PM
05-06-2014, 01:08 AM
You can save the equation in a string. Likewise, I would consider a separate string for the variables.
E.g.
These routines can easily to combined into a solver app to build an actual equation library with complete support for custom equations and variables. I'm currently working on one, but have been sidetracked with several other projects…
E.g.
Code:
// formula: F=ma; we'll use the global variable F and create m and a as needed
vars:={ "m", "a" };
eqns:="F=m*a";
// initialize solver
local cmd,i, n:=SIZE(vars);
for i from 1 to n do
cmd:=vars(i) + ":=0"; // set initial value to 0;
CAS(cmd); // call CAS to evaluate cmd as if run from command line
end;
E1:=eqns; // set E1
// … code here to start the app, see STARTAPP() or STARTVIEW()
// clean up, if needed
for i from 1 to d no
cmd:="purge(" + vars(i) +")"; // create a purge command
CAS(cmd); // purge the variable
end;
These routines can easily to combined into a solver app to build an actual equation library with complete support for custom equations and variables. I'm currently working on one, but have been sidetracked with several other projects…
05-06-2014, 07:17 AM
Han, is that part of program code? What did you show? How would you use it? Do you -have- to store equations to a global, capitalized variable F? Do you assign the variable list m,a and the equation prior to program start?
A working example with additional comments would be beneficial. Thanks.
A working example with additional comments would be beneficial. Thanks.
05-06-2014, 12:03 PM
I have saved formulas into CAS variables, defined solve.E1:='CAS variable' (a formula) then used Solver.
Here is a thread about this: http://www.hpmuseum.org/forum/thread-955.html
Best,
Carl
Here is a thread about this: http://www.hpmuseum.org/forum/thread-955.html
Best,
Carl
05-06-2014, 12:15 PM
Thank you, I remember your thread. You don't use any strings, I see? Copying over a note to the cas is not really user friendly. :-(
I had the feeling Han tried to add more automation on the one hand and on the other I feel like that is an example to learn to avoid issues when programming the calculator.
What is about string usage and no string usage. I studied the patch notes and did not notice any changes concerning these topics (that is data handling) so there is a need to get used to how things are now. They are likely to last.....
I might be old or I might not have enough time for the calculator there is even the chance of being too stupit, but I did not really understand this device. I can play with it, I find interessting aspects, but once I really need it I get stuck and can't find the right way to work with it. It still did not become a tool, it is still a toy which frustrates me.
I had the feeling Han tried to add more automation on the one hand and on the other I feel like that is an example to learn to avoid issues when programming the calculator.
What is about string usage and no string usage. I studied the patch notes and did not notice any changes concerning these topics (that is data handling) so there is a need to get used to how things are now. They are likely to last.....
I might be old or I might not have enough time for the calculator there is even the chance of being too stupit, but I did not really understand this device. I can play with it, I find interessting aspects, but once I really need it I get stuck and can't find the right way to work with it. It still did not become a tool, it is still a toy which frustrates me.