HUB
Sign inSign up
quantumsimulation-lab logo

credkellar/quantumsimulation-lab

By credkellar

โ€ขUpdated 17 days ago

QuantumSimulation-Lab: quantum simulation lab - Trotter errors measured, slopes fitted. Sim only!!!!

Image
Machine learning & AI
Developer tools
Data science
1

156

credkellar/quantumsimulation-lab repository overview

โ QuantumSimulation-Lab โš›๏ธ๐ŸŒ€

Digital Quantum Simulation Lab โ€” Trotterโ€“Suzuki Error, Measured โ€” by Darion Kellar

Educational digital quantum simulation lab in ONE pure-Python file: the transverse-field Ising chain (open chain, J = 1, labelled h) on N = 3 and N = 4 spins, simulated classically with a from-scratch linear-algebra kit โ€” Kronecker products, a scaling-and-squaring Taylor exponential for the exact propagator (unitarity deviation 4.88e-15), and Lie / Strang product formulas whose factors are exponentiated exactly as full matrices. The Trotter error is measured against the exact propagator in operator norm over the ladder n = 1..128 at t = 1 (order 1: 1.845492 -> 0.010793; order 2: 1.534259 -> 6.94410e-05), the log-log slopes are fitted and graded (measured -1.0074 vs theory -1; -2.0064 vs -2), and the steps to error < 1e-6 are printed with provenance: 1,069 for Strang, VERIFIED directly (measured 9.96e-07), versus 1,282,892 for Lie, EXTRAPOLATED from the fit and flagged as such. The resource ledger counts 8,980,244 rotations for Lie against 7,486 for Strang (a 1,199.6x ratio, Strang half-layers merged), the commuting points h = 0 and J = 0 are exact to machine precision (7.85e-16, 1.57e-15), and the observable section names its own trap: <Z_0> cannot separate the orders (diagonal phase layers cancel), so the orders are graded on <X_0> โ€” max deviation 0.063940 (Lie) vs 0.007016 (Strang) at n = 8. A from-scratch distance-weighted kNN classifier labels regimes from the lab's own policy.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: N <= 4 spins simulated on a classical machine is not a quantum computer and claims no speedup โ€” no hardware is touched, no molecule or material is discovered, and a 4-spin chain says nothing by itself about the thermodynamic limit. Every speedup / hardware / chemistry / materials / drug / vendor-benchmark / cryptanalysis / investment use is a permanent HOLD gate (14 total).

โ ๐Ÿงฐ Tech Stack Badges & Full Architecture Tech Stack

โ ๐Ÿ’ป Core Programming Languages & Core Systems

Python Stdlib Only Network Deterministic License TFIM Trotter-Suzuki

  • ๐Ÿ Python 3.12, pure standard library (math, cmath, hashlib, json, sys) โ€” zero dependencies, zero network, deterministic (double-run byte-identical)
  • ๐Ÿงฎ Linear algebra from scratch: Kronecker products, matrix multiply / dagger / Frobenius norm as plain lists of complex numbers, the matrix exponential by scaling-and-squaring Taylor (stated openly, graded by unitarity 4.88e-15), and the operator norm by power iteration on Mโ€ M with two deterministic start vectors
  • ๐ŸŒ€ Trotterโ€“Suzuki core: the ZZ factor exponentiated exactly as diagonal phases, the X factor as a Kronecker product of per-qubit rotations cos(hฯ„) I + i sin(hฯ„) X, assembled as full-matrix products โ€” Lie exp(โˆ’iBฯ„) exp(โˆ’iAฯ„) and Strang exp(โˆ’iAฯ„/2) exp(โˆ’iBฯ„) exp(โˆ’iAฯ„/2)
  • ๐Ÿ“‰ Error analysis: operator-norm error ladder n = 1..128 at fixed t, log-log slope fitted over the asymptotic region (n โ‰ฅ 4) and asserted against theory in CHECKS, steps-to-target verified by fit-guided bisection where affordable and flagged EXTRAPOLATED where it is not
  • ๐Ÿง  TinyML kNN regime classifier (from scratch, stdlib, distance-weighted): converged / trotter-limited / deep-circuit / trivially-exact from (error, steps, order, h/J), labels from the lab's own policy
  • ๐Ÿช‘ Council seats: Gemini Argon 4 DECIDER (names-only, tighten-only) + Muse advisor (never overrides HOLD) + Google Flow plan-only (rendered = False, live = 0)
โ โ›“๏ธ Web3 & Infrastructure
  • ๐Ÿšซ Not applicable โ€” honestly. No blockchain, no Web3, no tokens: the "infrastructure" in this lab is one offline file holding a 16ร—16 Hamiltonian, two product formulas, and an error ladder. Quantum speedup and cryptanalysis claims are permanent HOLD gates, not features. No fake badges here.
โ โš™๏ธ Platform Support & Hardware Architecture

Linux macOS Windows

  • ๐Ÿ–ฅ๏ธ Pure Python โ€” runs anywhere Python 3.12+ runs (Linux, macOS, Windows), plus the python:3.12-slim Docker image
  • ๐Ÿ”’ No quantum hardware is touched, ever: real devices, circuit execution, and hardware specifications are permanent HOLD gates (see the gate table below). This lab simulates a quantum algorithm classically; it does not run one
โ โšก Low-Level Infrastructure & Performance
  • ๐Ÿšซ No low-level code โ€” honestly. No C, no C++, no GPU, no compiled extensions: this is one interpreted Python file on purpose, so every matrix entry can be read, checked, and diffed. Performance here means honest algorithms โ€” a scaling-and-squaring exponential, power iteration for the operator norm, and a fit-guided bisection for the verified step count โ€” all deterministic and byte-identical between runs
โ ๐Ÿ› ๏ธ DevOps & Build Tools

Docker GitHub Actions pytest Git

  • ๐Ÿณ Docker (python:3.12-slim), GitHub Actions CI + Docker Publish (delivered in the paste pack)
  • ๐ŸŽฏ Target image: credkellar/quantumsimulation-lab:latest
  • ๐Ÿงช Tests: pytest (32 tests) + the built-in CHECKS suite (57 checks) in main.py
โ โ˜๏ธ Cloud Providers
  • ๐Ÿšซ None โ€” honestly. No cloud provider is used or needed: the lab runs fully offline on your own machine or in a local Docker container. Docker Hub appears only as the registry the publish workflow pushes the image to.

โ ๐Ÿณ Quick start

docker pull credkellar/quantumsimulation-lab:latest
docker run --rm credkellar/quantumsimulation-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 57/57).

Run a specific command instead:

docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py checks    # CHECKS 57/57
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py exact     # Hamiltonian + exact propagator receipts (JSON)
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py trotter   # error ladder, slope fits, steps to 1e-6 (JSON)
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py observable # <Z_0> / <X_0> curves, exact vs Trotter (JSON)
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py resources # rotation ledger to reach 1e-6 (JSON)
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py sweeps    # h sweep, N sweep, commuting points (JSON)
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py classify  # kNN verdicts: converged / trotter-limited / deep-circuit / trivially-exact
docker run --rm credkellar/quantumsimulation-lab:latest python3 main.py holds     # 14 HOLD gates

โ ๐Ÿ”ฌ What's inside

  • The chain, by hand โ€” TFIM built from in-file Kronecker products (dims 8 and 16); trace(H) = 0 exactly, ||H||_F = 10.5830, and ||[A, B]||_F = 19.5959 printed as the reason Trotter error exists.
  • Exact reference, receipted โ€” scaling-and-squaring Taylor propagator: unitarity deviation 4.88e-15, roundtrip U(t)U(-t) = I to 4.88e-15, <Z_0>(t = 1) from |0000> = -0.033022.
  • The ladder โ€” operator-norm error at t = 1 for n = 1..128, both orders; at n = 16 Strang (0.004451) is 19x more accurate than Lie (0.086520).
  • Slopes, fitted and graded โ€” -1.0074 (Lie, prefactor 1.4236) and -2.0064 (Strang, prefactor 1.1674) over n >= 4, asserted within 0.15 of theory; the fit reproduces the measured n = 128 errors within 35%.
  • Steps to target, with provenance โ€” Strang: 1,069 steps, bisected against directly measured errors (9.96e-07 at the count). Lie: 1,282,892 steps, fit-extrapolated and flagged EXTRAPOLATED everywhere it appears.
  • The observable trap, named โ€” the |0000> and Neel <Z_0> curves are identical, and Lie and Strang agree on <Z_0> to machine precision at equal n (diagonal ZZ half-layers are invisible to a diagonal observable); <X_0> separates the orders, 0.063940 vs 0.007016 max deviation at n = 8, with <X_0>(t = 1) = +0.499309 / -0.499309 for the two states.
  • Commuting points exact โ€” h = 0 error 7.85e-16 (Lie, n = 3), J = 0 error 1.57e-15 (Strang, n = 3); the h sweep shows Strang's n = 16 error growing 1.45e-15 -> 0.010762 across h = 0..2 while Lie's saturates around 0.07-0.10.
  • Resource ledger โ€” per-layer counts (3 ZZ + 4 X for N = 4) with Strang half-layer merging ((n + 1) ZZ layers for n steps): 8,980,244 total rotations for Lie vs 7,486 for Strang to the same 1e-6 target โ€” counted, none executed.
  • TinyML kNN classifier โ€” converged / trotter-limited / deep-circuit / trivially-exact from (error, steps, order, h/J); agreement with the lab's policy asserted on every scenario and all 336 training-grid rows.
  • Advisory seats โ€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

โ โœ… Verified

  • pytest: 32 passed
  • Built-in checks: CHECKS 57/57
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

โ ๐Ÿท๏ธ Categories

Science ยท Developer tools ยท Machine learning & AI

  • License: MIT ยฉ 2026 Darion Kellar
  • Image: credkellar/quantumsimulation-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:e5a4d6058โ€ฆ
Size
41.5 MB
Last updated
17 days ago
docker pull credkellar/quantumsimulation-lab:latest