def test_derivative(self): x = self.x y = self.y z = self.z logdf = LogarithmicDifferentialForm(1,[y*z,x*z,x*y],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,2) logdf_der = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(logdf_der.equals(logdf.derivative()))
def test_derivative(self): x = self.x y = self.y z = self.z logdf = LogarithmicDifferentialForm(1, [y * z, x * z, x * y], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 2) logdf_der = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(logdf_der.equals(logdf.derivative()))
def test_interior_1_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] form = DifferentialForm(self.normal_logdf.form_space,0,(x+y+z)/(x*y*z)) one = self.poly_ring.one() logdf = LogarithmicDifferentialForm(1,[one,one,one],self.normal_logdf) int_product = logdf.interior_product() logdf_form = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(int_product.equals(logdf_form))
def test_create_from_0_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm(0,[xp+yp+zp],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,0,(x+y+z)/(x*y*z)) logdf_form = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(logdf.equals(logdf_form))
def test_mul(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] logdf = LogarithmicDifferentialForm(2,[self.x,self.y,self.z],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,2) form[0,1] = -5/(y*z) form[0,2] = -5/(x*z) form[1,2] = -5/(x*y) self.assertTrue((logdf*(-5)).equals((-5)*logdf)) logdf_mul = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue((-5*logdf).equals(logdf_mul))
def test_sub(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] logdfA = LogarithmicDifferentialForm(2,[self.x,self.y,self.z],self.normal_logdf) logdfB = LogarithmicDifferentialForm(2,[self.z,self.y,self.x],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,2) form[0,1] = 1/(y*z) - 1/(x*y) form[0,2] = 0 form[1,2] = 1/(x*y) - 1/(y*z) logdf_diff = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(logdf_diff.equals(logdfA-logdfB))
def test_interior_1_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] form = DifferentialForm(self.normal_logdf.form_space, 0, (x + y + z) / (x * y * z)) one = self.poly_ring.one() logdf = LogarithmicDifferentialForm(1, [one, one, one], self.normal_logdf) int_product = logdf.interior_product() logdf_form = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(int_product.equals(logdf_form))
def test_wedge(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] norm = self.x*self.y*self.z logdfA = LogarithmicDifferentialForm(1,[self.x*norm,self.y*norm,self.z*norm],self.normal_logdf) logdfB = LogarithmicDifferentialForm(1,[self.z,self.y,self.x],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,2) form[0,1] = 1/z - 1/x form[0,2] = (x/(y*z)) - (z/(x*y)) form[1,2] = 1/z - 1/x logdf_wedge = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(logdf_wedge.equals(logdfA.wedge(logdfB)))
def test_mul(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] logdf = LogarithmicDifferentialForm(2, [self.x, self.y, self.z], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 2) form[0, 1] = -5 / (y * z) form[0, 2] = -5 / (x * z) form[1, 2] = -5 / (x * y) self.assertTrue((logdf * (-5)).equals((-5) * logdf)) logdf_mul = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue((-5 * logdf).equals(logdf_mul))
def test_create_from_0_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm(0, [xp + yp + zp], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 0, (x + y + z) / (x * y * z)) logdf_form = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(logdf.equals(logdf_form))
def test_create_from_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm(2,[xp*yp-yp*zp,xp**2-zp**2,xp*yp-yp*zp],self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,2) form[0,1] = 1/z - 1/x form[0,2] = (x/(y*z)) - (z/(x*y)) form[1,2] = 1/z - 1/x logdf_form = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(logdf.equals(logdf_form))
def test_sub(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] logdfA = LogarithmicDifferentialForm(2, [self.x, self.y, self.z], self.normal_logdf) logdfB = LogarithmicDifferentialForm(2, [self.z, self.y, self.x], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 2) form[0, 1] = 1 / (y * z) - 1 / (x * y) form[0, 2] = 0 form[1, 2] = 1 / (x * y) - 1 / (y * z) logdf_diff = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(logdf_diff.equals(logdfA - logdfB))
def test_interior(self): xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm(2,[xp**2,xp+4*yp+zp,xp**3*zp**3],self.whitney_logdf) int_product = logdf.interior_product() x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] whitney = x**2*y - z**2 form = DifferentialForm(self.normal_logdf.form_space,1) form[0] = (-2*x**2*y-2*x*z-8*y*z-2*z**2)/whitney form[1] = (x**3-2*x**3*z**4)/whitney form[2] = (x**2+4*x*y+x*z+2*x**3*y*z**3)/whitney logdf_form = LogarithmicDifferentialForm.create_from_form(form,self.whitney_logdf) self.assertTrue(int_product.equals(logdf_form))
def test_wedge(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] norm = self.x * self.y * self.z logdfA = LogarithmicDifferentialForm( 1, [self.x * norm, self.y * norm, self.z * norm], self.normal_logdf) logdfB = LogarithmicDifferentialForm(1, [self.z, self.y, self.x], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 2) form[0, 1] = 1 / z - 1 / x form[0, 2] = (x / (y * z)) - (z / (x * y)) form[1, 2] = 1 / z - 1 / x logdf_wedge = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(logdf_wedge.equals(logdfA.wedge(logdfB)))
def test_create_from_form(self): x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm( 2, [xp * yp - yp * zp, xp**2 - zp**2, xp * yp - yp * zp], self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 2) form[0, 1] = 1 / z - 1 / x form[0, 2] = (x / (y * z)) - (z / (x * y)) form[1, 2] = 1 / z - 1 / x logdf_form = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(logdf.equals(logdf_form))
def test_interior(self): xp = self.x yp = self.y zp = self.z logdf = LogarithmicDifferentialForm( 2, [xp**2, xp + 4 * yp + zp, xp**3 * zp**3], self.whitney_logdf) int_product = logdf.interior_product() x = self.normal_logdf.form_vars[0] y = self.normal_logdf.form_vars[1] z = self.normal_logdf.form_vars[2] whitney = x**2 * y - z**2 form = DifferentialForm(self.normal_logdf.form_space, 1) form[0] = (-2 * x**2 * y - 2 * x * z - 8 * y * z - 2 * z**2) / whitney form[1] = (x**3 - 2 * x**3 * z**4) / whitney form[2] = (x**2 + 4 * x * y + x * z + 2 * x**3 * y * z**3) / whitney logdf_form = LogarithmicDifferentialForm.create_from_form( form, self.whitney_logdf) self.assertTrue(int_product.equals(logdf_form))
def test_unit(self): one = LogarithmicDifferentialForm.make_unit(self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space, 0, 1) one_form = LogarithmicDifferentialForm.create_from_form( form, self.normal_logdf) self.assertTrue(one.equals(one_form))
def test_unit(self): one = LogarithmicDifferentialForm.make_unit(self.normal_logdf) form = DifferentialForm(self.normal_logdf.form_space,0,1) one_form = LogarithmicDifferentialForm.create_from_form(form,self.normal_logdf) self.assertTrue(one.equals(one_form))