DeRhamComputation/sage/superelliptic/superelliptic_function_clas...

116 lines
3.2 KiB
Python

#Class of rational functions on a superelliptic curve C. g = g(x, y) is a polynomial
#defining the function.
class superelliptic_function:
def __init__(self, C, g):
F = C.base_ring
Rxy.<x, y> = PolynomialRing(F, 2)
Fxy = FractionField(Rxy)
f = C.polynomial
r = f.degree()
m = C.exponent
self.curve = C
g = reduction(C, g)
self.function = g
def __repr__(self):
return str(self.function)
def jth_component(self, j):
g = self.function
C = self.curve
F = C.base_ring
Rx.<x> = PolynomialRing(F)
Fx.<x> = FractionField(Rx)
FxRy.<y> = PolynomialRing(Fx)
g = FxRy(g)
return coff(g, j)
def __add__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
g = reduction(C, g1 + g2)
return superelliptic_function(C, g)
def __sub__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
g = reduction(C, g1 - g2)
return superelliptic_function(C, g)
def __mul__(self, other):
C = self.curve
try:
g1 = self.function
g2 = other.function
g = reduction(C, g1 * g2)
return superelliptic_function(C, g)
except:
g1 = self.function
g2 = other.form
g = reduction(C, g1 * g2)
return superelliptic_form(C, g)
def __rmul__(self, constant):
C = self.curve
g = self.function
return superelliptic_function(C, constant*g)
def __truediv__(self, other):
C = self.curve
g1 = self.function
g2 = other.function
g = reduction(C, g1 / g2)
return superelliptic_function(C, g)
def __pow__(self, exp):
C = self.curve
g = self.function
return superelliptic_function(C, g^(exp))
def diffn(self):
C = self.curve
f = C.polynomial
m = C.exponent
F = C.base_ring
g = self.function
Rxy.<x, y> = PolynomialRing(F, 2)
Fxy = FractionField(Rxy)
g = Fxy(g)
A = g.derivative(x)
B = g.derivative(y)*f.derivative(x)/(m*y^(m-1))
return superelliptic_form(C, A+B)
def expansion_at_infty(self, place = 0, prec=10):
C = self.curve
f = C.polynomial
m = C.exponent
F = C.base_ring
Rx.<x> = PolynomialRing(F)
f = Rx(f)
Rt.<t> = LaurentSeriesRing(F, default_prec=prec)
RptW.<W> = PolynomialRing(Rt)
RptWQ = FractionField(RptW)
Rxy.<x, y> = PolynomialRing(F)
RxyQ = FractionField(Rxy)
fct = self.function
fct = RxyQ(fct)
r = f.degree()
delta, a, b = xgcd(m, r)
b = -b
M = m/delta
R = r/delta
while a<0:
a += R
b += M
g = (x^r*f(x = 1/x))
gW = RptWQ(g(x = t^M * W^b)) - W^(delta)
ww = naive_hensel(gW, F, start = root_of_unity(F, delta)^place, prec = prec)
xx = Rt(1/(t^M*ww^b))
yy = 1/(t^R*ww^a)
return Rt(fct(x = Rt(xx), y = Rt(yy)))