I want to calculate the Fourier transform of some Gaussian function. Consider the simple Gaussian g(t) = e^{-t^2}. The Fourier transform of g(t) has a simple analytical expression , such that the 0th frequency is simply root pi.
If I try to do the same thing in Python:
N = 1000
t = np.linspace(-1,1,N)
g = np.exp(-t**2)
h = np.fft.fft(g) #This is the Fourier transform of expression g
Simple enough. Now as per the docs h[0]
should contain the zero frequency term, which we know from the analytical expression is root pi. But instead it gives 746.444
?!
Why the discrepancy between the analytical solution and the computational one?