private CauchyProblemResult NewmarkSolver(Matrix massMatrix, Matrix stiffnessMatrix, Vector initValue, double gamma, double alfa, double maxTime, int intervals)
        {
            double deltaTime = maxTime / intervals;
            CauchyProblemResult result = new CauchyProblemResult(deltaTime);

            double a1 = (2 / (deltaTime * deltaTime * gamma));
            double a2 = (2 / (deltaTime * gamma));
            double a3 = ((1 / gamma) - 1);

            double a4 = deltaTime * (1-alfa); 
            double a5 = deltaTime * alfa;

            Vector u = initValue;
            Vector du = new Vector(initValue.Length);
            Vector ddu = massMatrix.LUalgorithm((-1) * stiffnessMatrix * initValue);

            result.AddResult(u);

            Matrix K = massMatrix * a1 + stiffnessMatrix;
            for (double t = deltaTime; t <= maxTime; t += deltaTime)
            {
                Vector uprev = u;
                Vector duprev = du;
                Vector dduprev = ddu;

                Vector F = massMatrix * (a1 * uprev + a2 * duprev + a3 * dduprev);
                u = K.LUalgorithm(F);

                ddu = a1 * (u - uprev) - a2 * duprev - a3 * dduprev;
                du = duprev + a4 * dduprev + a5 * ddu;

                ApplyNonlinearity(massMatrix, stiffnessMatrix, ref u, ref du, ref ddu, a1, a2, a3, a4, a5);

                result.AddResult(u);
            }

            return result;
        }