Ticket #7116: trac_7116-miller_functions.patch

File trac_7116-miller_functions.patch, 2.4 KB (added by cremona, 12 years ago)

Applies to 3.1.2.rc0

  • sage/schemes/elliptic_curves/ell_point.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1254687753 -3600
    # Node ID 9489d9ebb6883a572f89b7a1183d0a0e78625846
    # Parent  e334f15125a3faecdecfefc6079a7ba4536955e8
    #7116: miller functions should raise an error when evaluated at O.
    
    diff -r e334f15125a3 -r 9489d9ebb688 sage/schemes/elliptic_curves/ell_point.py
    a b  
    951951
    952952        INPUT:
    953953
    954         - ``R, Q`` -- points on self.curve()
     954        - ``R, Q`` -- points on self.curve() with ``Q`` nonzero.
    955955
    956956        OUTPUT:
    957957
    958         An element of the base field self.curve().base_field()
     958        An element of the base field self.curve().base_field().
     959        A ValueError is raised if ``Q`` is zero.
    959960
    960961        EXAMPLES::
    961962
     
    977978            sage: P._line_(P,Q) == a^4 + a^3 + a^2 + 1
    978979            True
    979980
     981        See trac #7116::
     982           
     983            sage: P._line_ (Q,O)
     984            Traceback (most recent call last):
     985            ...
     986            ValueError: Q must be nonzero.
     987
    980988        ..NOTES: 
    981989
    982990            This function is used in _miller_ algorithm.
     
    985993
    986994        - David Hansen (2009-01-25)
    987995        """
     996        if Q.is_zero():
     997            raise ValueError, "Q must be nonzero."
     998
    988999        if self.is_zero() or R.is_zero():
    9891000            if self == R:
    9901001                return self.curve().base_field().one_element()
     
    10141025
    10151026        INPUT:
    10161027
    1017         - ``Q`` -- a point on self.curve().
     1028        - ``Q`` -- a nonzero point on self.curve().
    10181029
    10191030        - ``n`` -- an integer such that `n*P = n*Q = (0:1:0)` where `P`=self.
    10201031
    10211032        OUTPUT:
    10221033
    10231034        An element in the base field self.curve().base_field()
     1035        A ValueError is raised if ``Q`` is zero.       
    10241036
    10251037        EXAMPLES::
    10261038
     
    10361048            True
    10371049            sage: Qx._miller_(Px,41) == b^13 + b^10 + b^8 + b^7 + b^6 + b^5
    10381050            True
     1051            sage: P._miller_(E(0),41)
     1052            Traceback (most recent call last):
     1053            ...
     1054            ValueError: Q must be nonzero.
    10391055
    10401056        An example of even order::
    10411057
     
    10671083        - David Hansen (2009-01-25)
    10681084
    10691085        """
     1086        if Q.is_zero():
     1087            raise ValueError, "Q must be nonzero."
     1088
    10701089        t = self.curve().base_field().one_element()
    10711090        V = self
    10721091        S = 2*V