Exemple #1
0
  def dfdx(self):
    """
    Jacobian of x + dt*dxdt.
    """
    nU,J,h,b,c = self.nU,self.J,self.h,self.b,self.c
    assert is1d(x)
    F = np.zeros((ndim(),ndim()))

    # X
    md = lambda i: np.mod(i,nU)
    for i in range(nU):
      # wrt. X
      F[i,i]         = - dt + 1
      F[i,md(i-2)]   = - dt * x[md(i-1)]
      F[i,md(i+1)]   = + dt * x[md(i-1)]
      F[i,md(i-1)]   =   dt *(x[md(i+1)]-x[md(i-2)])
      # wrt. Y
      F[i,nU+self.iiY[i]] = dt * -h*c/b
    # Y
    md = lambda i: nU + np.mod(i-nU,nU*J)
    for i in range(nU,(J+1)*nU):
      # wrt. Y
      F[i,i]         = -dt*c + 1
      F[i,md(i-1)]   = +dt*c*b * x[md(i+1)]
      F[i,md(i+1)]   = -dt*c*b * (x[md(i+2)]-x[md(i-1)])
      F[i,md(i+2)]   = -dt*c*b * x[md(i+1)]
      # wrt. X
      F[i,self.iiX[i-nU]] = dt * h*c/b
    return F
Exemple #2
0
def TLM(x):
  """Tangent linear model"""
  assert is1d(x)
  x,y,z = x
  TLM=np.array(
      [[-sig , sig , 0],
      [rho-z , -1  , -x],
      [y     , x   , -beta]])
  return TLM
Exemple #3
0
def TLM(x):
  """Tangent linear model"""
  assert is1d(x)
  x,y,z = x
  TLM=np.array(
      [[-a   , -2*y , -2*z],
      [y-b*z , x-1  , -b*x],
      [b*y+z , b*x  , x-1]])
  return TLM
Exemple #4
0
def TLM(x):
  """Tangent linear model"""
  assert is1d(x)
  m    = len(x)
  TLM  = np.zeros((m,m))
  md   = lambda i: np.mod(i,m)
  for i in range(m):
    TLM[i,i]       = -1.0
    TLM[i,   i-2 ] = -x[i-1]
    TLM[i,md(i+1)] = +x[i-1]
    TLM[i,   i-1 ] = x[md(i+1)]-x[i-2]
  return TLM