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

R语言 rootSolve包 steady.band()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 23:00:49 | 显示全部楼层 |阅读模式
steady.band(rootSolve)
steady.band()所属R语言包:rootSolve

                                         Steady-state solver for ordinary differential equations; assumes a banded jacobian
                                         常微分方程的稳态解算器,假设一个带状的雅可比

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

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

Estimates the steady-state condition for a system of ordinary differential equations.
估计常微分方程系统的稳定状态。

Assumes a banded jacobian matrix.
假设一个带状的雅可比矩阵。


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


steady.band(y, time = 0, func, parms = NULL,



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

参数:y
the initial guess of (state) values for the ODE system, a vector. If y has a name attribute, the names will be used to label the output matrix.  
(州)的初始估计值的ODE系统的一个向量。 y如果有一个name属性,名称将被用于标记输出矩阵。


参数:time
time for which steady-state is wanted; the default is time=0.  
想稳定状态的时间,默认为time= 0。


参数:func
either an R-function that computes the values of the derivatives in the ode system (the model defininition) at time time, or a character string giving the name of a compiled function in a dynamically loaded shared library. If func  is an R-function, it must be defined as: yprime = func(t, y, parms,...).  t is the current time point in the integration, y is the current estimate of the variables in the ODE system.  If the initial values y has a names attribute, the names will be available inside func. parms is a vector or list of parameters; ... (optional) are any other arguments passed to the function.  The return value of func should be a list, whose first element is a vector containing the derivatives of y with respect to time, and whose next elements are global values whose steady-state value is also required.  The derivatives should be specified in the same order as the state variables y.  
可以是R-函数的衍生物中的值,计算在时间的颂歌系统(模型defininition)time,或给人的编译函数在一个动态加载的共享库的名称的字符串。如果func是一个R-函数,它必须被定义为:yprime = func(t, y, parms,...)。 t是当前时间点的整合,y是目前估计的ODE系统中的变量。如果初始值y有一个名称属性,名称将是提供内func。 parms是一个向量或参数列表; (可选)传递给函数的任何其他参数。 func的返回值应该是一个列表的第一个元素是一个向量包含y的衍生工具就time,而其下一个元素是全球性的值,其稳态值也是必需的。衍生工具应以相同的顺序指定的作为状态变量y。


参数:parms
parameters passed to func.  
参数传递到func。


参数:nspec
the number of *species* (components) in the model.  
的数目*物种*(组件)在模型中。


参数:bandup
the number of nonzero bands above the Jacobian diagonal.  
数的非零以上频段的雅可比对角线。


参数:banddown
the number of nonzero bands below the Jacobian diagonal.  
数非零以下频段的雅可比矩阵对角线。


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


Details

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

This is the method of choice for single-species 1-D models.
这是选择单种1-D模型的方法。

For multi-species 1-D models, this method can only be used if the state variables are arranged per box, per species (e.g. A[1],B[1],A[2],B[2],A[3],B[3],.... for species A, B).
多品种的1-D模型,这种方法只能用于安排每盒如果状态变量,每个物种(例如A [1],B [1],A [2],B [2],A [ 3],B [3],...的物种A,B)。

Usually a 1-D *model* function will have the species arranged as A[1],A[2],A[3],....B[1],B[2],B[3],.... in this case, use steady.1D
通常为1-D *模型*功能将种排列为A [1],A [2],A [3],.... B [1],B [2],B [3]。 ...在这种情况下,使用steady.1D


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

A list containing
一个列表,其中包含


参数:y
a vector with the state variable values from the last iteration during estimation of steady-state condition of the system of equations. If y has a names attribute, it will be used to label the output values.  
从最后一次迭代在估算过程中的方程系统的稳态状况的状态变量值的一个矢量。如果y有一个名称属性,它会被用来标注的输出值。


参数:...
the number of "global" values returned.  
返回的“全球性”的价值观。

The output will have the attribute steady, which returns TRUE, if steady-state has been reached and the attribute precis with the precision attained during each iteration.
输出将有steady,它返回的属性TRUE,如果稳态已达到和属性precis在每次迭代中达到的精度。


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



Karline Soetaert <karline.soetaert@nioz.nl>




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

steady, for a general interface to most of the steady-state solvers
steady,一个通用的接口,大部分的稳态解算器

steady.1D, steady.2D, steady.3D, steady-state solvers for 1-D, 2-D and 3-D partial differential equations.
steady.1D,steady.2D,steady.3D,1-D,2-D和3-D偏微分方程的稳态解算器。

stode, iterative steady-state solver for ODEs with full or banded Jacobian.
stode,常微分方程全部或带状雅可比迭代稳态解算器。

stodes, iterative steady-state solver for ODEs with arbitrary sparse Jacobian.
stodes,常微分方程任意稀疏Jacobian迭代稳态解算器。

runsteady, steady-state solver by dynamically running to steady-state
runsteady,通过动态运行到稳定状态的稳态求解器


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


## =======================================================================[#================================================= ======================]
## 1000 simultaneous equations, solved 6 times for different [#1000的联立方程,为不同的解决了6倍]
## values of parameter "decay"[#参数“衰减”]
## =======================================================================[#================================================= ======================]

model <- function (time, OC, parms, decay)  {
  # model of particles (OC) that sink out of the water and decay[粒子模型(OC),沉水和衰减]
  # exponentially declining sinking rate, maximal 100 m/day[指数下降的下沉率,最大100米/天]
  sink <- 100 * exp(-0.01*dist)
  
  # boundary flux; upper boundary=imposed concentration (100)[边界通量;上边界=施加的浓度(100)]
  Flux <- sink * c(100 ,OC)     
   
  # Rate of change= Flux gradient and first-order consumption[变化率=通量梯度和一阶消费]
  dOC  <- -diff(Flux)/dx - decay*OC
  list(dOC, maxC = max(OC))
}

dx   &lt;- 1                          # thickness of boxes[厚度的盒子]
dist &lt;- seq(0, 1000, by = dx)      # water depth at each modeled box interface[在每个模型中界面的水深]

ss   <- NULL
for (decay in seq(from = 0.1, to = 1.1, by = 0.2))
  ss   <- cbind(ss, steady.band(runif(1000), func = model,
                parms = NULL, nspec = 1, decay = decay)$y)  

matplot(ss, 1:1000, type = "l", lwd = 2, main = "steady.band",
  ylim=c(1000, 0), ylab = "water depth, m",
  xlab = "concentration of sinking particles")

legend("bottomright", legend = seq(from = 0.1, to = 1.1, by = 0.2),
   lty = 1:10, title = "decay rate", col = 1:10, lwd = 2)

## =======================================================================[#================================================= ======================]
## 5001 simultaneous equations: solve[#5001联立方程:解决]
## dy/dt = 0 = d2y/dx2 + 1/x*dy/dx + (1-1/(4x^2)y - sqrx(x)*cos(x),[#DY / DT = 0 = d2y/dx2 + 1 / X *年/ dx的+(1-1 /(4倍^ 2)γ -  sqrx * COS(X),(x)的]
## over the interval [1,6], with boundary conditions: y(1)=1, y(6)=-0.5[#在区间[1,6],与边界条件为:y(1)= 1(6),Y = -0.5]
## =======================================================================[#================================================= ======================]

derivs <- function(t, y, parms, x, dx, N, y1, y6)  {

  # Numerical approximation of derivates:[数值逼近的衍生物:]
  # d2y/dx2 = (yi+1-2yi+yi-1)/dx^2[d2y/dx2 =(YI +1-2易+ YI-1)/ DX ^ 2]
   d2y <- (c(y[-1],y6) -2*y + c(y1,y[-N])) /dx/dx

  # dy/dx = (yi+1-yi-1)/(2dx)[DY / DX“(易+1-易-1)/(2DX)]
   dy  <- (c(y[-1],y6) - c(y1,y[-N])) /2/dx

   res <- d2y+dy/x+(1-1/(4*x*x))*y-sqrt(x)*cos(x)
   return(list(res))
}

dx     <- 0.001
x      <- seq(1,6,by=dx)
N      <- length(x)
y  <- steady.band(y = rep(1, N), time = 0, func = derivs, x = x, dx = dx,
                  N = N, y1 = 1, y6 = -0.5, nspec = 1)$y
plot(x, y, type = "l", main = "5001 nonlinear equations - banded Jacobian")

# add the analytic solution for comparison:[添加的解析解进行比较:]
xx     <- seq(1, 6, by = 0.1)
ana <- 0.0588713*cos(xx)/sqrt(xx)+1/4*sqrt(xx)*cos(xx)+
       0.740071*sin(xx)/sqrt(xx)+1/4*xx^(3/2)*sin(xx)
points(xx, ana)
legend("topright", pch = c(NA, 1), lty = c(1, NA),
       c("numeric", "analytic"))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-25 15:19 , Processed in 0.023955 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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