Esempio n. 1
0
 def F(self, y, j):
     N, phi, h, v = y
     indices = v.j()
     return numpy.array([
         P(0),
         P(0),
         self.V(phi, j) / 3. -
         sum(h[p] * h[q] + v[p] * v[q] / 3.
             for p, q in nloop(indices, 2) if p != j != q and p + q == j),
         -self.dVdphi(phi, j) - 3 *
         sum(h[p] * v[q]
             for p, q in nloop(indices, 2) if p != j != q and p + q == j),
     ])
Esempio n. 2
0
 def V(self, phi, j):
     indices = phi.j()
     ans = P(0)
     if j == 2:
         ans = ans + self.L
     if j >= 2:
         ans = ans + 1. / 2 * self.m**2 * sum(phi[p] * phi[q]
                                              for p, q in nloop(indices, 2)
                                              if p + q == j - 2)
         ans = ans + 1. / 24 * self.l * sum(
             phi[p] * phi[q] * phi[r] * phi[s]
             for p, q, r, s in nloop(indices, 4) if p + q == j - 2)
     return ans
Esempio n. 3
0
 def V(self, phi, j):
     indices = phi.j()
     ans = P(0)
     if j >= 2:
         ans = ans + 1. / 2 * self.m**2 * sum(phi[p] * phi[q]
                                              for p, q in nloop(indices, 2)
                                              if p + q == j - 2)
     return ans
Esempio n. 4
0
 def dVdphi(self, phi, j):
     ans = P(0)
     if j >= 2:
         ans = ans + self.m**2 * phi[j - 2]
         ans = ans + self.l / 6. * sum(phi[p] * phi[q] * phi[r]
                                       for p, q, r in nloop(indices, 3)
                                       if p + q == j - 2)
     return ans
Esempio n. 5
0
def BellC(x, j):
    """ Defines the complete ordinary Bell polynomial recursively. """
    indices = [i for i in x.j() if F(i) <= j]
    indices = [(p, q) for p, q in nloop(indices, 2) if p != 0 and p + q == j]
    if indices:
        s = sum(p / j * BellC(x, q) * x[p] for p, q in indices if x[p] != P(0))
        if s == 0:
            return P(0.)
        else:
            return s
    else:
        return P(1)