root_newton#

named_arrays.optimize.root_newton(function, guess, jacobian=None, max_abs_error=None, max_iterations=100, callback=None)#

Find the root of a given function using Newton’s method

Parameters:
  • function (Callable[[InputT], OutputT]) – a scalar-valued or vector-valued function to find the roots of

  • guess (InputT) – an initial guess for the root

  • jacobian (None | Callable[[InputT], OutputT]) – The Jacobian of the function (optional). If None, named_arrays.jacobian() is used.

  • max_abs_error (None | OutputT) – Maximum absolute error between zero and the function value. If the function value at the current root guess is below this value, the root is considered converged.

  • max_iterations (int) – Maxmimum number of iterations to carry out before a ValueError is raised.

  • callback (None | Callable[[int, InputT, OutputT, AbstractArray], None]) – Optional callback function that is called on every iteration as callback(i, x, f, converged), where i is the current iteration, x is the current root guess, f is the current function value, and converged is an array storing the convergence state for every root being computed.