def test_avf(self): max_order = 5 a = AVF b = modified_equation(a) result1 = convergence_order(a) self.assertEqual(2, result1) result2 = symplectic_up_to_order(a) self.assertEqual(2, result2) result3 = conjugate_to_symplectic(a) self.assertEqual(4, result3) result4 = symmetric_up_to_order(a, max_order) self.assertEqual(max_order, result4) result5 = energy_preserving_upto_order(b, max_order) self.assertEqual(max_order, result5) # = energy preserving
def test_RKcashKarp(self): a = RKcashKarp.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(5, result) # = order
def test_rk38(self): a = RK38rule.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(4, result) # = order
def test_RKlobattoIIIB4(self): a = RKlobattoIIIB4.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(4, result) # = order
def test_runge2(self): a = RKrunge2.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(2, result) # = order
def test_implicit_trapezoidal(self): a = RKimplicitTrapezoidal.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(2, result) # = order
def test_implicit_midpoint(self): a = RKimplicitMidpoint.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(2, result) # = order
def test_implicit_euler(self): a = RKimplicitEuler.phi() b = modified_equation(a) result = energy_preserving_upto_order(b) self.assertEqual(1, result) # = order
def test_exact(self): max_order = 5 a = exponential b = modified_equation(a) result = energy_preserving_upto_order(b, max_order) self.assertEqual(max_order, result)