Command for having a list of variables of an equation?

08282015, 07:44 PM
Post: #1




Command for having a list of variables of an equation?
Hello,
Is there a Home or Cas command able to output the list of variables of a given equation? Thank you very much, Giancarlo 

08282015, 08:10 PM
Post: #2




RE: Command for having a list of variables of an equation?
(08282015 07:44 PM)Giancarlo Wrote: Hello, The CAS command lname() is probably what you're looking for. If not, also look at algvar() and lvar(). <0ɸ0> Joe 

08292015, 10:09 AM
Post: #3




RE: Command for having a list of variables of an equation?
Hello John,
Thank you very much for your prompt answer. Unfortunately this is not what i am looking for. These CAS commands return only the list of lower case variables and only the one from a to z. In a formula like: Surf = ((B1 + B2) * h)/2 i would like to have a list or a vector of variables like that including 'Surf', 'B1', 'B2' and h. I know that i could use 's' for 'Surf', 'b' for 'B1' but this is not the point. If i have to think about an equation and i have to deal with a change of variable names, this implies an additional mental effort to me. I did it for the calculation of the inertia moment for generic shapes and believes me that it has been a nightmare to visually detect the errors. What i am trying to do now is to adapt my old equation library dealing with the new and very powerful HVars and DelHVars commands to create variables in HOME, store an Eq, Solve it and then removes the variables. One aspect that i discovered last night was the HVars command in the format HVars ("name", 2). This command returns the list of variables included in the 'name' variable if 'name' is a function. The issue again is that (i think) I cannot store a function without defining (STOring) each individual variable in advance. At the moment my only solution for shaping my personal Eqlibrary is to ask to the user: the equation, the equation name and the list of variables. In this way i can create all the variables before storing the EQuation, solve the equation for any of its variables and then ask the user if he/she wants to delete the variables. I hope someone can have another solution thinking out of the box, Thanks Giancarlo 

08292015, 12:59 PM
Post: #4




RE: Command for having a list of variables of an equation?
I don't understand the problem: lname(Surf = ((B1 + B2) * h)/2) returns [Surf, B1, B2, h]


08292015, 02:05 PM
(This post was last modified: 08292015 02:24 PM by DrD.)
Post: #5




RE: Command for having a list of variables of an equation?
As a CAS command, it works in HOME also, note the quote:
[HOME] lname("Surf = ((B1 + B2) * h)/2") ==> [Surf B1 B2 h] Dale 

08292015, 06:56 PM
Post: #6




RE: Command for having a list of variables of an equation?
Hello Bernard and Dale,
Unfortunately this doesn't work for me. If i run [HOME] CAS.lname (V=R×I0) ==> [ ]. CAS.lname ("V=R×I0") ==> [ ]. lname (V=R×I0) ==> [ ]. lname ("V=R×I0") ==> [ ]. Am i doing something wrong? I am running os 8151 with cas 1.1.211. Merci/Thanks Giancarlo 

08292015, 07:20 PM
Post: #7




RE: Command for having a list of variables of an equation?
It's best not to use reserved variables (like R). For example if your expression was:
lname("V=Radius*I0") ==> [Radius I0] or lname("V=r*I0") ==> [r I0] For reasons best explained by others, reserved variables are "special." <G> Dale 

08292015, 07:37 PM
Post: #8




RE: Command for having a list of variables of an equation?
Hello Dale,
I know that reserved variables A...Z are special. This is the reason why i put in the formula V=R×I0 where I0 is a capitol 'i' with a zero '0'. The 'I0' is not a reserved variable (A...Z). With the command: lname ( V = R × I0 ) I was expecting [ V R I0] or [ I0] for the reason above regarding reserved variables. The issue is that i only receive [ ] as answer. Is that normal? Giancarlo 

08292015, 08:33 PM
Post: #9




RE: Command for having a list of variables of an equation?
(08292015 07:37 PM)Giancarlo Wrote: Hello Dale, That is an issue discussed otherwhere on this forum, in CAS you must add quotes to the formula ie lname('R=V*I0'), that provides [R V I0], lname(Quote(R=V*I0)) again yields an empty list. So it seems to be difficult to be used in a program. Arno 

08292015, 08:39 PM
Post: #10




RE: Command for having a list of variables of an equation?
Hello,
I start seeing the point. Some variable names are not detected by the lname parser. V1 is not detected, Vol is detected R1 is not detected fR is detected I0 is not detected Il is detected Which is the rule? Thanks Giancarlo 

08292015, 09:24 PM
Post: #11




RE: Command for having a list of variables of an equation?
You should get you a list of systemvariables V1 is used in Advanced Graphing, R1 in Polar, I don't know why IO does not work. This list was made by Joe Horn, you can get it from here.
Arno 

08302015, 06:32 AM
Post: #12




RE: Command for having a list of variables of an equation?
If you are using HOME variables, they are replaced by their values during evaluation step, if the value is 0 then R*I0 cancels in your equation.


08302015, 11:58 AM
(This post was last modified: 08302015 12:03 PM by Marcus von Cube.)
Post: #13




RE: Command for having a list of variables of an equation?
(08302015 06:32 AM)parisse Wrote: If you are using HOME variables, they are replaced by their values during evaluation step, if the value is 0 then R*I0 cancels in your equation. I think it would help if the CAS completely ignored Home variables, except when they are qualified with "Home." or "Appname.". This way, everything from Home is still available on request but never comes in the way when not desired. For compatibility reasons, a user selectable CAS open "Require Home objects to be fully qualified" should be implemented. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basiccompare.html 

08302015, 02:21 PM
Post: #14




RE: Command for having a list of variables of an equation?
Hello,
I start seeing the point. Some variable names are not detected by the lname parser. V1 is not detected, Vol is detected R1 is not detected fR is detected I0 is not detected Il is detected Which is the rule? Thanks Giancarlo 

08302015, 05:16 PM
Post: #15




RE: Command for having a list of variables of an equation?
As already explained, HOME variables are evaluated inside the equation argument of lname, that's why you won't see them (unless you quote the equation).


« Next Oldest  Next Newest »

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