Exp[I x] vs. Cos[x] + I Sin[x] in Integrate

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg2035] Exp[I x] vs. Cos[x] + I Sin[x] in Integrate*From*: "Brian J. Albright" <albright at physics.ucla.edu>*Date*: Sat, 16 Sep 1995 01:41:10 -0400*Organization*: UCLA Department of Physics and Astronomy

Greetings. A friend of mine and I have recently run into some apparent peculiarities with the MMa Integrate function. If we enter the following In[1]:= Integrate[ Exp[I x] / (2 + Sin[x]), {x,0,2 Pi}] then we get Out[1]:= 0 Unfortunately, this is not the right answer. The correct answer, obtainable through contour integration, is 2 Pi I (1 - 2/Sqrt[3]). Interestingly, if we rewrite the integrand, changing "Exp[I x]" into "Cos[x] + I Sin[x]": In[2]:= Integrate[ (Cos[x] + I Sin[x]) / (2 + Sin[x]), {x,0,2 Pi}] then we get 4 I Pi Out[2]:= 2 I Pi - ------- Sqrt[3] which matches our paper-and-pencil result. Does anyone know why MMa gives different answers for the two? Thanks in advance. -Brian ps. Incidentally, if I write the "Sin[x]" in In[1] as "(Exp[I x] - Exp[-I x]) / (2 I)", I get In[3]:= Integrate[ Exp[I x] / (2 + (Exp[I x] - Exp[-I x])/(2 I) ), {x,0,2 Pi}] Out[3]:= 0 Also, if I use NIntegrate rather than Integrate, I get In[4]:= Chop[ NIntegrate[ Exp[I x] / (2 + Sin[x]), {x,0,2 Pi}] ] Out[4]:= -0.972012 I compare with In[5]:= Out[2]//N Out[5]:= -0.972012 -- Brian J. Albright | Department of Physics and Astronomy, UCLA | To err is human... albright at physics.ucla.edu | to err really big http://bohm.physics.ucla.edu/~albright | is government.