# Why does FourierTransform[] converge while same integral manually written does not?

I'm studying the quantum mechanics of an infinite square well from a computational standpoint.

My eigenfunctions are defined as $u_n(x)=\sqrt{2/L}\sin\left(n\pi x/L\right),\quad 0 \le x \le L, \quad n=1,2,3,\dots$ and zero outside of the $[0,L]$ interval.

I'd like to transform the wave function from position domain to the momentum domain. My book says that this is achieved by writing the Fourier transform of $u_n(x)$:

$\phi_n(k)=\frac{1}{\sqrt{2\pi}} \int_{-\infty}^{\infty} u_n(x)e^{-i k x}dx$

ClearAll["Global*"];
L = 1;
u[n_, x_] := Sqrt[2/L] Sin[n π x]
φ[n_, k_] := Assuming[{n ∈ Integers, {k, x} ∈ Reals},
1/(Sqrt[2π]) Integrate[u[n, x] Exp[-I k x], {x, -∞, ∞}]]


Integrate::idiv: Integral of E^(-I k x) Sin[n π x] does not converge on {-∞,∞}. >>

If I, though, use FourierTransform[], I get the result:

FourierTransform[u[n, x], x, k, FourierParameters -> {0, -1}]


-I Sqrt[π] DiracDelta[k - n π] + I Sqrt[π] DiracDelta[k + n π]

But my book says that the result should be:

$\phi_n(k) = \sqrt{\pi L} n \frac{1-(-1)^n e^{-i L k}}{(n\pi -L k)(n\pi + Lk)}$

I tried to get Mathematica to fully simplify the output of FourierTransform[], but I/it couldn't.

So my questions are:

1. Why does the integral not converge when written manually but it does converge when it is being calculated via FourierTransform[] ?

2. How could I prove that the output of FourierTransform[] is equivalent to the formula that is written in my book for $\phi_n(k)$ ?

• (1) FourierTransform is using (a generalized version of) the transform defined by integrating over the entire real line. There are other definitions more suitable for periodivc functions, e.g. integrating over (possibly a finite multiple of) the period. That appears to be what is wanted for your example, so it will indeed be difgferent from what Fouriertransform gives. Nov 12 '13 at 4:36
• (2) Often a Fourier transform exists even when the classical definition as an integral over R fails to converge. Your specific example is a case where this happens. Nov 12 '13 at 4:39
• It seems like the function u is missing Piecewise in its definition, so that it will be zero outside 0 to L. This is probably one reason why the FouerierTransform call isn't matching the manual integration from 0 to L. Oct 11 '18 at 22:20

Your function u is defined only for 0..L, then simply apply the integration over that range only.

ClearAll["Global*"];
L = 1;
u = Sqrt[2/L] Sin[n Pi x/L];
mma = Assuming[Element[n, Integers],1/(Sqrt[2 Pi]) Integrate[u  Exp[-I k x], {x, 0, L}]];
book = Sqrt[Pi L] n (1 - (-1)^n Exp[-I L k])/((n Pi - L k) (n Pi + L k )) Simplify[book - mma] On the question why sometimes FourierTransform seems to handle things better with some function vs. when applying the Integrate command directly from the book definition of FourierTransform, I think this has to do to some assumptions build in Fourier Transform about the function itself and may be other subtle things, and FourierTransform might apply special algorithms to integrate the function that might not be used by the general purpose Integrate at some point.

• That was it! Given that the whole question was based on an epic pebkac would you recommend to just delete it or? Nov 8 '13 at 22:36
• Well, the SE is like a repository of knowledge in the form of a Q/A, so questions based on having done something stupid may still be worthwhile. Chances are good someone else will do something stupid, too, or just otherwise find the question and answer illuminating. Also, the question of "why does mathematica seem to be able to do something with one function, but not another that's equivalent?" can often be fairly interesting. I would make a non-expert guess that Nasser is right: FourierTransform has algorithms/data that Integrate does not use. Nov 8 '13 at 23:10