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

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

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

                                         Full square jacobian matrix for a system of ODEs (ordinary differential equations)
                                         全方雅可比矩阵系统的常微分方程(常微分方程)

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

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

Given a vector of (state) variables, and a function that estimates one function value for each (state) variable (e.g. the rate of change), estimates the Jacobian matrix (d(f(x))/d(x))
给定一个向量(状态)变量和函数估计的一个函数值(州)变量(如变化率),估计雅可比矩阵(d(f(x))/d(x))

Assumes a full and square Jacobian matrix
假设一个完整的方雅可比矩阵


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


jacobian.full(y, func, dy = NULL, time = 0, parms = NULL,
              pert = 1e-8, ...)



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

参数:y
(state) variables, a vector; if y has a name attribute, the names will be used to label the Jacobian matrix columns.  
变量(州),矢量y如果有一个name属性的名字将被用来标记雅可比矩阵列。


参数:func
function that calculates one function value for each element of y; if an ODE system, func calculates the rate of change (see details).  
函数,计算一个函数值中的每个元素y;如果ODE系统,func计算的变化率(见详情)。


参数:dy
reference function value; if not specified, it will be estimated by calling func.  
参考函数值,如果没有指定,将通过调用func估计。


参数:time
time, passed to function func.  
时间,传递给函数的func。


参数:parms
parameter values, passed to function func.  
参数值传递给函数的func。


参数:pert
numerical perturbation factor; increase depending on precision of model solution.  
数值扰动因子,增加依赖于精确的模型解决方案。


参数:...
other arguments passed to function func.  
其他参数传递给函数的func。


Details

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

The function func that estimates the rate of change of the state variables has to be consistent with functions called from R-package deSolve, which contains integration routines.
该函数func估计的状态变量的变化率要与从R-套件deSolve,其中包含整合例程调用的功能相一致。

This function call is as: function(time,y,parms,...) where
这个函数的调用是:功能(时间,Y,PARMS,...),其中

y : (state) variable values at which the Jacobian is estimated.
y:(状态)变量的值的雅可比估计。

parms: parameter vector  - need not be used.
parms参数向量 - 不能使用。

time: time at which the Jacobian is estimated - in general, time will not be used.
time:时间估计 - 雅可比在一般情况下,time将不会被使用。

...: (optional) any other arguments.
...:(可选的)任何其他参数。

The Jacobian is estimated numerically, by perturbing the x-values.
雅可比数字估计,通过扰动的x值。


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

The square jacobian matrix;  the elements on i-th row and j-th column are given by: d(f(x)_i)/d(x_j)
雅可比矩阵的平方,在第i行和第j列的元素由下式给出:d(f(x)_i)/d(x_j)


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

This function is useful for stability analysis of ODEs, which start by estimating the Jacobian at equilibrium points. The type of equilibrium then depends on the eigenvalue of the Jacobian.
此功能是有用的常微分方程组,开始估计在平衡点的雅可比稳定性分析。均衡的类型取决于雅可比矩阵的特征值。


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



Karline Soetaert <karline.soetaert@nioz.nl>




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

jacobian.band, estimates the Jacobian matrix assuming a banded structure.
jacobian.band,估计雅可比矩阵,假设一个带状结构。

hessian, estimates the Hessian matrix.
hessian,估计Hessian矩阵。

gradient, for a full (not necessarily square) gradient matrix and where the function call is simpler.
gradient,一个完整的(不一定是正方形)的梯度矩阵和函数调用简单。

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

multiroot, to solve n roots of n (nonlinear) equations
multiroot,解决了n的n个根(非线性)方程


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


## =======================================================================[#================================================= ======================]
## 1. Structure of the Jacobian[#1。雅可比矩阵的结构]
## =======================================================================[#================================================= ======================]
mod <- function (t = 0, y, parms = NULL,...)
{
dy1<-  y[1] + 2*y[2]
dy2<-3*y[1] + 4*y[2] + 5*y[3]
dy3<-         6*y[2] + 7*y[3] + 8*y[4]
dy4<-                  9*y[3] +10*y[4]
return(as.list(c(dy1, dy2, dy3, dy4)))
}

jacobian.full(y = c(1, 2, 3, 4), func = mod)

## =======================================================================[#================================================= ======================]
## 2. Stability properties of a physical model[#2。物理模型的稳定性能]
## =======================================================================[#================================================= ======================]
coriolis <- function (t, velocity, pars, f)
{
  dvelx <- f*velocity[2]
  dvely <- -f*velocity[1]
  list(c(dvelx, dvely))
}

# neutral stability; f is coriolis parameter[中性稳定,f是科氏参数]
Jac <- jacobian.full(y = c(velx = 0, vely = 0), func = coriolis,
                     parms = NULL, f = 1e-4)
print(Jac)
eigen(Jac)$values

## =======================================================================[#================================================= ======================]
## 3. Type of equilibrium[#3。类型的平衡]
## =======================================================================[#================================================= ======================]
## From Soetaert and Herman (2009). A practical guide to ecological [#从Soetaert和Herman(2009)。对生态的实用指南]
## modelling. Using R as a simulation platform. Springer[#建模。使用R作为仿真平台。施普林格]

eqn <- function (t, state, pars)
{
  with (as.list(c(state, pars)),  {
  dx <- a*x + cc*y
  dy <- b*y + dd*x
  list(c(dx, dy))
  })
}

# stable equilibrium[稳定的平衡]
A <- eigen(jacobian.full(y = c(x = 0, y = 0), func = eqn,
              parms = c(a = -0.1, b = -0.3, cc = 0, dd = 0)))$values
# unstable equilibrium[不稳平衡]
B <- eigen(jacobian.full(y = c(x = 0, y = 0), func = eqn,
              parms = c(a = 0.2, b = 0.2, cc = 0.0, dd = 0.2)))$values
# saddle point[鞍点]
C <- eigen(jacobian.full(y = c(x = 0, y = 0), func = eqn,
              parms = c(a = -0.1, b = 0.1, cc = 0, dd = 0)))$values
# neutral stability[中性稳定]
D <- eigen(jacobian.full(y = c(x = 0, y = 0), func = eqn,
              parms = c(a = 0, b = 0, cc = -0.1, dd = 0.1)))$values
# stable focal point[稳定的焦点]
E <- eigen(jacobian.full(y = c(x = 0, y = 0), func = eqn,
              parms = c(a = 0, b = -0.1, cc = -0.1, dd = 0.1)))$values
# unstable focal point[不稳定的焦点]
F <- eigen(jacobian.full(y = c(x = 0, y = 0), func=eqn,
              parms = c(a = 0., b = 0.1, cc = 0.1, dd = -0.1)))$values

data.frame(type = c("stable", "unstable", "saddle", "neutral",
           "stable focus", "unstable focus"),
           eigenvalue_1 = c(A[1], B[1], C[1], D[1], E[1], F[1]),
           eigenvalue_2 = c(A[2], B[2], C[2], D[2], E[2], F[2]))

## =======================================================================[#================================================= ======================]
## 4. Limit cycles[#4。极限环]
## =======================================================================[#================================================= ======================]
## From Soetaert and Herman (2009). A practical guide to ecological [#从Soetaert和Herman(2009)。对生态的实用指南]
## modelling. Using R as a simulation platform. Springer[#建模。使用R作为仿真平台。施普林格]

eqn2 <- function (t, state, pars)
{
  with (as.list(c(state, pars)),
  {
  dx<-  a*y   + e*x*(x^2+y^2-1)
  dy<-  b*x   + f*y*(x^2+y^2-1)
  list(c(dx, dy))
  })
}

# stable limit cycle with unstable focus[稳定的极限环不稳定焦点]
eigen(jacobian.full(c(x = 0, y = 0), eqn2,
                    parms = c(a = -1, b = 1, e = -1, f = -1)))$values
# unstable limit cycle with stable focus[不稳定的极限环与稳定的焦点]
eigen(jacobian.full(c(x = 0, y = 0), eqn2,
                    parms = c(a = -1, b = 1, e = 1, f = 1)))$values

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-25 17:35 , Processed in 0.025145 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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