#18970: always simplify log(a^m,a) to m for any a,m coercible to Integer
-------------------------------------+-------------------------------------
       Reporter:  rws                |        Owner:
           Type:  defect             |       Status:  needs_info
       Priority:  major              |    Milestone:  sage-6.9
      Component:  symbolics          |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Ralf Stephan       |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/rws/always_simplify_log_a_m_a__to_m_for_any_a_m_coercible_to_integer|  
92d9762ad28880ef81a4781a0eee34b50accc1c6
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by dkrenn):

 * status:  needs_review => needs_info


Comment:

 Before this patch
 {{{
 sage: %timeit log(QQ(8),2)
 The slowest run took 5.08 times longer than the fastest. This could mean
 that an intermediate result is being cached
 10000 loops, best of 3: 39.4 µs per loop
 sage: %timeit log(QQ(8),3)
 10000 loops, best of 3: 38.1 µs per loop
 sage: %timeit log(ZZ(8),3)
 10000 loops, best of 3: 32.8 µs per loop
 sage: %timeit log(ZZ(8),2)
 The slowest run took 14.52 times longer than the fastest. This could mean
 that an intermediate result is being cached
 1000000 loops, best of 3: 1.12 µs per loop
 }}}
 After
 {{{
 sage: %timeit log(QQ(8),3)
 The slowest run took 37.28 times longer than the fastest. This could mean
 that an intermediate result is being cached
 10000 loops, best of 3: 48.8 µs per loop
 sage: %timeit log(QQ(8),2)
 The slowest run took 8.69 times longer than the fastest. This could mean
 that an intermediate result is being cached
 100000 loops, best of 3: 5.43 µs per loop
 sage: %timeit log(ZZ(8),3)
 10000 loops, best of 3: 48.4 µs per loop
 sage: %timeit log(ZZ(8),2)
 The slowest run took 8.80 times longer than the fastest. This could mean
 that an intermediate result is being cached
 100000 loops, best of 3: 5.34 µs per loop
 }}}

 I've repeated (differently) it due to the caching-warnings. Before
 {{{
 sage: timeit('log(QQ(8),3)', number=1, repeat=1)
 1 loops, best of 1: 191 µs per loop
 sage: timeit('log(QQ(8),2)', number=1, repeat=1)
 1 loops, best of 1: 150 µs per loop
 sage: timeit('log(ZZ(8),3)', number=1, repeat=1)
 1 loops, best of 1: 125 µs per loop
 sage: timeit('log(ZZ(8),2)', number=1, repeat=1)
 1 loops, best of 1: 24.1 µs per loop
 }}}
 After
 {{{
 sage: timeit('log(QQ(8),3)', number=1, repeat=1)
 1 loops, best of 1: 1.93 ms per loop
 sage: timeit('log(QQ(8),2)', number=1, repeat=1)
 1 loops, best of 1: 45.1 µs per loop
 sage: timeit('log(ZZ(8),3)', number=1, repeat=1)
 1 loops, best of 1: 158 µs per loop
 sage: timeit('log(ZZ(8),2)', number=1, repeat=1)
 1 loops, best of 1: 45.1 µs per loop
 }}}

 In particular `log(QQ(8),3)` becomes much slower (and only `log(QQ(8),2)`
 gains speed).

--
Ticket URL: <http://trac.sagemath.org/ticket/18970#comment:6>
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