Beispiel #1
0
 public ExpressionSolver()
 {
     undefinedVariablePolicy = UndefinedVariablePolicy.Error;
     AddCustomFunction("sin", delegate(double p) { return(System.Math.Sin(p)); }, true);
     AddCustomFunction("cos", delegate(double p) { return(System.Math.Cos(p)); }, true);
     AddCustomFunction("tan", delegate(double p) { return(System.Math.Tan(p)); }, true);
     AddCustomFunction("abs", delegate(double p) { return(System.Math.Abs(p)); }, true);
     AddCustomFunction("asin", delegate(double p) { return(System.Math.Asin(p)); }, true);
     AddCustomFunction("acos", delegate(double p) { return(System.Math.Acos(p)); }, true);
     AddCustomFunction("atan", delegate(double p) { return(System.Math.Atan(p)); }, true);
     AddCustomFunction("atan2", 2, delegate(double[] p) { return(System.Math.Atan2(p[0], p[1])); }, true);
     AddCustomFunction("sqrt", delegate(double p) { return(System.Math.Sqrt(p)); }, true);
     AddCustomFunction("sign", delegate(double p) { return(System.Math.Sign(p)); }, true);
     AddCustomFunction("floor", delegate(double p) { return(System.Math.Floor(p)); }, true);
     AddCustomFunction("ceil", delegate(double p) { return(System.Math.Ceiling(p)); }, true);
     AddCustomFunction("min", 2, delegate(double[] p) { return(System.Math.Min(p[0], p[1])); }, true);
     AddCustomFunction("max", 2, delegate(double[] p) { return(System.Math.Max(p[0], p[1])); }, true);
     AddCustomFunction("sinh", delegate(double p) { return(System.Math.Sinh(p)); }, true);
     AddCustomFunction("exp", delegate(double p) { return(System.Math.Exp(p)); }, true);
     AddCustomFunction("cosh", delegate(double p) { return(System.Math.Cosh(p)); }, true);
     AddCustomFunction("tanh", delegate(double p) { return(System.Math.Tanh(p)); }, true);
     AddCustomFunction("log", delegate(double p) { return(System.Math.Log(p)); }, true);
     AddCustomFunction("log10", delegate(double p) { return(System.Math.Log10(p)); }, true);
     AddCustomFunction("round", delegate(double p) { return(System.Math.Round(p)); }, true);
 }
 public ExpressionSolver()
 {
     undefinedVariablePolicy = UndefinedVariablePolicy.Error;
     AddCustomFunction("sin", delegate(double p) { return System.Math.Sin(p); },true);
     AddCustomFunction("cos", delegate(double p) { return System.Math.Cos(p); },true);
     AddCustomFunction("tan", delegate(double p) { return System.Math.Tan(p); },true);
     AddCustomFunction("abs", delegate(double p) { return System.Math.Abs(p); },true);
     AddCustomFunction("asin", delegate(double p) { return System.Math.Asin(p); },true);
     AddCustomFunction("acos", delegate(double p) { return System.Math.Acos(p); },true);
     AddCustomFunction("atan", delegate(double p) { return System.Math.Atan(p); },true);
     AddCustomFunction("atan2",2, delegate(double[] p) {	return System.Math.Atan2(p[0],p[1]); },true);
     AddCustomFunction("sqrt", delegate(double p) { return System.Math.Sqrt(p); },true);
     AddCustomFunction("sign", delegate(double p) { return System.Math.Sign(p); },true);
     AddCustomFunction("floor", delegate(double p) { return System.Math.Floor(p); },true);
     AddCustomFunction("ceil", delegate(double p) { return System.Math.Ceiling(p); },true);
     AddCustomFunction("min",2, delegate(double[] p) { return System.Math.Min(p[0],p[1]); },true);
     AddCustomFunction("max",2, delegate(double[] p) { return System.Math.Max(p[0],p[1]); },true);
     AddCustomFunction("sinh", delegate(double p) { return System.Math.Sinh(p); },true);
     AddCustomFunction("exp", delegate(double p) { return System.Math.Exp(p); },true);
     AddCustomFunction("cosh", delegate(double p) { return System.Math.Cosh(p); },true);
     AddCustomFunction("tanh", delegate(double p) { return System.Math.Tanh(p); },true);
     AddCustomFunction("log", delegate(double p) { return System.Math.Log(p); },true);
     AddCustomFunction("log10", delegate(double p) { return System.Math.Log10(p); },true);
     AddCustomFunction("round", delegate(double p) { return System.Math.Round(p); },true);
 }