# Fourier Cos coefficient vs Integrate vs common sense

I was trying to find out what the (discrete) Fourier transformation of the following function is $$f(\nu, u) = \frac{\sinh \nu}{\cosh \nu - \cos u}$$

So at first, I tried to evaluate a fancy MMA function FourierCoefficient

FourierCoefficient[Sinh[ν]/(Cosh[ν] - Cos[u]), u, n,
Assumptions -> {ν > 0, Element[n, Integers]}]


to no avail, as the computation never ended.

Then I realized that the function has only cos components, as sin are trivially zero. So I tried to evaluate

FourierCosCoefficient[Sinh[ν]/(Cosh[ν] - Cos[u]), u, n,
Assumptions -> {ν > 0, Element[n, Integers]}]


which led to some pretty nasty expression

1/((-1 + E^(2 ν)) (-1 + n) π) 2 I (1 + (-1)^n - E^(
2 ν) + (-1)^(1 + n) E^(2 ν) + (-1)^(1 + n)
Hypergeometric2F1[1, 1 - n, 2 - n, -E^-ν] -
Hypergeometric2F1[1, 1 - n, 2 - n, E^-ν] + (-1)^n E^(2 ν)
Hypergeometric2F1[1, 1 - n, 2 - n, -E^ν] +
E^(2 ν) Hypergeometric2F1[1, 1 - n, 2 - n, E^ν] + (-1)^
n E^(2 ν) Hypergeometric2F1[1, -1 + n, n, -E^-ν] +
E^(2 ν) Hypergeometric2F1[1, -1 + n, n, E^-ν] + (-1)^(
1 + n) Hypergeometric2F1[1, -1 + n, n, -E^ν] -
Hypergeometric2F1[1, -1 + n, n, E^ν]) Sinh[ν]


Moreover, this mess never evaluated if n was integer

%/.n->1
Power::infy: Infinite expression 1/0 encountered.
%/.n->2
Infinity::indet: Indeterminate expression 2-E^(2 ν)-E^(2 ν)+ComplexInfinity+ComplexInfinity+ComplexInfinity+ComplexInfinity-E^(3 ν) Log[1-E^-ν]+E^(3 ν) Log[1+E^-ν]+E^-ν Log[1-E^ν]-E^-ν Log[1+E^ν] encountered.


So I got mad and rewrote the integral from the definition

1/(2 π)
Integrate[(Sinh[ν])/(Cosh[ν] - Cos[u]) Cos[n u], {u, 0,
2 π}, Assumptions -> {ν > 0, Element[n, Integers]}]


which returned the same result as the cos coefficient function.

So I got really mad and just did it "by hand" (by constructing the list for some values of n to see some pattern):

(-(KroneckerDelta[0, #]/(2 π)) + 1/π) Integrate[
Sinh[ν]/(Cosh[ν] - Cos[u]) Cos[# u], {u, 0, 2 π},
Assumptions -> {ν > 0}] & /@ Range[0, 5] // FullSimplify

{1, 2 E^-ν, 2 E^(-2 ν), 2 E^(-3 ν), 2 E^(-4 ν), 2 E^(-5 ν)}


and the pattern is pretty clear: the zeroeth coefficient is one and the rest can be written as $2 \exp (- n \nu)$, so the formula is: $$\frac{\sinh \nu}{\cosh \nu - \cos u} = 1 + 2 \sum_{n = 1}^\infty e^{- n \nu} \cos n u$$

The question is: why neither of the FourierCoefficient (with assumptions), FourierCosCoefficient (with assumptions), Integrate (with assumptions) spotted this pattern, and instead yielded some function which cannot even be evaluated in integer values (despite $n$ being integer as was explicitly stated in assumptions)?

• Seems to depend upon version. In 11.3 FourierCosCoefficient[Sinh[ν]/(Cosh[ν] - Cos[u]), u, n, Assumptions -> {ν > 0}] gives $$\sinh (\nu ) \text{sech}^2\left(\frac{\nu }{2}\right) _3\tilde{F}_2\left(\frac{1}{2},1,1;1-n,n+1;\text{sech}^2\left(\frac{\nu }{2}\right)\right)$$ and FullSimplify[Table[c[k], {k, 0, 5}], \[Nu] > 0] gives $$\left\{2,2 e^{-\nu },2 e^{-2 \nu },2 e^{-3 \nu },2 e^{-4 \nu },2 e^{-5 \nu }\right\}$$ as expected. – Andrew Apr 23 '18 at 12:04
• It ran perfectly on my Mathematica 11.2 – t-smart Apr 23 '18 at 12:52
• On MMA 11.3 the cos transform returns a result in terms of HypergeometricPFQRegularized which evaluates for $n=1$ and can be simplified. What version are you using? – MarcoB Apr 23 '18 at 14:53
• @MarcoB I am using 11.2. I didn't know that results of Integrate are THAT dependent on the version... – user16320 Apr 23 '18 at 18:32