pypsa.pf.newton_raphson_sparse

pypsa.pf.newton_raphson_sparse#

pypsa.pf.newton_raphson_sparse(f: Callable, guess: ndarray, dfdx: Callable, x_tol: float = 1e-10, lim_iter: int = 100, distribute_slack: bool = False, slack_weights: ndarray | None = None) tuple[ndarray, int, Any, bool]#

Solve f(x) = 0 with initial guess for x and dfdx(x).

dfdx(x) should return a sparse Jacobian. Terminate if error on norm of f(x) is < x_tol or there were more than lim_iter iterations.