Beispiel #1
0
        public static double SolveOde(Func <double, double, double> rhs, double x0, double y0, double x1, EvaluationSettings settings)
        {
            if (rhs == null)
            {
                throw new ArgumentNullException("rhs");
            }

            MultiOdeStepper stepper = new BulrischStoerStepper((double x, IList <double> y) => new double[] { rhs(x, y[0]) }, x0, new double[] { y0 }, settings);

            //MultiOdeStepper stepper = new RungeKutta54Stepper((double x, IList<double> y) => new double[] { rhs(x, y[0]) }, range.LeftEndpoint, new double[] { start }, settings);
            stepper.Integrate(x1);
            return(stepper.Y[0]);
        }
Beispiel #2
0
        public static OdeResult <IList <double> > SolveOde(Func <double, IList <double>, IList <double> > rhs, double x0, IList <double> y0, double x1, EvaluationSettings settings)
        {
            if (rhs == null)
            {
                throw new ArgumentNullException("rhs");
            }
            if (y0 == null)
            {
                throw new ArgumentNullException("y0");
            }
            if (settings == null)
            {
                throw new ArgumentException("settings");
            }

            MultiOdeStepper stepper = new BulrischStoerStepper(rhs, x0, y0, settings);

            stepper.Integrate(x1);

            return(stepper.Result);
        }