Solvers: reusable nonlinear solvers¶
newton description¶
srlife.solvers.newton is a reusable Newton-Raphson solver with
backtracking line search that can be used wherever we need to solve a
nonlinear system of equations.
- srlife.solvers.newton(RJ, x0, rel_tol=-5.0, abs_tol=1e-08, miters=20, linear_solver=<function solve>, verbose=True, return_extra=False, linesearch=True, max_search=10)¶
Simple newton-raphson solver
- Parameters:
RJ – function that gives the residual and jacobian values
x0 – initial guess
rel_tol (Optional[1.0e-6]) – relative convergence tolerance
abs_tol (Optional[1.0e-8]) – absolute convergence tolerance
miters (Optional[20]) – maximum number of iterations
linear_solver (Optional[numpy.linalg.solve]) – function that solves the linear system A x = b
verbose (Optional[True]) – if true, print debug info,
return_extra (Optional[False]) – if true also return the final residual vector and Jacobian
linesearch (Optional[True]) – if true do backtracking linesearch
max_search (Optional[10]) – max number of backtracking steps