39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
class as_cech:
|
|
def __init__(self, C, omega, f):
|
|
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.omega0 = omega
|
|
self.f = f
|
|
|
|
def __repr__(self):
|
|
return "( " + str(self.omega0)+", " + str(self.f) + " )"
|
|
|
|
def __add__(self, other):
|
|
C = self.curve
|
|
omega = self.omega0
|
|
f = self.f
|
|
omega1 = other.omega0
|
|
f1 = other.f
|
|
return as_cech(C, omega + omega1, f+f1)
|
|
|
|
def __sub__(self, other):
|
|
C = self.curve
|
|
omega = self.omega0
|
|
f = self.f
|
|
omega1 = other.omega0
|
|
f1 = other.f
|
|
return as_cech(C, omega - omega1, f - f1)
|
|
|
|
def __rmul__(self, constant):
|
|
C = self.curve
|
|
omega = self.omega0
|
|
f = self.f
|
|
return as_form(C, constant*omega, constant*f) |