Root Finding
Introduction
This module provides functions for finding the roots of univariate functions.
API
NumericalMethods.Roots.bisect — Methodbisect(f, xlow, xhigh; tol=1.0e-6, maxiter=30, verbose=false, kwargs...)Find the root of f in the interval [xlow, xhigh] using the bisection method.
Such a method will not work in multiple dimensions.
Arguments
f::Function: The function to find the root of.xlow::Real: The lower bound of the interval.xhigh::Real: The upper bound of the interval.tol::Real=1.0e-6: The tolerance for the root.maxiter::Integer=30: The maximum number of iterations to perform.kwargs...: Additional keyword arguments to pass tof.
Returns
xroot::Real: The root off.fxroot::Real: The value offat the root.xlow::Real: The lower bound of the root interval.xhigh::Real: The upper bound of the root interval.niter::Integer: The number of iterations performed.
NumericalMethods.Roots.brent — Methodbrent(f::Function, x_0, x_1; tol=1e-6, max_iter=1000, kwargs...)Use Brent's method to find the root of a function f.
Arguments
f::Function: The function to find the root of.x_0::Real: The first guess.x_1::Real: The second guess.rtol::Real=1e-6: The tolerance for the root.ftol::Real=1e-6: The tolerance for the function value.max_iter::Integer=1000: The maximum number of iterations to perform.kwargs...: Additional keyword arguments to pass tof.
Returns
xroot: The root off.fxroot: The value offat the root.iter: The number of iterations performed.
NumericalMethods.Roots.newton — Methodnewton(f, x_0; tol=1e-6, max_iter=1000, kwargs...)Use Newton's method to find the root of a multivariate function f: R^n → R.
Arguments
f::Function: The function to find the root of.x_0: The first guess.tol=1e-6: The tolerance for the root.max_iter=1000: The maximum number of iterations to perform.kwargs...: Additional keyword arguments to pass tof.
Returns
xroot: The root off.fxroot: The value offat the root.iter: The number of iterations performed.
NumericalMethods.Roots.newton — Methodnewton(f, x_0; tol=1e-6, max_iter=1000, kwargs...)Use Newton's method to find the root of a function f: R → R.
Arguments
f::Function: The function to find the root of.x_0::Real: The first guess.tol=1e-6: The tolerance for the root.max_iter=1000: The maximum number of iterations to perform.kwargs...: Additional keyword arguments to pass tof.
Returns
xroot: The root off.fxroot: The value offat the root.iter: The number of iterations performed.
NumericalMethods.Roots.secant — Methodsecant(f, x_0, x_1; tol=1e-6, max_iter=1000, kwargs...)Use the secant method to find the root of a function f.
Arguments
f::Function: The function to find the root of.x_0::Real: The first guess.x_1::Real: The second guess.tol::Real=1e-6: The tolerance for the root.max_iter::Integer=1000: The maximum number of iterations to perform.kwargs...: Additional keyword arguments to pass tof.
Returns
xroot: The root off.fxroot: The value offat the root.iter: The number of iterations performed.