# Finite representation and distinguishable memory states

Run `python reproduce.py` with numpy and matplotlib. All data are deterministic analytic teaching examples in normalized arbitrary signal units, not hardware measurements.

Quantizer: N=2,4,8 bits; M=2^N; q=1/M. For x in [0,1], code=min(M-1,floor(M*x)); reconstruction=(code+.5)/M. Internal thresholds choose the upper bin; x=1 chooses the last bin. Out-of-range/nonfinite inputs and unsupported bit counts are rejected. The error is reconstruction minus input and has magnitude at most q/2, including endpoints. Quantizer.csv contains 3,003 points (1,001 per bit count). This deterministic ramp error is not assumed white stochastic noise. No converter accuracy or energy claim follows.

Readout: M=2,4,8 equally likely states at i/(M-1), with additive zero-mean Gaussian noise of standard deviation sigma. Nearest-state thresholds lie halfway between adjacent states; outer decision intervals extend to infinity. No clipping is applied to noisy observations. With spacing delta=1/(M-1), average symbol error is 2(M-1)/M Q(delta/(2sigma)), Q(z)=0.5 erfc(z/sqrt(2)); sigma=0 explicitly gives zero. readout-error.csv contains 603 points: sigma=0 through .2 in .001 steps for each M. This is wrong-state probability, not bit error, usable capacity or retention. log2(M) is nominal bits for perfectly distinguishable independent states, not delivered throughput.

readout-density.csv has 4,004 points: four conditional Gaussian densities at sigma=.12, observation -.5 to1.5 by .002. Each complete density integrates to one over the real line; the plotted window omits tiny tails. The plotted densities are conditional on each state, not weighted mixture components. Dashed vertical lines are decision thresholds. The two original figures are provided in PNG/SVG/PDF.

Validation checks all quantizer bounds, endpoints and exact internal thresholds; every Gaussian transition matrix for all603 readout cases has nonnegative entries and rows summing to one. Error calculated independently by one minus the average diagonal agrees with the erfc formula within 2.33e-16 absolute. Noise monotonicity, zero-noise limit, large-noise limit 1-1/M and binary special case pass. Seven invalid-input cases are rejected. Total CSV rows: 7,610. No Monte Carlo sampling or confidence intervals are involved.

No retention, drift, material chemistry, energy, hardware speed or quantum behavior is modeled. More nominal states can reduce readout margin at a fixed range and noise; this calculation does not establish any particular material's performance.

Sources: [Analog Devices MT-001](https://www.analog.com/media/en/training-seminars/tutorials/MT-001.pdf) supports finite quantization; [Analog Devices input-noise discussion](https://www.analog.com/en/resources/analog-dialogue/articles/adc-input-noise.html) distinguishes input noise; [IBM multilevel memory research](https://research.ibm.com/publications/practical-nonvolatile-multilevel-cell-phase-change-memory) illustrates real drift/readout concerns. Parameters and curves here are original synthetic examples, not measurements extracted from those sources.
