3
$\begingroup$

Recently I do simulation on Lorentzian Function with FFT

Lorentzian Function is 2a/(x**2+a**2)

import numpy as np
from scipy import fft
import matplotlib.pyplot as plt 
a =1 
N = 500
x =np.linspace(-30,30,N)
lorentz = (2*a) * (1/(a**2 + x**2))
fourier = (fft.fft(lorentz))
fig, (ax1) = plt.subplots(nrows=1, ncols=1)
ax1.loglog(abs(fourier[0:int(N/2)]),basey=np.e)
ax1.grid(True)
plt.show()

According to contour integration, it's supposed to be exp(-|k|*a)

It seems correct enter image description here

It's supposed to be linear,when I plot it on log scale. But there are some oscillation on it.

enter image description here

when I extend my points till x = np.linspace(-100,100,N) enter image description here The oscillation seems postpone.

x =np.linspace(-300,300,N) enter image description here

I could not figure out the reason of oscillation.

$\endgroup$
1
$\begingroup$

Welcome to scicomp! If I remember correctly, then in order to Fourier transform a function it has to be a periodical so that you can use the sine and cosine functions as base for it. In your case the peak will have a discontinuity in the derivative at the ends at x=30 or x=-30. The Fourier base is not well suited for discontinuities. If my hunch is correct, then you should be able to extend your domain further outward, so that the discontinuity becomes less pronounced and consequently your oscillations should subside. To get a feel for what is happening look up the tent function and its Fourier transformation, there you will see similar oscillations.

$\endgroup$

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.