Post Reply 
Do PPL program input parameters accept symbolic arguments?
10-27-2014, 02:49 PM
Post: #1
Do PPL program input parameters accept symbolic arguments?
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.
Find all posts by this user
Quote this message in a reply
10-27-2014, 03:37 PM (This post was last modified: 10-27-2014 03:48 PM by Han.)
Post: #2
RE: Do PPL program input parameters accept symbolic arguments?
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.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
10-27-2014, 03:47 PM (This post was last modified: 10-27-2014 03:59 PM by Helge Gabert.)
Post: #3
RE: Do PPL program input parameters accept symbolic arguments?
Sure, here is the snippet

   


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.
Find all posts by this user
Quote this message in a reply
10-27-2014, 05:22 PM (This post was last modified: 10-27-2014 05:39 PM by Helge Gabert.)
Post: #4
RE: Do PPL program input parameters accept symbolic arguments?
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).
Find all posts by this user
Quote this message in a reply
Post Reply 




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