static FunctionBounds CreateBounds(string[] parts) { System.Text.RegularExpressions.Regex rg_bound = new System.Text.RegularExpressions.Regex("{.*}"); FunctionBounds Bounds = new FunctionBounds(); foreach (string part in parts.Skip(1)) { if (rg_bound.IsMatch(part)) { string[] bound = part.Remove(part.Length - 1, 1).Remove(0, 1).Split(','); Bounds.AddBound((float)Convert.ToDouble(bound[0]), (float)Convert.ToDouble(bound[bound.Length - 1])); if (bound.Length == 3) { Bounds.AddStep((float)Convert.ToDouble(bound[1])); } else { Bounds.AddDefaultStep((float)Convert.ToDouble(bound[0]), (float)Convert.ToDouble(bound[bound.Length - 1])); } } else { } } return Bounds; }
private static float NIntCore(FunctionBounds Bounds, FunctionBase FB) { FunctionalEquationLegacy FE = new FunctionalEquationLegacy(FB, Bounds); object[][] Output = (object[][])FE.eval(); float val = 0; for (int x = 0; x < Output.Length; x++) { float dval = (float)Convert.ToDouble((Output[x][Output[x].Length - 1])); for (int j = 0; j < FE.stepsize.Length; j++) { dval = dval * (float)FE.stepsize[j]; } val += dval; } return val; }
private static FunctionBounds ReduceBounds(FunctionBounds Bounds) { for (int j = 0; j < Bounds.StepList.Count; j++) { Bounds.StepList[j] = Bounds.StepList[j] / 2; } return Bounds; }
public FunctionalEquation(FunctionBase _func, FunctionBounds _bounds) { func = _func; bounds = _bounds.BoundsList; stepsize = _bounds.StepList; }