import { useMemo } from 'react'
import katex from 'katex'
function Tex({ tex, display }: { tex: string; display?: boolean }) {
const html = useMemo(
() => katex.renderToString(tex, { displayMode: !!display, throwOnError: false }),
[tex, display],
)
return
}
/** One term of the formula: the symbol, then what it is. */
function Def({ tex, children }: { tex: string; children: React.ReactNode }) {
return (
<>
{children}
>
)
}
/**
* The theoretical rate R exactly as `model/theory.ts` computes it, with every
* symbol defined. The derivation that justifies it is still to be written.
*/
export default function MathSection() {
return (
The dashed line on the compression chart is R, the predicted bits per sample. It is
computed in three steps: the spectrum of the stored signal, the residual an ideal
predictor leaves, and the entropy of that residual on the integer grid.
standard deviation of the i.i.d. Gaussian input, in quantization steps (the step is the
unit, so rounding is to the nearest integer)
the FIR kernel the input is convolved with — the taps drawn in the kernel plot, L of
them
the kernel's frequency response, the quantity plotted in dB as |H(f)|
frequency in cycles per sample, running from 0 to ½ (Nyquist); the plots label the same
axis in Hz, as f times the sample rate
variance charged to rounding, treated as additive white noise: 1/12 for the roundoff
alone, 1/6 when dither is on (the dither is stored in the integers, so its 1/12 adds)
power spectrum of the stored integer signal, in steps² per unit frequency
standard deviation of the innovation — what an ideal linear predictor still cannot
predict from all earlier samples. The exponent is the Szegő–Kolmogorov formula for the
one-step prediction error, the geometric mean of the spectrum.
standard normal cumulative distribution function
probability that the innovation, rounded to the integer grid, lands on z
bits per sample; the compression ratio the chart marks is 16/R, against 16-bit integer
storage
The integral is evaluated by the midpoint rule on 8192 points and the sum over z is taken
out to where the remaining mass is negligible. A derivation — and an account of where
modeling the roundoff as white noise stops being fair — is still to be written.
)
}