Direct DFT evaluation costs . The fast Fourier transform (FFT) computes the same transform in operations for suitable factorizations of ; it is an algorithm for the DFT.
For the connection between Fourier analysis and the complex frequency used in control systems, see Laplace Transform.
In NumPy, use norm="forward" for both fft and ifft to match this note: the forward transform includes , and the inverse transform has no scaling factor.
import numpy as np
N = 9 # Odd size avoids a separate Nyquist convention.
t = np.arange(N) / N
y = 1 + 2 * np.cos(2 * np.pi * t) - np.sin(4 * np.pi * t)
z = np.fft.fft(y, norm="forward")
y_reconstructed = np.fft.ifft(z, norm="forward")
# Frequencies in cycles per unit t, in fft order.
k = np.fft.fftfreq(N, d=1 / N)
t_eval = np.linspace(0, 1, 201)
p = np.exp(2j * np.pi * np.outer(t_eval, k)) @ zThe nonzero coefficients are , , , and . The centered interpolant reproduces the function up to floating-point roundoff.