function alpha = backtracking(f, gf, p, x, alpha, rho, c) xn = x + alpha * p; while f(xn(1), xn(2)) > f(x(1), x(2)) + c * alpha * gf(x(1), x(2))' * p alpha = rho * alpha; xn = x + alpha * p; end end