Post Reply 
Calling the contents of an identifier
03-13-2017, 10:29 PM (This post was last modified: 03-21-2017 04:18 AM by compsystems.)
Post: #3
RE: Calling the contents of an identifier
In CAS MODE, does not work, evaluates the USER variables, (A, ... Z, L0-L9, M0-M9, etc.) I keep insisting that the quotation marks should be not evaluated the expression.

//CAS MODE with X uppercase
X:=0;
symbExpr:='X+1';
var:="FF1";
CAS( EVAL ( var + "(X):=" + symbExpr ) ); // FF1(X):=1
FF1(2); // RETURNS 1 evaluates X =(

//HOME MODE with X uppercase
X:=0;
symbExpr:='X+1';
var:="FF1";
CAS( EVAL (var + "(X):=" + symbExpr )); // FF1(X):='X+1'
FF1(2); // RETURNS 3 OK

//CAS MODE with x lowercase
purge(x);
symbExpr:='x+1'; // or symbExpr:=x+1;
var:="FF2";
CAS( EVAL ( var + "(x):=" + symbExpr ) ); // FF2(x):='x+1'
FF2(2); // RETURNS 3 OK

At least I was able to execute INPUT CMD from a CAS PRG
run PRGCAS();

PHP Code:
export resetFunctionAppVarsvarApp_str )
BEGIN
  expr
"Function." varApp_str ":=0"); // "" = "No definition in Symbolic view"
  
return "Done";
END;


#cas
  
PRGCAS():= 
  
BEGIN
    SetFunctionAppVars
"F1" );
    
SetFunctionAppVars"F2" );
    
// ....
    
return("Done");
  
END;
#end

export SetFunctionAppVarsvarApp_str )
BEGIN
  local symbExpr
resetVALUE_FXinitVALUE_FX;
  
IFERR
    initVALUE_FX 
:= EXPRvarApp_str );
  
THEN
    initVALUE_FX 
:= 0
  
END
  
resetVALUE_FX := 'X^2/9';
  
local ObjectType_SymbolicExpression := 8;
  if 
  (
    
input
    { { 
symbExpr, [ ObjectType_SymbolicExpression ] } }, 
    
"Set Function App Vars",
    
varApp_str+"(X):",
    
"Enter Symbolic Expression for "+varApp_str+"(X)",
    
resetVALUE_FX
    
initVALUE_FX
    
)
  )
  
then
    expr
("Function." varApp_str ":='" symbExpr "'");
    
//CAS( EVAL(varApp_str + "(X):=" + symbExpr) );
    //return( { varApp_str, symbExpr, varApp_str + "(X):=" + symbExpr,  varApp_str + ":='" + symbExpr + "'" });
  
end;
END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Calling the contents of an identifier - compsystems - 03-13-2017 10:29 PM



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