AK.Expression.SetVariable C# (CSharp) Method

SetVariable() public method

public SetVariable ( string name, double value ) : Variable
name string
value double
return Variable
        public Variable SetVariable(string name, double value)
        {
            Variable v;
            if (constants.TryGetValue(name,out v))
            {
                if (v.stringValue != null)
                {
                    throw new ESParameterTypeChangedException("Can not change type of existing parameter " + name);
                }
                v.value = value;
                return v;
            }
            v = new Variable(name,value);
            constants.Add(name,v);
            return v;
        }

Same methods

Expression::SetVariable ( string name, string value ) : Variable

Usage Example

Example #1
0
 // private float a = 0f;
 float fx(float s, float t)
 {
     // return (1.25f+0.5f*Mathf.Cos(s))*Mathf.Cos(t);
     // return Mathf.Cos(s);
     // var exp = solver.SymbolicateExpression(sfx,new string[]{"s", "t", "a"});
     fxexp.SetVariable("t", t);
     fxexp.SetVariable("s", s);
     fxexp.SetVariable("a", a);
     return((float)fxexp.Evaluate());
     // return s;
 }
All Usage Examples Of AK.Expression::SetVariable