Example #1
0
    def _makefp(self, params):
        zdot = self.x[self.dim:]
        out = np.concatenate((
            zdot,
            np.dot(
                self.Mzi, -tn.einsum('i,ijk,k', zdot, self.dMz, zdot) +
                tn.einsum('i,ikl,k', zdot, self.dMz, zdot) / 2 + self.dVz) +
            matmult(
                tn.subs(self._dPsi, self.qtoz),
                self.Mqi,  # here we might need subs
                self.u)))

        out = tn.SymExpr(tn.subs(out, self.ztox))
        out.callable(*params)
        return out
Example #2
0
    def _makefp(self, params):
        zdot = self.x[self.dim:]
        out = np.concatenate((zdot,
                              np.dot(self.Mzi,
                                     - tn.einsum(
                                         'i,ijk,k', zdot, self.dMz, zdot)
                                     + tn.einsum(
                                         'i,ikl,k', zdot, self.dMz, zdot) / 2
                                     + self.dVz)
                              + matmult(
                                  tn.subs(self._dPsi, self.qtoz),
                                  self.Mqi,  # here we might need subs
                                  self.u)
                              ))

        out = tn.SymExpr(tn.subs(out, self.ztox))
        out.callable(*params)
        return out
Example #3
0
    def _makefm(self, params):
        zdot = self.x[self.dim:]
        OhmP = tn.subs(self._Ohm, zip(self.z, self._P))
        OhmI = tn.subs(self._dPsi, zip(self.q, OhmP))

        zz = self._P
        zzdot = np.dot(self._dP, zdot)

        out = -tn.einsum('i,ijk,k', zzdot, self.dMzz, zzdot) \
            + tn.einsum('i,ikj,k', zzdot, self.dMzz, zzdot) / 2
        out = np.dot(self.Mzzi, out + self.dVzz)
        out = out - tn.einsum('ijk,j,k', tn.diff(self._dP, self.z), zdot, zdot)
        out = out + matmult(OhmI, self.Mqi, self.u)
        # in general, there should be a subs here
        out = matmult(self._dPi, out)
        out = np.concatenate((zdot, out))

        out = tn.SymExpr(tn.subs(out, self.ztox))
        out.callable(*params)

        return out
Example #4
0
    def _makefm(self, params):
        zdot = self.x[self.dim:]
        OhmP = tn.subs(self._Ohm, zip(self.z, self._P))
        OhmI = tn.subs(self._dPsi, zip(self.q, OhmP))

        zz = self._P
        zzdot = np.dot(self._dP, zdot)

        out = -tn.einsum('i,ijk,k', zzdot, self.dMzz, zzdot) \
            + tn.einsum('i,ikj,k', zzdot, self.dMzz, zzdot) / 2
        out = np.dot(self.Mzzi, out + self.dVzz)
        out = out - tn.einsum('ijk,j,k',
                              tn.diff(self._dP, self.z), zdot, zdot)
        out = out + matmult(OhmI, self.Mqi, self.u)
                            # in general, there should be a subs here
        out = matmult(self._dPi, out)
        out = np.concatenate((zdot, out))

        out = tn.SymExpr(tn.subs(out, self.ztox))
        out.callable(*params)

        return out