#2019 defint(exp(cos(x))*cos(sin(x)),x,0,2*%pi) wrong result 0


The correct result is 2*%pi. This is a new bug appearing in version 5.21.1. Previous
versions (<= 5.20.1 ) return just the integral expression unevaluated, which is fair enough, but
most importantly is not a wrong result.

Maxima version: 5.21.1
Maxima build date: 8:13 4/26/2010
Host type: i686-pc-mingw32 also on linux system (fedora11)
Lisp implementation type: GNU Common Lisp (GCL) also with cmucl
Lisp implementation version: GCL 2.6.8 also with cmucl 19f


  • Raymond Toy
    Raymond Toy

    This particular integral is evaluated by computing the antiderivative. Perhaps in earlier versions, maxima could not, but maxima can now. So integrate(exp(cos(x))*cos(sin(x)),x) returns:


    Somehow this doesn't look right. Don't know if this is the correct antiderivative or not, but that's how maxima gets zero for the answer. At x=0, the result is zero, and by periodicity x=2*%pi is also zero. The wrong branch cut is taken, assuming the antiderivative is correct.

  • Dieter Kaiser
    Dieter Kaiser

    We get a more simple result when expanding the function gamma_incomplete:

    (%i3) integrate(exp(cos(x))*cos(sin(x)),x),gamma_expand:true;
    (%o3) -(%i*expintegral_ei(%e^(%i*x))-%i*expintegral_ei(%e^-(%i*x)))/2

    I think this result is correct, as a reference I have compared the result with wolfram alpha.

    But nevertheless, the definite integral is wrong and I am wondering why the conjugate function is introduced in the unsimplified result.

    Dieter Kaiser

  • Raymond Toy
    Raymond Toy

    Expanding does produce a better answer. The derivative does equal the integrand.

    Plotting realpart(%o3 )shows a discontinuity near %pi. (Perhaps it's a bug, but plot2d(%o3,[x,0,%pi]) produces a warning that a non-numeric value occurs somewhere. It seems as if it occurs everywhere except at 0.)

  • Dan Gildea
    Dan Gildea

    Fixed in defint.lisp rev 1.81: give up when we see %gamma_incomplete
    in limit-subs, due to discontinuities. This integral now returns a noun
    form. Ideally the code would identify the discontinuities and handle them.

  • Dan Gildea
    Dan Gildea

    • status: open --> pending
    • status: pending --> closed
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).