Exemplo n.º 1
0
        static public Solution Solve(DAEEDescription equations, DAEESolver solver)
        {
            List <double[]> values = new List <double[]>();
            List <double>   time   = new List <double>();
            XZVectorPair    xz     = new XZVectorPair
            {
                X = Vector <double> .Build.Dense(equations.InitialValuesX),
                Z = Vector <double> .Build.Dense(equations.InitialValuesZ)
            };
            DAEEAnalytic system = new DAEEAnalytic(equations);

            values.Add(xz.ToArray());
            time.Add(equations.T0);
            for (double t = 0.0; t < equations.Time;)
            {
                double ti = t + equations.T0;
                t += solver.step;
                xz = solver.IntegrateStep(system, xz, ti);
                values.Add(xz.ToArray());
                double tnext = t + equations.T0;
                time.Add(tnext);
            }
            string[] variables = equations.VariableNames;
            return(new Solution(values, time, variables));
        }
 public DAEEAnalytic(DAEEDescription description)
 {
     fEquations        = description.F.ToArray();
     gEquations        = description.G.ToArray();
     SizeX             = description.SizeX;
     SizeZ             = description.SizeZ;
     dFdXequations     = description.DfdX;
     dFdZequations     = description.DfdZ;
     dGdXequations     = description.DgdX;
     parameters        = description.Parameters;
     parameterIndicies = description.GetParameterDictionary();
 }