Thank you for responses. It seems that the best solution would be to use pari in the way that Dr. Stein said earlier.
Again, I'm new to the development process and would like to contribute to sage. Should I submit a ticket and write my own patch and submit it now? I'm not sure how development should follow. Should I have submitted a ticket and not even posted this question in sage-devel? Or should you discuss it first here and then submit a ticket? Thanks, Rick On Tuesday, February 11, 2014 9:57:04 PM UTC-5, ref...@uncg.edu wrote: > > Dear All, > > I was developing an algorithm that depended on the calculation of the > gamma function. I noticed that the algorithm was surprisingly slow. Upon > investigation, I realized that the issue lies with the gamma function. To > illustrate: > > sage: RR = RealField(1000) > sage: CC = ComplexField(1000) > sage: %timeit RR(-3.52).gamma() > 100 loops, best of 3: 3.58 ms per loop > sage: %timeit CC(-3.52).gamma() > 1000 loops, best of 3: 538 us per loop > > This surprised me. I figured it was because of the high precision, but > the next example shows it isn't. > > sage: RR > Real Field with 53 bits of precision > sage: CC > Complex Field with 53 bits of precision > sage: %timeit RR(-3.52).gamma() > 10000 loops, best of 3: 136 us per loop > sage: %timeit CC(-3.52).gamma() > 10000 loops, best of 3: 77.9 us per loop > > After some investigation, the reason lies in the fact that version RR > version gamma uses mpfr directly to compute gamma. On the other hand, the > CC version of gamma uses pari to compute the gamma function. Is there a > reason for this that I'm not seeing? > > I'm new to development, so I'm not sure if I should have posted this > question here. Should I have submitted a ticket first? > > Thanks, > > Rick > > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.