Exemplo n.º 1
0
        public Launcher(DifferentialEquations differentialEquations, ExactSolution exactSolution, params ISolver[] solvers)
        {
            this.differentialEquations = differentialEquations;
            this.exactSolution         = exactSolution;

            wrappers = new SolverWrapper[solvers.Length];
            for (int i = 0; i < wrappers.Length; i++)
            {
                wrappers[i] = new SolverWrapper(solvers[i], differentialEquations);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            DifferentialEquations differentialEquation = (state, input, time) => (time * state); // y' = t * y
            ExactSolution         exactSolution        = (time) => (Math.Exp(0.5 * time * time + 1));
            Launcher launcher = new Launcher(differentialEquation, exactSolution,
                                             new SolverEuler(),
                                             new SolverEulerTrapezoidal(),
                                             new SolverHeun(),
                                             new SolverMidpoint(),
                                             new SolverRK4(),
                                             new SolverRK4Enhanced(),
                                             new SolverDormandPrince(),
                                             new SolverAdamsBashforth(5),
                                             new SolverAdamsMoulton(5));

            launcher.Test(2d, 0.001d);

            Console.ReadKey();
        }