Ticket #3674: sage-trac3674new-extra4.patch

File sage-trac3674new-extra4.patch, 2.9 kB (added by cremona, 3 months ago)
  • a/sage/schemes/elliptic_curves/ell_rational_field.py

    old new  
    37873787            set([2, 3, 4]) 
    37883788            starting search of remaining points using coefficient bound  6 
    37893789            x-coords of extra integral points: 
    3790             set([2, 3, 4, 37, 8, 342, 11, 14, 816, 52, 21, 406, 93]) 
     3790            set([2, 3, 4, 37, 406, 8, 11, 14, 816, 52, 21, 342, 93]) 
    37913791            Total number of integral points: 18 
    37923792 
    37933793        It is also possible to not specify mw_base, but then the 
     
    38993899                    xP = P[0] 
    39003900                    if xP.is_integral(): 
    39013901                        xs.add(xP) 
    3902                          
     3902                        
    39033903            def use_t(R): 
    39043904                """ 
    39053905                Helper function to record x-coords of a point +torsion if integral. 
     
    39193919            # rational points if they are approximately integral 
    39203920 
    39213921            def is_approx_integral(P): 
    3922                 return (abs(P[0]-P[0].round()))<0.001 and (abs(P[1]-P[1].round()))<0.001 
     3922                return (abs(P[0]-P[0].round()))<0.1 #one case was 0.09, so 0.001 was too small 
    39233923             
    39243924            RR = RealField() #(100) 
    39253925            ER = self.change_ring(RR) 
     
    39273927            for i in range(r): 
    39283928                if abs(Rgens[i][1]-mw_base[i][1])>abs((-Rgens[i])[1]-mw_base[i][1]): 
    39293929                    Rgens[i] = -Rgens[i] 
    3930             for ni in cartesian_product_iterator([range(-N,N+1) for i in range(r-1)]+[range(N+1)]): 
     3930            #for ni in cartesian_product_iterator([range(-N,N+1) for i in range(r-1)]+[range(N+1)]): ##opt1 
     3931            for mi in range(ceil(((2*H_q+1)**r)/2)): ##opt2 
     3932                ni = Z(mi).digits(base=2*H_q+1, padto=r, digits=range(-H_q, H_q+1)) ##opt2 
    39313933                RP=sum([ni[i]*Rgens[i] for i in range(r)],ER(0)) 
    39323934                for T in tors_points: 
    39333935                    if is_approx_integral(RP+ER(T)): 
     
    40944096            m = M.identity_matrix() 
    40954097            for i in range(r): 
    40964098                m[i, r] = R(c*mw_base_log[i]).round() 
    4097             m[r,r] = max(1,R(c*w1).round()) #ensures that m isn't singular 
     4099            m[r,r] = max(Z(1),R(c*w1).round()) #ensures that m isn't singular 
    40984100     
    40994101            #LLL - implemented in sage - operates on rows not on columns  
    41004102            m_LLL = m.LLL()