Post Reply 
Can app equations be indexed?
01-13-2017, 08:35 PM (This post was last modified: 01-13-2017 08:43 PM by Han.)
Post: #5
RE: Can app equations be indexed?
I've done this in Graph3D, but only using a single V0 to do temporary calculations and restoring the original content of V0. The format is just V0:=<string> where <string> is an actual string or a variable containing a string. It's also a way to quickly create a function.

The string itself needs to be a valid expression. Tim's suggestion works fine for a list strings.

If you are running into issues with variables, you can create app variables using AVars("varname"):=0 and delete when with DelAVars (can be a list of strings corresponding to app variables, too).

Code:
ex:="2*x-3*y+myvar";
varnames:=lname(CAS(eval(ex)));
k:=size(varnames);
for n from 1 to k do
  varnames(n):=string(varnames(n));
  AVars(varnames(n)):=0;
end;

Then to delete, since varnames have been converted to strings, just use DelAVars(varnames);

I have been using this scheme to program my own Equations Library and solver application that allows for any sort of variable.

EDIT: In case it was not clear, once the app variables are created, you can use your string equations as already described by Tim and Didier without needing to convert to upper case or limiting yourself to single-letter variables.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Can app equations be indexed? - DrD - 01-13-2017, 04:45 PM
RE: Can app equations be indexed? - DrD - 01-13-2017, 05:46 PM
RE: Can app equations be indexed? - Han - 01-13-2017 08:35 PM
RE: Can app equations be indexed? - DrD - 01-14-2017, 09:13 PM
RE: Can app equations be indexed? - Han - 01-14-2017, 09:50 PM
RE: Can app equations be indexed? - DrD - 01-14-2017, 10:18 PM



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