Ticket #12509: trac12509-heights2.patch

File trac12509-heights2.patch, 2.9 KB (added by pbruin, 9 years ago)
  • sage/schemes/elliptic_curves/ell_point.py

    # HG changeset patch
    # User Peter Bruin <peter.bruin@math.uzh.ch>
    # Date 1358207832 -3600
    # Node ID fa88a46f7c05080254d3a4a447119a43430a56d2
    # Parent  585188935e75222c1ea0933bd18d5823f334fb31
    #12509: fix two more precision issues
    
    diff --git a/sage/schemes/elliptic_curves/ell_point.py b/sage/schemes/elliptic_curves/ell_point.py
    a b  
    88``EllipticCurvePoint_number_field`` and
    99``EllipticCurvePoint_finite_field`` provide further support for point
    1010on curves defined over number fields (including the rational field
    11 `\QQ`) and over finite fields.  Although there is no special
    12 class for points over `\QQ`, there is currently greater
    13 functionality implemented over `\QQ` than over other number
    14 fields.
     11`\QQ`) and over finite fields.
    1512
    1613The class ``EllipticCurvePoint``, which is based on
    1714``SchemeMorphism_point_projective_ring``, currently has little extra
     
    19631960    A point on an elliptic curve over a number field.
    19641961
    19651962    Most of the functionality is derived from the parent class
    1966     ``EllipticCurvePoint_field``.  In addition we have support for the
    1967     order of a point, and heights (currently only implemented over
    1968     `\QQ`).
     1963    ``EllipticCurvePoint_field``.  In addition we have support for
     1964    orders, heights, reduction modulo primes, and elliptic logarithms.
    19691965
    19701966    EXAMPLES::
    19711967
     
    26612657                Computes [ K_v : Q_v ]
    26622658                """
    26632659                return 2 - int(v.im_gens()[0] in rings.RR)
    2664             return sum(local_degree(v) * self.archimedian_local_height(v, prec) for v in K.places(prec=prec)) / K.degree()
     2660            return sum(local_degree(v) * self.archimedian_local_height(v, prec) for v in K.places()) / K.degree()
    26652661           
    26662662        from sage.rings.number_field.number_field import refine_embedding
    2667         vv = refine_embedding(v) # doubles precision
    26682663        if prec is None:
    2669             prec  = vv.codomain().prec()
     2664            prec  = v.codomain().prec()
     2665        vv = refine_embedding(v, 2*prec)  # prec(vv) = max(2*prec, prec(v))
    26702666        E = self.curve()
    26712667        b2, b4, b6, b8 = [vv(b) for b in E.b_invariants()]
    26722668        H = max(4, abs(b2), 2*abs(b4), 2*abs(b6), abs(b8))
    2673         # The following comes from Silvermn Theorem 4.2.  Silverman
     2669        # The following comes from Silverman Theorem 4.2.  Silverman
    26742670        # uses decimal precision d, so his term (5/3)d =
    26752671        # (5/3)*(log(2)/log(10))*prec = 0.5017*prec, which we round
    26762672        # up.  The rest of the expression was wrongly transcribed in
     
    27192715                    t = w/(z-w)
    27202716                    beta = not beta
    27212717            four_to_n >>= 2
    2722         return rings.RealField(v.codomain().prec())(lam + mu/4)
     2718        return rings.RealField(prec)(lam + mu/4)
    27232719
    27242720    def nonarchimedian_local_height(self, v=None, prec=None, weighted=False, is_minimal=None):
    27252721        """