Summation bug in 11.2
The problem is not with Sum
:
FourierCoefficient[Cos[x], x, -k]
(* 0 *)
FourierCoefficient[Cos[x], x, k]
The second code is also much faster. It suggests to me that FourierCoefficient
calls Integrate
in the first case and uses a short-cut in the second. In fact Integrate
(from a Trace
of FourierCoefficient
) gives a result that is only generically correct:
Integrate[E^(I k x) Cos[x], {x, -π, π},
Assumptions -> k ∈ Integers, GenerateConditions -> False]
(* -((2 k Sin[k π])/(-1 + k^2)) *)
This is not an answer as why it happens. But the change happened after version 7.
I went back to verion 7 to be able to obtain different result. I tried versions 11, 10, 9, and 8 and they all gave same result as above. But in version 7: