# Changeset 5447:cd60620ddfe5

Ignore:
Timestamp:
06/05/07 01:49:06 (6 years ago)
Branch:
default
Children:
5448:a711eb87b846, 5449:bb432d7a85b0
Message:

Fixes to left multiplication and coercion of 0 in Jacobians and point sets.

Location:
sage/schemes
Files:
4 edited

Unmodified
Removed
• ## sage/schemes/generic/scheme.py

 r4852 """ raise NotImplementedError def __call__(self, *args):
• ## sage/schemes/hyperelliptic_curves/jacobian_generic.py

 r4851 class HyperellipticJacobian_generic(Jacobian_generic): def __call__(self, *args, **kwds): """ EXAMPLES: sage: FF = FiniteField(2003) sage: R. = PolynomialRing(FF) sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 sage: C = HyperellipticCurve(f) sage: J = Jacobian(C) sage: a = x**2 + 376*x + 245; b = 1015*x + 1368 sage: X = J(FF) sage: D = X([a,b]) sage: D (x^2 + 376*x + 245, y + 988*x + 635) sage: J(0) (1) sage: D == J([a,b]) True sage: D == D + J(0) True """ if len(args) == 1: if is_Ring(args[0]): return jacobian_homset.JacobianHomset_divisor_classes(self, args[0]) return jacobian_homset.JacobianHomset_divisor_classes(self, self.base_ring())(args[0]) raise TypeError, "Arguments must be a coefficient ring or Mumford divisor." """ EXAMPLES: sage: FF = FiniteField(2003) sage: R. = PolynomialRing(FF) sage: f = x**5 + 1184*x**3 + 1846*x**2 + 956*x + 560 sage: C = HyperellipticCurve(f) sage: J = C.jacobian() sage: a = x**2 + 376*x + 245; b = 1015*x + 1368 sage: X = J(FF) sage: D = X([a,b]) sage: D (x^2 + 376*x + 245, y + 988*x + 635) sage: J(0) (1) sage: D == J([a,b]) True sage: D == D + J(0) True An more extended example, demonstrating arithmetic in J(QQ) and J(K) for a number field K/QQ. sage: P. = PolynomialRing(QQ) sage: f = x^5 - x + 1; h = x sage: C = HyperellipticCurve(f,h,'u,v') sage: C Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: PP = C.ambient_space() sage: PP Projective Space of dimension 2 over Rational Field sage: C.defining_polynomial() -x0^5 + x0*x1*x2^3 + x1^2*x2^3 + x0*x2^4 - x2^5 sage: C(QQ) Set of Rational Points of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: K. = NumberField(x^2-2) sage: C(K) Set of Rational Points over Number Field in t with defining polynomial x^2 - 2 of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: P = C(QQ)(0,1,1); P (0 : 1 : 1) sage: P == C(0,1,1) True sage: C(0,1,1).parent() Set of Rational Points of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: P1 = C(K)(P) sage: P2 = C(K)([2,4*t-1,1]) sage: P3 = C(K)([-1/2,1/8*(7*t+2),1]) sage: P1, P2, P3 ((0 : 1 : 1), (2 : 4*t - 1 : 1), (-1/2 : 7/8*t + 1/4 : 1)) sage: J = C.jacobian() sage: J Jacobian of Hyperelliptic Curve over Rational Field defined by v^2 + u*v = u^5 - u + 1 sage: Q = J(QQ)(P); Q (u, v + -1) sage: for i in range(6): Q*i (1) (u, v + -1) (u^2, v + u - 1) (u^2, v + 1) (u, v + 1) (1) sage: Q1 = J(K)(P1); print "%s -> %s"%( P1, Q1 ) (0 : 1 : 1) -> (u, v + -1) sage: Q2 = J(K)(P2); print "%s -> %s"%( P2, Q2 ) (2 : 4*t - 1 : 1) -> (u + -2, v + -4*t + 1) sage: Q3 = J(K)(P3); print "%s -> %s"%( P3, Q3 ) (-1/2 : 7/8*t + 1/4 : 1) -> (u + 1/2, v + -7/8*t - 1/4) sage: R. = PolynomialRing(K) sage: Q4 = J(K)([x^2-t,R(1)]) sage: for i in range(4): Q4*i (1) (u^2 + -t, v + -1) (u^2 + (-3/4*t - 9/16)*u + 1/2*t + 1/4, v + (-1/32*t - 57/64)*u + 1/2*t + 9/16) (u^2 + (1352416/247009*t - 1636930/247009)*u + -1156544/247009*t + 1900544/247009, v + (-2326345442/122763473*t + 3233153137/122763473)*u + 2439343104/122763473*t - 3350862929/122763473) sage: R2 = Q2*5; R2 (u^2 + (-3789465233/116983808)*u + -267915823/58491904, v + (-233827256513849/1789384327168*t + 1/2)*u + -15782925357447/894692163584*t) sage: R3 = Q3*5; R3 (u^2 + 5663300808399913890623/14426454798950909645952*u + -26531814176395676231273/28852909597901819291904, v + (253155440321645614070860868199103/2450498420175733688903836378159104*t + 1/2)*u + 2427708505064902611513563431764311/4900996840351467377807672756318208*t) sage: R4 = Q4*5; R4 (u^2 + (-3789465233/116983808)*u + -267915823/58491904, v + (233827256513849/1789384327168*t + 1/2)*u + 15782925357447/894692163584*t) sage: # Thus we find the following identity: sage: 5*Q2 + 5*Q4 (1) sage: # Moreover the following relation holds in the 5-torsion subgroup: sage: Q2 + Q4 == 2*Q1 True """ def dimension(self): return self.__curve.genus() def point(self, mumford, check=True): try: return jacobian_homset.JacobianHomset_divisor_classes(self, self.base_ring())(mumford) except AttributeError: raise ValueError, "Arguments must determine a valid Mumford divisor." def _homset_class(self, *args, **kwds):
• ## sage/schemes/hyperelliptic_curves/jacobian_homset.py

 r4851 import sage.schemes.generic.spec as spec from sage.rings.all import is_Polynomial, PolynomialRing, ZZ from sage.rings.all import is_Polynomial, PolynomialRing, Integer, ZZ from sage.schemes.generic.homset import SchemeHomset_generic from sage.schemes.generic.morphism import is_SchemeMorphism sage: J = C.jacobian() sage: Q = J(QQ)(P) sage: for i in range(6): Q*i sage: for i in range(6): i*Q (1) (u, v + -1) (1) """ if P == 0: if isinstance(P,(int,long,Integer)) and P == 0: R = PolynomialRing(self.value_ring(), 'x') return JacobianMorphism_divisor_class_field(self, (R(1),R(0))) elif isinstance(P,(list,tuple)): if len(P) == 1 and P[0] == 0: R = PolynomialRing(self.value_ring(), 'x') return JacobianMorphism_divisor_class_field(self, (R(1),R(0))) elif len(P) == 2: P1 = P[0]; P2 = P[1] if is_Polynomial(P1) and is_Polynomial(P2): return JacobianMorphism_divisor_class_field(self, P) if is_SchemeMorphism(P1) and is_SchemeMorphism(P2): return self(P1) - self(P2) raise TypeError, "Argument P (= %s) must have length 2."%P elif isinstance(P,JacobianMorphism_divisor_class_field) and self == P.parent(): return P elif isinstance(P,(list,tuple)): if len(P) != 2: raise TypeError, "Argument P (= %s) must have length 2"%P P1 = P[0]; P2 = P[1] if is_Polynomial(P1) and is_Polynomial(P2): return JacobianMorphism_divisor_class_field(self, P) if is_SchemeMorphism(P1) and is_SchemeMorphism(P2): return self(P1) - self(P2) elif is_SchemeMorphism(P): x0 = P[0]; y0 = P[1]
• ## sage/schemes/hyperelliptic_curves/jacobian_morphism.py

 r4851 return "(%s, %s)"%(a(x), y - b(x)) def scheme(self): return self.codomain() def list(self): return self.__polys D = cantor_composition(self.__polys,other.__polys,f,h,C.genus()) return JacobianMorphism_divisor_class_field(X, D, reduce=False, check=False) def __cmp__(self, other): if not isinstance(other, JacobianMorphism_divisor_class_field): try: other = self.parent()(other) except TypeError: return -1 return cmp(self.__polys, other.__polys) def __nonzero__(self): return self.__polys[0] != 1 def __sub__(self, other): X = self.parent() if n < 0: return self * (-n) return - self * (-n) elif n == 0: return self.parent()(0) elif n == 1: return self D = self.__mul__(n//2) elif n < 4: D = self else: D = self.__mul__(n//2) if n % 2 == 0: return D + D return D + D + self def __nonzero__(self): return self.__polys[0] != 1 def _rmul_(self, n): return self.__mul__(n) def scheme(self): return self.codomain()
Note: See TracChangeset for help on using the changeset viewer.