1
$\begingroup$

The 2D rectangular function and its Fourier Transform is

$$ g_{in}(x,\,y) = rect(\frac{x}{x0}) \, rect(\frac{y}{y0}) \quad \xrightarrow{\mathscr{F}} \quad G_{in}(u,v) = x0 \, y0 \, sinc(\pi u x0) \, sinc(\pi v y0) $$

where $ x0 > 0 $ and $ y0 >0 $.

I tried out this relation with Mathematica's built-in ForierTransform function (UnitBox is a Mathematica implementation of the rectangular function):

In[1]:= FourierTransform[UnitBox[x/x0] UnitBox[y/y0], {x, y}, {u, v}, FourierParameters -> {0, 2*Pi}]

Out[1]= Abs[x0] Abs[y0] Sinc[\[Pi] u x0] Sinc[\[Pi] v y0]

This not only is in agreement with the relation but also reveals the general cases where $x0$ or $y0$ is not positive. This result was cross-checked using the definition of Fourier Transform:

In[2]:= Integrate[UnitBox[x/x0] UnitBox[y/y0] Exp[-I 2 Pi (u x + v y)], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]

Out[2] is nothing but a longer version of Out[1]: $$ \begin{cases} \tag{Out[2]} -\frac{\sin (\pi u \text{x0}) \sin (\pi v \text{y0})}{\pi ^2 u v} & (\text{x0}>0\land \text{y0}<0)\lor (\text{x0}<0\land \text{y0}>0) \\ \frac{\sin (\pi u \text{x0}) \sin (\pi v \text{y0})}{\pi ^2 u v} & (\text{x0}>0\land \text{y0}>0)\lor (\text{x0}<0\land \text{y0}<0) \\ 0 & \text{True} \end{cases} $$

So far, it seems that FourierTransform saves me from a hassle of typing Integrate, Exponent, etc., and yields a succinct representation. However, FourierTransform fails my expectation when Assumptions -> x0 && y0 is thrown in it:

In[3]:= FourierTransform[UnitBox[x/x0] UnitBox[y/y0], {x, y}, {u, v}, FourierParameters -> {0, 2*Pi}, Assumptions -> {x0 > 0 && y0 > 0}]

Out[3]= Abs[x0] Abs[y0] Sinc[\[Pi] u x0] Sinc[\[Pi] v y0]

This is strange because the first two terms in the output should be without Abs's with the aforesaid assumption, like this:

In[4]:= Simplify[FourierTransform[UnitBox[x/x0] UnitBox[y/y0], {x, y}, {u, v}, FourierParameters -> {0, 2*Pi}], Assumptions -> {x0 > 0 && y0 > 0}]

Out[4]= x0 y0 Sinc[\[Pi] u x0] Sinc[\[Pi] v y0]

or this:

In[5]:= Integrate[UnitBox[x/x0] UnitBox[y/y0] Exp[-I 2 Pi (u x + v y )], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}, Assumptions -> {x0 > 0 && y0 > 0}]

Out[5]= (Sin[\[Pi] u x0] Sin[\[Pi] v y0])/(\[Pi]^2 u v)

From this simple example, it seems that the Assumptions option in FourierTransform does not work as usually expected. Can anyone give me a hint on what's happening in the function?

$\endgroup$
  • 1
    $\begingroup$ @ herrpark: it is not uncommon that MMA "forgets" Assumptions made under e.g. an integral. The remedy is to simplify the resulting expression with the same Assumption: Simplify[%, {x0 > 0, y0 > 0}]. So, just say it twice (Goethe's Faust recommended even "Du musst es dreimal sagen" to take effect) ;-) $\endgroup$ – Dr. Wolfgang Hintze Sep 25 '15 at 12:12
  • $\begingroup$ @Dr. Wolfgang Hintze Thanks for the suggestion. Now I wonder whether there are some features that enable me to step into and out of a function that we do, say, in Visual Studio. Stepping through a function would give me some information on intermediate steps it takes. $\endgroup$ – herrpark Sep 25 '15 at 12:53
  • $\begingroup$ The Trace family can be used sometimes for debugging, and there is a built-in debugger in the Evaluation menu. However, it is not a very convenient one. The Mathematica workbench seems to have a better one. $\endgroup$ – Sjoerd C. de Vries Sep 25 '15 at 22:17
  • $\begingroup$ It's always great for me to have a new message. Thanks and Mathematica workbench seems promising to me. I will give it a try. $\endgroup$ – herrpark Sep 30 '15 at 0:01

Your Answer

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

Browse other questions tagged or ask your own question.