# [Maxima] expintegral_ei() bug on convergence

Raymond Toy toy.raymond at gmail.com
Sun Apr 8 01:23:21 CDT 2012

```On 4/7/12 9:20 PM, 本田康晃 wrote:
> Hi Raymond san,
>
> > Yes, this was basically what I had in mind, except the condition
> would have been abs(z) > 1 and,
> > maybe, abs(phase(z)) < 3.1, so that we stay away from the negative axis.
>
> The condition (and (> (abs z) 1) (< (abs (phase z)) (* pi 0.99))) did
> not pass the rtest_expintegral. The condition that passes the
> rtest_expintegral is:
> (and (> (abs z) 2) (< (abs (phase z)) (* pi 0.9)))
How does rtest_expintegral fail for the first case? Accuracy reduced?
>
> If you think this is OK, then I will modify bfloat and frac versions
> of expintegral-e() in a same manner and create a patch for everyone's
> review.
If you think this is the right solution, I think you should just go
ahead. If there's a problem we'll find it. :-) And for those that are
interested, I'm sure they'll look at your patch.
>
> For the z on the negative real axis, I don't know the correct behavior
> of the expintegral_e(). Just I experimented with couple of z values
> such as z=-100, z=-200, z=-300 with expintegral_e(1, z) in Maxima and
> e1(z) in mpmath in Python. They coincide with each other.
Sorry about that. I was just thinking that evaluating the power series
with terms like 200^k would not converge very well, but I didn't check.
And the values are reasonably close to the asymptotic value of
exp(-z)/z, so it looks good. Might be good to add a few test cases for z
= -100 and -200.

Ray

```