def from_weierstrass_map(self): """ Returns a morphism from the associated elliptic curve on Weierstrass form to this Edwards curve. """ P2 = ProjectiveSpace(2, self.__base_ring, names='xyz') x, y, z = P2.coordinate_ring().gens() a, d = self.ainvs() E = self.associated_ec() C = P2.subscheme(a * x**2 * z**2 + y**2 * z**2 - z**4 - d * x**2 * y**2) f = WeierstrassTransformation( E, C, [ 2 * x * (x + (a - d) * z), # <-- x (x - (a - d) * z) * y, # <-- y y * (x + (a - d) * z) # <-- z ], 1) return f
def to_weierstrass_map(self): """ Returns a morphism from this Edwards curve to the associated elliptic curve on Weierstrass form. """ P2 = ProjectiveSpace(2, self.__base_ring, names='xyz') x, y, z = P2.coordinate_ring().gens() a, d = self.ainvs() E = self.associated_ec() C = P2.subscheme(a * x**2 * z**2 + y**2 * z**2 - z**4 - d * x**2 * y**2) f = WeierstrassTransformation( C, E, [ (a - d) * (z + y) * x, # <-- x (a - d) * 2 * (z**2 + y * z), # <-- y z * x * (z - y) # <-- z ], 1) return f
def Jacobian_of_equation(polynomial, variables=None, curve=None): r""" Construct the Jacobian of a genus-one curve given by a polynomial. INPUT: - ``F`` -- a polynomial defining a plane curve of genus one. May be homogeneous or inhomogeneous. - ``variables`` -- list of two or three variables or ``None`` (default). The inhomogeneous or homogeneous coordinates. By default, all variables in the polynomial are used. - ``curve`` -- the genus-one curve defined by ``polynomial`` or # ``None`` (default). If specified, suitable morphism from the jacobian elliptic curve to the curve is returned. OUTPUT: An elliptic curve in short Weierstrass form isomorphic to the curve ``polynomial=0``. If the optional argument ``curve`` is specified, a rational multicover from the Jacobian elliptic curve to the genus-one curve is returned. EXAMPLES:: sage: R.<a,b,c> = QQ[] sage: f = a^3+b^3+60*c^3 sage: Jacobian(f) Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field sage: Jacobian(f.subs(c=1)) Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field If we specify the domain curve the birational covering is returned:: sage: h = Jacobian(f, curve=Curve(f)); h Scheme morphism: From: Projective Plane Curve over Rational Field defined by a^3 + b^3 + 60*c^3 To: Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field Defn: Defined on coordinates by sending (a : b : c) to (-216000*a^4*b^4*c - 12960000*a^4*b*c^4 - 12960000*a*b^4*c^4 : 108000*a^6*b^3 - 108000*a^3*b^6 - 6480000*a^6*c^3 + 6480000*b^6*c^3 + 388800000*a^3*c^6 - 388800000*b^3*c^6 : 216000*a^3*b^3*c^3) sage: h([1,-1,0]) (0 : 1 : 0) Plugging in the polynomials defining `h` allows us to verify that it is indeed a rational morphism to the elliptic curve:: sage: E = h.codomain() sage: E.defining_polynomial()(h.defining_polynomials()).factor() (2519424000000000) * c^3 * b^3 * a^3 * (a^3 + b^3 + 60*c^3) * (a^9*b^6 + a^6*b^9 - 120*a^9*b^3*c^3 + 900*a^6*b^6*c^3 - 120*a^3*b^9*c^3 + 3600*a^9*c^6 + 54000*a^6*b^3*c^6 + 54000*a^3*b^6*c^6 + 3600*b^9*c^6 + 216000*a^6*c^9 - 432000*a^3*b^3*c^9 + 216000*b^6*c^9) By specifying the variables, we can also construct an elliptic curve over a polynomial ring:: sage: R.<u,v,t> = QQ[] sage: Jacobian(u^3+v^3+t, variables=[u,v]) Elliptic Curve defined by y^2 = x^3 + (-27/4*t^2) over Multivariate Polynomial Ring in u, v, t over Rational Field TESTS:: sage: from sage.schemes.elliptic_curves.jacobian import Jacobian_of_equation sage: Jacobian_of_equation(f, variables=[a,b,c]) Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field """ from sage.schemes.toric.weierstrass import WeierstrassForm f, g = WeierstrassForm(polynomial, variables=variables) try: K = polynomial.base_ring() f = K(f) g = K(g) except (TypeError, ValueError): pass E = EllipticCurve([f, g]) if curve is None: return E X, Y, Z = WeierstrassForm(polynomial, variables=variables, transformation=True) from sage.schemes.elliptic_curves.weierstrass_transform import WeierstrassTransformation return WeierstrassTransformation(curve, E, [X*Z, Y, Z**3], 1)