When I do*

FourierCosSeries[DiracDelta[x - 0.0001], x, 5]

I get as a result

{0.140401, 1/\[Pi] + 0.63662 Cos[x] + 0.63662 Cos[2 x] + 0.63662 Cos[3 x] + 0.63662 Cos[4 x] + 0.63662 Cos[5 x]}.

Where each coefficient is a factor two too big. (The Delta function)


FourierSeries[DiracDelta[x], x, 5] 

on the other hand, gives the correct result

{0.140401, 1/(2 \[Pi]) + E^(-I x)/(2 \[Pi]) + E^(I x)/(2 \[Pi]) + E^(-2 I x)/(2 \[Pi]) + E^(2 I x)/(2 \[Pi]) + E^(-3 I x)/(2 \[Pi]) + E^(3 I x)/(2 \[Pi]) + E^(-4 I x)/(2 \[Pi]) + E^(4 I x)/(2 \[Pi]) + E^(-5 I x)/(2 \[Pi]) + E^(5 I x)/(2 \[Pi])}

(it is easy to see by using 2cos(x)=exp(ix)+exp(-ix) that the two expressions differ by a factor two) So I know the correct expansion, but I prefer to trace back the origin of the mistake, to avoid similar wrong results in the future.

*The -0.0001 in the argument of the delta-function prevents me from getting a bunch of HeavisideTheta[0]'s in the answer

I tried another random symmetric function and the problem doesn't seem to persist there.

  • 1
    $\begingroup$ Have you looked up FourierParameters? The default normalization in Mathematica might be different than the one you expect. $\endgroup$ – march Oct 17 '16 at 15:57

Ok, so FourierCosSeries only integrates from 0 to pi and doubles the result. For a symmetric function this is the same as integrating from -pi to pi.

As a consequence, in calculating the FourierCosSeries of DiracDelta[x] only the 'right halve' of the deltafunction counts as in the integration boundaries(hence Heavisidetheta[0]). Shifting the whole delta-function corresponds to having two delta-functions on [-pi,pi]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.