Home / Docs-Technical WhitePaper / 09-EFT.WP.Core.Density v1.0
Appendix C — Kernel and Window Library (Density Volume)
I. Scope and Unified Notation
- This appendix standardizes kernel functions K(u) (for kde_h(x), see S92-5, S92-6) and discrete spectral windows w[n] (for S_xx(f), see S92-8, S92-9): definitions, common properties, and quick-reference constants. All symbols follow the volume-wide conventions and registry.
- Kernel convention (1D primitive)
∫ K(u) du = 1, K(u) ≥ 0. Symmetric kernels satisfy K(u) = K(-u). The second raw moment is mu2(K) = ( ∫ u^2 K(u) du ), and roughness is R(K) = ( ∫ K(u)^2 du ). In d-dimensional isotropic form,
kde_h(x) = ( 1 / (N h^d) ) * ∑ K( ||x - x_i|| / h ); for anisotropy see Section III. - Window convention (length N, sampling rate fs)
w[n] is defined for n = 0,1,...,N-1. Window power U_w = ( 1 / N ) * ∑_0^{N-1} w[n]^2 (see S92-9); equivalent noise bandwidth ENBW_Hz = fs * ( ∑ w[n]^2 ) / ( ∑ w[n] )^2 (see S92-8); coherent gain CG = ( ∑ w[n] ) / N. In “bin” units, ENBW_bins = U_w / CG^2.
II. Kernel Catalogue (1D, symmetric, normalized)
- Gaussian (unbounded support)
- Definition: K(u) = ( 1 / sqrt(2*pi) ) * exp( - u^2 / 2 )
- Support: u ∈ (-∞, +∞); maximum smoothness
- Constants: mu2(K) = 1, R(K) = 1 / ( 2 * sqrt(pi) ) ≈ 0.282094
- Note: neutral baseline in AMISE analysis; Scott bandwidth in d dims in Section III.
- Epanechnikov (compact support)
- Definition: K(u) = ( 3 / 4 ) * ( 1 - u^2 ) * 1{|u| ≤ 1}
- Constants: mu2(K) = 1/5 = 0.2, R(K) = 3/5 = 0.6
- Note: AMISE-optimal among compact, symmetric, second-order kernels with fixed mu2.
- Uniform / Rectangular (compact support)
- Definition: K(u) = ( 1 / 2 ) * 1{|u| ≤ 1}
- Constants: mu2(K) = 1/3 ≈ 0.333333, R(K) = 1/2 = 0.5
- Note: boundary-friendly interpretation; least smooth estimates.
- Triangular (compact support)
- Definition: K(u) = ( 1 - |u| ) * 1{|u| ≤ 1}
- Constants: mu2(K) = 1/6 ≈ 0.166667, R(K) = 2/3 ≈ 0.666667
- Biweight / Quartic (compact support)
- Definition: K(u) = ( 15 / 16 ) * ( 1 - u^2 )^2 * 1{|u| ≤ 1}
- Constants: mu2(K) = 1/7 ≈ 0.142857, R(K) = 5/7 ≈ 0.714286
- Triweight (compact support)
- Definition: K(u) = ( 35 / 32 ) * ( 1 - u^2 )^3 * 1{|u| ≤ 1}
- Constants: mu2(K) = 1/9 ≈ 0.111111, R(K) = 350/429 ≈ 0.815851
- Cosine (compact support)
- Definition: K(u) = ( pi / 4 ) * cos( ( pi / 2 ) * u ) * 1{|u| ≤ 1}
- Constants: mu2(K) ≈ 0.18943, R(K) ≈ 0.61685
- Laplace / Double-Exponential (unbounded support)
- Definition: K(u) = ( 1 / 2 ) * exp( - |u| )
- Constants: mu2(K) = 2, R(K) = 1/4 = 0.25
- Note: heavier tails; AMISE suggests shrinking h to temper variance.
- Quick AMISE guide (1D, twice-differentiable target)
AMISE(h) ≈ ( R(K) / ( N * h ) ) + ( ( mu2(K)^2 / 4 ) * h^4 * R( f'' ) ) * c_dim, with c_dim = 1 (1D) and R(f'') = ( ∫ ( f''(x) )^2 dx ). The optimal h* balances the two terms (see Chapter 4 and Mx-93).
III. Multivariate Kernels and Bandwidth Matrices
- Isotropic: kde_h(x) = ( 1 / ( N * h^d ) ) * ∑ K( ||x - x_i|| / h ).
- Anisotropic (SPD bandwidth H):
kde_H(x) = ( 1 / ( N * |H|^{1/2} ) ) * ∑ K( || H^{-1/2} * ( x - x_i ) || ). - Scott rule: H_scott = h_scott^2 * Sigma, h_scott = ( 4 / ( d + 2 ) )^{ 1 / ( d + 4 ) } * N^{ -1 / ( d + 4 ) }, with Sigma the sample covariance.
- Silverman (1D): h_silverman = 0.9 * min( sigma, IQR / 1.34 ) * N^{-1/5}.
- Implementation note: in kde_build(..., kernel:str, h:float|H:matrix) report K(•), h, and the selection score CV(h) (see I90-2 and rule set III).
IV. Boundary and Grid-Aware Kernel Corrections
- Reflection (mirror at boundary x_b): x_ref = 2 * x_b - x_i; use K( ( x - x_i ) / h ) + K( ( x - x_ref ) / h ) with normalization preserved.
- Truncate–renormalize: integrate contributions only over D and renormalize with Z(x) = ( ∫_D K( ( x - u ) / h ) du ).
- Local linear kernels: add first-order terms to reduce boundary bias.
- Consistency with voxelization: when reconstructing from a grid rho_i, preserve mass_preserve = ( ∑ rho_i * V_i ) (see S92-11, Chapter 7).
V. Window Catalogue (for discrete spectral density)
- Cosine-sum form and metrics
w[n] = ∑_{k=0}^K a_k * cos( 2*pi*k*n / (N-1) ) (typical alternating signs a0 - a1 cos + a2 cos2 - ...).
For large N: U_w ≈ a0^2 + 0.5 * ∑_{k=1}^K a_k^2, CG ≈ a0, ENBW_bins ≈ U_w / CG^2.
ENBW_Hz = ENBW_bins * ( fs / N ).- Rectangular — w[n] = 1
U_w = 1, CG = 1, ENBW_bins = 1.000; first sidelobe ≈ −13 dB. - Bartlett / Triangular — w[n] = 1 - | ( 2*n / (N-1) ) - 1 |
U_w ≈ 1/3, CG ≈ 0.5, ENBW_bins ≈ 4/3 = 1.333; first sidelobe ≈ −26 dB. - Hann — w[n] = 0.5 - 0.5 * cos( 2*pi*n / (N-1) )
U_w ≈ 0.375, CG ≈ 0.5, ENBW_bins ≈ 1.500; first sidelobe ≈ −31 dB. (Default trade-off; see Chapter 6). - Hamming — w[n] = 0.54 - 0.46 * cos( 2*pi*n / (N-1) )
U_w ≈ 0.3974, CG ≈ 0.54, ENBW_bins ≈ 1.3628; first sidelobe ≈ −43 dB. - Blackman — w[n] = 0.42 - 0.5 * cos( 2*pi*n / (N-1) ) + 0.08 * cos( 4*pi*n / (N-1) )
U_w ≈ 0.3046, CG ≈ 0.42, ENBW_bins ≈ 1.7268; first sidelobe ≈ −58 dB. - Blackman–Harris (4-term, 92 dB) —
w[n] = a0 - a1 * cos( 2*pi*n / (N-1) ) + a2 * cos( 4*pi*n / (N-1) ) - a3 * cos( 6*pi*n / (N-1) )
with a0=0.35875, a1=0.48829, a2=0.14128, a3=0.01168.
U_w ≈ 0.25796, CG ≈ 0.35875, ENBW_bins ≈ 2.004; first sidelobe ≈ −92 dB. - Nuttall (4-term) — coefficients a0=0.355768, a1=0.487396, a2=0.144232, a3=0.012604 (same structure).
U_w ≈ 0.25583, CG ≈ 0.355768, ENBW_bins ≈ 2.021; sidelobe suppression comparable to BH. - Flat-top (5-term, amplitude accuracy priority) —
w[n] = a0 - a1 * cos( 2*pi*n / (N-1) ) + a2 * cos( 4*pi*n / (N-1) ) - a3 * cos( 6*pi*n / (N-1) ) + a4 * cos( 8*pi*n / (N-1) )
typical a0=1.0, a1=1.93, a2=1.29, a3=0.388, a4=0.028.
U_w ≈ 3.7702, CG ≈ 1.0, ENBW_bins ≈ 3.770; minimizes amplitude bias. - Kaiser (parameterized) —
w[n] = I0( pi*beta*sqrt( 1 - x^2 ) ) / I0( pi*beta ), with x = ( 2*n / (N-1) ) - 1, I0 the zeroth-order modified Bessel.
Empirical: beta=6 → ENBW_bins ≈ 1.9, beta=8 → ≈ 2.23, beta=10 → ≈ 2.5.
Beta tunes sidelobe vs. main-lobe width continuously.
- Rectangular — w[n] = 1
- Implementation hint: in spectral_density(sig, method="welch", window="hann") report U_w, ENBW_Hz, and CG, and use the same window power normalization in the energy check (Mx-95, Chapter 6).
VI. Shape Mapping and Selection Guidance
- Shape isomorphisms: Uniform ↔ Rectangular, Triangular ↔ Bartlett, Cosine kernel ↔ Hann window, higher-order compact polynomial kernels ↔ polynomial cosine-sum windows (e.g., Blackman). Choosing shape-matched pairs maintains a coherent smoothing style across domains (density ↔ spectrum).
- Defaults (cross-volume aligned):
- For density estimation, prefer Epanechnikov or Biweight (compact support, AMISE-friendly).
- For spectrum estimation, prefer Hann (balanced leakage vs. resolution); for amplitude-critical work use Flat-top.
VII. I90 Binding and Example Configurations
- KDE: kde_build(data, kernel="epanechnikov", h=..., rule="cv") -> PdfRef; evaluate with normalize=True, and record CV(h) plus kernel constants mu2(K)/R(K) (see I90-2).
- Spectrum: spectral_density(sig, method="welch", window="hann") -> SpecRef; then spec_to_energy(spec, band) for energy consistency (I90-6).
- Mandatory metadata: bind K, h, U_w, ENBW_Hz, CG as estimator attributes (I90-8).
VIII. Pre-Publication Self-Check (Kernels & Windows)
- check_dim: ensure kernel-density units match the input measure; PSD reports ENBW_Hz and bin width fs/N.
- Normalization: kernels must satisfy ∫ K du = 1; windows must use the same U_w in energy checks.
- Reporting: KDE must include K(•), h, and the selection criterion; PSD must include window, U_w, ENBW_Hz, CG.
- Boundaries: if D is bounded, declare the boundary-correction strategy.
- Arrival-time axis: where spectral/time-frequency metrics are tied to T_arr, provide both forms and record delta_form (see ruleset and Chapter 9).
IX. Quick Constants (Summary)
- Kernel second moments and roughness
- Gaussian: mu2=1, R=1/(2*sqrt(pi))≈0.282094
- Epanechnikov: mu2=1/5, R=3/5
- Uniform: mu2=1/3, R=1/2
- Triangular: mu2=1/6, R=2/3
- Biweight: mu2=1/7, R=5/7
- Triweight: mu2=1/9, R=350/429≈0.815851
- Cosine: mu2≈0.18943, R≈0.61685
- Laplace: mu2=2, R=1/4
- Common window ENBW_bins (approx.)
Rectangular = 1.000, Bartlett = 1.333, Hann = 1.500, Hamming = 1.363, Blackman = 1.727, Blackman-Harris(4) = 2.004, Nuttall(4) = 2.021, Flat-top(5) = 3.770, Kaiser(beta=8) ≈ 2.23
X. Cross-References and Version Alignment
- Direct reuse with Chapter 4 (Mx-93 bandwidth selection), Chapter 6 PSD formalism (S92-8/S92-9, Mx-95), Chapter 7 conservation discretization (S92-11, Mx-96).
- Bound to interface layer I90-2/4/6/8; window and energy conventions match Core.Sea exactly. Where arrival-time metrics apply, adhere to the two-form disparity delta_form recording rule.
Copyright & License (CC BY 4.0)
Copyright: Unless otherwise noted, the copyright of “Energy Filament Theory” (text, charts, illustrations, symbols, and formulas) belongs to the author “Guanglin Tu”.
License: This work is licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0). You may copy, redistribute, excerpt, adapt, and share for commercial or non‑commercial purposes with proper attribution.
Suggested attribution: Author: “Guanglin Tu”; Work: “Energy Filament Theory”; Source: energyfilament.org; License: CC BY 4.0.
First published: 2025-11-11|Current version:v5.1
License link:https://creativecommons.org/licenses/by/4.0/