public static SLValueList EvalPolarFce(string xexpr, string yexpr, double from, double to, double step) { if (from >= to) { return(null); } if ((to - from) < step) { return(null); } SLValueList newdata = new SLValueList(); SLMath.SLMathExp mathx = new SLMathExp(); SLMath.SLMathExp mathy = new SLMathExp(); mathx.Expresion = xexpr; mathy.Expresion = yexpr; MathVar var1 = mathx.AddVariable("x", 0); MathVar var2 = mathy.AddVariable("x", 0); for (double i = from; i < to + step; i += (double)step) { if (Math.Abs(i) < 0.00001) { i = 0; } i = Math.Round(i, 5); var1.value = i; var2.value = i; double x = mathx.Evaluate(); double y = mathy.Evaluate(); SLValueXY val = new SLValueXY(); val.X = x; val.Y = y; newdata.Add(val); } //Add(newdata); return(newdata); }
// STATICKE FUNKCE public static SLValueList EvaluateFce(string expr, double xfrom, double xto, double step) { if (xfrom >= xto) { return(null); } if ((xto - xfrom) < step) { return(null); } SLValueList newdata = new SLValueList(); newdata.Title = expr; SLMath.SLMathExp math = new SLMathExp(); math.Expresion = expr; MathVar var = math.AddVariable("x", 0); for (double i = xfrom; i < xto + step; i += (double)step) { if (Math.Abs(i) < 0.00001) { i = 0; } i = Math.Round(i, 5); var.value = i; double x = i; double y = math.Evaluate(); SLValueXY val = new SLValueXY(); val.X = x; val.Y = y; newdata.Add(val); } //Add(newdata); return(newdata); }