Exemplo n.º 1
0
 public DAEDIAnalytic(DAEDIDescription description)
 {
     fEquations     = description.F.ToArray();
     gEquations     = description.G.ToArray();
     SizeX          = description.SizeX;
     SizeZ          = description.SizeZ;
     dFdXequations  = description.DfdX;
     dFddXequations = description.DfddX;
     dFdZequations  = description.DfdZ;
     dGdXequations  = description.DgdX;
     dGdZequations  = description.DfdZ;
 }
Exemplo n.º 2
0
        static public Solution Solve(DAEDIDescription equations, DAEDISolver solver, double t0, double time)
        {
            List <double[]> values    = new List <double[]>();
            List <double>   timeArray = new List <double>();
            XZVectorPair    xz        = new XZVectorPair {
                X = Vector <double> .Build.Dense(equations.InitialValuesX),
                Z = Vector <double> .Build.Dense(equations.InitialValuesX)
            };
            DAEDIAnalytic system = new DAEDIAnalytic(equations);

            values.Add(xz.ToArray());
            timeArray.Add(t0);
            for (double t = 0.0; t < time;)
            {
                double ti = t + t0;
                xz = solver.IntegrateStep(system, xz, ti);
                t += solver.step;
                values.Add(xz.ToArray());
                double tnext = t + t0;
                timeArray.Add(tnext);
            }
            string[] variables = equations.VariableNames;
            return(new Solution(values, timeArray, variables));
        }