#9903: is_prime should document proof flag
-------------------------------------+-------------------------------------
       Reporter:  dmharvey           |        Owner:  mvngu
           Type:  defect             |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.7
      Component:  documentation      |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Marc Mezzarobba    |    Reviewers:  Vincent Delecroix
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/mmezzarobba/9903-is_prime        |  5822cdfa0b5cd237aa7261b5d1777964d7c55501
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vbraun):

 * status:  positive_review => needs_work


Comment:

 {{{
  sage -t --long src/sage/sets/set_from_iterator.py
  **********************************************************************
  File "src/sage/sets/set_from_iterator.py", line 443, in
  sage.sets.set_from_iterator.Decorator._sage_doc_
  Failed example:
      print sage_getdoc(d)   # indirect doctest
  Expected:
         Test whether "self" is prime.
      ...
         IMPLEMENTATION: Calls the PARI "isprime" function.
      <BLANKLINE>
  Got:
         Test whether "self" is prime.
      <BLANKLINE>
         INPUT:
      <BLANKLINE>
         * "proof" -- Boolean or "None" (default). If False, use a strong
           pseudo-primality test (see "is_pseudoprime()"). If True, use a
           provable primality test.  If unset, use the "default arithmetic
           proof flag".
      <BLANKLINE>
         Note: Integer primes are by definition *positive*! This is
           different than Magma, but the same as in PARI. See also the
           "is_irreducible()" method.
      <BLANKLINE>
         EXAMPLES:
      <BLANKLINE>
            sage: z = 2^31 - 1
            sage: z.is_prime()
            True
            sage: z = 2^31
            sage: z.is_prime()
            False
            sage: z = 7
            sage: z.is_prime()
            True
            sage: z = -7
            sage: z.is_prime()
            False
            sage: z.is_irreducible()
            True
      <BLANKLINE>
            sage: z = 10^80 + 129
            sage: z.is_prime(proof=False)
            True
            sage: z.is_prime(proof=True)
            True
      <BLANKLINE>
         When starting Sage the arithmetic proof flag is True. We can
 change
         it to False as follows:
      <BLANKLINE>
            sage: proof.arithmetic()
            True
            sage: n = 10^100 + 267
            sage: timeit("n.is_prime()")  # not tested
            5 loops, best of 3: 163 ms per loop
            sage: proof.arithmetic(False)
            sage: proof.arithmetic()
            False
            sage: timeit("n.is_prime()")  # not tested
            1000 loops, best of 3: 573 us per loop
      <BLANKLINE>
         ALGORITHM:
      <BLANKLINE>
         Calls the PARI "isprime" function.
      <BLANKLINE>
  **********************************************************************
  1 item had failures:
     1 of   6 in sage.sets.set_from_iterator.Decorator._sage_doc_
      [213 tests, 1 failure, 4.14 s]
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/9903#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to