Why does Mathematica give an incorrect answer to this multiple integral?

Why does Mathematica give the wrong answer when integrating?

  • I integrate Integrate[Exp[I Cos[b - c]] Cos[b], {b, 0, 2 Pi}] Mathematica gives: 2 I Pi BesselJ[1, 1] Which is indepedent on $c$. However, the result is NOT independent on $c$. The numerical value of what Mathematica gives is 0. + 2.76492 I while NIntegrate[Exp[I Cos[b - 0.5]] Cos[b], {b, 0, 2 Pi}] Gives 1.16655*10^-10 + 2.42645 I Certainly not the same. If we multiply the value Mathematica gives with $\cos(0.5)$ the result is the same. What is wrong?

  • Answer:

    Looks like a bug that ran off in the development version of Mathematica. In[1]:= Integrate[Exp[I Cos[b - c]] Cos[b], {b, 0, 2 Pi}]//InputForm Out[1]//InputForm= (2*I)*Pi*BesselJ[1, 1]*Cos[c] In[2]:= %/.c->.5 Out[2]= 0. + 2.42645 I

Jonas Teuwen at Mathematica Visit the source

Was this solution helpful to you?

Other answers

This bug appears to have been known for over a year now! https://groups.google.com/forum/?fromgroups#!searchin/comp.soft-sys.math.mathematica/integrate%2420bessel%2420function%2420bug%7Csort%3adate/comp.soft-sys.math.mathematica/ofJh_oRFAB4/TFcbpQsKw3MJ Edit To explain why I consider these bugs to be equivalent, I'll re-write the two integrals using the integration variable x. In the present question, we have $$I_1(c)=\int_0^{2\pi}\exp(i\cos(x-c))\cos x\,dx$$ On the other hand, the MathGroup post I linked here considers the integral $$I_2(c)=\int_{-\pi}^{\pi}\exp(i\cos(x-c))\exp(ix-ic)\,dx$$ where I specialized to the case giving the same Bessel argument in the result. Pulling out the constant factor, using the periodicity of the integrand and making a substitution of variables, one finds $$I_2(c)=e^{-ic}\left[I_1(c)+i\, I_1(c-\frac{\pi}{2})\right]$$ Therefore, if Wolfram fixed the bug in the calculation of $I_2$ but still gets an incorrect result for $I_1$, that fix was itself incorrect. This argument generalizes to integer Bessel indices other than 1 (which is what this question has). Finally, the question is whether it is a bug fix to return the integrals unevaluated. I would argue that because these are such ubiquitous integrals, Mathematica should definitely know what to do with them. But I may not have all the information as to why this bug is so hard to fix... I just wanted to briefly clarify my thinking in case anyone cares.

Jens

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.