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

R语言 rootSolve包 multiroot.1D()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 22:59:36 | 显示全部楼层 |阅读模式
multiroot.1D(rootSolve)
multiroot.1D()所属R语言包:rootSolve

                                         Solves for n roots of n (nonlinear) equations, created by discretizing ordinary differential equations.
                                         N(非线性)的离散常微分方程的方程组,求解n根。

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

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

multiroot.1D finds the solution to boundary value problems of ordinary differential equations, which are approximated using the method-of-lines approach.
multiroot.1D发现,这是近似计算方法线的方法,常微分方程边值问题的解决方案。

Assumes a banded Jacobian matrix, uses the Newton-Raphson method.
假设一个带状的雅可比矩阵,采用Newton-Raphson方法。


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


multiroot.1D(f, start, maxiter = 100,
             rtol = 1e-6, atol = 1e-8, ctol = 1e-8,
             nspec = NULL, dimens = NULL,
             verbose = FALSE, positive = FALSE, names = NULL, ...)



参数----------Arguments----------

参数:f
function for which the root is sought; it must return a vector with as many values as the length of start.  
函数的根要求,它必须返回一个矢量的start的长度与尽可能多的价值。


参数:start
vector containing initial guesses for the unknown x; if start has a name attribute, the names will be used to label the output vector.  
向量的初始猜测的未知Xstart有一个name属性,名称将被用于标记输出向量。


参数:maxiter
maximal number of iterations allowed.  
允许的最大数目的迭代。


参数:rtol
relative error tolerance, either a scalar or a vector, one value for each element in the unknown x.  
相对误差,无论是一个标量或向量,未知X中的每个元素的一个值。


参数:atol
absolute error tolerance, either a scalar or a vector, one value for each element in x.  
绝对误差,无论是一个标量或向量,在x中的每个元素的一个值。


参数:ctol
a scalar. If between two iterations, the maximal change in the variable values is less than this amount, then it is assumed that the root is found.  
一个标量。如果两次迭代之间的最大变化的变量的值是小于这个量,那么它被假定,发现根。


参数:nspec
the number of *species* (components) in the model. If NULL, then dimens should be specified.  
的数目*物种*(组件)在模型中。如果NULL,那么dimens应该被指定。


参数:dimens
the number of *boxes* in the model. If NULL, then nspec should be specified.  
在模型中的数目*盒*。如果为NULL,那么nspec应指定。


参数:verbose
if TRUE: full output to the screen, e.g. will output the steady-state settings.  
如果TRUE:完整的输出到屏幕上,例如将输出的稳定状态设置。


参数:positive
if TRUE, the unknowns y are forced to be non-negative numbers.  
如果TRUE,未知数y是被迫成为非负数。


参数:names
the names of the components; used to label the output, which will be written as a matrix.  
的组件的名称,用于标记的输出,这将被写为一个矩阵。


参数:...
additional arguments passed to function f.  
额外的参数传递给函数的f。


Details

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

multiroot.1D is similar to steady.1D, except for the function specification which is simpler in multiroot.1D.
multiroot.1D是类似steady.1D,除了功能规格在multiroot.1D这是简单的。

It is to be used to solve (simple) boundary value problems of differential equations.
它是被用来解决(简单)的差分方程的边值问题。

The following differential equation:
下面的微分方程:

with boundary conditions
与边界条件

y(x=a) = ya, at the start and y(x=b)=yb at the end of the integration interval [a,b] is approximated
y(x=a)=雅,在开始和y(x=b)= YB结束时的积分区间[A,B]近似

as follows:
如下所示:

1. First the integration interval x is discretized, for instance:
1。首先,积分区间x被离散,例如:

dx <- 0.01
dx <- 0.01

x <- seq(a,b,by=dx)
x <- seq(a,b,by=dx)

where dx should be small enough to keep numerical errors small.
dx应该是足够小,以保持数值误差小。

2. Then the first- and second-order derivatives are differenced on this numerical grid. R's diff function is very efficient in taking numerical differences, so it is used to approximate the first-, and second-order derivates as follows.
2。第一和二阶导数差分此数值网格。 R的diff函数采取数值差异是非常有效的,因此它被用于如下的近似的第一,和第二阶衍生物。

A first-order derivative y' can be approximated either as:
一阶导数Y可近似为:




y'=diff(c(ya,y))/dx if only the initial condition ya is prescribed,
Y=diff(c(ya,y))/dx如果只有初始条件的雅规定,




y'=diff(c(y,yb))/dx if only the final condition, yb is prescribed,
Y=diff(c(y,yb))/dx,如果只有最后一个条件,Yb的规定,




y'=0.5*(diff(c(ya,y))/dx+diff(c(y,yb))/dx) if initial, ya,
Y=0.5*(diff(c(ya,y))/dx+diff(c(y,yb))/dx),如果初始,亚,

The latter (centered differences) is to be preferred.
后者(中心的差异)是被优选的。

A second-order derivative y&rdquo; can be approximated by differencing twice.
第二阶导数Y“可以近似的差异两次。

y&rdquo;=diff(diff(c(ya,y,yb))/dx)/dx
Y“=diff(diff(c(ya,y,yb))/dx)/dx

3. Finally, function multiroot.1D is used to locate the root.
3。最后,功能multiroot.1D用于定位的根本。

See the examples
见的例子。


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

a list containing:
一个列表,其中包含:


参数:root
the values of the root.  
根值。


参数:f.root
the value of the function evaluated at the root.  
在root评价函数的值。


参数:iter
the number of iterations used.  
使用的迭代数量。


参数:estim.precis
the estimated precision for root.  It is defined as the mean of the absolute function values (mean(abs(f.root))).  
估计的精度为root。它被定义为绝对函数值的平均值(平均(绝对值(f.root)))。


注意----------Note----------

multiroot.1D makes use of function steady.1D.
multiroot.1D使用功能steady.1D。

It is NOT guaranteed that the method will converge to the root.
它不能保证该方法将收敛到根。


(作者)----------Author(s)----------



Karline Soetaert &lt;karline.soetaert@nioz.nl&gt;




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

stode, which uses a different function call.
stode,它使用一个不同的函数调用。

uniroot.all, to solve for all roots of one (nonlinear) equation
uniroot.all,解决根源之一方程(非线性)

steady, steady.band,  steady.1D, steady.2D, steady.3D, steady-state solvers, which find the roots of ODEs or PDEs. The function call differs from multiroot.
steady,steady.band,steady.1D,steady.2D,steady.3D,稳态解算器,找到常微分方程和偏微分方程的根。函数调用不同于multiroot。

jacobian.full, jacobian.band, estimates the Jacobian matrix assuming a full or banded structure.
jacobian.full,jacobian.band,估计雅可比矩阵假设全部或带状结构。

gradient, hessian, estimates the gradient matrix or the Hessian.
gradient,hessian,估计的梯度矩阵或Hessian的。


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


## =======================================================================[#================================================= ======================]
## Example 1: simple standard problem[例1:简单的标准问题]
## solve the BVP ODE:[解决的BVP ODE:]
## d2y/dt^2=-3py/(p+t^2)^2[#d2y/dt ^ 2 = 3PY /(P + T ^ 2)^ 2]
## y(t= -0.1)=-0.1/sqrt(p+0.01)[#Y(T = -0.1)= -0.1/sqrt(0.01)]
## y(t=  0.1)= 0.1/sqrt(p+0.01)[#Y(T = 0.1)= 0.1/sqrt(0.01)]
## where p = 1e-5[#P = 1E-5]
##[#]
## analytical solution y(t) = t/sqrt(p + t^2).[#解析解y(t)= T / SQRT(P + T ^ 2)。]
##[#]
## =======================================================================[#================================================= ======================]

bvp <- function(y) {
  dy2 <- diff(diff(c(ya, y, yb))/dx)/dx
  return(dy2 + 3*p*y/(p+x^2)^2)
}

dx <- 0.0001
x <- seq(-0.1, 0.1, by = dx)

p  <- 1e-5
ya <- -0.1/sqrt(p+0.01)
yb <-  0.1/sqrt(p+0.01)

print(system.time(
  y <- multiroot.1D(start = runif(length(x)), f = bvp, nspec = 1)
))

plot(x, y$root, ylab = "y", main = "BVP test problem")

# add analytical solution[加分析的解决方案]
curve(x/sqrt(p+x*x), add = TRUE, type = "l", col = "red")

## =======================================================================[#================================================= ======================]
## Example 2: bvp test problem 28[例2:的BVP测试问题28]
## solve:[#解决:]
## xi*y'' + y*y' - y=0[#XI * Y+ Y * Y -  Y = 0]
## with boundary conditions:[#与边界条件:]
## y0=1[#Y0 = 1]
## y1=3/2[#Y1 = 3/2]
## =======================================================================[#================================================= ======================]

prob28 <-function(y, xi) {
dy2 &lt;- diff(diff(c(ya, y, yb))/dx)/dx          # y''[Y]
dy  &lt;- 0.5*(diff(c(ya, y)) +diff(c(y, yb)))/dx # y' - centered differences[Y - 为中心的差异]

xi*dy2 +dy*y-y
}

ya <- 1
yb <- 3/2
dx <- 0.001
x <- seq(0, 1, by = dx)
N <- length(x)
print(system.time(
  Y1 <- multiroot.1D(f = prob28, start = runif(N),
                     nspec = 1, xi = 0.1)
))
Y2<- multiroot.1D(f = prob28, start = runif(N), nspec = 1, xi = 0.01)
Y3<- multiroot.1D(f = prob28, start = runif(N), nspec = 1, xi = 0.001)

plot(x, Y3$root, type = "l", col = "green", main = "bvp test problem 28")
lines(x, Y2$root, col = "red")
lines(x, Y1$root, col = "blue")


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-25 16:05 , Processed in 0.024268 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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