I am trying to write a code which propagates a beam a certain distance through Fourier propagation. Here is the relevant excerpt of the code: import numpy as np from numpy.fft import fft2, ifft2, fftfreq from matplotlib import pyplot as plt dz=0.001 #propagation distance (m) def Propag(U,dz): #frequency coordinates fx = fftfreq(gr, d=d) fy = fftfreq(gr, d=d) fx, fy = np.meshgrid(fx, fy) kx = 2*pi*fx ky = 2*pi*fy kz = sqrt(k**2 - kx**2 - ky**2 + 0j) #propagation constant in z #radial complex amplitude Fourier_U = ifft2(U) #angular spectrum Propag_FU = Fourier_U * exp(1j * kz * dz) U_propag = fft2(Propag_FU) return U_propag fx=GaussianBeam(z_0,wavelength) W_0=fx.W_0 gr=1000 x = np.linspace(-4*W_0,4*W_0,gr) #grid size y = np.linspace(-4*W_0,4*W_0,gr) X,Y = np.meshgrid(x,y) rho=sqrt(X**2+Y**2) phi=arctg(Y,X) U=fx.Amplitude(z_0,rho,phi) #this is a bidimensional Gaussian U_propag=Propag(U,dz) plot(U_propag) The code works, but it propagates the beam backwards - which can be seen by the shrunkage of the profile when dz=z_0, meaning that the beam is propagating towards its waist. I want to fix this and make the beam propagate forward. I read that the Fourier transform in optics has a positive sign, but swapping fft and ifft produced the same results. I then tried to give exp(1j * kz * dz) a negative sign, but that gave me an error: /tmp/ipython-input-17-2768534464.py:14: RuntimeWarning: overflow encountered in exp Propag_FU = Fourier_U * exp(-1j * kz * dz) /usr/local/lib/python3.11/dist-packages/numpy/fft/_pocketfft.py:94: RuntimeWarning: invalid value encountered in fft return ufunc(a, fct, axes=[(axis,), (), (axis,)], out=out) Why is my beam being propagated backwards, and how can I propagate it forward? Continue reading...