def test_intersection_symetry(self): x = self.x y = self.y z = self.z sm1 = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z], [x, y, z**2]]) sm2 = SingularModule([[x, y**2, z**3]]) sm_1_2 = sm1.intersection(sm2) sm_2_1 = sm2.intersection(sm1) #Assert that equals is symetric self.assertTrue(sm_1_2.equals(sm_2_1))
def test_intersect_contains(self): x = self.x y = self.y z = self.z sm1 = SingularModule([[x, y + z, z**3 - 2 * y], [x, y, z], [x, y, z**2]]) sm2 = SingularModule([[x, y**2, z**3]]) #Assert the intersection is contained in both modules gens = (sm1.intersection(sm2)).gens for gen in gens: self.assertTrue(sm1.contains(gen)) for gen in gens: self.assertTrue(sm2.contains(gen))
def test_intersect(self): x = self.x y = self.y z = self.z smA = SingularModule([[x, y**3, z + x], [z, x, x**2]]) smB = SingularModule([[z, y, x], [-z, x**2, 4 * y + z]]) smI = smA.intersection(smB) gen_1_1 = x**5 * z + x * y**3 * z**2 + 4 * y**4 * z**2 + y**3 * z**3 + x**3 * y * z - x**3 * z**2 - x**2 * z**3 - x**3 * z - 4 * x**2 * y * z - x**2 * z**2 - x * y * z**2 - y * z**3 gen_2_1 = x**4 * y**3 * z - x**3 * y**3 * z + x**2 * y**4 * z + 4 * y**5 * z + y**4 * z**2 + x**5 - x**4 * z - x**3 * z**2 - 4 * x**2 * y**2 - 2 * x**2 * y * z - x * y * z**2 gen_3_1 = x**3 * y**3 * z - x**3 * y * z + 4 * x**2 * y**4 * z + x**2 * y**3 * z**2 + x**6 - 4 * x**3 * y**2 - x**4 * z - x**3 * z**2 - x**3 * z - 4 * x**2 * y * z + 4 * x * y**2 * z - 2 * x**2 * z**2 - 3 * x * y * z**2 + 4 * y**2 * z**2 - x * z**3 + y * z**3 gens = [[gen_1_1, gen_2_1, gen_3_1]] #Test this example self.assertEqual(gens, smI.gens)