This repository contains the simulation code, data, and analysis for our paper on the Memory-Resonance Condition (MRC): a cross-domain design principle showing that systems across classical and quantum domains exhibit optimal performance when environmental memory synchronizes with internal dynamics (Θ ≡ ω_fast τ_B ≈ 1).
- Paper:
mrl_synthesis_paper/main.pdf(latest build) - Data: Core CSVs:
results/theta_sweep_today.csv(Class S),results/classical_parametric_mod03.csv(Class C),results/quantum_nonlin/kerr02_tol001.csv(Class M),results/quantum_nonlin/kerr00_tol001.csv(quantum surrogate),results/quantum_eqheat_sweep_for_figB.csv(quantum null)- Supplementary (adaptive confirmations):
results/adaptive/classC_fraction_attempt.csv(Class C re-run),results/adaptive/kerr08_det12_theta_grid.csv(Class M fast grid). These confirm the same diagnostics with tighter sampling; no model changes, only runtime/sampling refinements.
- Supplementary (adaptive confirmations):
- Figures:
figures/(scripts + PDFs for all panels)
Memory-Resonance Condition: Systems often perform best when their environment's correlation time (τ_B) matches their fastest internal rhythm (1/ω_fast):
Θ ≡ ω_fast τ_B ≈ 1
Key Insight: The observable (a shallow optimum near Θ≈1) recurs across substrates—from stochastic resonance in neural circuits to noise-assisted quantum transport—but the mechanism varies:
- Class S (Spectral): Frequency-domain overlap in near-linear systems
- Class C (Coherent): Weak nonlinearity reweights spectra
- Class M (Memory): Time-nonlocal dynamical kernels
Our Contribution: We formalize this cross-domain pattern, provide operational diagnostics to classify mechanism, and apply them to a minimal hierarchy—confirming the classical mechanism while documenting where the quantum diagnostic returns a null.
.
├── mrl_synthesis_paper/ # Paper source (LaTeX + PDF)
│ ├── main.tex # Main paper source
│ ├── main.pdf # Compiled PDF (390 KB, 11 pages)
│ └── references.bib # Bibliography
│
├── figures/ # Figure generation scripts
│ ├── make_figA.py # Classical Class S (OU ≈ surrogate)
│ ├── make_figB.py # Quantum linear equal-carrier (null)
│ ├── make_figC.py # Robustness across metrics
│ ├── make_figD_parametric.py # Classical Class C (parametric modulation)
│ ├── make_figE_collapse.py # Cross-domain collapse onto Θ
│ ├── make_figF_quantum_nonlin.py # Quantum Class M (detune + Kerr)
│ ├── figA_classical.pdf
│ ├── figB_equal_carrier.pdf
│ ├── figC_robustness.pdf
│ ├── figD_parametric_classC.pdf
│ ├── figE_collapse.pdf
│ └── figF_quantum_nonlin.pdf
│
├── results/ # Simulation data and manifests
│ ├── theta_sweep_today.csv # Consolidated dataset (301 KB)
│ └── production_archive/ # QA logs, manifests, config hash
│
├── src/ # Core simulation code
│ ├── quantum_models.py # Quantum hierarchy (Lindblad + pseudomode)
│ ├── hierarchical_analysis.py # Classical analysis (OU bath, controls)
│ └── ... # Supporting modules
│
├── tests/ # Validation suite
│ └── test_quantum_hierarchy.py
│
├── PAPER_STATUS.md # Current paper status
├── SUBMISSION_READY.md # Pre-submission checklist
└── README.md # This file
# Clone repository
git clone https://github.com/Mat-Tom-Son/memory-resonance.git
cd memory-resonance
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt# Regenerate all figures from consolidated data
cd figures
PYTHONPATH=.. python make_figA.py # Classical Class S (~5 sec)
PYTHONPATH=.. python make_figD_parametric.py # Classical Class C (~8 sec)
PYTHONPATH=.. python make_figF_quantum_nonlin.py # Quantum Class M (~8 sec)
PYTHONPATH=.. python make_figB.py # Quantum null (~5 sec)
PYTHONPATH=.. python make_figE_collapse.py # Cross-domain collapse (~3 sec)
PYTHONPATH=.. python make_figC.py # Robustness (~5 sec)Output: figA_classical.pdf, figD_parametric_classC.pdf, figF_quantum_nonlin.pdf, figB_equal_carrier.pdf, figE_collapse.pdf, figC_robustness.pdf
- Supplementary adaptive figures:
figures/figD_parametric_adaptive.pdf,figures/figF_quantum_nonlin_adaptive.pdf
# Validate simulation code
pytest tests/test_quantum_hierarchy.py -v
# Quick diagnostic (10 seconds)
python quick_diagnostic.pyTo quickly verify the paper's claims:
- Check the data:
head results/theta_sweep_today.csv(Class S)head results/classical_parametric_mod03.csv(Class C) plushead results/classical_parametric_mod00.csv(no-modulation control)head results/quantum_nonlin/kerr02_tol001.csv(Class M),head results/quantum_nonlin/kerr00_tol001.csv(linear detuned control),head results/quantum_nonlin/kerr02_tol001_neg.csv(negative detuning)head results/quantum_eqheat_sweep_for_figB.csv(quantum null)
- Regenerate figures:
cd figuresand runPYTHONPATH=.. python make_figA.py,PYTHONPATH=.. python make_figD_parametric.py,PYTHONPATH=.. python make_figF_quantum_nonlin.py,PYTHONPATH=.. python make_figB.py,PYTHONPATH=.. python make_figE_collapse.py,PYTHONPATH=.. python make_figC.py - Run validation suite:
pytest tests/test_quantum_hierarchy.py -v(~20 sec) - Config hash verification: All figures embed
c7dc5aa1- grep for it in the PDF or check figure captions
Expected verification time: < 5 minutes
We do not claim novelty of the Θ≈1 phenomenon itself (it appears across stochastic resonance, coherence resonance, and noise-assisted transport).
Our contribution:
- Pattern recognition: Formalizing the cross-domain recurrence as a unified Memory-Resonance Condition
- Mechanism taxonomy: Classes S/C/M with operational diagnostics to distinguish spectral overlap, coherent modulation, and memory backaction
- Falsifiable tests in practice: Class S replication (OU ≈ surrogate), a parametric modulation run that breaks the PSD gate (Class C), and a detuned Kerr equal-carrier sweep that yields a quantum enhancement (Class M) alongside the linear null
- Rigorous validation + boundaries: Pre-registered gates reported for all sweeps (PSD-NRMSE, |d_z|, |�95J|/J*), highlighting where the diagnostics pass, fail, or mark the edge of applicability
- Actionable design rule: Boxed Design Card with step-by-step guidance and shared CSVs for immediate reuse
| Pillar | Mechanism | Gate | Threshold | Observed | Status |
|---|---|---|---|---|---|
| Classical | Spectral overlap (Class S) | PSD-NRMSE | < 0.03 | 0.006–0.007 | ✓ Pass |
| Classical | Coherent modulation (Class C) | PSD-NRMSE | – | 1.08–2.13 | ✗ Surrogate fails |
| Classical | Coherent modulation (Class C) | |d_z| | – | ≈0.20 | ✗ Surrogate fails |
| Quantum | Memory backaction (Class M) | |ΔJ|/J* | ≤ 0.02 | ≤ 1e-3 | ✓ Pass (peak R_env ≈ 1.11 at Θ=0.90; adaptive) |
| Quantum | Linear boundary | |ΔJ|/J* | ≤ 0.02 | < 0.02 | ✓ Pass (R_env ≈ 1.00) |
| All | Robustness | Metric consistency | - | Baseband ≈ Narrowband | ✓ Pass |
Finding: Ornstein-Uhlenbeck (OU) noise and PSD-matched surrogates are practically equivalent.
Gates: PSD-NRMSE < 0.03, |d_z| < 0.30 ✓
Interpretation: Classical Θ-dependence arises from spectral overlap (Wiener-Khinchin), consistent with stochastic resonance literature.
Finding: A weakly modulated coupling yields a Θ-band optimum (
-
Detuned Kerr sweep: Equal-carrier calibration at the operating amplitude (
$|�ΔJ|/J^*|�≤�10^{-3}$ ) yields a clear peak in the adaptive fast scan at Θ = 0.90 (R_env ≈ 1.11); auxiliary metrics agree and the fast-mode occupancy remains ≈2×10⁻². - Detuned linear surrogate: With Kerr set to zero the equal-carrier curve stays flat (R_env ≤ 1.06), demonstrating that mild nonlinearity is essential for the enhancement.
- Linear-Gaussian null: Without detuning the original hierarchy returns R_env ≈ 1 for all Θ, marking the boundary of the minimal hierarchy.
Finding: Baseband and narrowband metrics agree in ordering across Θ.
Interpretation: MRC is a system-environment property, not a metric-specific artifact.
# Full OU calibration + surrogate comparison + Θ sweep
python hierarchical_analysis.py # ~20 minutes, 25 Θ points × 16 seeds
# Outputs:
# - experiment1_equal_variance.png
# - experiment2_sweep_equal_variance.png
# - Terminal: Bootstrap CI on Θ peak
# Class C parametric modulation sweep
python classical_parametric_sweep.py --output results/classical_parametric_mod03.csv --mod-amp 0.3 --n-seeds 6
PYTHONPATH=. python figures/make_figD_parametric.py
# (Optional) no-modulation control for collapse/checks
python classical_parametric_sweep.py --output results/classical_parametric_mod00.csv --mod-amp 0.0 --n-seeds 6# Stage 1: Markovian baseline
python stage1_markovian.py # ~30 sec
# Stage 2: Pseudomode comparison
python stage2_pseudomode.py # ~1 min
# Stage 3: τ_B parameter sweep
python stage3_parameter_sweep.py # ~5 min
# Or run complete pipeline:
python quantum_hierarchy.py # ~6 min
# Class M (detuned + Kerr) vs surrogate
python quantum_nonlin_sweep.py --output results/quantum_nonlin/kerr02_tol001.csv --detune-frac 0.1 --kerr-fast 0.02 --equal-carrier-tol 0.001 --theta-list 0.6 0.8 1.0 1.1 1.2 1.3 1.4
python quantum_nonlin_sweep.py --output results/quantum_nonlin/kerr00_tol001.csv --detune-frac 0.1 --kerr-fast 0.0 --equal-carrier-tol 0.001 --theta-list 0.6 0.8 1.0 1.1 1.2 1.3 1.4
python quantum_nonlin_sweep.py --output results/quantum_nonlin/kerr02_tol001_neg.csv --detune-frac -0.1 --kerr-fast 0.02 --equal-carrier-tol 0.001 --theta-list 0.6 0.8 1.0 1.1 1.2 1.3 1.4
PYTHONPATH=. python figures/make_figF_quantum_nonlin.pyThe paper includes a boxed Design Card with:
- Rule: Target Θ in the MR band [0.7, 1.4]
- How to estimate ω_fast: 3 cases (linear, nonlinear, driven)
- How to choose τ_B: Use τ_B^(eff) (observable-effective timescale)
- Diagnostics: Tests to classify Classes S/C/M
- Failure modes: When MRC may not apply
- Optional controller: Two-point dither for τ_B adaptation
The paper synthesizes evidence from:
- Stochastic resonance (Mondal et al. 2018, Gammaitoni et al.)
- Coherence resonance (Brugioni et al. 2005, Pikovsky & Kurths)
- Quantum transport (Moreira et al. 2020, Plenio & Huelga)
- Photosynthesis (Uchiyama et al. 2017)
- Neural detection (Duan et al. 2014)
- Energy harvesting (Romero-Bastida & López 2020)
All simulation code, raw data, configuration manifests, and figure-generation scripts are in this repository:
- Consolidated dataset:
results/theta_sweep_today.csv(301 KB) - Config hash:
c7dc5aa1(production run identifier) - Reproduction scripts:
figures/make_fig*.py - QA manifests:
results/production_archive/
Reproducibility: All figures can be regenerated from source data. Gates, seeds, and quality checks are documented.
# Modify stage3_parameter_sweep.py
tau_B_values = np.linspace(0.1, 3.0, 50) # Denser Θ grid
# Then run: python stage3_parameter_sweep.py# Add to quantum_models.py
def compute_entanglement_entropy(rho, subsystem_dims):
# Your implementation
return S_ent
# Use in stage scripts to plot new metrics# Estimate runtime for large Hilbert spaces
python benchmark.py
# For classical runs, reduce n_seeds or T for exploration:
# In hierarchical_analysis.py:
n_seeds = 8 # Default: 16
T = 100.0 # Default: 200.0If you use this code or data in your research, please cite:
@article{Thompson2025MRC,
title={Memory-Resonance Condition: A Cross-Domain Control Principle for Colored-Noise Systems},
author={Thompson, Mat},
journal={Preprint},
year={2025},
note={In preparation; see repository for latest PDF}
}(We will update with the arXiv identifier upon posting.)
Q: Is this the same as stochastic resonance?
A: Similar observable (Θ≈1 optimum), but we recognize it as a broader cross-domain pattern. Stochastic resonance is typically Class S (spectral overlap). The MRC framework also covers Class C (coherent modulation) and Class M (memory backaction).
Q: Can I use this for my system?
A: Yes! Check if your system has: (1) timescale separation between fast and slow dynamics, (2) a tunable environmental correlation time τ_B, and (3) a measurable slow-band observable. See the Design Card in the paper (after Methods section) for step-by-step guidance.
Q: What if I have multiple ω_fast peaks?
A: See "Failure modes" in the Design Card - multimode ambiguity is a known limitation. The MRC applies best when there's a single dominant transduction frequency. For multi-peak systems, you may need controller synthesis instead of passive tuning.
Q: How do I know which mechanism class (S/C/M) applies to my system?
A: Run the diagnostics:
- Class S test: Does a PSD-matched surrogate reproduce the Θ≈1 optimum? (Pass → Class S)
- Class M test: Does the optimum persist under equal-carrier conditions (fixed spectral weight)? (Yes → Class M)
- Class C: If both tests fail, inspect for weak nonlinearity or coherent modulation effects
Q: What if my τ_B isn't tunable?
A: See the "Optional controller" in the Design Card. You can use a two-point dither or sample τ_B from the MR band [0.7, 1.4] × (1/ω_fast) to hedge against model mismatch.
Q: Why pre-register gates instead of using p-values?
A: Practical equivalence gates (PSD-NRMSE < 0.03, |d_z| < 0.30) are more meaningful than statistical significance for equivalence testing. We report p-values for transparency (in supplement), but gates are the primary acceptance criterion.
- Issues: GitHub Issues
- Questions: Open a discussion or email mat.tom.son@protonmail.com
- Contributing: Pull requests welcome!
This project is licensed under the MIT License - see LICENSE file for details.
- QuTiP for quantum simulation framework
- All cited authors for cross-domain evidence synthesis
- Reviewers and collaborators for feedback
- Paper Status:
PAPER_STATUS.md- Current version, stats, checklist - Submission Ready:
SUBMISSION_READY.md- Final checks, talking points - Session Notes:
.claude_session_notes/- Detailed revision history (hidden)
Status: Preprint ready for submission (2025-10-12)
Config hash: c7dc5aa1 | PDF: 390 KB, 11 pages | Data: 301 KB CSV