how to programatically define
|
11-28-2016, 07:13 AM
Post: #2
|
|||
|
|||
RE: how to programatically define
Hello,
Yes, you can actually do it, but it is a little bit cumbersome, sorry about that... Defined functions are actually user system global variables that contains a user function (a user function is different from an expression. A user function is an instruction sequence (ie, an executable list of objects) that has named parameters). However, contrary to the CAS system, which is formal, there is no syntax for a user to enter/create such an object in the command line (although there is one in program mode). As a result, you need to jump through hoops to do "make it happen". So, without further due, here is how to do it! First, define a user system global variable using the HVars instruction: HVars("abc"):='A+2*B' Then, and this is where the trick is, you need to tell the system to convert that expression into a user function with given parameters. Do this using the 2nd meta data of the abc variable. HVars("abc",2):={"B"} This tells the system that the variable abc is now a user function and that it takes 1 parameter (ie local variable) called B. You can provide as many parameters as you want of course, and the order in which you give them is the order in which they appear in the parameter list. Note, this works both ways, you can get the parameter list of an existing user defines function by doing HVars("name", 2) By the way, this is explained in the help (not as extensively as here) Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
how to programatically define - primer - 11-26-2016, 04:15 PM
RE: how to programatically define - cyrille de brébisson - 11-28-2016 07:13 AM
RE: how to programatically define - primer - 11-28-2016, 11:35 PM
RE: how to programatically define - Brad Barton - 12-06-2016, 04:41 AM
RE: how to programatically define - cyrille de brébisson - 12-06-2016, 06:23 AM
RE: how to programatically define - Brad Barton - 12-07-2016, 05:48 PM
|
User(s) browsing this thread: 1 Guest(s)