[SOLVED] LNAME - exctracting variables from stringed expression?
|
01-16-2017, 11:41 AM
(This post was last modified: 01-16-2017 11:42 AM by DrD.)
Post: #2
|
|||
|
|||
RE: LNAME - exctracting variables from stringed expression?
I can share this, and hopefully, it's helpful for you and others ...
(You can copy each command line up to the semi, and paste into the command entry for testing): 1. Example: b:="X+Y<4"; // We know X,Y are reserved vars, so: LNAME(CAS("CAS(b)")); // ==> {}; 2. Convert to lower case variables, one way to avoid reserved vars: b:=LOWER(b); // X+Y<4 ==> x+y<4 LNAME(CAS("CAS(b)")); // ==> {x,y} LNAME(CAS("right(CAS(b)")); // ==> {x,y} I won't mention the CAS left/right thing. 3. Extending the example to your case: b:="(X-Y)"; ==> similar to your expression, using X and Y b:=LOWER(b); ==> non reserved variables LNAME(CAS("CAS(b)")); // ==> {x,y} LNAME(CAS("left(CAS(b)")); // ==> {x} I won't mention the CAS left/right thing. b:= "(C-A)"; ==> Precisely your provided expression b:=LOWER(b); ==> To get non-reserved variables LNAME(CAS("CAS(b)")); // ==> {} // Check to see if there was any pre-existing content in variables c or a: // I previously used a and c, so let's change to different variables: "(G-F)" b:= "(G-F)"; ==> Modeling your provided expression b:=LOWER(b); ==> To get non-reserved variables LNAME(CAS("CAS(b)")); // ==> {g,f} Summary: 1. LNAME is shown in the [Toolbox] and command entry, as a Home command, and shown in the [Help] as a CAS command. 2. LNAME requires non-reserved variables, (symbolics only). 3. Possibly one way to get non-reserved variables is to shift them to lower case equivalents. They must not pre-exist, only symbolic. 4. An LNAME acceptable string argument can get "evaluated" in the CAS system using the CAS command. 5. Be careful when using the CAS to obtain left or right expressions from a statement. The opinions expressed, may not be your own. -Dale- |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
[SOLVED] LNAME - exctracting variables from stringed expression? - chromos - 01-16-2017, 09:34 AM
RE: LNAME - exctracting variables from stringed expression? - DrD - 01-16-2017 11:41 AM
RE: [SOLVED] LNAME - exctracting variables from stringed expression? - Han - 01-16-2017, 02:46 PM
RE: LNAME - exctracting variables from stringed expression? - Didier Lachieze - 01-16-2017, 12:23 PM
RE: LNAME - exctracting variables from stringed expression? - chromos - 01-16-2017, 12:38 PM
RE: [SOLVED] LNAME - exctracting variables from stringed expression? - DrD - 01-16-2017, 03:05 PM
RE: [SOLVED] LNAME - exctracting variables from stringed expression? - DrD - 01-16-2017, 03:33 PM
|
User(s) browsing this thread: 1 Guest(s)