Trouble with Mathematica Integration and using Assumptions

Hi All,

I am having trouble here getting Mathematica to Integrate a simple function where inside the cosine function, n is just a simple integer.

Here is what I have tried.

Integrate[Exp[a*x]*Cos[n*x], {x, -\[Pi], \[Pi]}, Assumptions -> n \[Element] Integers]

and I get out

(2 (n Cosh[a \[Pi]] Sin[n \[Pi]] + a Cos[n \[Pi]] Sinh[a \[Pi]]))/(a^2 + n^2)

But since n is an integer, the Sin(n [Pi]) term should be zero but for some reason I cannot get Mathematica to go there. It is like it is ignoring the Assumption that n are Integers.

Anyone know what I am doing wrong? Thanks in advance :slight_smile:

Try

FullSimplify[
 Integrate[Exp[a x] Cos[n*x], {x, -\[Pi], \[Pi]}, 
  Assumptions -> n \[Element] Integers], n \[Element] Integers]

That did the trick. Thanks so much.

Yes, it fixes it, but I would have expected the Assumptions inside of Integrate to have taken care of it too… I think though that the assumptions did not limit Integrate from getting a correct answer: the answer is not restricted in this case by the n \[Element] Integers assumption and hence is correct.