Sure, here are some examples of what I did: #First, and example of the bug Ei(20) Output: 25615646.4145 + 6.28318530718*I #it should instead be just 25615646.4145
Ei(19) Output: 9950907.25105 #the error doesn't occur here -exponential_integral_1(-20).n(digits=50) Output: 25615652.664056588 #here the bug doesn't occur, although the code for exponential_integral_1 loses a lot of accuracy by converting the number returned from PARI into a float, so i has much less accuracy -pari(-20).eint1().n(digits = 50) Output: 2.5615652664056588773746625520288944244384765625000e7 #here the full accuracy from PARI is preserved #the following shows the difference in the speed of the two methods #the current implementation %time for i in srange (1,10^6): num = Ei(10) Output: CPU time: 51.64 s, Wall time: 51.81 s #the time of PARI's implementation %time for i in srange (1,10^6): num = pari(-i).eint1() Output: CPU time: 20.12 s, Wall time: 20.32 s #PARI's implementation seems to be more than twice as fast On Dec 15, 8:00 pm, "David Joyner" <wdjoy...@gmail.com> wrote: > Thank you for this bug report. I wonder if you would be kind enough to > include some commented code in an email, so someone can fill out a trac > report for the issue? > > On Mon, Dec 15, 2008 at 7:13 PM, M. Yurko <myu...@gmail.com> wrote: > > > I have noticed recently that when evaluating the EI function at any > > number over 20, it adds 2pi i, which shouldn't be there. After looking > > at the code it appears that it uses scipy, so the error is probably > > there. However, when looking for alternatives, I found the > > exponential_integral_1 from PARI function which doesn't seem to suffer > > from the same issue as scipy. When I did a test using the identity Ei > > (x) = -exponential_integral_1(-x), PARI's implementation was about > > twice as fast as scipy and had a much greater precision. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---