130 lines
4.8 KiB
Python
130 lines
4.8 KiB
Python
class as_witt_form:
|
|
def __init__(self, fcts1, fcts2):
|
|
self.Vs = fcts1
|
|
self.dVs = fcts2
|
|
self.n = len(fcts1) - 1
|
|
self.curve = fcts1[0].curve
|
|
if self.dVs[0].function!=0:
|
|
raise ValueError('First dV should be zero!')
|
|
if len(fcts1) != len(fcts2):
|
|
raise ValueError('Both lists should be of the same length!')
|
|
|
|
def __repr__(self):
|
|
result = ''
|
|
i = 0
|
|
for f in self.Vs:
|
|
if i != 0:
|
|
result += 'V^' + str(i) + '([' + str(f) + '] d[x]) +'
|
|
else:
|
|
result += '[' + str(f) + '] d[x] +'
|
|
i+=1
|
|
i = 1
|
|
for f in self.dVs[1:]:
|
|
result += 'dV^' + str(i) + '([' + str(f) + ']) +'
|
|
i+=1
|
|
return result
|
|
|
|
def __add__(self, other):
|
|
#print(self, other)
|
|
n = self.n
|
|
AS = self.curve
|
|
########
|
|
i = 0
|
|
while(i <= n and self.Vs[i].function == 0 and other.Vs[i].function == 0):
|
|
i+=1
|
|
if i<=n:
|
|
#print('a')
|
|
if (i <= n and self.Vs[i].function != 0 and other.Vs[i].function != 0):
|
|
self1 = self.cutVs(i)
|
|
other1 = other.cutVs(i)
|
|
result = self1 + other1
|
|
self_first = self.Vs[i].teichmuller(n)
|
|
other_first = other.Vs[i].teichmuller(n)
|
|
aux = self_first + other_first
|
|
for j in range(0, n+1 - i):
|
|
#print(i, j)
|
|
result += aux.f[j].Vd(n, i+j)
|
|
return result
|
|
if (i <= n and self.Vs[i].function != 0 and other.Vs[i].function == 0):
|
|
self1 = self.cutVs(i)
|
|
other1 = other.cutVs(i)
|
|
result = self1 + other1
|
|
result.Vs[i] = self.Vs[i]
|
|
return result
|
|
if (i <= n and self.Vs[i].function == 0 and other.Vs[i].function != 0):
|
|
self1 = self.cutVs(i)
|
|
other1 = other.cutVs(i)
|
|
result = self1 + other1
|
|
result.Vs[i] = other.Vs[i]
|
|
return result
|
|
########
|
|
i = 0
|
|
while(i <= n and self.dVs[i].function == 0 and other.dVs[i].function == 0):
|
|
i+=1
|
|
if i<=n:
|
|
#print('b', i)
|
|
if (i <= n and self.dVs[i].function != 0 and other.dVs[i].function != 0):
|
|
self1 = self.cutdVs(i)
|
|
other1 = other.cutdVs(i)
|
|
result = self1 + other1
|
|
self_first = self.dVs[i].teichmuller(n)
|
|
other_first = other.dVs[i].teichmuller(n)
|
|
aux = self_first + other_first
|
|
for j in range(0, n+1 - i):
|
|
result += aux.f[j].dV(n, i+j)
|
|
return result
|
|
if (i <= n and self.dVs[i].function != 0 and other.dVs[i].function == 0):
|
|
self1 = self.cutdVs(i)
|
|
other1 = other.cutdVs(i)
|
|
result = self1 + other1
|
|
result.dVs[i] = self.dVs[i]
|
|
return result
|
|
if (i <= n and self.dVs[i].function == 0 and other.dVs[i].function != 0):
|
|
self1 = self.cutdVs(i)
|
|
other1 = other.cutdVs(i)
|
|
result = self1 + other1
|
|
result.dVs[i] = other.dVs[i]
|
|
return result
|
|
return (0*AS.x).Vd(n)
|
|
|
|
def __rmul__(self, other):
|
|
n = self.n
|
|
AS = self.curve
|
|
|
|
if parent(other) == ZZ or isinstance(other, int):
|
|
if other == 0:
|
|
return as_witt_form((n+1)*[0*AS.x], (n+1)*[0*AS.x])
|
|
if other < 0:
|
|
return -(-other)*self
|
|
return self + (other - 1)*self
|
|
|
|
if isinstance(other, as_witt):
|
|
result = as_witt_form((n+1)*[0*AS.x], (n+1)*[0*AS.x])
|
|
for i in range(0, n+1):
|
|
for j in range(0, n+1):
|
|
result += auxilliary_multiplication(other.f[i], i, self.Vs[j], j, n)
|
|
result += auxilliary_multiplication(other.f[i], i, self.dVs[j], j, n)
|
|
return result
|
|
|
|
def verschiebung(self, i = 1):
|
|
AS = self.curve
|
|
p = AS.base_ring.characteristic()
|
|
n = self.n
|
|
if i == 1:
|
|
result_Vs = [0*AS.x] + self.Vs[1:]
|
|
result_dVs = 2*[0*AS.x] + self.Vs[2:]
|
|
result_dVs = [a^p for a in result_dVs]
|
|
return as_witt_form(result_Vs, result_dVs)
|
|
return self.verschiebung().verschiebung(i = i-1)
|
|
|
|
def cutVs(self, i):
|
|
n = self.n
|
|
AS = self.curve
|
|
result_Vs = self.Vs[:i] + (n+1 - i)*[0*AS.x]
|
|
return as_witt_form(result_Vs, self.dVs)
|
|
|
|
def cutdVs(self, i):
|
|
n = self.n
|
|
AS = self.curve
|
|
result_dVs = self.dVs[:i] + (n+1 - i)*[0*AS.x]
|
|
return as_witt_form(self.Vs, result_dVs) |