fzero | R Documentation |
Find root of continuous function of one variable.
fzero(fun, x, maxiter = 500, tol = 1e-12, ...)
fun |
function whose root is sought. |
x |
a point near the root or an interval giving end points. |
maxiter |
maximum number of iterations. |
tol |
relative tolerance. |
... |
additional arguments to be passed to the function. |
fzero
tries to find a zero of f
near x
, if x
is a scalar. Expands the interval until different signs are found at the
endpoints or the maximum number of iterations is exceeded.
If x
is a vector of length two, fzero
assumes x
is
an interval where the sign of x[1]
differs from the sign of
x[1]
. An error occurs if this is not the case.
“This is essentially the ACM algorithm 748. The structure of the algorithm has been transformed non-trivially: it implement here a FSM version using one interior point determination and one bracketing per iteration, thus reducing the number of temporary variables and simplifying the structure.”
This approach will not find zeroes of quadratic order.
fzero
returns a list with
x |
location of the root. |
fval |
function value at the root. |
fzero
mimics the Matlab function of the same name, but is translated
from Octave's fzero
function, copyrighted (c) 2009 by Jaroslav Hajek.
Alefeld, Potra and Shi (1995). Enclosing Zeros of Continuous Functions. ACM Transactions on Mathematical Software, Vol. 21, No. 3.
uniroot
, brent
fzero(sin, 3) # 3.141593
fzero(cos,c(1, 2)) # 1.570796
fzero(function(x) x^3-2*x-5, 2) # 2.094551
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.