#4807: bug in exponential integral
----------------------+-----------------------------------------------------
 Reporter:  wdj       |       Owner:  burcin  
     Type:  defect    |      Status:  new     
 Priority:  major     |   Milestone:  sage-3.3
Component:  calculus  |    Keywords:          
----------------------+-----------------------------------------------------
 This was reported by M. Yurko in an email to sage-support:

 here are some examples of what I did:
 #First, an 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 it 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

 William Stein added this:

 A quick remark: The Pari Ei only works with *real* input, whereas the
 scipy one works with complex input.
 The Sage function will have to fixed in the meantime or
 at least as a bare minimum have a big comment at the top explaining that
 there is a bug.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4807>
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