uniroot.all(rootSolve)
uniroot.all()所属R语言包:rootSolve
Finds many (all) roots of one equation within an interval
发现很多(所有)的时间间隔内的一个方程根
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function uniroot.all searches the interval from lower to upper for several roots (i.e., zero's) of a function f with respect to its first argument.
函数uniroot.all搜索的时间间隔从下到上的多根(即零)的的一个函数f就它的第一个参数。
用法----------Usage----------
uniroot.all(f, interval, lower = min(interval), upper = max(interval),
参数----------Arguments----------
参数:f
the function for which the root is sought.
功能要求的根。
参数:interval
a vector containing the end-points of the interval to be searched for the root.
一个向量,包含要搜索的根的结束点的时间间隔。
参数:lower
the lower end point of the interval to be searched.
要搜索的下端的间隔的点。
参数:upper
the upper end point of the interval to be searched.
的上端部的间隔的点进行搜索。
参数:tol
the desired accuracy (convergence tolerance).
所需的精度(收敛宽容)。
参数:maxiter
the maximum number of iterations.
最大迭代次数。
参数:n
number of subintervals in which the root is sought.
寻求在根的子区间数。
参数:...
additional named or unnamed arguments to be passed to f (but beware of partial matching to other arguments).
额外的有名或无名的参数被传递给f(但要注意的部分匹配其他参数)。
Details
详细信息----------Details----------
f will be called as f(x, ...) for a numeric value of x.
f将被称为f(x, ...)一个数值x。
Run demo(Jacobandroots) for an example of the use of uniroot.all for steady-state analysis.
运行demo(Jacobandroots)的一个例子稳态分析使用uniroot.all。
See also second example of gradient This example is discussed in the book by Soetaert and Herman (2009).
也是第二个例子gradient这个例子的讨论在书中由Soetaert和Herman(2009)。
值----------Value----------
a vector with the roots found in the interval
的时间间隔中找到一个向量,其根
注意----------Note----------
The function calls uniroot, the basic R-function.
函数调用uniroot,基本R-函数。
It is not guaranteed that all roots will be recovered.
它不能保证所有的根都将被收回。
This will depend on n, the number of subintervals in which the interval is divided.
这将取决于n,在该间隔被划分的子区间的数目。
If the function "touches" the X-axis (i.e. the root is a saddle point), then this root will generally not be retrieved. (but chances of this are pretty small).
如果函数“摩的”X-轴(即根是一个鞍点),然后这根一般不被检索。 (但机会是非常小的)。
(作者)----------Author(s)----------
Karline Soetaert <karline.soetaert@nioz.nl>
参见----------See Also----------
uniroot for more information about input.
uniroot更多的信息输入。
实例----------Examples----------
## =======================================================================[#================================================= ======================]
## Mathematical examples [#数学例子]
## =======================================================================[#================================================= ======================]
# a well-behaved case...[一个乖巧的情况下......]
fun <- function (x) cos(2*x)^3
curve(fun(x), 0, 10,main = "uniroot.all")
All <- uniroot.all(fun, c(0, 10))
points(All, y = rep(0, length(All)), pch = 16, cex = 2)
# a difficult case...[一个困难的情况下......]
f <- function (x) 1/cos(1+x^2)
AA <- uniroot.all(f, c(-5, 5))
curve(f(x), -5, 5, n = 500, main = "uniroot.all")
points(AA, rep(0, length(AA)), col = "red", pch = 16)
f(AA) # !!![!]
## =======================================================================[#================================================= ======================]
## Ecological modelling example [#生态建模实例]
## =======================================================================[#================================================= ======================]
# Example from the book of Soetaert and Herman(2009)[为例书的Soetaert和赫尔曼(2009年)]
# A practical guide to ecological modelling -[生态模型的实用指南 - ]
# using R as a simulation platform. Springer[使用R作为仿真平台。施普林格]
r <- 0.05
K <- 10
bet <- 0.1
alf <- 1
# the model : density-dependent growth and sigmoid-type mortality rate[模型:密度依赖的生长和乙状结肠死亡率]
rate <- function(x, r = 0.05) r*x*(1-x/K) - bet*x^2/(x^2+alf^2)
# find all roots within the interval [0,10][找到所有的根在区间[0,10]]
Eq <- uniroot.all(rate, c(0, 10))
# jacobian evaluated at all roots: [雅可比在所有的根评价:]
# This is just one value - and therefore jacobian = eigenvalue[这仅仅是一个价值 - 因此,雅可比特征值]
# the sign of eigenvalue: stability of the root: neg=stable, 0=saddle, pos=unstable[的符号特征值稳定的根源:负=稳定,0 =鞍,POS =不稳定]
eig <- vector()
for (i in 1:length(Eq))
eig[i] <- sign (gradient(rate, Eq[i]))
curve(rate(x), ylab = "dx/dt", from = 0, to = 10,
main = "Budworm model, roots",
sub = "Example from Soetaert and Herman, 2009")
abline(h = 0)
points(x = Eq, y = rep(0, length(Eq)), pch = 21, cex = 2,
bg = c("grey", "black", "white")[eig+2] )
legend("topleft", pch = 22, pt.cex = 2,
c("stable", "saddle", "unstable"),
col = c("grey", "black", "white"),
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|