Example #1
0
 def test_saddle(self):
     lie = LieAlgebra(1)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     orig = q(0)*p(0)
     eq_type = 's'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     real = comp.substitute(c2r)
     diff = orig-real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c)<1.0e-15)
Example #2
0
 def test_saddle(self):
     lie = LieAlgebra(1)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     orig = q(0) * p(0)
     eq_type = 's'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     real = comp.substitute(c2r)
     diff = orig - real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c) < 1.0e-15)
Example #3
0
 def test_centre_saddle(self):
     lie = LieAlgebra(2)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     cent = (0.5*q(0)**2)+(0.5*p(0)**2)
     sadd = (1.0*q(1))*(1.0*p(1))
     orig = cent + sadd
     self.assertEquals(len(orig), 3)
     eq_type = 'cs'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     self.assertEquals(len(comp), 2)
     real = comp.substitute(c2r)
     diff = orig-real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c)<1.0e-15)
Example #4
0
 def test_centre_saddle(self):
     lie = LieAlgebra(2)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     cent = (0.5 * q(0)**2) + (0.5 * p(0)**2)
     sadd = (1.0 * q(1)) * (1.0 * p(1))
     orig = cent + sadd
     self.assertEquals(len(orig), 3)
     eq_type = 'cs'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     self.assertEquals(len(comp), 2)
     real = comp.substitute(c2r)
     diff = orig - real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c) < 1.0e-15)
Example #5
0
 def test_centre(self):
     lie = LieAlgebra(1)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     orig = (0.5*q(0)**2)+(0.5*p(0)**2)
     self.assertEquals(len(orig), 2)
     eq_type = 'c'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     self.assertEquals(len(comp), 1)
     for m, c in comp.powers_and_coefficients():
         self.assert_(c.real == 0.0)
         self.assert_(m[0] == 1)
         self.assert_(m[1] == 1)
     real = comp.substitute(c2r)
     diff = orig-real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c)<1.0e-15)
Example #6
0
 def test_centre(self):
     lie = LieAlgebra(1)
     diag = Diagonalizer(lie)
     q = lie.q
     p = lie.p
     orig = (0.5 * q(0)**2) + (0.5 * p(0)**2)
     self.assertEquals(len(orig), 2)
     eq_type = 'c'
     comp = Complexifier(lie, eq_type)
     r2c = comp.calc_sub_complex_into_real()
     c2r = comp.calc_sub_real_into_complex()
     comp = orig.substitute(r2c)
     self.assertEquals(len(comp), 1)
     for m, c in comp.powers_and_coefficients():
         self.assert_(c.real == 0.0)
         self.assert_(m[0] == 1)
         self.assert_(m[1] == 1)
     real = comp.substitute(c2r)
     diff = orig - real
     for m, c in diff.powers_and_coefficients():
         self.assert_(abs(c) < 1.0e-15)