def test_associative_law(self): A = Moeb.rnd(-50, +50, NUMBER_TESTS) B = Moeb.rnd(-50, +50, NUMBER_TESTS) C = Moeb.rnd(-50, +50, NUMBER_TESTS) for i in range(0, NUMBER_TESTS): a, b, c = A[i], B[i], C[i] self.assertEqual(associative_property(a, b, c), moeb_id)
def moeb_to(z0, z1): """Returns the Moebius transformation mapping the complex number z0 to z1. Parameters ---------- z0 : ComplexNumber Complex number to be mapped to z1 : ComplexNumber Target complex number Returns ------- Moeb Moebius transformation mapping the complex number z0 to z1 """ re_z0 = z0.re im_z0 = z0.im re_z1 = z1.re im_z1 = z1.im a = math.sqrt(im_z1 / im_z0) b = -re_z0 * math.sqrt(im_z1 / im_z0) + re_z1 * math.sqrt(im_z0 / im_z1) c = .0 d = math.sqrt(im_z0 / im_z1) return Moeb(a, b, c, d)
def parab(t): """Returns an element of the one parameter group of Moebius translations in x-direction. Parameters ---------- t : Float Flow parameter Returns ------- Moeb The Moebius translation in y-direction by an offset of t """ return Moeb(1.0, t, .0, 1.0)
def loxod(t): """Returns an element of the one parameter group of Moebius loxodromic transformations (dilatation in y-direction). Parameters ---------- t : Float Flow parameter Returns ------- Moeb The element of the one parameter group of Moebius loxodromic dilatation evaluated for time t """ return Moeb(math.exp(.5 * t), .0, .0, math.exp(-.5 * t))
def ellip_0(t): """Returns an element of the one parameter group of Moebius rotations (element of elliptic transformations) around imaginary unit. Parameters ---------- t : Float Flow parameter Returns ------- Moeb The element of the one parameter group of Moebius rotations around the imaginary unit for time t """ return Moeb(math.cos(t), math.sin(t), -math.sin(t), math.cos(t))
def vert_to_vert(v_0, v_1): """Returns the Moebius transformation mapping the geodesic, vertical line v_0 to the vertical line v_1. Parameters ---------- v_0 : Line of LineType VERTICAL Vertical line to be mapped to v_1 : Line of LineType VERTICAL Target Vertical line Returns ------- Moeb Moebius transformation mapping the geodesic, vertical line v_0 to the vertical line v_1 """ return Moeb(1.0, v_1.Absc - v_0.Absc, .0, 1.0)
def circ_to_vert(c, v): """Returns the Moebius transformation mapping the geodesic circle to the geodesic vertical line. Parameters ---------- c : Line of LineType CIRCLE Geodesic circle to be mapped to v : Line of LineType VERTICAL Target vertical line Returns ------- Moeb Moebius transformation mapping the geodesic circle to the geodesic vertical line """ u = v.Absc return Moeb(1.0, u, .0, 1.0) * circ_to_Yaxis(c)
def circ_to_Yaxis(circ): """Returns the Moebius transformation mapping the geodesic circle to the y-axis. Parameters ---------- c : Line of LineType CIRCLE Geodesic circle to be mapped to the y-axis Returns ------- Moeb Moebius transformation mapping the geodesic circle to the y-axis """ c = circ.Center r = circ.Radius return Moeb(1 / (math.sqrt(2.0 * r)), -c / (math.sqrt(2.0 * r)) + math.sqrt(r / 2.0), -1 / (math.sqrt(2.0 * r)), c / (math.sqrt(2.0 * r)) + math.sqrt(r / 2.0))
def test_inv_element(self): M = Moeb.rnd(-50, +50, NUMBER_TESTS) for m in M: self.assertEqual(inv_element_r(m, m.inv()), moeb_id) self.assertEqual(inv_element_r(m, m.inv()), moeb_id)
def test_neutral_element(self): M = Moeb.rnd(-50, +50, NUMBER_TESTS) for m in M: self.assertEqual(neutral_element_r(m, moeb_id), moeb_id) self.assertEqual(neutral_element_l(m, moeb_id), moeb_id)