#4432: [with patch, needs work] symbolic gamma and factorial
-------------------------+--------------------------------------------------
 Reporter:  whuss        |        Owner:  whuss     
     Type:  enhancement  |       Status:  new       
 Priority:  major        |    Milestone:  sage-3.2.1
Component:  calculus     |   Resolution:            
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by whuss):

 Michael,[[BR]]
 I probably have to read the Mercurial documentation.

 I'm not sure if I measure the performance correctly, but if I do

 {{{
 def f(n):
     s = 0
     for i in xrange(n):
         s += factorial(2^i)
     return s.ndigits()

 def g(n):
     s = 0
     for i in xrange(n):
         s += gamma((1.8)^i)
     return s

 def h(n):
     set_random_seed(0)
     s = 0
     for i in xrange(n):
         s += gamma(random())
     return s

 timeit('f(22)')
 timeit('g(22)')
 timeit('h(10^4)')
 }}}

 I get the following:

 on sage-3.2 without the patch
 {{{
 5 loops, best of 3: 10.9 s per loop
 125 loops, best of 3: 4.16 ms per loop
 5 loops, best of 3: 5.38 s per loop
 }}}

 with trac_4432.patch
 {{{
 5 loops, best of 3: 10.9 s per loop
 125 loops, best of 3: 4.18 ms per loop
 5 loops, best of 3: 1.67 s per loop
 }}}

 with trac_4432.patch + trac_4432-gamma.patch
 {{{
 5 loops, best of 3: 10.9 s per loop
 125 loops, best of 3: 4.17 ms per loop
 5 loops, best of 3: 5.45 s per loop
 }}}

 So trac_4432.patch is much faster for small values of the gamma function
 because we are not computing over the complex numbers.

 Also only with trac_4432.patch
 {{{
 plot(gamma, 1, 4)
 }}}
 works. But this also doesn't work with the current code.

 Greetings,[[BR]]
 Wilfried

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4432#comment:10>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to