I was trying to calculate this integral in Mathematica 9:
2/π Integrate[ Cosh[a x] Cos[n x], {x, 0, π}, Assumptions -> n ∈ Integers]
I got as a result :
$$\frac{2 (a \sinh (\pi a) \cos (\pi n)+n \cosh (\pi a) \sin (\pi n))}{\pi \left(a^2+n^2\right)}$$
That's the same result I obtained manually, but how can I force Mathematica to change $\sin(n \pi)$ into $0$ and $\cos(n \pi)$ into $(-1)^n$ ?
Answer
Thanks to J. M. and Artes, I figured out what the problem was.
I had to change
2/π Integrate[ Cosh[a x] Cos[n x], {x, 0, π}, Assumptions -> n ∈ Integers]
into
Assuming[ n ∈ Integers, 2/π Integrate[ Cosh[a x] Cos[n x], {x, 0, π}]]
or
Simplify[ 2/π Integrate[ Cosh[a x] Cos[n x], {x, 0, π}], n ∈ Integers]
I don't know what's the problem with the first form but still, it works !
Comments
Post a Comment