1
$\begingroup$

I'm trying to numerically compute the Fourier transform of the following bump function:

$$\hat{r}(k)=\int r(x)e^{ikx}dx$$,

where $r\in C^{\infty}_{0}(\mathbb{R}^{2})$, namely:

$$r(x)=\begin{cases}\exp\left(-\frac{1}{1-x^{2}}\right),&\|x\|<1,\\0,&\text{otherwise}.\end{cases}$$

Thus $$\hat{r}(k)=\int\exp\left(-\frac{1}{1-x^{2}}\right)\exp(ikx)dx,\qquad\|x\|<1$$ and $0$ otherwise.

Or $$\hat{r}(k)=\int\int\exp\left(-\frac{1}{1-x^{4}-y^{4}}\right)\exp(ik(x^2+y^2))dxdy,\qquad\sqrt{x^{2}+y^{2}}<1$$ and $0$ otherwise.

Now, the first thing I notice is that my 3D Plot is discontinuous:

Plot3D[Piecewise[{{Exp[-(1 - x^4 - y^4)^(-1)], 
Sqrt[x^2 + y^2] < 1}, {0, Sqrt[x^2 + y^2] >= 1}}], {x, -1, 
1}, {y, -1, 1}, PlotRange -> {-0.5, 0.5}]

And using NIntegrate doesn't yield anything either when I use

\[ScriptCapitalR] = Circle[]
Assuming[Element[k, \[ScriptCapitalR]], {NIntegrate[Piecewise[{{Exp[-(1/(1 - 
x^4 - y^4))]*Exp[I*k*(x^2 + y^2)], Sqrt[x^2 + y^2] < 1}, {0, Sqrt[x^2 + y^2] 
>= 1}}], {y, -1, 1}, {x, -1, 1}]}]
$\endgroup$
  • $\begingroup$ Using Needs["GeneralUtilities`"]; PrintDefinitions[NFourierTransform] you can see the source code for this particular function, and as you can see there is no definition for multidimensional Fourier transforms, so this is a no go. On the upside you can see that, just as it says in the documentation, this function directly uses NIntegrate so you will lose nothing by using NIntegrate directly, you don't need NFourierTransform. $\endgroup$ – C. E. Nov 20 '16 at 1:02
  • $\begingroup$ @C.E. See the edit. $\endgroup$ – Jason Born Nov 20 '16 at 11:11
  • $\begingroup$ 1. “Do I also have to set some parameters on $k$?” Of course, you're doing a numeric transform. 2. What do you mean by $r\in C^{\infty}_{0}(\mathbb{R}^{2})$? The $x$ in $r(x)$ is a complex number? $\endgroup$ – xzczd Nov 20 '16 at 12:13
  • $\begingroup$ @xzczd $C^{\infty}_{0}(\mathbb{R}^{2})$ is the space of smooth functions with compact support over $\mathbb{R}^{2}$, which should also answer your second question: $x$ is a real number. Mind you, the function space shouldn't really be too important since I've already provided an explicit example of such a function, namely $r(x)$. $\endgroup$ – Jason Born Nov 20 '16 at 12:19
  • 2
    $\begingroup$ Just use e.g. Table[NIntegrate[Piecewise[{{Exp[-(1/(1 - x^4 - y^4))]*Exp[I*k*(x^2 + y^2)], Sqrt[x^2 + y^2] < 1}}], {y, -1, 1}, {x, -1, 1}],{k,-10,10}]//Abs//ListLinePlot, if you want to use Plot, then func[k_?NumericQ]:=NIntegrate[Piecewise[{{Exp[-(1/(1 - x^4 - y^4))]*Exp[I*k*(x^2 + y^2)], Sqrt[x^2 + y^2] < 1}}], {y, -1, 1}, {x, -1, 1}];Plot[func[k]//Abs,{k,-10,10}](*Probably slow*). $\endgroup$ – xzczd Nov 20 '16 at 13:17

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.