/ concept-collection / timeseries-compressibility
Sign in
concept-collection / timeseries-compressibility
timeseries-compressibility / src / components / MathSection.tsx
43 lines · 2.4 KBBlameHistoryRaw
1import { useMemo } from 'react'
2import katex from 'katex'
4function Display({ tex }: { tex: string }) {
5 const html = useMemo(() => katex.renderToString(tex, { displayMode: true, throwOnError: false }), [tex])
6 return <div dangerouslySetInnerHTML={{ __html: html }} />
7}
9/**
10 * Stub for the full derivation. It states the model and the formula the app
11 * plots; the reasoning connecting them is to come.
12 */
13export default function MathSection() {
14 return (
15 <div className="math-section">
16 <p>
17 The generating model: i.i.d. Gaussian noise, a FIR filter h, optional uniform dither, and
18 rounding to the integer quantization grid (the step is the unit, so σ is measured in
19 steps):
20 </p>
21 <Display tex="x_n \sim \mathcal{N}(0,\sigma^2)\ \text{i.i.d.}, \qquad y = h * x, \qquad z_n = \operatorname{round}(y_n + d_n), \quad d_n \sim \mathcal{U}[-\tfrac12,\tfrac12)\ \text{or}\ 0" />
22 <p>
23 The reference rate R treats the roundoff as an additive white noise floor on the spectrum
24 — σ<sub>q</sub>² = 1/12 without dither, 1/6 with it (the dither is stored in the
25 integers) — takes the one-step Wiener prediction error of the resulting process
26 (Szegő–Kolmogorov), and charges the exact entropy of that innovation quantized at unit
27 step:
28 </p>
29 <Display tex="S_z(f) = \sigma^2\,|H(f)|^2 + \sigma_q^2, \qquad \sigma_e^2 = \exp\!\Big(2\!\int_0^{1/2}\!\ln S_z(f)\,df\Big), \qquad R = H_{\Delta}(\sigma_e)" />
30 <Display tex="H_{\Delta}(s) = -\sum_{z\in\mathbb{Z}} p_z \log_2 p_z, \qquad p_z = \Phi\!\Big(\tfrac{z+\frac12}{s}\Big) - \Phi\!\Big(\tfrac{z-\frac12}{s}\Big)" />
31 <p>
32 with f in cycles per sample. In the fine-quantization regime (S ≫ 1 everywhere) this
33 reduces to the classical Gaussian entropy rate ½ log₂(2πe) + ∫ log₂ S(f) df — and with
34 no filter, to ½ log₂(2πe σ²). The noise floor keeps R finite and positive where a deep
35 stopband pushes S(f) below one step², which is where the classical formula diverges to
36 −∞. It is still an approximation: roundoff is not truly white, independent, or Gaussian,
37 prediction is from the quantized past, and everything degrades when the whole signal
38 hides inside the dead zone (σ_y ≪ 1). Quantifying that gap — and why LPC + ANS is the
39 right yardstick — is the subject of the full derivation, still to be written.
40 </p>
41 </div>
42 )
moveopenescclose