# `pymor.algorithms.newton`¶

## Module Contents¶

### Functions¶

 `newton` Newton algorithm.
pymor.algorithms.newton.newton(operator, rhs, initial_guess=None, mu=None, range_product=None, source_product=None, least_squares=False, miniter=0, maxiter=100, atol=0.0, rtol=1e-07, relax='armijo', line_search_params=None, stagnation_window=3, stagnation_threshold=np.inf, error_measure='update', return_stages=False, return_residuals=False)[source]

Newton algorithm.

This method solves the nonlinear equation

```A(U, mu) = V
```

for `U` using the Newton method.

Parameters

operator

The `Operator` `A`. `A` must implement the `jacobian` interface method.

rhs

`VectorArray` of length 1 containing the vector `V`.

initial_guess

If not `None`, a `VectorArray` of length 1 containing an initial guess for the solution `U`.

mu

The `parameter values` for which to solve the equation.

range_product

The inner product `Operator` on `operator.range` with which the norm of the resiudal is computed. If `None`, the Euclidean inner product is used.

source_product

The inner product `Operator` on `operator.source` with which the norm of the solution and update vectors is computed. If `None`, the Euclidean inner product is used.

least_squares

If `True`, use a least squares linear solver (e.g. for residual minimization).

miniter

Minimum amount of iterations to perform.

maxiter

Fail if the iteration count reaches this value without converging.

atol

Finish when the error measure is below this threshold.

rtol

Finish when the error measure has been reduced by this factor relative to the norm of the initial residual resp. the norm of the current solution.

relax

If real valued, relaxation factor for Newton updates; otherwise `'armijo'` to indicate that the `armijo` line search algorithm shall be used.

line_search_params

Dictionary of additional parameters passed to the line search method.

stagnation_window

Finish when the error measure has not been reduced by a factor of `stagnation_threshold` during the last `stagnation_window` iterations.

stagnation_threshold

See `stagnation_window`.

error_measure

If `'residual'`, convergence depends on the norm of the residual. If `'update'`, convergence depends on the norm of the update vector.

return_stages

If `True`, return a `VectorArray` of the intermediate approximations of `U` after each iteration.

return_residuals

If `True`, return a `VectorArray` of all residual vectors which have been computed during the Newton iterations.

Returns

U

`VectorArray` of length 1 containing the computed solution

data

Dict containing the following fields:

solution_norms

`NumPy array` of the solution norms after each iteration.

update_norms

`NumPy array` of the norms of the update vectors for each iteration.

residual_norms

`NumPy array` of the residual norms after each iteration.

stages

See `return_stages`.

residuals

See `return_residuals`.

Raises

NewtonError

Raised if the Newton algorithm failed to converge.