DeRhamComputation/sage/superelliptic/decomposition_into_g0_g8.sage

60 lines
2.6 KiB
Python
Raw Normal View History

2023-02-27 12:51:16 +01:00
def decomposition_g0_g8(fct, prec = 50):
2023-02-23 12:26:25 +01:00
'''Writes fct as a difference g0 - g8, with g0 regular on the affine patch and g8 at the points in infinity.'''
C = fct.curve
g = C.genus()
coord = fct.coordinates()
nontrivial_part = 0*C.x
for i, a in enumerate(C.cohomology_of_structure_sheaf_basis()):
nontrivial_part += coord[i]*a
fct -= nontrivial_part
2023-02-27 12:51:16 +01:00
if fct.coordinates(prec=prec) != g*[0]:
2023-02-23 12:26:25 +01:00
raise ValueError("The given function cannot be written as g0 - g8.")
Fxy, Rxy, x, y = C.fct_field
fct = Fxy(fct.function)
num = fct.numerator()
den = fct.denominator()
aux_den = superelliptic_function(C, Rxy(den))
g0 = superelliptic_function(C, 0)
g8 = superelliptic_function(C, 0)
for monomial in num.monomials():
aux = superelliptic_function(C, monomial)
if aux.expansion_at_infty().valuation() >= aux_den.expansion_at_infty().valuation():
g8 += num.monomial_coefficient(monomial)*aux/aux_den
else:
g0 += num.monomial_coefficient(monomial)*aux/aux_den
return (g0, g8, nontrivial_part)
2023-02-27 12:51:16 +01:00
2023-02-23 12:26:25 +01:00
def decomposition_omega0_omega8(omega, prec=50):
'''Writes omega as a difference omega0 - omega8, with omega0 regular on the affine patch and omega8 at the points in infinity.'''
C = omega.curve
2023-02-27 12:51:16 +01:00
omega.form = reduction(C, omega.form)
F = C.base_ring
delta = C.nb_of_pts_at_infty
m = C.exponent
if sum(omega.residue(place = i, prec = 50) for i in range(delta)) != 0:
raise ValueError(str(omega) + " has non zero residue!")
2023-02-23 12:26:25 +01:00
Fxy, Rxy, x, y = C.fct_field
2023-02-27 12:51:16 +01:00
Rx.<x> = PolynomialRing(F)
Fx = FractionField(Rx)
2023-02-23 12:26:25 +01:00
fct = Fxy(omega.form)
num = fct.numerator()
den = fct.denominator()
aux_den = superelliptic_function(C, Rxy(den))
g0 = superelliptic_function(C, 0)
g8 = superelliptic_function(C, 0)
2023-02-27 12:51:16 +01:00
for j in range(0, m):
component = Fx(omega.jth_component(j))
q, r = component.numerator().quo_rem(component.denominator())
g0 += (C.y)^(-j)*superelliptic_function(C, Rxy(q))
if ((C.y)^(-j)*superelliptic_function(C, Fxy(r/component.denominator()))*C.dx).expansion_at_infty().valuation() < 0:
raise ValueError("Something went wrong for "+str(omega))
g8 -= (C.y)^(-j)*superelliptic_function(C, Fxy(r/component.denominator()))
2023-02-23 12:26:25 +01:00
g0, g8 = g0*C.dx, g8*C.dx
if g0.is_regular_on_U0():
return (g0, g8)
2023-02-27 12:51:16 +01:00
#Rx.<x> = PolynomialRing(F)
#Rx.<x> = PolynomialRing(F)
#aux_fct = (g0.form)*y
2023-02-23 12:26:25 +01:00
else:
2023-02-27 12:51:16 +01:00
raise ValueError("Something went wrong for "+str(omega) +". Result would be "+str(g0)+ " and " + str(g8))