public static double GetCylIntegrX(Func <double, double> f_ot_x, double a, double b) { var f2 = new Func <double, Vector, Vector>((x, v) => new Vector(Pow(f_ot_x(x), 2))); var v0 = new Vector(0); var sol = Ode.Adams4(a, v0, f2, (b - a) / 300).SolveTo(b); return(PI * sol.Last().X[0]); }
public void ExponentSolveToAdams4Test1() { var sol = Ode.Adams4(0, 1, (t, x) => - x, new Options { RelativeTolerance = 1e-3, InitialStep = 0.1 }).SolveTo(1000); foreach (var sp in sol) { Assert.IsTrue(Math.Abs(sp.X[0] - Math.Exp(-sp.T)) < 1e-2); } }