View Source Integrator.NonLinearEqnRoot (Integrator v0.1.2)
Finds the roots (i.e., zeros) of a non-linear equation.
Based on fzero.m
from Octave.
This is essentially the ACM algorithm 748: Enclosing Zeros of Continuous Functions due to Alefeld, Potra and Shi, ACM Transactions on Mathematical Software, Vol. 21, No. 3, September 1995. Although the workflow is the same, the structure of the algorithm has been transformed non-trivially; also, the algorithm has also been slightly modified.
Summary
Functions
Finds a zero for a function in an interval [a, b]
(if the 2nd argument is a list) or
in the vicinity of a
(if the 2nd argument is a float).
Types
@type convergence_status() :: :halt | :continue
@type interpolation_type() ::
:bisect
| :double_secant
| :inverse_cubic_interpolation
| :quadratic_interpolation_plus_newton
| :secant
@type iter_type() :: 1 | 2 | 3 | 4 | 5
@type t() :: %Integrator.NonLinearEqnRoot{ a: float() | nil, b: float() | nil, c: float() | nil, d: float() | nil, e: float() | nil, fa: float() | nil, fb: float() | nil, fc: float() | nil, fd: float() | nil, fe: float() | nil, fn_eval_count: integer(), fu: float() | nil, fx: float() | nil, iter_type: iter_type(), iteration_count: integer(), mu_ba: float() | nil, u: float() | nil, x: float() | nil }
Functions
Finds a zero for a function in an interval [a, b]
(if the 2nd argument is a list) or
in the vicinity of a
(if the 2nd argument is a float).
Options
:max_iterations
(integer/0
) - The maximum allowed number of iterations when finding a root. The default value is1000
.:max_fn_eval_count
(integer/0
) - The maximum allowed number of function evaluations when finding a root. The default value is1000
.:type
- The Nx type. The default value is:f64
.:machine_eps
(float/0
) - The machine epsilon. Defaults to Nx.constants.epsilon/1 for this Nx type.:tolerance
(float/0
) - The tolerance for the convergence when finding a root. Defaults to Nx.Constants.epsilon/1 for this Nx type.:nonlinear_eqn_root_output_fn
(term/0
) - An output function to call so intermediate results can be retrieved when finding a root. The default value isnil
.