I'm trying to define the functional $T$ on test functions $f$ and $g$ in Mathematica 11, where $$T(f,g) = \int_{-\infty}^\infty\hat{f}(x)\hat{g}(-x)\,dx$$ So I have written:

T[f_Symbol, g_Symbol] := Integrate[FourierTransform[f[s], s, x] * FourierTransform[g[s], s, -x], {x, -\[Infinity], \[Infinity]}]

Then, I define (for example) the functions

f[s_]:= Exp[-s^2];
g[s_]:= 2*s*Exp[-s^2];

I can successfully evaluate the command T[f,f], but when I try to evaluate T[f,g], I get the error General: -x is not a valid variable. I suspect that this is some assignment issue involving :=, but I don't know where to start when troubleshooting this. What is going on here?

  • $\begingroup$ @chuy That was also my first thought but FourierTransform[f[s], s, -x] is evaluated successfully without errors. $\endgroup$ – Henrik Schumacher Apr 5 '18 at 15:59
  • $\begingroup$ Perhaps I should have mentioned that I'm trying to not introduce conjugates into this calculation, because the functions I want to use this with have a number of other parameters and building a Refine or ComplexExpand command into all this makes it take quite a while. $\endgroup$ – sourisse Apr 5 '18 at 16:01
  • $\begingroup$ @chuy Check out my answer. $\endgroup$ – Henrik Schumacher Apr 5 '18 at 16:01

Since $g$ is of the form $g(s) = s \, h(s)$, we have $\hat g(\xi) = \pm \operatorname{i} \tfrac{\partial}{\partial \xi} \hat h(\xi)$. If the Fourier transform of $h$ is known (as it is in this case; $h$ is basically the Gaussian bell function), this is the method of choice to compute the Fourier transform. $\xi$ is the third argument of FourierTransform, so Mathematica uses $\xi = - x$ and this is why it tries to evaluate D[1/(Sqrt[2]*E^(x^2/4)), {-x, 1}] since this is $\tfrac{\partial \hat h(-x)}{\partial (-x)}$. And D needs Symbols in the second argument for operation. But -x (Minus[x] in InputForm) has the head Minus and is thus not treated as Symbol, thus the error message.

The following seems to circumvent this:

T[f_Symbol, g_Symbol] := Integrate[
  FourierTransform[f[s], s, x] (FourierTransform[g[s], s, y] /. y -> -x),
  {x, -∞, ∞}]
T[f, g]


Seems to be correct because the integrant is an odd function.

| improve this answer | |
  • $\begingroup$ Wow, I used the wrong syntax when I tried this before posting, and consequently ruled it out too hastily. Thanks! $\endgroup$ – sourisse Apr 5 '18 at 16:05
  • $\begingroup$ You're welcome! Actually, this behavior is a bit subtle, so I wouldn't have expected it upfront. It's really not obvious that the syntax is wrong. $\endgroup$ – Henrik Schumacher Apr 5 '18 at 16:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.