Ticket #3674: sage-trac3674b.patch

File sage-trac3674b.patch, 2.2 KB (added by cremona, 9 years ago)
  • sage/schemes/elliptic_curves/ell_rational_field.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1216647631 -3600
    # Node ID 88bca48f0c597a44b42e80d32a9fd0cbcd1f1278
    # Parent  60d3d284fd133619eed07a5c5c078549812ef8a1
    trac#3674: added antilogarithm() function as inverse to elliptic_logarithm()
    
    diff -r 60d3d284fd13 -r 88bca48f0c59 sage/schemes/elliptic_curves/ell_rational_field.py
    a b class EllipticCurve_rational_field(Ellip 
    37023702        else:
    37033703            h_gs = max(1, log_g2)
    37043704        return max(R(1),h_j, h_gs)
     3705
     3706    def antilogarithm(self, z, prec=53):
     3707        """The rational point (if any) associated to this complex number
     3708           (inverse of elliptic logarithm)
     3709
     3710           INPUT:
     3711               z -- a complex number representing an element of
     3712               CC/L where L is the period lattice of the elliptic
     3713               curve
     3714
     3715           OUTPUT: The rational point which is the image of z under
     3716               the Weierstrass parametrization, if it exists and can
     3717               be determined from z with default precision
     3718
     3719           ALGORITHM: This uses the function ellztopoint from the pari library
     3720
     3721           WARNING: At present (3.0.4) it is not possible to pass the
     3722           precision parameter to ellztopoint!
     3723           
     3724           EXAMPLES:
     3725           sage: E=EllipticCurve('5077a1')                 
     3726           sage: Pi=E.gens()                               
     3727           sage: Pi
     3728           [(-2 : 3 : 1), (-7/4 : 25/8 : 1), (1 : -1 : 1)]
     3729           sage: zi=[P.elliptic_logarithm(100) for P in Pi]
     3730           sage: Qi = [E.antilogarithm(z) for z in zi]     
     3731           sage: Pi == Qi
     3732           True
     3733
     3734        """
     3735       
     3736        E_pari = self.pari_curve(prec)
     3737        CC = ComplexField(prec)
     3738        try:
     3739            coords = E_pari.ellztopoint(z)
     3740            if len(coords) == 1:
     3741                return self(0)
     3742            return self([CC(xy).real().simplest_rational() for xy in coords])
     3743        except:
     3744            raise ValueError, "No rational point computable from z"
    37053745
    37063746    def integral_points(self, mw_base='auto', both_signs=False):
    37073747        """