Mode of #cas

fourierTransform

The Fourier transform of a Gaussian in Mathlib’s convention, with a theorem for every frequency.

#cas [fourierTransform x ξ] f
gives the Fourier transform of the Gaussian f as a function of ξ, in Mathlib’s convention, and proves it for every real ξ.

fourierTransform computes the transform of a Gaussian ce−αx2+βx+γ. It covers those and nothing else. Conventions for the Fourier transform differ by factors of 2π from one book to the next, and the first thing to know is which one you are getting. Here it is Mathlib’s, ℱf(ξ)=∫ℝe−2πixξf(x)dx, the one Mathematica uses with FourierParameters -> {0, -2 Pi}. The theorem is about FourierTransform.fourier of f as a complex function, for every real ξ.

The computation is the one from a first course, completing the square, which gives cπ/αeβ2/(4α)+γ−π2ξ2/α, times the phase e−iπβξ/α when β≠0.

Details and Options

  • For the printed F, the theorem is ∀ ξ : ℝ, FourierTransform.fourier (fun x : ℝ ↦ (f : ℂ)) ξ = F, with f as written. In Mathlib, 𝓕 f ξ = ∫ x, exp (-2 * π * I * x * ξ) * f x.
  • f is c * exp (-α * x ^ 2 + β * x + γ) with rational c ≠ 0, α > 0, β and γ. The exponent may be written in any form, such as -(x - 1) ^ 2, as long as it is a polynomial of degree 2 in x.
  • The transform is c * √(π / α) * exp (β ^ 2 / (4 * α) + γ - π ^ 2 * ξ ^ 2 / α) times the phase exp (-(π * β * ξ / α) * I), which is left out when β = 0. With α = a / b in lowest terms, the root is printed sqrt(b*pi/a).
  • Parameters, π among them, are refused, and so are products with other functions. The command is also refused inside a section with variables.
  • There are no options. A proof can take the printed theorem as a hypothesis and evaluate it, as under Applications.

Examples (14)#

Basic Examples (2)

The transform of e−x2, with the theorem for every real ξ:

In[1]:=
#cas [fourierTransform x ξ] (exp (-x ^ 2))
Out[1]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

πe−π2ξ2
sqrt(pi)*exp(-(pi^2*ξ^2))
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-x ^ 2))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2))) ξ = ↑(√Real.pi * Real.exp (-(Real.pi ^ 2 * ξ ^ 2)))
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2))) ξ = ↑(√Real.pi * Real.exp (-(Real.pi ^ 2 * ξ ^ 2)))

    Checked by Lean’s kernel


A linear term in the exponent gives a phase, and completing the square gives the factor e1:

In[2]:=
#cas [fourierTransform x ξ] (3 * exp (-(x ^ 2) + 2 * x))
Out[2]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

3πe1−π2ξ2e−(2πξ)i
3*sqrt(pi)*exp(1 - pi^2*ξ^2)*exp(-(2*pi*ξ)*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(3 * exp (-(x ^ 2) + 2 * x))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(3 * Real.exp (-x ^ 2 + 2 * x))) ξ =
    ↑(3 * √Real.pi * Real.exp (1 - Real.pi ^ 2 * ξ ^ 2)) * Complex.exp (-↑(2 * (Real.pi * ξ)) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(3 * Real.exp (-x ^ 2 + 2 * x))) ξ =
        ↑(3 * √Real.pi * Real.exp (1 - Real.pi ^ 2 * ξ ^ 2)) * Complex.exp (-↑(2 * (Real.pi * ξ)) * Complex.I)

    Checked by Lean’s kernel

Scope (2)

Rational α, β and γ, and a negative coefficient. For α=3/2 the root is printed sqrt(2*pi/3):

In[3]:=
#cas [fourierTransform x ξ] (-2 * exp (-(3 / 2) * x ^ 2 - x / 3 + 1))
Out[3]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

−22π3e5554−23π2ξ2e29πξi
-2*sqrt(2*pi/3)*exp(55/54 - 2/3*pi^2*ξ^2)*exp(2/9*pi*ξ*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(-2 * exp (-(3 / 2) * x ^ 2 - x / 3 + 1))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(-2 * Real.exp (-(3 / 2) * x ^ 2 - x / 3 + 1))) ξ =
    ↑(-2 * √(2 * Real.pi / 3) * Real.exp (55 / 54 - 2 / 3 * (Real.pi ^ 2 * ξ ^ 2))) *
      Complex.exp (↑(2 / 9 * (Real.pi * ξ)) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(-2 * Real.exp (-(3 / 2) * x ^ 2 - x / 3 + 1))) ξ =
        ↑(-2 * √(2 * Real.pi / 3) * Real.exp (55 / 54 - 2 / 3 * (Real.pi ^ 2 * ξ ^ 2))) *
          Complex.exp (↑(2 / 9 * (Real.pi * ξ)) * Complex.I)

    Checked by Lean’s kernel


For α=5/7 the root is sqrt(7*pi/5), and the coefficient -1 * comes out as a sign:

In[4]:=
#cas [fourierTransform x ξ] (-1 * exp (-(5 / 7) * x ^ 2 + 2 * x - 1))
Out[4]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

−(7π5e25−75π2ξ2)e−(145πξ)i
-(sqrt(7*pi/5)*exp(2/5 - 7/5*pi^2*ξ^2))*exp(-(14/5*pi*ξ)*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(-1 * exp (-(5 / 7) * x ^ 2 + 2 * x - 1))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(-1 * Real.exp (-(5 / 7) * x ^ 2 + 2 * x - 1))) ξ =
    ↑(-(√(7 * Real.pi / 5) * Real.exp (2 / 5 - 7 / 5 * (Real.pi ^ 2 * ξ ^ 2)))) *
      Complex.exp (-↑(14 / 5 * (Real.pi * ξ)) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(-1 * Real.exp (-(5 / 7) * x ^ 2 + 2 * x - 1))) ξ =
        ↑(-(√(7 * Real.pi / 5) * Real.exp (2 / 5 - 7 / 5 * (Real.pi ^ 2 * ξ ^ 2)))) *
          Complex.exp (-↑(14 / 5 * (Real.pi * ξ)) * Complex.I)

    Checked by Lean’s kernel

Applications (1)

The printed theorem as a hypothesis in a proof, evaluated at ξ=0. Only the three standard axioms are used:

In[5]:=
theorem fourierTransform_at_zero
    (h : ∀ ξ : ℝ, FourierTransform.fourier (fun x : ℝ ↦ ((Real.exp (-x ^ 2) : ℝ) : ℂ)) ξ =
      ((√Real.pi * Real.exp (-(Real.pi ^ 2 * ξ ^ 2)) : ℝ) : ℂ)) :
    FourierTransform.fourier (fun x : ℝ ↦ ((Real.exp (-x ^ 2) : ℝ) : ℂ)) 0 = (√Real.pi : ℂ) := by
  rw [h 0]
  simp

#print axioms fourierTransform_at_zero
Out[5]=

fourierTransform_at_zero depends on the axioms propext, Classical.choice, Quot.sound.

Properties and Relations (4)

Shifting f by 1 multiplies the transform by the phase e−2πiξ. Compare the transform of e−x2 under Basic Examples:

In[6]:=
#cas [fourierTransform x ξ] (exp (-(x - 1) ^ 2))
Out[6]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

πe−π2ξ2e−(2πξ)i
sqrt(pi)*exp(-(pi^2*ξ^2))*exp(-(2*pi*ξ)*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-(x - 1) ^ 2))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(Real.exp (-(x - 1) ^ 2))) ξ =
    ↑(√Real.pi * Real.exp (-(Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (-↑(2 * (Real.pi * ξ)) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(Real.exp (-(x - 1) ^ 2))) ξ =
        ↑(√Real.pi * Real.exp (-(Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (-↑(2 * (Real.pi * ξ)) * Complex.I)

    Checked by Lean’s kernel


Reflecting f in x=0 reflects the transform. These two Gaussians are mirror images, and their phases are conjugate:

In[7]:=
#cas [fourierTransform x ξ] (exp (-(x ^ 2) / 2 + x / 2))
Out[7]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

2πe18−2π2ξ2e−(πξ)i
sqrt(2*pi)*exp(1/8 - 2*pi^2*ξ^2)*exp(-(pi*ξ)*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-(x ^ 2) / 2 + x / 2))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2 + x / 2))) ξ =
    ↑(√(2 * Real.pi) * Real.exp (1 / 8 - 2 * (Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (-↑(Real.pi * ξ) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2 + x / 2))) ξ =
        ↑(√(2 * Real.pi) * Real.exp (1 / 8 - 2 * (Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (-↑(Real.pi * ξ) * Complex.I)

    Checked by Lean’s kernel

In[8]:=
#cas [fourierTransform x ξ] (exp (-(x ^ 2) / 2 - x / 2))
Out[8]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

2πe18−2π2ξ2eπξi
sqrt(2*pi)*exp(1/8 - 2*pi^2*ξ^2)*exp(pi*ξ*i)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-(x ^ 2) / 2 - x / 2))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2 - x / 2))) ξ =
    ↑(√(2 * Real.pi) * Real.exp (1 / 8 - 2 * (Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (↑(Real.pi * ξ) * Complex.I)
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2 - x / 2))) ξ =
        ↑(√(2 * Real.pi) * Real.exp (1 / 8 - 2 * (Real.pi ^ 2 * ξ ^ 2))) * Complex.exp (↑(Real.pi * ξ) * Complex.I)

    Checked by Lean’s kernel


A narrower Gaussian has a wider transform. For α=3 it is π/3e−π2ξ2/3, here with a minus sign:

In[9]:=
#cas [fourierTransform x ξ] (-exp (-3 * x ^ 2))
Out[9]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

−π3e−13π2ξ2
-(sqrt(pi/3)*exp(-(1/3*pi^2*ξ^2)))
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(-exp (-3 * x ^ 2))

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(-Real.exp (-3 * x ^ 2))) ξ =
    ↑(-(√(Real.pi / 3) * Real.exp (-(1 / 3 * (Real.pi ^ 2 * ξ ^ 2)))))
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(-Real.exp (-3 * x ^ 2))) ξ =
        ↑(-(√(Real.pi / 3) * Real.exp (-(1 / 3 * (Real.pi ^ 2 * ξ ^ 2)))))

    Checked by Lean’s kernel


At ξ=0 the transform is the integral of f over ℝ. An antiderivative of e−x2 is π2erfx, with erf, and erfx→±1 as x→±∞, so the integral is π:

In[10]:=
#cas [integrate x] (exp (-x ^ 2))
Out[10]=

antiderivative (with the interval integrals)

12πerf(x)
1/2*sqrt(pi)*erf(x)
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-x ^ 2))

Checked by Lean’s kernel: Integral of the input

∀ (a b : ℝ),
  ∫ (x : ℝ) in a..b, Real.exp (-x ^ 2) = 1 / 2 * √Real.pi * CAS.erf b - 1 / 2 * √Real.pi * CAS.erf a

from CAS.integral_gaussian_eq

The certificate: 2 checked steps
  1. Integral of the input

    ∀ (a b : ℝ),
      ∫ (x : ℝ) in a..b, Real.exp (-x ^ 2) = 1 / 2 * √Real.pi * CAS.erf b - 1 / 2 * √Real.pi * CAS.erf a

    Checked by Lean’s kernel · CAS.integral_gaussian_eq

  2. Derivative of the primitive

    ∀ (x : ℝ), HasDerivAt (fun x ↦ 1 / 2 * √Real.pi * CAS.erf x) (Real.exp (-x ^ 2)) x

    Checked by Lean’s kernel · CAS.hasDerivAt_gaussianPrimitive

Possible Issues (4)

The coefficients are rational, so π in the exponent is refused. Mathlib’s theorem fourier_gaussian_pi gives the transform of exp (-π * b * x ^ 2):

In[11]:=
#cas [fourierTransform x ξ] (exp (-pi * x ^ 2))
Out[11]=

Error

fourierTransform: expected c * exp (-α x ^ 2 + β x + γ) with rational c, α, β, γ and α > 0 (parameters are not supported)

The Gaussian must decay. ex2 is not integrable, and the input is refused:

In[12]:=
#cas [fourierTransform x ξ] (exp (x ^ 2))
Out[12]=

Error

fourierTransform: expected c * exp (-α x ^ 2 + β x + γ) with rational c, α, β, γ and α > 0 (parameters are not supported)

A product with another function is refused, here with cosx:

In[13]:=
#cas [fourierTransform x ξ] (exp (-x ^ 2) * cos x)
Out[13]=

Error

fourierTransform: expected c * exp (-α x ^ 2 + β x + γ) with rational c, α, β, γ and α > 0 (parameters are not supported)

The two variables must be different:

In[14]:=
#cas [fourierTransform x x] (exp (-x ^ 2))
Out[14]=

Error

fourierTransform: the variables x and ξ must be different

Neat Examples (1)

The function e−x2/2/2 is 2π/2 times the density of the standard normal distribution. Without that factor, the transform is e−2π2ξ2, the characteristic function e−t2/2 of the distribution at t=2πξ:

In[15]:=
#cas [fourierTransform x ξ] (exp (-(x ^ 2) / 2) / 2)
Out[15]=

Fourier transform 𝓕 f ξ = ∫ e ^ (-2 π i x ξ) f x dx (Mathlib)

122πe−2π2ξ2
1/2*sqrt(2*pi)*exp(-(2*pi^2*ξ^2))
Input (c e ^ (-α x ^ 2 + β x + γ), α > 0)
(exp (-(x ^ 2) / 2) / 2)

Checked by Lean’s kernel: Fourier transform

∀ (ξ : ℝ),
  FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2) / 2)) ξ =
    ↑(1 / 2 * √(2 * Real.pi) * Real.exp (-(2 * (Real.pi ^ 2 * ξ ^ 2))))
The certificate: 1 checked step
  1. Fourier transform

    ∀ (ξ : ℝ),
      FourierTransform.fourier (fun x ↦ ↑(Real.exp (-x ^ 2 / 2) / 2)) ξ =
        ↑(1 / 2 * √(2 * Real.pi) * Real.exp (-(2 * (Real.pi ^ 2 * ξ ^ 2))))

    Checked by Lean’s kernel

See Also

laplace · fourier · integrate · erf