# Problem with the Fourier transform of |sin(x)|

The code FourierTransform[Abs[Sin[t]], t, w] gives me a timeout like "This computation has exceeded the time limit for your plan."

What indeed is the FT of $$|\sin(x)|$$ ? Why can't Mathematica compute it ?

• The Fourier transform of $|\sin t|$ does not exist in traditional math because the integral $\int_{\mathbb{R}} |\sin t|\,dt$ diverges (see encyclopediaofmath.org/index.php/Fourier_transform for info). – user64494 Feb 13 at 17:03
• @user64494 $|\sin t|$ is tempered so its Fourier transform is perfectly well-defined. This is explained in your own link ("In classical analysis such a generalization has been constructed for locally integrable functions..."). Please stop making wrong statements about distributions, or learn the basics first. – AccidentalFourierTransform Feb 14 at 0:04
• Pulling an actual book from my shelves, I find that Bracewell has the transform of Abs[Cos[t]] in his "pictorial dictionary". Adjusting for his eccentric scaling, it's the same as the series in the answers below, but with signs of terms alternating to get the phasing right. – John Doty Feb 14 at 2:40

Abs isn't analytic, and using it here seems to lead FourierTransform to get lost in the complex plane. Use RealAbs:

FourierTransform[RealAbs[Sin[t]], t, w]


yielding: Since the function is periodic, its transform is a train of delta functions. Something like FourierSeries might be more illuminating here. Maybe something like:

ComplexExpand[FourierSeries[RealAbs[Sin[t]], t, 10]]


yielding: is what you want.

• thanks for the answer! could I get further insight by perhaps getting the magnitude of this complex result? Abs[%] does not seem to work because of the infinite sum. – mlg556 Feb 13 at 15:29
• The result of FourierTransform[RealAbs[Sin[t]], t, w] is [CASE:4370384] reported by me on 08.01.20 This result is not a closed-form expression, but an analytic expression (see en.wikipedia.org/wiki/Closed-form_expression ). It is difficult to work with it. I was answered that the Mathematica devolopers were informed about that. – user64494 Feb 13 at 16:32
• @user64494 : what closed-form do you expect for an infinite train of delta functions? – John Doty Feb 13 at 17:37
• @user64494 : but it gives something that appears to be a correct answer. What's wrong with that? – John Doty Feb 13 at 20:42
• @user64494: it exists in the pragmatic sense that we use in applied physics, and my FourierSeries result along with @mikado's DiracComb result are perhaps better representations. – John Doty Feb 13 at 21:50

You can obtain a simple expression using the convolution theorem. A single cycle of the waveform is given by

sig = Sin[t] UnitBox[t/π - 1/2]


This has a relatively simple Fourier Transform

spec = FullSimplify[FourierTransform[sig, t, ω]]
(* -((1 + E^(I π ω))/(Sqrt[2 π] (-1 + ω^2))) *)


We can convert our single cycle into a periodic signal by convolution with a Dirac Comb. This transforms to another Dirac comb

combspec = FourierTransform[DiracComb[t/π], t, ω]
(* Sqrt[π/2] DiracComb[ω/2] *)


By the convolution theorem (this probably needs multiply by a something like 2π), the Fourier transform of periodic signal is given by

Assuming[ω/2 ∈ Integers, FullSimplify[combspec*spec]]
(* DiracComb[ω/2]/(1 - ω^2) *)


Note that we can simplify the factor in front of the comb, as its value only needs to be correct for cases where the comb is non-zero.

• However, the actions of FourierTransform and InverseFourierTransform on DiracDelta related functions are not reliable and correct in many cases (see that recent discussion mathematica.stackexchange.com/questions/212352/… ) . – user64494 Feb 13 at 21:43
• With this excellent answer, we now have three different approaches yielding equivalent results. – John Doty Feb 13 at 22:46