DeRhamComputation/sage/as_covers/as_form_class.sage

252 lines
9.1 KiB
Python

class as_form:
def __init__(self, C, g):
self.curve = C
n = C.height
F = C.base_ring
variable_names = 'x, y'
for i in range(n):
variable_names += ', z' + str(i)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
self.form = RxyzQ(g)
def __repr__(self):
return "(" + str(self.form)+") * dx"
def expansion_at_infty(self, i = 0):
C = self.curve
delta = C.nb_of_pts_at_infty
F = C.base_ring
x_series = C.x[i]
y_series = C.y[i]
z_series = C.z[i]
dx_series = C.dx[i]
n = C.height
variable_names = 'x, y'
for j in range(n):
variable_names += ', z' + str(j)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
prec = C.prec
Rt.<t> = LaurentSeriesRing(F, default_prec=prec)
g = self.form
sub_list = {x : x_series, y : y_series} | {z[j] : z_series[j] for j in range(n)}
return g.substitute(sub_list)*dx_series
def __add__(self, other):
C = self.curve
g1 = self.form
g2 = other.form
return as_form(C, g1 + g2)
def __sub__(self, other):
C = self.curve
g1 = self.form
g2 = other.form
return as_form(C, g1 - g2)
def __rmul__(self, constant):
C = self.curve
omega = self.form
return as_form(C, constant*omega)
def group_action(self, ZN_tuple):
C = self.curve
n = C.height
F = C.base_ring
variable_names = 'x, y'
for j in range(n):
variable_names += ', z' + str(j)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
sub_list = {x : x, y : y} | {z[j] : z[j]+ZN_tuple[j] for j in range(n)}
g = self.form
return as_form(C, g.substitute(sub_list))
def coordinates(self, holo):
"""Find coordinates of the given form self in terms of the basis forms in a list holo."""
C = self.curve
n = C.height
gC = C.genus()
F = C.base_ring
variable_names = 'x, y'
for j in range(n):
variable_names += ', z' + str(j)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
from sage.rings.polynomial.toy_variety import linear_representation
return linear_representation(Rxyz(self.form), holo)
def trace(self):
C = self.curve
C_super = C.quotient
n = C.height
F = C.base_ring
variable_names = 'x, y'
for j in range(n):
variable_names += ', z' + str(j)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
g = self.form
result = RxyzQ(0)
g_num = Rxyz(numerator(g))
g_den = Rxyz(denominator(g))
z = prod(z[i] for i in range(n))^(p-1)
for a in g_num.monomials():
if (z.divides(a)):
result += g_num.monomial_coefficient(a)*a/z
result /= g_den
Rxy.<x, y> = PolynomialRing(F, 2)
return superelliptic_form(C_super, Rxy(result))
def trace2(self):
C = self.curve
C_super = C.quotient
n = C.height
F = C.base_ring
variable_names = 'x, y'
for j in range(n):
variable_names += ', z' + str(j)
Rxyz = PolynomialRing(F, n+2, variable_names)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
result = as_form(C, 0)
for i in range(0, p):
for j in range(0, p):
result += self.group_action([i, j])
result = result.form
Rxy.<x, y> = PolynomialRing(F, 2)
Qxy = FractionField(Rxy)
return superelliptic_form(C_super, Qxy(result))
def artin_schreier_transform(power_series, prec = 10):
"""Given a power_series, find correction such that power_series - (correction)^p +correction has valuation
-jump non divisible by p. Also, express t (the variable) in terms of the uniformizer at infty on the curve
z^p - z = power_series, where z = 1/t_new^(jump) and express z in terms of the new uniformizer."""
correction = 0
F = power_series.parent().base()
Rt.<t> = LaurentSeriesRing(F, default_prec=prec)
RtQ = FractionField(Rt)
power_series = RtQ(power_series)
if power_series.valuation() == +Infinity:
return(0,0,t,0)
while(power_series.valuation() % p == 0 and power_series.valuation() < 0):
M = -power_series.valuation()/p
coeff = power_series.list()[0] #wspolczynnik a_(-p) w f_AS
correction += coeff.nth_root(p)*t^(-M)
power_series = power_series - (coeff*t^(-p*M) - coeff.nth_root(p)*t^(-M))
jump = max(-(power_series.valuation()), 0)
try:
T = ((power_series)^(-1)).nth_root(jump) #T is defined by power_series = 1/T^m
except:
print("no ", str(jump), "-th root; divide by", power_series.list()[0])
return (jump, power_series.list()[0])
T_rev = new_reverse(T, prec = prec)
t_old = T_rev(t^p/(1 - t^((p-1)*jump)).nth_root(jump))
z = 1/t^(jump) + Rt(correction)(t = t_old)
return(jump, correction, t_old, z)
def are_forms_linearly_dependent(set_of_forms):
from sage.rings.polynomial.toy_variety import is_linearly_dependent
C = set_of_forms[0].curve
F = C.base_ring
n = C.height
variable_names = 'x, y'
for i in range(n):
variable_names += ', z' + str(i)
Rxyz = PolynomialRing(F, n+2, variable_names)
denominators = prod(denominator(omega.form) for omega in set_of_forms)
return is_linearly_dependent([Rxyz(denominators*omega.form) for omega in set_of_forms])
#given a set S of (form, corresponding Laurent series at some pt), find their combinations holomorphic at that pt
def holomorphic_combinations_fcts(S, pole_order):
C_AS = S[0][0].curve
p = C_AS.characteristic
F = C_AS.base_ring
prec = C_AS.prec
Rt.<t> = LaurentSeriesRing(F, default_prec=prec)
RtQ = FractionField(Rt)
minimal_valuation = min([Rt(g[1]).valuation() for g in S])
if minimal_valuation >= -pole_order:
return [s[0] for s in S]
list_of_lists = [] #to będzie lista złożona z list współczynników część nieholomorficznych rozwinięcia form z S
for eta, eta_exp in S:
a = -minimal_valuation + Rt(eta_exp).valuation()
list_coeffs = a*[0] + Rt(eta_exp).list() + (-minimal_valuation)*[0]
list_coeffs = list_coeffs[:-minimal_valuation - pole_order]
list_of_lists += [list_coeffs]
M = matrix(F, list_of_lists)
V = M.kernel() #chcemy wyzerować części nieholomorficzne, biorąc kombinacje form z S
# Sprawdzamy, jakim formom odpowiadają elementy V.
forms = []
for vec in V.basis():
forma_holo = as_function(C_AS, 0)
forma_holo_power_series = Rt(0)
for vec_wspolrzedna, elt_S in zip(vec, S):
eta = elt_S[0]
#eta_exp = elt_S[1]
forma_holo += vec_wspolrzedna*eta
#forma_holo_power_series += vec_wspolrzedna*eta_exp
forms += [forma_holo]
return forms
#given a set S of (form, corresponding Laurent series at some pt), find their combinations holomorphic at that pt
def holomorphic_combinations_forms(S, pole_order):
C_AS = S[0][0].curve
p = C_AS.characteristic
F = C_AS.base_ring
prec = C_AS.prec
Rt.<t> = LaurentSeriesRing(F, default_prec=prec)
RtQ = FractionField(Rt)
minimal_valuation = min([Rt(g[1]).valuation() for g in S])
if minimal_valuation >= -pole_order:
return [s[0] for s in S]
list_of_lists = [] #to będzie lista złożona z list współczynników część nieholomorficznych rozwinięcia form z S
for eta, eta_exp in S:
a = -minimal_valuation + Rt(eta_exp).valuation()
list_coeffs = a*[0] + Rt(eta_exp).list() + (-minimal_valuation)*[0]
list_coeffs = list_coeffs[:-minimal_valuation - pole_order]
list_of_lists += [list_coeffs]
M = matrix(F, list_of_lists)
V = M.kernel() #chcemy wyzerować części nieholomorficzne, biorąc kombinacje form z S
# Sprawdzamy, jakim formom odpowiadają elementy V.
forms = []
for vec in V.basis():
forma_holo = as_form(C_AS, 0)
forma_holo_power_series = Rt(0)
for vec_wspolrzedna, elt_S in zip(vec, S):
eta = elt_S[0]
#eta_exp = elt_S[1]
forma_holo += vec_wspolrzedna*eta
#forma_holo_power_series += vec_wspolrzedna*eta_exp
forms += [forma_holo]
return forms
#print only forms that are log at the branch pts, but not holomorphic
def only_log_forms(C_AS):
list1 = AS.at_most_poles_forms(0)
list2 = AS.at_most_poles_forms(1)
result = []
for a in list2:
if not(are_forms_linearly_dependent(list1 + result + [a])):
result += [a]
return result