bessel_i quadpack bug 5.26.0



On Tue, Feb 28, 2012 at 1:01 PM, Edwin Woollett <woollett at charter.net>wrote:

> Thanks for the discussion of what is happening here.
>

I took a closer look, and it is as I guessed.  quad_qags is working with
%i*bessel_i(1,%i*x) and numerical evaluation of that gives a complex result
with a small imaginary part.  The function maybe-realpart returns nil in
this case, causing quad_qags to think the integrand is bad.


>
> I see the small imaginary parts appearing if I print out
> a table, but why does this only bother the evaluations
> using bessel_i and not the other bessel functions.
>

This could probably be fixed by changing how bessel_i(1,%i*x) is computed.
bessel_i(1,3*%i) has a small real part even though we know it must be
purely imaginary.

For the other bessel functions at %i*x the result is complex, except
bessel_j.  For bessel_j, it looks like we are careful and return a purely
imaginary result.

Or maybe tell maxima that bessel_i(n,%i*x) = bessel_j(n,x).  Maxima doesn't
seem to know that property.  Maybe the simplifier should honor %iargs to do
this transformation.

Ray