DeRhamComputation/sage/as_covers/as_function_class.sage

144 lines
4.3 KiB
Python
Raw Normal View History

2022-11-18 15:00:34 +01:00
class as_function:
def __init__(self, C, g):
self.curve = C
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)
x, y = Rxyz.gens()[:2]
z = Rxyz.gens()[2:]
RxyzQ = FractionField(Rxyz)
self.function = RxyzQ(g)
#self.function = as_reduction(AS, RxyzQ(g))
def __repr__(self):
return str(self.function)
def __add__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
return as_function(C, g1 + g2)
def __sub__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
return as_function(C, g1 - g2)
def __rmul__(self, constant):
C = self.curve
g = self.function
return as_function(C, constant*g)
def __mul__(self, other):
2022-12-19 14:37:14 +01:00
if isinstance(other, as_function):
C = self.curve
g1 = self.function
g2 = other.function
return as_function(C, g1*g2)
if isinstance(other, as_form):
C = self.curve
g1 = self.function
g2 = other.form
return as_form(C, g1*g2)
def __truediv__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
return as_function(C, g1/g2)
def __pow__(self, exponent):
C = self.curve
g1 = self.function
return as_function(C, g1^(exponent))
2022-11-18 15:00:34 +01:00
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_series[i]
y_series = C.y_series[i]
z_series = C.z_series[i]
2022-11-18 15:00:34 +01:00
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.function
g = RxyzQ(g)
sub_list = {x : x_series, y : y_series} | {z[j] : z_series[j] for j in range(n)}
return g.substitute(sub_list)
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.function
return as_function(C, g.substitute(sub_list))
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)
result = as_function(C, 0)
G = C.group
for a in G:
result += self.group_action(a)
2022-11-18 15:00:34 +01:00
result = result.function
Rxy.<x, y> = PolynomialRing(F, 2)
Qxy = FractionField(Rxy)
2022-12-19 14:37:14 +01:00
result = as_reduction(AS, result)
return superelliptic_function(C_super, Qxy(result))
2022-12-19 14:37:14 +01:00
def diffn(self):
C = self.curve
C_super = C.quotient
n = C.height
RxyzQ, Rxyz, x, y, z = C.fct_field
fcts = C.functions
f = self.function
y_super = superelliptic_function(C_super, y)
dy_super = y_super.diffn().form
dz = []
for i in range(n):
dfct = fcts[i].diffn().form
dz += [-dfct]
result = f.derivative(x)
result += f.derivative(y)*dy_super
for i in range(n):
result += f.derivative(z[i])*dz[i]
return as_form(C, result)
def valuation(self, i = 0):
'''Return valuation at i-th place at infinity.'''
2022-12-19 14:37:14 +01:00
C = self.curve
F = C.base_ring
Rt.<t> = LaurentSeriesRing(F)
return Rt(self.expansion_at_infty(i)).valuation()