API

RootSolvers

RootSolvers.RootSolversModule
RootSolvers

Contains functions for solving roots of non-linear equations. See find_zero.

Example

julia> using RootSolvers

julia> sol = find_zero(x -> x^2 - 100^2,
                       SecantMethod{Float64}(0.0, 1000.0),
                       CompactSolution());

julia> sol
RootSolvers.CompactSolutionResults{Float64}(99.99999999994358, true)

julia> sol.root
99.99999999994358
source

Numerical methods

RootSolvers.find_zeroFunction
sol = find_zero(
        f::F,
        method::RootSolvingMethod{FT},
        soltype::SolutionType,
        tol::Union{Nothing, AbstractTolerance} = nothing,
        maxiters::Int = 10_000,
        )

Finds the nearest root of f. Returns a the value of the root x such that f(x) ≈ 0, and a Boolean value converged indicating convergence.

  • f function of the equation to find the root
  • method can be one of:
  • soltype is a solution type which may be one of: CompactSolution GPU-capable. Solution has converged and root only, see CompactSolutionResults VerboseSolution CPU-only. Solution has additional diagnostics, see VerboseSolutionResults
  • tol is a tolerance type to determine when to stop iterations.
  • maxiters is the maximum number of iterations.
source

Solution types

RootSolvers.CompactSolutionResultsType
CompactSolutionResults{FT} <: AbstractSolutionResults{FT}

Result returned from find_zero when CompactSolution is passed as the soltype.

To extract the root, use

sol = RootSolvers.find_zero(...)
sol.root
source

Tolerance types

Internal helper methods