private static double[] GradF(double[] x, Function F) { int n = x.Length; double[] grad = new double[n]; for (int i = 0; i < n; i++) { grad[i] = FDiff(i, F)(x); } return(grad); }
private static double[,] GessF(double[] x, Function F) { int n = x.Length; double[,] gess = new double[n, n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { gess[i, j] = FDiff(j, FDiff(i, F))(x); } } return(gess); }