# Inverse Fourier Transform and peculiar results

In order to get Fourier and Inverse Transform of a function $$f(x)$$ I write the following commands:

As far I can see that Nominator in the quotient of INF[x] is zero and the other 2 small quotients sum to 4.... What I do not understand is:

1. why Mathematica prefers to write down in such a complicated way the result..

2. How can I make the result of INF[x] looks like the function f[x]?

Thanks.

Some Edit after receiving help.

Element[a, Reals];
Element[b, Reals];

f[x_] = Piecewise[{{1, a <= x <= b}, {0, \[Placeholder]}}]
(* Piecewise[{{1, a <= x <= b}}, 0] *)

F[s_] = FullSimplify[FourierTransform[f[x], x, s, FourierParameters -> {1, 1},
Assumptions -> Element[s, Reals], Assumptions -> a < b]]
(* Piecewise[{{(I*(E^(I*a*s) - E^(I*b*s)))/s, a < b}}, 0] *)

INF[x_] = FullSimplify[InverseFourierTransform[F[s], s, x, FourierParameters -> {1, 1},
Assumptions -> Element[s, Reals], Assumptions -> Element[a, Reals],
Assumptions -> Element[b, Reals], Assumptions -> a < b, Assumptions -> a <= x <= b]]
(* Piecewise[{{(1/4)*(-((I*(Log[1/(a - x)] + Log[I*(a - x)] -
Log[a - x] - Log[I/(b - x)] + Log[I*(b - x)] - Log[(I*(b - x)^2)/(a - x)]))/Pi) -
2/Sign[a - x] + 2/Sign[b - x]), a < b}}, 0] *)

• Please post Mathematica code so that we can copy it and work on it ourselves.
– Hugh
Commented Apr 30, 2020 at 12:24
• Copy the input cells and paste. Then. select them and click on the curly brackets in the tool bar. Have a go at editing your post.
– Hugh
Commented Apr 30, 2020 at 13:11
• Which mathematica version is this? With 12.0 I obtain for FullSimplify[InverseFourierTransform[FourierTransform[Piecewise[{{1, a < t < b}}, 0], t,w], w, t],a < b] the result (Sign[b-t]+Sign[-a+t])/2 which is just the original integrand looking a little bit different.
– Max1
Commented Apr 30, 2020 at 14:02
• As to typesetting of the code, check this post: mathematica.meta.stackexchange.com/q/1584/1871 Commented Apr 30, 2020 at 14:36
• Stand-alone statement like Element[a, Reals] tests whether a is real. If a has not been assigned a value it returns unevaluated since it is neither True nor False. To declare a real this must be added to \$Assumptions or included in an Assumptions option. Do not give an option twice in a single command. Second use will override the first. To make assumptions available to all commands that take assumptions, either put them in Assumptions or use Assuming. Commented Apr 30, 2020 at 14:39

Clear["Global*"]

f[x_] = Piecewise[{{1, a <= x <= b}}]

(* Piecewise[{{1, a <= x <= b}}, 0] *)


Piecewise defaults to 0 so you do not need to specify a second case.

F[s_] = Assuming[{Element[s, Reals], a < b},
FullSimplify[
FourierTransform[f[x], x, s, FourierParameters -> {1, 1}]]]

(* (I*(E^(I*a*s) - E^(I*b*s)))/s *)


Note that by using Assuming the assumptions are available to both FourierTransform and FullSimplify since both functions accept an Assumptions option. Although, not important in this case, it is generally a better practice. Similarly, with the following.

INF[x_] = Assuming[{Element[s, Reals], a <= x <= b},
FullSimplify[
InverseFourierTransform[F[s],
s, x, FourierParameters -> {1, 1}]]]

(* 1/2 (Sign[b - x] + Sign[-a + x]) *)


You can use a custom ComplexityFunction in FullSimplify to penalize the use of Sign

INF[x_] = Assuming[{Element[s, Reals], a <= x <= b},
FullSimplify[
InverseFourierTransform[F[s],
s, x, FourierParameters -> {1, 1}],
ComplexityFunction -> (LeafCount[#] + 100*
Count[#, _Sign, {0, Infinity}] &)]]

(* 1 *)


and the constraint of a <= x <= b is implied by the assumptions used.

• Excellent help and commentary!!! Thanks a lot! Commented May 1, 2020 at 11:08