private Matrix getInverseGessePoly(PolynomialDerivativeFunction function) { double [,] arr = new double [2, 2] { { function.coefficients.a * 2, function.coefficients.b }, { function.coefficients.b, function.coefficients.c * 2 } }; return(new Matrix(arr).getInverseMatrix()); }
public List <string> getResults(PolynomialDerivativeFunction function, double x1, double x2, double e) { List <string> results = new List <string>(); Matrix grad = null; Matrix gesse = getInverseGessePoly(function); int i = 1; do { grad = calculateGrad(function, x1, x2); Matrix res = gesse * grad; x1 -= res.get(0, 0); x2 -= res.get(0, 1); results.Add(String.Format("k={0} x1={1} x2={2} f(x1,x2)={3}", i++, Math.Round(x1, 3), Math.Round(x2, 3), Math.Round(function.getY(x1, x2), 3))); } while (grad == null || (Math.Abs(grad.get(0, 0)) > e && Math.Abs(grad.get(0, 1)) > e)); return(results); }
public List <string> getResults(PolynomialDerivativeFunction function, double eps, double x1, double x2) { return(getResults(function, eps, x1, x2, 0.5, 0.3, 0.5)); }
public List <string> getResults(PolynomialDerivativeFunction function, double x1, double x2, double e) { return(getResults(function, x1, x2, e, 0.1)); }