#2286 imagpart of bessel_i and bessel_k

closed
nobody
5
2011-10-24
2011-10-23
Ted Woollett
No

There is a bug in imagpart. imagpart(bessel_i(1,%i*x)) should
be -%i*bessel_i(1,%i*x), but imagpart is >returning bessel_i(1,%i*x).
If this simplification is not immediately made, then the numerical
work should automatically enforce that the result is
a real number.
One way this bug shows up is the noun form returned in:
(%i6) quad_qag(imagpart(bessel_i(1,%i*x)),x,1,3,3,limit=700);
(%o6) quad_qag(bessel_i(1,%i*x),x,1,3,3,epsrel = 1.0E-8,epsabs = 0.0,
limit = 700)

Discussion

  • Dieter Kaiser
    Dieter Kaiser
    2011-10-24

    This bug has been fixed in bessel.lisp revision 23.10.2011.

    (%i1) imagpart(bessel_i(1,%i*x));
    (%o1) -%i*bessel_i(1,%i*x)

    Nevertheless, the reported example is not solved:

    (%i2) quad_qag(imagpart(bessel_i(1,%i*x)),x,1,3,3,limit=700);
    (%o2) quad_qag(-%i*bessel_i(1,%i*x),x,1,3,3,epsrel = 1.e-8,epsabs = 0.0,
    limit = 700)

    The reason is a small imaginary part because of rounding errors:

    (%i3) imagpart(bessel_i(1,%i));
    (%o3) -%i*bessel_i(1,%i)
    (%i4) rectform(%),numer;
    (%o4) .4400505857449336-2.694443716532522e-17*%i

    For other Bessel functions Maxima knows pure real or imaginary results and cuts off the rounding errors accordingly. This can be added for the bessel_i function too.

    Dieter Kaiser

     
  • Dieter Kaiser
    Dieter Kaiser
    2011-10-24

    • status: open --> closed