44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
def decomposition_g0_g8(fct):
|
|
'''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()
|
|
if fct.coordinates() != g*[0]:
|
|
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)
|
|
|
|
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
|
|
Fxy, Rxy, x, y = C.fct_field
|
|
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)
|
|
dx_valuation = C.dx.expansion_at_infty(prec=prec).valuation()
|
|
for monomial in num.monomials():
|
|
aux = superelliptic_function(C, monomial)
|
|
if aux.expansion_at_infty(prec=prec).valuation() + dx_valuation >= aux_den.expansion_at_infty(prec=prec).valuation():
|
|
g8 += num.monomial_coefficient(monomial)*aux/aux_den
|
|
else:
|
|
g0 += num.monomial_coefficient(monomial)*aux/aux_den
|
|
g0, g8 = g0*C.dx, g8*C.dx
|
|
if g0.is_regular_on_U0():
|
|
return (g0, g8)
|
|
else:
|
|
raise Error("Something went wrong.") |