root_secant#
- named_arrays.optimize.root_secant(function, guess, min_step_size=None, max_abs_error=None, max_iterations=100, damping=None, callback=None)#
Find the root of a given function using the secant method.
- Parameters:
function (Callable[[InputT], OutputT]) – a scalar-valued or vector-valued function to find the root of.
guess (InputT) – an initial guess for the root
min_step_size (None | InputT) – Stop iterating if the step size falls below this value
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
ValueErroris raised.damping (None | float) – If this parameter is equal to
1, it has no effect and is equivalent to the default,None(vanilla secant method). If this parameter is less than1, the damped secant method is carried out. The damped secant method can address some of the failure modes of the secant method, particularly the problem of entering an infinite cyclecallback (None | Callable[[int, InputT, OutputT, AbstractArray], None]) – Optional callback function that is called on every iteration as
callback(i, x, f, converged), whereiis the current iteration,xis the current root guess,fis the current function value, andconvergedis an array storing the convergence state for every root being computed.
- Return type:
InputT