# Mathematica Fourier Transform not responding

I am trying to do Fourier Transformation on the following function Izzn, which is essentially just a lot of trigonometric function, whose Fourier transformation are all well defined. However, when I type FourierTransform[Izzn,t,f], mathematica takes an unreasonably long time to evaluate. By unreasonable, I mean that it never gives the result but keeps evaluating. Some typical terms of Izz are posted below

 0.272441 Cos[1519.09 t]^2 + 2.69272 Cos[1519.22 t]^2 +
0.383058 Cos[1519.22 t]^2 -
0.0419625 Cos[1519.22 t] Cos[1519.22 t] +
0.0494935 Cos[1519.22 t]^2 +
0.910475 Cos[1519.22 t] Cos[1519.24 t] +
0.407475 Cos[1519.22 t] Cos[1519.24 t] + 2.42896 Cos[1519.24 t]^2 +
0.127629 Cos[1519.22 t] Cos[1519.25 t] -
0.0659875 Cos[1519.22 t] Cos[1519.25 t] -
0.351161 Cos[1519.24 t] Cos[1519.25 t] + 1.05013 Cos[1519.25 t]^2 -
0.5246 Cos[1519.22 t] Cos[1519.25 t] +
0.0886742 Cos[1519.22 t] Cos[1519.25 t] +
2.17117 Cos[1519.24 t] Cos[1519.25 t] -
2.97282 Cos[1519.25 t] Cos[1519.25 t] + 5.7118 Cos[1519.25 t]^2 -
1.68453 Cos[1519.22 t] Cos[1519.26 t] -
0.181303 Cos[1519.22 t] Cos[1519.26 t] -
5.27604 Cos[1519.24 t] Cos[1519.26 t] +
0.928094 Cos[1519.25 t] Cos[1519.26 t]

• Please can you post something we can work with in Mathematica? Make it so that I can copy and paste. A minimum working example is the usual format. I think you may have a list of numbers, but I can't see properly, if so, you need Fourier not FourierTransform.
– Hugh
Nov 17, 2021 at 10:52
• Hi, I tried to post Izzn for people's use, but the website tell me that most of my post is code so it's not possible to add it. But as I said, and you can look in the picture, Izzn is just a large bunch of trigonometric functions of argument t. Nov 17, 2021 at 11:07
• Can you just post as few of the typical terms? Then I can see what happens.
– Hugh
Nov 17, 2021 at 11:13
• Hi, I copied about one fifth of the terms here Nov 17, 2021 at 11:24

I have had a play with your data. I don't know what your data means but, as Daniel Huber points out, you can take the FourierTransform.

  ex = 0.272441 Cos[1519.09 t]^2 + 2.69272 Cos[1519.22 t]^2 +
0.383058 Cos[1519.22 t]^2 -
0.0419625 Cos[1519.22 t] Cos[1519.22 t] +
0.0494935 Cos[1519.22 t]^2 +
0.910475 Cos[1519.22 t] Cos[1519.24 t] +
0.407475 Cos[1519.22 t] Cos[1519.24 t] +
2.42896 Cos[1519.24 t]^2 +
0.127629 Cos[1519.22 t] Cos[1519.25 t] -
0.0659875 Cos[1519.22 t] Cos[1519.25 t] -
0.351161 Cos[1519.24 t] Cos[1519.25 t] +
1.05013 Cos[1519.25 t]^2 - 0.5246 Cos[1519.22 t] Cos[1519.25 t] +
0.0886742 Cos[1519.22 t] Cos[1519.25 t] +
2.17117 Cos[1519.24 t] Cos[1519.25 t] -
2.97282 Cos[1519.25 t] Cos[1519.25 t] + 5.7118 Cos[1519.25 t]^2 -
1.68453 Cos[1519.22 t] Cos[1519.26 t] -
0.181303 Cos[1519.22 t] Cos[1519.26 t] -
5.27604 Cos[1519.24 t] Cos[1519.26 t] +
0.928094 Cos[1519.25 t] Cos[1519.26 t];
FourierTransform[ex, t, f]


As you can see it is full of delta functions which you may not want (or you may). There is a post somewhere that explains why FourierTransform does this.

If this is a time series analysis I suggest you use LaplaceTransform and then convert to Fourier. Thus

lt = LaplaceTransform[ex, t, s];
ft = lt /. s -> I ω // Chop


I don't know if this helps. I had some fun working out the poles of your expression thus

b = List @@ ft;
den = Denominator[#] & /@ b;
Solve[# == 0, ω] & /@ den


So you have lots of poles at high frequencies and low.

Hope that helps.

• Hi, thanks a lot. Actually I guess the problem is about the length of the function. I posted the full Izzn just above your answer. Could you try it? I think for a small series, FourierTransform works fine, but when the function gets longer, it fails. Nov 17, 2021 at 11:49
f[t_] = .272441 Cos[1519.09 t]^2 + 2.69272 Cos[1519.22 t]^2 +
0.383058 Cos[1519.22 t]^2 -
0.0419625 Cos[1519.22 t] Cos[1519.22 t] +
0.0494935 Cos[1519.22 t]^2 +
0.910475 Cos[1519.22 t] Cos[1519.24 t] +
0.407475 Cos[1519.22 t] Cos[1519.24 t] +
2.42896 Cos[1519.24 t]^2 +
0.127629 Cos[1519.22 t] Cos[1519.25 t] -
0.0659875 Cos[1519.22 t] Cos[1519.25 t] -
0.351161 Cos[1519.24 t] Cos[1519.25 t] +
1.05013 Cos[1519.25 t]^2 - 0.5246 Cos[1519.22 t] Cos[1519.25 t] +
0.0886742 Cos[1519.22 t] Cos[1519.25 t] +
2.17117 Cos[1519.24 t] Cos[1519.25 t] -
2.97282 Cos[1519.25 t] Cos[1519.25 t] + 5.7118 Cos[1519.25 t]^2 -
1.68453 Cos[1519.22 t] Cos[1519.26 t] -
0.181303 Cos[1519.22 t] Cos[1519.26 t] -
5.27604 Cos[1519.24 t] Cos[1519.26 t] +
0.928094 Cos[1519.25 t] Cos[1519.26 t];

FourierTransform[f[t], t, w]


Is this the result you expect? And it is lightning fast.

However, you do not actually need a Fourier Transform. Every Cos term will give 2 Delta functions and every Cos^2 term 3 Delta Functions and Cos Cos 4 Delta FunctionsE.g.:

FourierTransform[ Cos[a  t], t, w]
FourierTransform[Cos[a  t]^2, t, w]
FourierTransform[Cos[a  t] Cos[b t], t, w]


Therefore, as the Fourier Transform is linear, you can get the result by replacing

Note, due to numerical accuracy with machine numbers, you do not get exactly the same result as from Fourier Transform. For this you would need to use accurate numbers.

• Did you try InverseFourierTransform[%, w, t] to verify it? Nov 17, 2021 at 11:38
• Hi, for this it is probably fast as there are only a few terms. But my problem is that for the full series (which you can see the picture), it seems very slow. Nov 17, 2021 at 11:44
• You do not actually need a Fourier Transform as your input consist only of Cos terms. Therefore you can get the solution by replacement. I added this possibility to my answer. Nov 17, 2021 at 12:40