HP Forums
Do PPL program input parameters accept symbolic arguments? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Do PPL program input parameters accept symbolic arguments? (/thread-2344.html)



Do PPL program input parameters accept symbolic arguments? - Helge Gabert - 10-27-2014 02:49 PM

In a PPL program (Home environment), is it possible to pass from the command line a symbolic argument to the program?

For example, run MYPROGPPL(k1,k2,k3). Here k3 should contain 'X' or 'X^2' or something like that (defined by the user at program start).

Then, for example, integration could work with \int (from the template) like \int(k3,'X',k1,k2);

This is all no problem with a CAS program,

e.g., MYPROGCAS(k1,k2,k3) with k3 containing 'x^2' can run int(k3,'x',k1,k2); just fine,

but I'm running into problems with PPL and symbolic arguments.


RE: Do PPL program input parameters accept symbolic arguments? - Han - 10-27-2014 03:37 PM

Would you care to share a few code snippets? I think seeing what it is you want to do would make it easier to make suggestions.

Code:

MYINT(v1,v2,v3,v4)
BEGIN
int(QUOTE(v1),QUOTE(v2),v3,v4);
END;

The code above works just fine. What you must always keep in mind, though, is that this program behaves differently in Home vs in CAS. In Home, you can use MYINT('X','X',1,2) and get the right answer. However, in CAS, the 'X' are treated as constants (as opposed to 'x', provided you also did not store any values into x).

In sum, MYINT() is placed under the same restrictions as built-in commands.


RE: Do PPL program input parameters accept symbolic arguments? - Helge Gabert - 10-27-2014 03:47 PM

Sure, here is the snippet

[attachment=1164]


So, ideally, the user could call PU(1,2, 'N^3'). And next time, the user could call PU(1,4, 'N^2+N') and so on.


RE: Do PPL program input parameters accept symbolic arguments? - Helge Gabert - 10-27-2014 05:22 PM

Thank you! That does work!

So QUOTE() does the trick, and you don't even have to call CAS.int() or CAS("int()"). Amazing (although you can't debug).