expintegral_ei() bug on convergence



2012/4/5 ???? <yasuaki.honda at gmail.com>

> Hi Raymond san, all,
>
> I am looking at the expintegral.lisp line 534 where the continued fraction
> or power series
> is chosen.
>
> According to DLMF Section 6.18 (http://dlmf.nist.gov/6.18 which is an
> updated publication of A&S),
>
> "For small or moderate values of x and z, the expansion in power series
> (?6.6) or in series of spherical Bessel functions (?6.10(ii)) can be used.
> ....
> Lastly, the continued fraction (6.9.1) can be used if z is
> bounded away from the origin. Convergence becomes slow when z is near the
> negative real axis, however."
>
> So, I would like to propose:
> if z is close to origin or z is close to the negative real axis, we expand
> in power series,
> otherwise, we expand in continued fraction. The actual patch comes below.
>

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.

This fixes your immediate problem, I think, but we are still left with the
issue of what do we do if we want expintegral_e on the negative axis.  I
haven't figured that out yet....

Ray