Post Reply 
Write an equation that contains several variables, and go immediately to solve them
03-07-2021, 08:37 PM
Post: #10
Write an equation that contains several variables, and go immediately to solve them
Not sure if this helps but, if you don't mind enclosing your equation in double quotes, this program:

PHP Code:
#pragma mode( separator(.,;) integer(h32) )
EXPORT makevars(is)
BEGIN
 local n
,stc,mtvs,sz;
 
local fy:={};
 
stc:="lname("+is+")";
 
mtvs:=CAS(eval(stc));
 
sz:=SIZE(mtvs);
 if 
sz then
  fy
:=MAKELIST(string(mtvs(n)),n,1,sz);
 
AVars(fy):=0;
 
END;
 
AVars;
END

will create any app variables that do not already exist and return a list.

DelAVars({"y","x"});
makevars("exp (x) * 2sin (y)");

returns: {"x","y"}

-road
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE - CharlieF - 02-27-2021, 05:58 AM
Write an equation that contains several variables, and go immediately to solve them - roadrunner - 03-07-2021 08:37 PM



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