2
$\begingroup$

FourierCosCoefficient is way more powerful than I expected. For example,

In[1] := Table[FourierCosCoefficient[1/(2 - 2 Cos[x]), x, i], {i, -5, 5, 1}] Out[1] = {-5, -4, -3, -2, -1, 0, -1, -2, -3, -4, -5} 
In[2] := FourierCosCoefficient[1/(4 - 2 Cos[x] - 2 Cos[y]), {x, y}, {2, 3}] Out[2] = -((8/3 + \[Pi] - Log[2])/\[Pi]) 

These are indeed the correct results. However, the functions above have singularities, so we can't obtain the results by just integration. How does FourierCosCoefficient find the results? What algorithm does FourierCosCoefficient take for the above examples?

$\endgroup$
13
  • $\begingroup$ I remembered now from class, that at point of discontinuity of the function, the series converges to the average of the function at that point. But not sure this helps with your function, since at zero it blows up. But see Fouriercoscoefficient-for-generalized-function-with-singularity for related discuassion $\endgroup$ Commented Mar 1, 2024 at 23:45
  • 1
    $\begingroup$ I'm currently teaching EE261, The Fourier transform and its applications at Stanford (using Mathematica) and can confirm that such series converge to the average of limits on either side of a discontinuity. The square wave function is the clearest case. $\endgroup$ Commented Mar 2, 2024 at 0:24
  • $\begingroup$ @Nasser Hi, the "Fourier series coefficient" of $f(x)=(2-2\cos{x})^{-1}$ is $\tilde{f}_n = -|n|/2$. This is not a conventional Fourier series because $\sum_{n=-\infty}^{\infty} |n|\exp{\mathrm{i}nx}$ is nowhere convergent. The proper way is to understand it as the Fourier transformation between a distribution on $\mathbb{R}/2\pi\mathbb{Z}$ and a distribution on $\mathbb{Z}$. I'm surprised that Mathematica can give results in this vastly generalized sense. $\endgroup$ Commented Mar 2, 2024 at 0:28
  • $\begingroup$ @Nasser: The link refers to this actual page. What was your intention? $\endgroup$ Commented Mar 2, 2024 at 9:45
  • 1
    $\begingroup$ @user64494: Can you stop editing OP question if you do not understand the topic? Leave the title as it was typed by OP. $\endgroup$ Commented Mar 3, 2024 at 8:50

1 Answer 1

1
$\begingroup$

I think FourierCosCoefficient is simply ignoring pole of the function at x=0. We can see it by computing indefinite integral and then substituting upper and lower bounds of integration - we get the same result as FourierCosCoefficient.

I am not sure whether it is a feature or simply a bug.

Table[1/π Integrate[1/(2 - 2 Cos[x]) Cos[k x], x], {k, -5, 5}]; (# /. x -> π) - (# /. x -> -π) & /@ % 

{-5, -4, -3, -2, -1, 0, -1, -2, -3, -4, -5} 
$\endgroup$
8
  • $\begingroup$ Would this not be wrong math if this is what Mathematica did? Since Fundamental Theorem of Calculus which you used can't be applied if the integrand is not Continuous between the limits of integration? Can FTC really be used if there are countable number of poles between the limits? I did not think so. $\endgroup$ Commented Mar 2, 2024 at 23:30
  • $\begingroup$ This is definitely a bug in FourierCoefficient: Integrate[1/(2 - 2 Cos[x])*Cos[3*x], {x, -Pi, Pi}] performs "Integrate::idiv: Integral of Cos[3 x]/(2-2 Cos[x]) does not converge on {-[Pi],[Pi]}.". $\endgroup$ Commented Mar 3, 2024 at 7:02
  • $\begingroup$ [CASE:5119482] has been submitted by me. $\endgroup$ Commented Mar 3, 2024 at 7:04
  • 1
    $\begingroup$ @Nasser: As OP said in his comments it can have some sense not as a function but as a distribution. $\endgroup$ Commented Mar 3, 2024 at 8:07
  • 1
    $\begingroup$ @user64494: Have you read OP comment under the question? His explanation is more concrete. $\endgroup$ Commented Mar 3, 2024 at 8:35

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.