Newton's method

# Newton's method

Sometimes it is necessary to refine obtained solutions. For this we provide an interface to Newton's method.

``newton(F::AbstractSystem, x₀, norm=euclidean_norm, cache=NewtonCache(F, x₀); tol=1e-6, miniters=1, maxiters=3, simplified_last_step=true)``

An ordinary Newton's method. If `simplified_last_step` is `true`, then for the last iteration the previously Jacobian will be used. This uses an LU-factorization for square systems and a QR-factorization for overdetermined.

``NewtonResult{T}``

Structure holding information about the outcome of the `newton` function. The fields are.

• `return_code::NewtonReturnCode.codes`: The return code of computation. `NewtonReturnCode.converged` means that `accuracy ≤ tol`.
• `accuracy::T`: |xᵢ-xᵢ₋₁| for i = iters and x₀,x₁,…,xᵢ₋₁,xᵢ are the Newton iterates.
• `iters::Int`: The number of iterations used.
• `digits_lost::Float64` Estimate of the (relative) lost digits in the linear algebra.
``NewtonReturnCode.codes``

The possible return codes of Newton's method

• `NewtonReturnCode.converged`
• `NewtonReturnCode.terminated`
• `NewtonReturnCode.terminated_no_approximate`
• `NewtonReturnCode.maximal_iterations`
source

For high performance applications we also provide an in-place version of Newton's method which avoids any temporary allocations.

``newton!(out, F::AbstractSystem, x₀, norm, cache::AbstractNewtonCache; tol=1e-6, miniters=1, maxiters=3, simplified_last_step=true)``

In-place version of `newton`. Needs a `NewtonCache` and `norm` as input.

``NewtonCache(F::AbstractSystem, x)``

Cache for the `newton` function.