The Fourier Transform

Pure mathematics is much more than an armory of tools and techniques for the applied mathematician. On the other hand, the pure mathematician has ever been grateful to applied mathematics for stimulus and inspiration. From the vibrations of the violin string they have drawn enchanting harmonies of Fourier Series, and to study the triode valve they have invented a whole theory of non-linear oscillations.

George Frederick James Temple In 100 Years of Mathematics: a Personal Viewpoint (1981).


The Fourier Transform (FT) is an integral transform, a powerful mathematical tool to map a function from its original space representation into another function space (called, in this case, the Fourier space). In the time domain, the Fourier space is the frequency and in the Cartesian domain is the so-called reciprocal space. The FT is accomplished by integrating the given function in its original space. The advantage of the FT is that in the transformed space, the properties of the original function can usually be characterised and manipulated more quickly than in the original function space. The FT function can generally be mapped back to the original function space using the inverse FT.

The FT plays an important role in pure and applied science, computer science, electronic engineering, and medicine. In this lecture, I will shortly introduce the mathematics of the FT and then show some examples of practical applications.

The Fourier Integral of a Non-Periodic Function

The Fourier series of a periodic function {f(x)} with a period \lambda=2p can be approximated with the following trigonometric series

f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty} \left(a_n\cos\frac{n\pi x}{p} +b_n\sin \frac{n\pi x}{p}\right)

with

a_0=\frac{1}{p}\int_{-p}^{p} f(t)dt,

a_n=\frac{1}{p}\int_{-p}^{p} f(t)\cos \frac{n\pi t}{p} dt

and

b_n=\frac{1}{p}\int_{-p}^{p} f(t)\sin \frac{n\pi t}{p} dt

A non-periodic function can be considered as a periodic function in the limit of {p \rightarrow \infty}. Let now see what happen to the Forier series if we apply this definition.

The first term goes to zero as

\left| \frac{1}{p}\int_{-p}^{p} f(t)dt \right| \leq \left| \frac{1}{p}\int_{-p}^{p} |f(t)|dt \right|  \leq \left| \frac{1}{p}\int_{-\infty}^{\infty} |f(t)| dt \right| = |Q|/p \rightarrow 0

First we need to define a new variable called {\alpha_n = \pi n/p} that assume equidistant valules in the interval (0,\infty) of value {\Delta \alpha = \pi/p}. Now we explicitly write the last terms in the Fourier series using the new variable

\sum_{n=1}^{\infty} \left(a_n\cos\frac{n\pi x}{p} +b_n\sin \frac{n\pi x}{p}\right)=\sum_{n=1}^{\infty} \frac{1}{p}\int_{-p}^{p} f(t)\cos(\frac{n\pi (t-x)}{p})dt

and

\sum_{n=1}^{\infty} \frac{1}{p}\int_{-p}^{p} f(t)\cos(\frac{n\pi (t-x)}{p}) dt = \frac{1}{\pi} \sum_{\alpha}\Delta\alpha \int_{-p}^{p} f(t)\cos( \alpha \pi (t-x)) dt

Per {p \rightarrow \infty} the limit of the sum become

\frac{1}{\pi} \int_{0}^{\infty}d\alpha \int_{-\infty}^{\infty} f(t)\cos( \alpha \pi (t-x)) dt.

Therefore, we have that

f(x)=\frac{1}{\pi} \int_{0}^{\infty}d\alpha \int_{-\infty}^{\infty} f(t)\cos( \alpha \pi (t-x)) dt.

This formula is the Fourier integral of the function f(x).

In addition, the Fourier Theorem assure that in the point of discontinuity x_d, the function assumes the average value of the right and left limits to x_d, i.e.

f(x_d)= \frac{f(x_d +)+f(x_d -)}{2}.

Introducendo le due funzioni

A(\alpha)=\frac{1}{\pi} \int_{-\infty}^{\infty} f(t)\cos( \alpha \pi t) dt

B(\alpha)=\frac{1}{\pi} \int_{-\infty}^{\infty} f(t)\sin( \alpha \pi t) dt

The Fourier integral can be written as

f(x)= \int_{0}^{\infty} [A(\alpha)\cos( \alpha x) +B(\alpha)\sin(\alpha x)] d\alpha.

The Fourier Integral in Complex Form

The Fourier integral can also be expressed in a more compact form using the complex exponential as

f(x)=\frac{1}{2\pi} \int_{-\infty}^{\infty}d\alpha \int_{-\infty}^{\infty} f(t) e^{\alpha (t-x)i}dt.

By substituting

e^{\alpha(t-x)i}=\cos \alpha(t-x)+i\sin \alpha(t-x)

we get the Fourier integral and a second integral

\frac{1}{2\pi}  \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} i\sin{\alpha (t-x)}dt d\alpha

that is equal to zero as result of the integration of the odd function \sin \alpha.

Calculation of Fourier Transform Integral using Python

The Fourier integral is a fundamental concept in signal processing and mathematics. It allows us to analyze a complex, time-domain signal in terms of its frequency components. In this Python example, we will demonstrate how to compute the Fourier integral of a simple signal, the rectangular pulse function. The rectangular pulse function is a piecewise function that takes the value 1 within a certain time interval and 0 outside that interval. By applying the Fourier integral, we can decompose this function into its constituent sinusoidal frequencies.

f(t)= \begin{cases} 1, & \text{if } -\frac{T}{2} \leq t \leq \frac{T}{2} \\ 0, & \text{otherwise} \end{cases}

import numpy as np
import matplotlib.pyplot as plt

def rectangular_pulse(t, T):
    return np.where(np.abs(t) <= T / 2, 1, 0)

def fourier_integral(t, f_t):
    N = len(t)
    dt = t[1] - t[0]
    omega = 2 * np.pi / (N * dt)
    F_omega = np.fft.fft(f_t)
    F_omega = np.fft.fftshift(F_omega)
    frequencies = np.fft.fftfreq(N, dt)
    frequencies = 2 * np.pi * frequencies
    return frequencies, F_omega

# Parameters
T = 2          # Width of the rectangular pulse
duration = 10  # Total time duration
N = 1000       # Number of points

# Time values
t = np.linspace(-duration / 2, duration / 2, N, endpoint=False)

# Generate the rectangular pulse function
f_t = rectangular_pulse(t, T)

# Compute the Fourier integral
frequencies, F_omega = fourier_integral(t, f_t)

# Plot the results
plt.figure(figsize=(12, 6))

plt.subplot(2, 1, 1)
plt.plot(t, f_t, label='Rectangular Pulse')
plt.xlabel('Time')
plt.ylabel('f(t)')
plt.grid()
plt.legend()

plt.subplot(2, 1, 2)
plt.plot(frequencies, np.abs(F_omega), label='Fourier Integral')
plt.xlabel('Frequency (ω)')
plt.ylabel('|F(ω)|')
plt.grid()
plt.legend()

plt.tight_layout()
plt.show()

Description of the Python Program:

  1. Defining the Rectangular Pulse Function: We define a Python function rectangular_pulse(t, T) to generate the rectangular pulse function. The function takes two arguments: t for time and T for the width of the pulse. It returns 1 when the time falls within the interval [-T/2, T/2] and 0 otherwise.
  2. Computing the Fourier Integral: Another function, fourier_integral(t, f_t), is defined to compute the Fourier integral of a given function. It uses the Fast Fourier Transform (FFT) algorithm to perform this calculation. The function takes the time values t and the function values f_t as input. It calculates the frequencies and their corresponding amplitudes.
  3. Setting Parameters: We set the following parameters for our example:
  • T represents the width of the rectangular pulse.
  • duration is the total time duration we want to consider.
  • N is the number of data points to sample.

The program output is shown in the Figure below.

The upper panel shows the square pulse function. The bottom panel its Fourier Integral.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.