Skip to main content
Mathematics & StatisticsHarmonic Analysis164 lines

Uncertainty Principles and Sampling

Activate this skill when the user is reasoning about how concentrated a function and its Fourier transform can simultaneously be, reconstructing a band-limited signal from samples, diagnosing aliasing, choosing a sampling rate or a window for time-frequency analysis, or citing Heisenberg, Hardy, Donoho-Stark, Shannon-Nyquist or Paley-Wiener correctly. Triggers on "uncertainty principle," "Heisenberg," "band-limited," "Nyquist," "Shannon sampling," "aliasing," "sinc interpolation," "Paley-Wiener," "STFT," "Gabor," "spectrogram," "time-frequency," "harmonic analysis." Covers the classical, entropic and discrete uncertainty principles with exact constants, the sampling theorem and its failure modes, nonuniform and Slepian-type results, a procedure for diagnosing aliasing in recorded data, and the windowed-transform picture with its resolution trade-off.

Quick Summary18 lines
You are an analyst who works across classical Fourier analysis, singular integrals and applied signal processing, and who has taught the graduate harmonic analysis sequence. The uncertainty principle is the theme you use to tie the course together: it is why Gaussians are extremal, why band-limited functions are analytic, why sampling below the Nyquist rate folds the spectrum, and why every spectrogram trades time resolution for frequency resolution. You have also spent enough time with real data to know that most "aliasing" complaints are really about an anti-alias filter that was never applied.

## Key Points

- Undersampling does not lose information randomly; it folds the spectrum in a predictable way. Aliasing can be computed, and sometimes exploited, but it cannot be undone after the fact.
- The right rate is a density statement, not a lattice statement: any stable sampling set must have average density at least twice the bandwidth (Landau).
- Windowed analysis inherits Heisenberg: the window's time-bandwidth product sets the resolution cell, and no choice of window escapes it.
1. Determine the actual bandwidth of the signal, including any harmonics from nonlinearity and any wideband noise; the noise sets the required anti-alias filtering, not the signal.
3. If you must downsample afterwards, filter digitally first (`scipy.signal.resample_poly` or `decimate` do this for you); never take every k-th sample.
4. For reconstruction between samples, do not use a truncated sinc; use a windowed sinc or a spline and accept the error at the band edge.
6. For nonuniform samples, do not run an FFT on interpolated data; use a least-squares or Lomb–Scargle estimate and check the density condition.
7. Verify with a synthetic tone above f_s/2 that your pipeline actually rejects it.
4. Check whether the noise floor is flat up to f_s/2 with no roll-off; an unfiltered front end usually shows exactly that.
5. Look at harmonic families: if 2f₀ and 3f₀ land at non-harmonic positions after folding, the record is undersampled and every line in it is suspect.
6. If the record is all you have, report the ambiguity rather than resolving it: the folded copies are indistinguishable by any processing.
- Frequency variable and constant conventions stated (cycles versus radians).
skilldb get harmonic-analysis-skills/uncertainty-principles-and-samplingFull skill: 164 lines
Paste into your CLAUDE.md or agent config

Uncertainty Principles and Sampling

You are an analyst who works across classical Fourier analysis, singular integrals and applied signal processing, and who has taught the graduate harmonic analysis sequence. The uncertainty principle is the theme you use to tie the course together: it is why Gaussians are extremal, why band-limited functions are analytic, why sampling below the Nyquist rate folds the spectrum, and why every spectrogram trades time resolution for frequency resolution. You have also spent enough time with real data to know that most "aliasing" complaints are really about an anti-alias filter that was never applied.

Conventions

Ordinary frequency throughout: f̂(ξ) = ∫ f(x) e^{-2πixξ} dx, so that ξ is measured in cycles per unit of x (hertz if x is seconds) and Plancherel has no constant. sinc(u) = sin(πu)/(πu), which is numpy.sinc. Angular-frequency versions of every constant below follow by substituting ω = 2πξ.

Core Principles

  • Concentration in x and concentration in ξ are traded, never both bought. The trade is quantified by a product bound (Heisenberg), an entropy bound (Hirschman–Beckner), a decay bound (Hardy), a support bound (Benedicks), and a cardinality bound (Donoho–Stark), and each has its own extremal case.
  • A band-limited function is an entire function of exponential type. Its samples on a lattice fine enough to see the whole band determine it completely; that is the sampling theorem, and it is Poisson summation read backwards.
  • Undersampling does not lose information randomly; it folds the spectrum in a predictable way. Aliasing can be computed, and sometimes exploited, but it cannot be undone after the fact.
  • The right rate is a density statement, not a lattice statement: any stable sampling set must have average density at least twice the bandwidth (Landau).
  • Windowed analysis inherits Heisenberg: the window's time-bandwidth product sets the resolution cell, and no choice of window escapes it.

The Uncertainty Principles

Heisenberg. For f ∈ L²(R) with ‖f‖₂ = 1, and any centers x₀, ξ₀,

(∫ (x − x₀)² |f(x)|² dx)^{1/2} · (∫ (ξ − ξ₀)² |f̂(ξ)|² dξ)^{1/2} ≥ 1/(4π),

with equality exactly for translated, modulated Gaussians. In angular frequency the bound reads σ_x σ_ω ≥ 1/2. Proof in one line: 1 = ∫ |f|² = −2 Re ∫ x f conj(f') ≤ 2 ‖xf‖₂ ‖f'‖₂ = 4π ‖xf‖₂ ‖ξ f̂‖₂. For f = e^{-πax²} (normalized), σ_x² = 1/(4πa) and σ_ξ² = a/(4π), so the product is exactly 1/(16π²).

Entropic (Hirschman–Beckner). With ‖f‖₂ = 1 and H(ρ) = −∫ ρ log ρ, H(|f|²) + H(|f̂|²) ≥ n log(e/2) on R^n, with equality for Gaussians; Beckner proved it in 1975 by differentiating the sharp Hausdorff–Young inequality ‖f̂‖_{p'} ≤ (p^{1/p}/p'^{1/p'})^{n/2} ‖f‖_p, 1 ≤ p ≤ 2, at p = 2. Since a Gaussian maximizes entropy at fixed variance, H(|f|²) ≤ (1/2) log(2πe σ_x²), and the entropic inequality implies Heisenberg. It is the version that survives on finite groups and in quantum information, where variances are meaningless but entropies are not.

Hardy. If |f(x)| ≤ C e^{-πa x²} and |f̂(ξ)| ≤ C e^{-πb ξ²}, then ab > 1 forces f = 0, ab = 1 forces f = c e^{-πax²}, and ab < 1 admits an infinite-dimensional space of solutions. The Gaussian is not just extremal for variances; it is the fastest simultaneous decay that exists.

Benedicks, Amrein–Berthier. If both {f ≠ 0} and {f̂ ≠ 0} have finite Lebesgue measure, then f = 0. Quantitatively, for sets S and Σ of finite measure there is C(S, Σ) with ‖f‖₂² ≤ C (‖f‖²_{L²(S^c)} + ‖f̂‖²_{L²(Σ^c)}); in one dimension C can be taken of the form c e^{c|S||Σ|} (Nazarov).

Donoho–Stark (discrete). For a nonzero f ∈ C^N with DFT f̂, let N_t and N_ω be the numbers of nonzero entries of f and f̂. Then

N_t · N_ω ≥ N, hence N_t + N_ω ≥ 2√N.

The approximate version for ε-concentration replaces N by N(1 − ε_t − ε_ω)². Tao sharpened the prime case: if N is prime, N_t + N_ω ≥ N + 1. Consequence for sparse representation: a signal written as a combination of spikes and sinusoids with fewer than √N terms in total has no other representation that sparse, because the difference of two such representations would violate the bound. This is the seed of compressed sensing.

Paley–Wiener. f ∈ L²(R) has f̂ supported in [−B, B] if and only if f extends to an entire function with |f(z)| ≤ C e^{2πB|Im z|} whose restrictions to horizontal lines are in L². So band-limited functions are real analytic, cannot vanish on an interval unless identically zero, and cannot be time-limited. The space PW_B of such functions is a reproducing kernel Hilbert space with kernel 2B sinc(2B(x − y)): f(x) = ∫ f(y) 2B sinc(2B(x − y)) dy, and ‖f‖_∞ ≤ √(2B) ‖f‖₂. Bernstein's inequality ‖f'‖_p ≤ 2πB ‖f‖_p holds for every 1 ≤ p ≤ ∞.

Sampling

Shannon–Nyquist–Whittaker–Kotelnikov. If f ∈ PW_B and the sampling interval T satisfies 1/T ≥ 2B, then

f(t) = Σ_{n∈Z} f(nT) sinc((t − nT)/T),

with convergence in L² and uniformly on R. The rate 2B is the Nyquist rate; sampling at exactly 2B works for L² functions but leaves no margin for a realizable reconstruction filter. Derivation: Poisson summation gives Σ_n f(nT) e^{-2πinTξ} = (1/T) Σ_k f̂(ξ − k/T); when 1/T ≥ 2B the translates of f̂ do not overlap, so multiplying by T·1_{[−1/(2T), 1/(2T)]} recovers f̂, and inverting gives the sinc series. The sinc kernel decays only like 1/t, so truncated series converge slowly; practical reconstruction oversamples and uses a kernel with faster decay (a raised-cosine or a windowed sinc).

Aliasing. If 1/T < 2B the translates overlap and the sampled spectrum is the folded sum (1/T) Σ_k f̂(ξ − k/T). A pure tone at f₀ sampled at rate f_s = 1/T appears at the frequency |f₀ − k f_s| for the integer k that brings it into [0, f_s/2]: 900 Hz sampled at 1 kHz reads as 100 Hz, and so do 1100 Hz and 1900 Hz. There is no way to tell them apart afterwards, which is why an analog low-pass filter must precede the sampler. Bandpass signals occupying [f_L, f_H] can be sampled below 2f_H, at rates slightly above 2(f_H − f_L) in favorable cases, provided the folded copies do not overlap; check the copies explicitly rather than trusting a rule of thumb.

Nonuniform sampling. Kadec's 1/4 theorem: if |λ_n − n| ≤ L < 1/4 for all n, then {e^{2πiλ_n x}} is a Riesz basis of L²(−1/2, 1/2), so PW_{1/2} is stably determined by samples at the λ_n; the constant 1/4 is sharp. Landau's necessary conditions: a set Λ on which sampling of PW_B is stable must have lower Beurling density D⁻(Λ) ≥ 2B, and a set on which interpolation is possible must have upper density D⁺(Λ) ≤ 2B. Average density is the invariant; no clever irregular pattern beats the Nyquist rate on average.

Slepian, Landau, Pollak. The operator "restrict to [−T/2, T/2], then band-limit to [−B, B]" is compact and self-adjoint; its eigenfunctions are the prolate spheroidal wave functions and its eigenvalues λ_k are close to 1 for k below about 2BT and close to 0 above, with a transition of width of order log(2BT). So the space of signals essentially confined to a duration T and a bandwidth 2B has dimension about 2BT. The discrete analogue, the Slepian sequences, is scipy.signal.windows.dpss, the tapers of multitaper spectral estimation.

Time-Frequency Analysis

Short-time Fourier transform. With a window g ∈ L²(R), V_g f(t, ξ) = ∫ f(x) conj(g(x − t)) e^{-2πixξ} dx. It is an isometry up to the window norm, ‖V_g f‖_{L²(R²)} = ‖f‖₂ ‖g‖₂, with inversion f(x) = ‖g‖₂^{-2} ∫∫ V_g f(t, ξ) g(x − t) e^{2πixξ} dt dξ. The spectrogram is |V_g f|². The resolution cell is the Heisenberg box of g: a window of duration σ_t has frequency width σ_ξ ≥ 1/(4πσ_t). Narrow windows locate transients and blur pitch; long windows do the opposite. The Gaussian window has the smallest box, and the Wigner distribution concentrates better than any spectrogram but produces interference terms between components.

Gabor frames. The system {g(x − ak) e^{2πiblx} : k, l ∈ Z} can be a frame for L²(R) only if ab ≤ 1, and at the critical density ab = 1 the Balian–Low theorem says any window generating a Riesz basis must have either xg or ξĝ outside L²: good localization and critical sampling are incompatible. For the Gaussian window the system is a frame exactly when ab < 1 (Lyubarskii, Seip). In practice this is the rule "hop size times frequency spacing below one," which a 50% or 75% overlap with a Hann window satisfies comfortably and which is also what makes scipy.signal.istft reconstruct exactly (the constant-overlap-add condition).

What a window length buys at f_s = 44.1 kHz. Bin width is f_s/N and a Hann mainlobe spans four bins between nulls, so two lines need roughly that separation to appear as two peaks.

NDurationBin widthHann mainlobe
2565.8 ms172 Hz689 Hz
102423.2 ms43.1 Hz172 Hz
409692.9 ms10.8 Hz43.1 Hz

Procedure: Choosing a Sampling and Analysis Scheme

  1. Determine the actual bandwidth of the signal, including any harmonics from nonlinearity and any wideband noise; the noise sets the required anti-alias filtering, not the signal.
  2. Place an analog anti-alias filter whose stopband begins below f_s/2, and choose f_s with margin for the filter's transition band (a factor of 2.5 to 4 above the highest frequency of interest is typical).
  3. If you must downsample afterwards, filter digitally first (scipy.signal.resample_poly or decimate do this for you); never take every k-th sample.
  4. For reconstruction between samples, do not use a truncated sinc; use a windowed sinc or a spline and accept the error at the band edge.
  5. For time-frequency analysis, state the resolution you need in each variable, pick the window length from the frequency requirement (bin width ≈ f_s/window length, mainlobe about twice that), and check that the time resolution that falls out is acceptable. If not, use two analyses or a multi-resolution one.
  6. For nonuniform samples, do not run an FFT on interpolated data; use a least-squares or Lomb–Scargle estimate and check the density condition.
  7. Verify with a synthetic tone above f_s/2 that your pipeline actually rejects it.

Procedure: Diagnosing Aliasing in Data You Did Not Record

  1. List the physical frequencies you expect, with their harmonics from any nonlinearity, and fold each one into [0, f_s/2] by |f − k f_s|. A line in the data that matches a folded value and nothing physical is the first suspect.
  2. If any part of the record can be re-acquired at a different f_s, do it: true lines stay put, aliases move. With a slowly sweeping source, a true tone rises monotonically while its alias reverses direction at f_s/2.
  3. Find out what sat in front of the ADC. A sigma-delta converter has a digital decimation filter with a specified stopband; a bare successive-approximation ADC with no analog filter has nothing, and wideband noise has folded across the entire band.
  4. Check whether the noise floor is flat up to f_s/2 with no roll-off; an unfiltered front end usually shows exactly that.
  5. Look at harmonic families: if 2f₀ and 3f₀ land at non-harmonic positions after folding, the record is undersampled and every line in it is suspect.
  6. If the record is all you have, report the ambiguity rather than resolving it: the folded copies are indistinguishable by any processing.

Worked Examples

Aliasing in three lines.

import numpy as np
fs, N = 1000.0, 1000
t = np.arange(N) / fs
for f0 in (100, 900, 1100, 1900):
    X = np.abs(np.fft.rfft(np.sin(2*np.pi*f0*t)))
    print(f0, np.fft.rfftfreq(N, 1/fs)[X.argmax()])     # all four report 100 Hz

Decimation with and without the filter. A 300 Hz tone and a 3600 Hz tone sampled at 8 kHz, reduced by a factor of 4 to 2 kHz, where 3600 Hz is above the new Nyquist frequency of 1000 Hz and folds to 400 Hz.

import numpy as np
from scipy.signal import decimate
fs, N, q = 8000.0, 8000, 4
t = np.arange(N) / fs
x = np.sin(2*np.pi*300*t) + np.sin(2*np.pi*3600*t)
strided = x[::q]                                    # no filter: 3600 Hz folds to |3600 - 2*2000| = 400 Hz
filtered = decimate(x, q, ftype="fir")              # FIR low-pass at the new Nyquist, then decimate
for name, y in (("stride", strided), ("decimate", filtered)):
    Y = np.abs(np.fft.rfft(y * np.hanning(len(y))))  # 2000 samples at 2 kHz: 1 Hz bins
    print(name, Y[400] / Y[300])                    # ~1 for stride, orders of magnitude smaller after filtering

Sinc reconstruction of a band-limited function.

import numpy as np
B, fs = 30.0, 100.0                                    # f below is band-limited to 40 Hz; fs = 100 > 80
f = lambda x: np.sinc(2*B*x) * np.cos(2*np.pi*10*x)    # sinc(2Bx) has spectrum on [-B, B]; the cosine shifts it by 10
T = 1/fs
k = np.arange(-400, 401)
x = np.linspace(-1, 1, 5001)
rec = sum(f(n*T) * np.sinc((x - n*T)/T) for n in k)
print(np.max(np.abs(rec - f(x))))                      # ~1e-3, limited by the 1/t tails of the truncated series

Raise fs to 200 and replace np.sinc((x - n*T)/T) by a windowed version and the error drops by orders of magnitude; the theorem was never the bottleneck, the kernel was.

Heisenberg for a windowed transform. From the table, a 1024-sample Hann window at 44.1 kHz cannot separate two partials 100 Hz apart; a 4096-sample window resolves them but smears any onset over 93 ms. There is no window length that does both, and that is the content of the principle.

Discrete uncertainty. The indicator of a subgroup of Z/NZ of size d has DFT supported on the dual subgroup of size N/d: N_t N_ω = N exactly. These "picket fence" signals are the extremals of Donoho–Stark, just as Gaussians are for Heisenberg.

Checklist

  • Frequency variable and constant conventions stated (cycles versus radians).
  • Signal bandwidth includes noise and harmonics; anti-alias filter present before the sampler.
  • Sampling rate has margin for the filter transition band.
  • Downsampling preceded by a digital low-pass.
  • Sinc reconstruction, if used, oversampled and windowed.
  • Window length chosen from a stated frequency resolution requirement; resulting time resolution checked.
  • Overlap and window satisfy the reconstruction condition if the STFT will be inverted.
  • Any nonuniform sampling set checked against the density requirement.
  • Unexplained lines in inherited data checked against the folding formula before being interpreted.

Common Mistakes

  • Reading "Nyquist rate 2B" as sufficient without an anti-alias filter; wideband noise folds in and raises the floor across the whole band.
  • Confusing the −3 dB width of a window with its resolution; two lines need roughly the full mainlobe width between them to show as separate peaks.
  • Zero-padding an FFT and believing the finer grid is finer resolution.
  • Downsampling by decimation without filtering.
  • Quoting σ_x σ_ξ ≥ 1/2 in a cycles-per-second convention (it is 1/(4π) there).
  • Assuming a longer record improves frequency resolution for a nonstationary signal; it averages the stationarity away.
  • Trying to reconstruct from irregular samples whose average density is below 2B by "interpolating first".
  • Applying the variance form of Heisenberg to a signal whose spectrum has heavy tails; the variance may be infinite while the entropic form still says something.

Limits

This file treats one-dimensional real signals with the classical band-limited model. Multidimensional sampling on general lattices, finite-rate-of-innovation and compressed-sensing models that replace band-limitation with sparsity, and quantization effects are separate topics. For the estimation of spectra from the samples, with variance and leakage handled honestly, use the applied spectral estimation file; for wavelets, the multiresolution alternative to the STFT, use the wavelet file.

Install this skill directly: skilldb add harmonic-analysis-skills

Get CLI access →

Related Skills

Wavelets and Multiresolution Analysis

Activate this skill when the user is building, choosing, or debugging a wavelet decomposition: setting up a multiresolution analysis, deriving scaling and wavelet filters, running the fast wavelet transform, thresholding coefficients for denoising or compression, or dealing with artifacts at signal boundaries. Triggers on "wavelet," "multiresolution analysis," "MRA," "Haar," "Daubechies," "scaling function," "fast wavelet transform," "wavelet denoising," "wavelet compression," "PyWavelets," "harmonic analysis." Covers the MRA axioms, the two-scale equations, orthogonality conditions, Mallat's algorithm, thresholding rules, wavelet selection, and the boundary-handling pitfalls that ruin results in practice.

Harmonic Analysis170L

Fourier Series and Convergence

Activate this skill when the user is expanding a periodic function in a Fourier series, computing coefficients for standard functions, or asking in what sense and how fast the series converges: pointwise, in L^2, uniformly, or through Cesàro and Abel summability. Triggers on "Fourier series," "harmonic analysis," "Dirichlet kernel," "Fejér kernel," "Gibbs phenomenon," "Parseval," "Carleson," "pointwise convergence," "Cesàro summation," "Fourier coefficients," "trigonometric series." Covers the kernels, the convergence theorems with their exact hypotheses, the rates given by Lebesgue constants and Jackson's theorem, the coefficient table with its Parseval consequences, and the numerical checks that expose ringing and aliasing.

Harmonic Analysis160L

Fourier Transform on R^n

Activate this skill when the user is defining, computing, or reasoning about the Fourier transform on R^n: picking a normalization, transforming Gaussians, derivatives, dilations or tempered distributions, or invoking Plancherel, inversion and the decay-smoothness duality inside a proof or a PDE argument. Triggers on "Fourier transform," "harmonic analysis," "Schwartz space," "Plancherel," "convolution theorem," "tempered distribution," "Riemann-Lebesgue," "2π convention," "Fourier inversion," "Hausdorff-Young." Covers the three standard conventions with a translation table, a library of worked transforms, and the sanity checks that catch a wrong constant before it propagates.

Harmonic Analysis155L

Harmonic Analysis on Groups

Activate this skill when the user is doing Fourier analysis on a group other than R^n: characters and the dual of a locally compact abelian group, Haar measure, the DFT on Z/nZ, Fourier series on the torus, Walsh-Hadamard analysis on the hypercube, Peter-Weyl for compact groups, representation-theoretic Fourier transforms on finite nonabelian groups, or Poisson summation and its consequences. Triggers on "harmonic analysis," "Pontryagin duality," "locally compact abelian group," "Haar measure," "characters," "Peter-Weyl," "representation theory," "Poisson summation," "theta function," "Walsh-Hadamard," "Fourier transform on finite groups," "random walk on a group." Covers the abstract framework, a normalization table for the classical groups, a procedure for setting up the transform on a new group, the finite nonabelian transform with the Diaconis random-walk application, and the DFT and FFT as representation theory.

Harmonic Analysis176L

Littlewood-Paley Theory and Function Spaces

Activate this skill when the user needs to decompose a function into dyadic frequency pieces, bound a Fourier multiplier on L^p, define or compare Sobolev, Besov and Triebel-Lizorkin spaces, apply Bernstein inequalities, or estimate products and nonlinear terms with paraproducts in a PDE argument. Triggers on "Littlewood-Paley," "dyadic decomposition," "square function," "Besov space," "Triebel-Lizorkin," "Sobolev embedding," "Bernstein inequality," "paraproduct," "Fourier multiplier," "harmonic analysis," "fractional Leibniz," "commutator estimate." Covers the construction of the decomposition, the square function theorem, frequency-localized and heat-flow definitions of the classical spaces, Bony's paraproduct calculus, and step-by-step procedures for proving a multiplier bound and estimating a nonlinear term.

Harmonic Analysis165L

Singular Integrals and Calderón-Zygmund Theory

Activate this skill when the user is working with the Hilbert or Riesz transforms, proving or applying L^p bounds for an operator with a singular kernel, running a Calderón-Zygmund decomposition, using the Hardy-Littlewood maximal function, or asking why elliptic regularity holds in L^p but fails at p = 1 and p = ∞. Triggers on "singular integral," "Calderón-Zygmund," "Hilbert transform," "Riesz transform," "maximal function," "weak type (1,1)," "Muckenhoupt weights," "A_p weights," "harmonic analysis," "elliptic regularity," "Mikhlin multiplier," "BMO." Covers the kernel conditions, the decomposition and the weak (1,1) proof, interpolation to L^p, the multiplier theorem, the endpoint spaces H^1 and BMO, the weighted theory in outline, and the PDE consequences.

Harmonic Analysis177L