I need to calculate the Fourier Transform of both Gaussian and Lorentzian functions and plot the result. I know the result for both, but I can't seem to get them right and I don't really understand how the fft works in Python...
This is what I have for the lorentzian function so far
import numpy as np
from scipy import fftpack
import matplotlib.pyplot as plt
a = 1.0
N = 500 #number of points
x = np.linspace(-5,5,N)
lorentz = (a/np.pi) * (1/(a**2 + x**2)) #lorentzian function
fourier = fftpack.rfft(lorentz)
fourier = (2 * np.pi**2 / N)* abs(fourier[0:N/4]) #supposed to normalize
plt.plot(fourier)
plt.show()
I'm really lost on this. I should be getting something like exp(-pi|k|), I don't know what I should do with this to make that look more like what I want.