root | R Documentation |
Search one root with given precision (on y). Iterate over uniroot as long as necessary.
root( f, lower, upper, maxerror_f = 1e-07, f_lower = f(lower, ...), f_upper = f(upper, ...), tol = .Machine$double.eps^0.25, convexity = 0, ... )
f |
the function for which the root is sought. |
lower |
the lower end point of the interval to be searched. |
upper |
the upper end point of the interval to be searched. |
maxerror_f |
the maximum error on f evaluation (iterates over uniroot to converge). |
f_lower |
the same as f(lower). |
f_upper |
the same as f(upper). |
tol |
the desired accuracy (convergence tolerance on f arg). |
convexity |
the learned convexity factor of the function, used to reduce the boundaries for uniroot. |
... |
additional named or unnamed arguments to be passed to f. |
Yann Richet, IRSN
f=function(x) {cat("f");1-exp(x)}; f(root(f,lower=-1,upper=2)) f=function(x) {cat("f");exp(x)-1}; f(root(f,lower=-1,upper=2)) .f = function(x) 1-exp(1*x) f=function(x) {cat("f");y=.f(x);points(x,y,pch=20,col=rgb(0,0,0,.2));y} plot(.f,xlim=c(-1,2)); f(root(f,lower=-1,upper=2)) .f = function(x) exp(10*x)-1 f=function(x) {cat("f");y=.f(x);points(x,y,pch=20);y} plot(.f,xlim=c(-1,2)); f(root(f,lower=-1,upper=2)) .f = function(x) exp(100*x)-1 f=function(x) {cat("f");y=.f(x);points(x,y,pch=20);y} plot(.f,xlim=c(-1,2)); f(root(f,lower=-1,upper=2)) f=function(x) {cat("f");exp(100*x)-1}; f(root(f,lower=-1,upper=2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.