def test_rcvexample(self): R = QQ['x,y'] x,y = R.gens() f = x**2*y**3 - x**4 + 1 a = integral_basis(f) b = [1, x*y, x**2*y**2] self.assertEqual(a,b)
def test_rcvexample_monicized(self): R = QQ['x,y'] x,y = R.gens() f = y**3 - x**8 + x**4 a = integral_basis(f) b = [1, y/x, y**2/x**2] self.assertEqual(a,b)
def test_issue86(self): R = QQ['x,z'] x,z = R.gens() f = -x**7 + 2*x*z**5 + z**4 a = integral_basis(f) b = [1, 2*x*z, 2*z*(2*x*z + 1)/x, 4*z**2*(2*x*z + 1)/x**3, 8*z**3*(2*x*z + 1)/x**5] self.assertEqual(a,b)
def test_f8b(self): # the curve f8 recentered at the singular point (0 : 1 : 0) R = QQ['x,y'] x,y = R.gens() g = -y**8 + 2*x**3 + x**2 a = integral_basis(g) b = [1, y, y**2, y**3, y**4/x, y**5/x, y**6/x, y**7/x] self.assertEqual(a,b)
def test_integral_basis(self): self.assertEqual(integral_basis(f1,x,y), [1, y*(x**2 - x + 1)/x**2]) self.assertEqual(integral_basis(f2,x,y), [1, y/x, y**2/x**3]) self.assertEqual(integral_basis(f4,x,y), [1, y/x]) # # long time # self.assertEqual(integral_basis(f5,x,y), # []) # # long time # self.assertEqual(integral_basis(f6,x,y), # [1, y, y**2/x, y**3/x]) self.assertEqual(integral_basis(f7,x,y), [1, y, y**2]) # self.assertEqual(integral_basis(f8,x,y), # []) self.assertEqual(integral_basis(f9,x,y), [1, y, y**2]) self.assertEqual(integral_basis(f10,x,y), [1, x*y, x**2*y**2, x**3*y**3])
def differentials_numerators(f): """Return the numerators of a basis of holomorphic differentials on a Riemann surface. Parameters ---------- f : plane algebraic curve Returns ------- differentials : list A list of :class:`Differential`s representing *a* basis of Abelian differentials of the first kind. """ # homogenize and compute total degree R = f.parent().change_ring(QQbar) x,y = R.gens() d = f.total_degree() # construct the generalized adjoint polynomial. we want to think of it as # an element of B[*c][x,y] where B is the base ring of f and *c are the # indeterminates cvars = ['c_%d_%d'%(i,j) for i in range(d-2) for j in range(d-2)] vars = list(R.variable_names()) + cvars C = PolynomialRing(QQbar, cvars) S = PolynomialRing(C, [x,y]) T = PolynomialRing(QQbar, vars) c = S.base_ring().gens() x,y = S(x),S(y) P = sum(c[j+(d-2)*i] * x**i * y**j for i in range(d-2) for j in range(d-2) if i+j <= d-3) # for each singular point [x:y:z] = [alpha:beta:gamma], map f onto the # "most convenient and appropriate" affine subspace, (u,v), and center at # u=0. determine the conditions on P singular_points = singularities(f) conditions = [] for singular_point, _ in singular_points: # recenter the curve and adjoint polynomial at the singular point: find # the affine plane u,v such that the singularity occurs at u=0 g = recenter_curve(f, singular_point) Ptilde = recenter_curve(P, singular_point) # compute the intergral basis at the recentered singular point # and determine the Mnuk conditions of the adjoint polynomial b = integral_basis(g) for bi in b: conditions_bi = mnuk_conditions(g, bi, Ptilde) conditions.extend(conditions_bi) # reduce the general adjoint modulo the ideal generated by the integral # basis conditions. the coefficients of the remaining c_ij's form the # numerators of a basis of abelian differentials of the first kind. # # additionally, we try to coerce the conditions to over QQ for speed. it's # questionable in this situation whether there is a noticible performance # gain but it does suppress the "slow toy implementation" warning. try: T = T.change_ring(QQ) ideal = T.ideal(conditions) basis = ideal.groebner_basis() except: pass ideal = T.ideal(conditions) basis = ideal.groebner_basis() P_reduced = P(T(x), T(y)) if basis != [0]: P_reduced = P_reduced.reduce(basis) U = R[S.base_ring().variable_names()] args = [U(x),U(y)] + [U(ci) for ci in c] Pc = P_reduced(*args) numerators = Pc.coefficients() return numerators
def test_f10(self): x,y = self.f10.parent().gens() a = integral_basis(self.f10) b = [1, x*y, x**2*y**2, x**3*y**3] self.assertEqual(a,b)
def test_f9(self): x,y = self.f9.parent().gens() a = integral_basis(self.f9) b = [1, y, y**2] self.assertEqual(a,b)
def test_f8(self): x,y = self.f8.parent().gens() a = integral_basis(self.f8) b = [1, x*y, x*y**2, y**3*x, x**2*y**4, y**5*x**2] self.assertEqual(a,b)
def test_f6(self): x,y = self.f6.parent().gens() a = integral_basis(self.f6) b = [1, y, y**2/x, y**3/x] self.assertEqual(a,b)
def test_f5(self): x,y = self.f5.parent().gens() a = integral_basis(self.f5) b = [1, y, y**2, y**3, y*(y**3-1)/x, y**2*(y**3-1)/x**2] self.assertEqual(a,b)
def test_f4(self): x,y = self.f4.parent().gens() a = integral_basis(self.f4) b = [1, y/x] self.assertEqual(a,b)
def test_f3(self): x,y = self.f3.parent().gens() a = integral_basis(self.f3) b = [1, y, (y**2-1)/(x-1), -y*(x - 4*y**2 + 3)/(x*(x - 1))] self.assertEqual(a,b)
def test_f2(self): x,y = self.f2.parent().gens() a = integral_basis(self.f2) b = [1, y/x, y**2/x**3] self.assertEqual(a,b)
def test_f1(self): x,y = self.f1.parent().gens() a = integral_basis(self.f1) b = [1, y*(x**2-x+1)/x**2] self.assertEqual(a,b)