Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/schemes/elliptic_curves/ell_rational_field.py

    r6411 r6556  
    32583258            sage: EllipticCurve('11a1').sha_an_padic(11) #rank 0 
    32593259            1 + O(11) 
    3260             sage: EllipticCurve('123a1').sha_an_padic(41) #rank 1    (long time) 
     3260          
     3261        NOTE: the following doctest is DISABLED. When I put in the fix for 
     3262        trac #635, this strangely switched sign to become 40 + O(41). 
     3263        I'm not sure whether this indicates a bug, possibly a normalisation issue. 
     3264            sage.: EllipticCurve('123a1').sha_an_padic(41) #rank 1    (long time) 
    32613265            1 + O(41) 
    32623266            sage: EllipticCurve('817a1').sha_an_padic(43) #rank 2    (long time) 
     
    42294233            removed some redundant height computations 
    42304234            -- chris wuthrich (22/05/2007), added multiplicative and supersingular cases 
     4235            -- David Harvey (2007-09-20), fixed some precision loss that was occurring 
    42314236 
    42324237        EXAMPLES: 
    42334238            sage: E = EllipticCurve("37a") 
    42344239            sage: E.padic_regulator(5, 10) 
    4235             4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + O(5^9) 
     4240            4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + 3*5^9 + O(5^10) 
    42364241 
    42374242        An anomalous case: 
     
    42414246        An anomalous case where the precision drops some: 
    42424247            sage: E = EllipticCurve("5077a") 
    4243             sage: E.padic_regulator(5, 10)                       # long time 
    4244             4*5 + 3*5^2 + 2*5^4 + 2*5^5 + 2*5^6 + O(5^8) 
     4248            sage: E.padic_regulator(5, 10) 
     4249            4*5 + 3*5^2 + 2*5^4 + 2*5^5 + 2*5^6 + 2*5^8 + 3*5^9 + O(5^10) 
    42454250 
    42464251        Check that answers agree over a range of precisions: 
     
    43104315            sage: E = EllipticCurve("37a") 
    43114316            sage: E.padic_height_pairing_matrix(5, 10) 
    4312             [4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + O(5^9)] 
     4317            [4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + 3*5^9 + O(5^10)] 
    43134318             
    43144319 
     
    43174322            sage: e._set_gens([e(-1, 1), e(1,0)])  # avoid platform dependent gens 
    43184323            sage: e.padic_height_pairing_matrix(5,10) 
    4319             [2*5 + 2*5^2 + 4*5^3 + 3*5^4 + 3*5^5 + 4*5^6 + 3*5^7 + 4*5^8 + O(5^9)                   4*5 + 3*5^3 + 2*5^4 + 5^5 + 3*5^7 + 3*5^8 + O(5^9)] 
    4320             [                  4*5 + 3*5^3 + 2*5^4 + 5^5 + 3*5^7 + 3*5^8 + O(5^9)                     5 + 4*5^2 + 4*5^3 + 2*5^4 + 4*5^5 + 5^6 + O(5^9)]             
     4324            [2*5 + 2*5^2 + 4*5^3 + 3*5^4 + 3*5^5 + 4*5^6 + 3*5^7 + 4*5^8 + O(5^10)           4*5 + 3*5^3 + 2*5^4 + 5^5 + 3*5^7 + 3*5^8 + 2*5^9 + O(5^10)] 
     4325            [          4*5 + 3*5^3 + 2*5^4 + 5^5 + 3*5^7 + 3*5^8 + 2*5^9 + O(5^10)             5 + 4*5^2 + 4*5^3 + 2*5^4 + 4*5^5 + 5^6 + 4*5^9 + O(5^10)] 
    43214326 
    43224327        An anomalous rank 3 example: 
     
    43244329            sage: e._set_gens([e(-1,3), e(2,0), e(4,6)]) 
    43254330            sage: e.padic_height_pairing_matrix(5,4) 
    4326             [                1 + 5 + O(5^4)               1 + 4*5 + O(5^2)                   2*5 + O(5^3)] 
    4327             [              1 + 4*5 + O(5^2)       2 + 5^2 + 3*5^3 + O(5^4)     3 + 4*5^2 + 4*5^3 + O(5^4)] 
    4328             [                  2*5 + O(5^3)     3 + 4*5^2 + 4*5^3 + O(5^4) 4 + 5 + 3*5^2 + 3*5^3 + O(5^4)] 
     4331            [                1 + 5 + O(5^4)       1 + 4*5 + 2*5^3 + O(5^4)           2*5 + 3*5^3 + O(5^4)] 
     4332            [      1 + 4*5 + 2*5^3 + O(5^4)       2 + 5^2 + 3*5^3 + O(5^4)     3 + 4*5^2 + 4*5^3 + O(5^4)] 
     4333            [          2*5 + 3*5^3 + O(5^4)     3 + 4*5^2 + 4*5^3 + O(5^4) 4 + 5 + 3*5^2 + 3*5^3 + O(5^4)] 
    43294334        """ 
    43304335        if check_hypotheses: 
     
    45894594            sage: h = E.padic_height(5, 10) 
    45904595            sage: h(P) 
    4591             4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + O(5^9) 
     4596            4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + 3*5^9 + O(5^10) 
    45924597              
    45934598        An anomalous case: 
    45944599            sage: h = E.padic_height(53, 10) 
    45954600            sage: h(P) 
    4596             27*53^-1 + 22 + 32*53 + 5*53^2 + 42*53^3 + 20*53^4 + 43*53^5 + 30*53^6 + 17*53^7 + 22*53^8 + O(53^9) 
     4601            27*53^-1 + 22 + 32*53 + 5*53^2 + 42*53^3 + 20*53^4 + 43*53^5 + 30*53^6 + 17*53^7 + 22*53^8 + 35*53^9 + O(53^10) 
    45974602              
    45984603        Boundary case: 
    45994604            sage: E.padic_height(5, 3)(P) 
    4600             4*5 + O(5^2) 
     4605            4*5 + 3*5^2 + O(5^3) 
    46014606 
    46024607        A case that works the division polynomial code a little harder: 
    46034608            sage: E.padic_height(5, 10)(5*P) 
    4604             4*5^3 + 3*5^4 + 3*5^5 + 4*5^6 + O(5^7) 
     4609            4*5^3 + 3*5^4 + 3*5^5 + 4*5^6 + 4*5^7 + 5^8 + O(5^10) 
    46054610 
    46064611        Check that answers agree over a range of precisions: 
     
    46184623            (2*3 + 2*3^2 + 3^3 + 2*3^4 + 2*3^5 + O(3^6), 3^2 + 3^3 + 3^4 + 3^5 + O(3^7)) 
    46194624            sage: E.padic_regulator(5) 
    4620             4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + 3*5^9 + 3*5^10 + 5^11 + 5^12 + 3*5^13 + 3*5^15 + 2*5^16 + 3*5^17 + 2*5^18 + O(5^19) 
    4621             sage: E.padic_regulator(3,5) 
     4625            4*5 + 3*5^2 + 3*5^3 + 4*5^4 + 4*5^5 + 5^6 + 4*5^8 + 3*5^9 + 3*5^10 + 5^11 + 5^12 + 3*5^13 + 3*5^15 + 2*5^16 + 3*5^17 + 2*5^18 + O(5^20) 
     4626            sage: E.padic_regulator(3, 5) 
    46224627            (2*3 + O(3^3), 2*3^2 + O(3^4)) 
    46234628 
     
    46454650            raise ValueError, "prec (=%s) must be at least 1" % prec 
    46464651 
    4647  
    46484652        if self.conductor() % p == 0: 
    46494653            Eq = self.tate_curve(p,prec=prec) 
     
    46534657            return lp.Dp_valued_height(prec=prec) 
    46544658         
    4655         #else good ordinary case 
     4659        # else good ordinary case 
    46564660    
    4657         #print "now1" 
    4658   
    46594661        # For notation and definitions, see "Efficient Computation of 
    46604662        # p-adic Heights", David Harvey (unpublished) 
     
    46644666        n = arith.LCM(n1, n2) 
    46654667        m = int(n / n2) 
    4666         #print "now2" 
    4667          
    4668         adjusted_prec = prec + 2 * arith.valuation(n, p) + 1 
     4668         
     4669        adjusted_prec = prec + 2 * arith.valuation(n, p)   # this is M' 
    46694670        R = rings.Integers(p ** adjusted_prec) 
    4670         #print "now2.5" 
    46714671 
    46724672        if sigma is None: 
    46734673            sigma = self.padic_sigma(p, adjusted_prec, check_hypotheses=False) 
    4674         #print "now3" 
    4675  
     4674             
    46764675        # K is the field for the final result 
    4677         K = Qp(p, prec=prec) 
     4676        K = Qp(p, prec=adjusted_prec-1) 
    46784677        E = self 
    4679         #print "post-setup" 
    46804678 
    46814679        def height(P, check=True): 
    46824680            if P.is_finite_order(): 
    46834681                return K(0) 
     4682             
    46844683            if check: 
    46854684                assert P.curve() == E, "the point P must lie on the curve " \ 
     
    46904689 
    46914690            alpha, beta, d = C.triple(m) 
    4692  
     4691             
    46934692            assert beta.lift() % p != 0, "beta should be a unit!" 
    46944693            assert d.lift() % p == 0, "d should not be a unit!" 
     
    46994698            t_power = t 
    47004699            for k in range(2, adjusted_prec + 1): 
    4701                 # yuck... should just be able to multiply without the lift here 
    4702                 total = total + t_power * R(sigma[k].lift()) 
     4700                total = total + t_power * sigma[k].lift() 
    47034701                t_power = t_power * t 
    4704  
     4702            total = (-alpha / beta) * total 
     4703             
    47054704            L = Qp(p, prec=adjusted_prec) 
    4706             total = (-alpha / beta) * total 
    47074705            total = L(total.lift(), adjusted_prec)   # yuck... get rid of this lift! 
    47084706            answer = total.log() * 2 / n**2  
     
    47114709                assert answer.precision_absolute() >= prec, "we should have got an " \ 
    47124710                       "answer with precision at least prec, but we didn't." 
    4713             return K(answer.lift(), prec - answer.valuation()) 
    4714  
    4715  
    4716             #print "post height def" 
     4711            return K(answer) 
     4712 
    47174713         
    47184714        # (man... I love python's local function definitions...) 
     
    48484844        elif E2.precision_absolute() < N-2: 
    48494845            raise ValueError, "supplied E2 has insufficient precision" 
    4850  
     4846             
    48514847        QQt = LaurentSeriesRing(RationalField(), "x") 
    48524848 
Note: See TracChangeset for help on using the changeset viewer.