找回密码
 注册
查看: 529|回复: 0

R语言 Rmpfr包 unirootR()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 19:03:25 | 显示全部楼层 |阅读模式
unirootR(Rmpfr)
unirootR()所属R语言包:Rmpfr

                                        One Dimensional Root (Zero) Finding &ndash; in pure <font face="Courier New,Courier" color="#666666"><b>R</b></font>
                                         一维根(零)的发现 - 在纯净的<font face="Courier New,Courier" color="#666666"> <B> R </ B> </ FONT>

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The function unirootR searches the interval from lower to upper for a root (i.e., zero) of the function f with respect to its first argument.
函数unirootR搜索的时间间隔从lower到upper根(即零)的功能f它的第一个参数。

unirootR() is &ldquo;clone&rdquo; of uniroot(), written entirely in R, in a way that it works with mpfr-numbers as well.
unirootR()的uniroot()是“克隆”,完全写在R,在它的工作原理与mpfr号。


用法----------Usage----------


unirootR(f, interval, ...,
        lower = min(interval), upper = max(interval),
        f.lower = f(lower, ...), f.upper = f(upper, ...),
        verbose = FALSE,
        tol = .Machine$double.eps^0.25, maxiter = 1000,
        epsC = NULL)



参数----------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.
一个向量,包含要搜索的根的结束点的时间间隔。


参数:...
additional named or unnamed arguments to be passed to f
被传递f的额外的有名或无名的参数


参数:lower, upper
the lower and upper end points of the interval to be searched.
要搜索的下限和上限的时间间隔的终点。


参数:f.lower, f.upper
the same as f(upper) and f(lower), respectively.  Passing these values from the caller where they are often known is more economical as soon as f() contains non-trivial computations.
f(upper)和f(lower),分别相同。这些值传递的来电,他们通常被称为是更经济的f()不平凡的计算。


参数:verbose
logical (or integer) indicating if (and how much) verbose output should be produced during the iterations.
逻辑(或整数)(多少)详细的输出应在迭代过程中产生的。


参数:tol
the desired accuracy (convergence tolerance).
所需的精度(收敛宽容)。


参数:maxiter
the maximum number of iterations.
最大迭代次数。


参数:epsC
positive number or NULL in which case a smart default is sought.  This should specify the &ldquo;achievable machine precision&rdquo; for the given numbers and their arithmetic.  The default will set this to .Machine$double.eps for double precision numbers, and will basically use 2 ^ - min(getPrec(f.lower), getPrec(f.upper)) when that works (as, e.g., for mpfr-numbers) otherwise.  This is factually a lower bound for the achievable lower bound, and hence, setting tol smaller than epsC is typically non-sensical sense and produces a warning.  
正数或NULL在这种情况下,寻求一个聪明的默认。这应该指定给定的数字和算术“可实现机器的精度”。的默认设置为.Machine$double.eps双精度数,基本上使用2 ^ - min(getPrec(f.lower), getPrec(f.upper))时,(例如,mpfr号),否则。这是事实一个下限所能达到的下限,因此,设置tol小于epsC通常是无意义的意义和产生一个警告。


Details

详细信息----------Details----------

Note that arguments after ... must be matched exactly.
需要注意的是参数后...必须完全匹配。

Either interval or both lower and upper must be specified: the upper endpoint must be strictly larger than the lower endpoint.  The function values at the endpoints must be of opposite signs (or zero).
无论是interval或两个lower和upper必须指定的上端点必须严格大于下端点。在端点处的函数值必须是符号相反(或零)。

The function only uses R code with basic arithmetic, such that it should also work with &ldquo;generalized&rdquo; numbers (such as mpfr-numbers) as long the necessary Ops methods are defined for those.
功能只使用基本的算术运算,R代码,它应该也与“广义”的号码(如mpfr号)只要Ops方法被定义为那些必要的。

The underlying algorithm assumes a continuous function (which then is known to have at least one root in the interval).
底层的算法假定一个连续函数(然后是已知的间隔中至少有一个根)。

Convergence is declared either if f(x) == 0 or the change in x for one step of the algorithm is less than tol (plus an allowance for representation error in x).
收敛宣布如果f(x) == 0或变化x的算法的一个步骤是小于tol(加x)表示错误的津贴。

If the algorithm does not converge in maxiter steps, a warning is printed and the current approximation is returned.
如果算法不收敛maxiter步骤,打印警告信息并返回当前的逼近。

f will be called as f(<VAR>x</VAR>, ...) for a (generalized) numeric value of <VAR>x</VAR>.
f将被称为f(<VAR>x</VAR>, ...)的(广义)的数值<VAR> X </ VAR>。


值----------Value----------

A list with four components: root and f.root give the location of the root and the value of the function evaluated at that point. iter and estim.prec give the number of iterations used and an approximate estimated precision for root.  (If the root occurs at one of the endpoints, the estimated precision is NA.)
有四个分量的列表:root和f.root给根的位置和在该点的评价函数的值。 iter和estim.prec给所使用的迭代的数量和估计的近似精度root。 (如果根发生在一个端点,估计的精确度是NA。)


源----------Source----------

Based on zeroin() (in package rootoned) by John Nash who manually translated the C code in R's zeroin.c and on uniroot() in R's sources.
基于zeroin()(在包rootoned)由约翰·纳什手动翻译的C代码中R的zeroin.c和uniroot()R的来源。


参考文献----------References----------



参见----------See Also----------

polyroot for all complex roots of a polynomial; optimize, nlm.
polyroot所有复杂的多项式的根; optimize,nlm。


实例----------Examples----------


require(utils) # for str[为STR]

## some platforms hit zero exactly on the first step:[#某些平台上打零完全相同的第一步:]
## if so the estimated precision is 2/3.[#若有的估计精度为2/3。]
f <- function (x,a) x - a
str(xmin <- unirootR(f, c(0, 1), tol = 0.0001, a = 1/3))

## handheld calculator example: fixpoint of cos(.):[#手持计算器的例子:不动点(COS)。]
rc <- unirootR(function(x) cos(x) - x, lower=-pi, upper=pi, tol = 1e-9)
rc$root

## the same with much higher precision:[#同样具有更高的精度:]
rcM <- unirootR(function(x) cos(x) - x,
                 interval= mpfr(c(-3,3), 300), tol = 1e-40)
rcM
x0 <- rcM$root
stopifnot(all.equal(cos(x0), x0,
                    tol = 1e-40))## 40 digits accurate![排名第40位数字准确!]

str(unirootR(function(x) x*(x^2-1) + .5, lower = -2, upper = 2,
            tol = 0.0001), digits.d = 10)
str(unirootR(function(x) x*(x^2-1) + .5, lower = -2, upper = 2,
            tol = 1e-10 ), digits.d = 10)

## A sign change of f(.), but not a zero but rather a "pole":[#A的f()的符号变化,但不是零,而是一个“极点”:]
tan. &lt;- function(x) tan(x * (Const("pi",200)/180))# == tan( &lt;angle&gt; )[==谭(<angle>)]
(rtan <- unirootR(tan., interval = mpfr(c(80,100), 200), tol = 1e-40))
## finds 90 {"ok"}, and now gives a warning[#找到90 {“”},现在给出一个警告]


## Find the smallest value x for which exp(x) &gt; 0 (numerically):[#查找最小的x值EXP(X)> 0(数字):]
r <- unirootR(function(x) 1e80*exp(x)-1e-300, c(-1000,0), tol = 1e-15)
str(r, digits.d = 15) ##&gt; around -745, depending on the platform.[#-745左右,根据不同的平台。]

exp(r$root)     # = 0, but not for r$root * 0.999...[= 0,但不为R $根* 0.999 ...]
minexp <- r$root * (1 - 10*.Machine$double.eps)
exp(minexp)     # typically denormalized[典型的不规范]

## --- using mpfr-numbers :[#--- MPFR号码:]

## Find the smallest value x for which exp(x) &gt; 0 ("numerically");[#查找进出口(x)的最小的值x> 0(“数字”);]
## Note that mpfr-numbers underflow *MUCH* later than doubles:[#需要注意的是MPFR号溢*不迟于双打:]
## one of the smallest mpfr-numbers {see also ?mpfr-class } :[第1的最小MPFR号{?MPFR级}:]
(ep.M <- mpfr(2, 55) ^ - ((2^30 + 1) * (1 - 1e-15)))
r <- unirootR(function(x) 1e99* exp(x) - ep.M, mpfr(c(-1e20, 0), 200))
r # 97 iterations; f.root is very similar to ep.M[97迭代; f.root是非常类似的ep.M]


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-24 08:46 , Processed in 0.022873 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表