コード例 #1
0
        //<summary><summary>
        public static Vector <double> Solve(NonlinearSystem system, Vector <double> x0, int maxIterations, double accuracy, double alpha)
        {
            Vector <double> x = x0;
            Vector <double> F = system.F(x);

            for (int i = 0; i < maxIterations; i++)
            {
                Matrix <double> J = system.DF(x);

                Vector <double> dx    = J.Solve(F.Multiply(-alpha));
                Vector <double> x_new = x + dx;
                Vector <double> F_new = system.F(x_new);
                x = x_new;
                if (F_new.L2Norm() < accuracy)
                {
                    return(x);
                }
                F = F_new;
            }
            throw new Exception("Решение не сошлось");
        }
コード例 #2
0
 public abstract void Solve(NonlinearSystem system, Vector <double> x0);