This is probably a very naive question but here it is.
I want to calculate Fourier transform of a function f(x). So I define a numpy array X and pass through vectorized function f. Now if I calculate the FFT of this array f(X) it does not come out to be Fourier Transform of f(x) as it would if I do it on a piece of paper. For example If I calculate FFT of Gaussian I should get a Gaussian or an array whose real part would resemble a Gaussian very closely.
here is the code. please let me know what I have to change to get the usual Fourier Transform.
import matplotlib.pyplot as plt
import numpy as np
N = 128
x = np.linspace(-5, 5, N)
y = np.exp(-x**2)
y_fft = np.fft.fftshift(np.fft.fft(y).real)
plt.plot(x, y_fft)
plt.show()
let me reiterate. I want to calculate Fourier transform of any function (e.g. gaussian). FFT is way to calculate Fourier transform of an array of numbers but this is not same as simple discretization of continuous Fourier transform formula.