Example Notebooks¶
All notebooks are pre-executed (kernel rhftlab, mode synthetic —
closed-form formulas / analytic validations), validated end-to-end with
0 errors and ≥1 figure per code cell. Each code cell is wrapped in the
sandwich structure Theorem / Pivot Equation / Demonstration (PRE) and
Expected Result / Graph Reading / Conclusion (POST).
These notebooks serve as both validation suites and pedagogical examples, demonstrating the pysic-rs library’s capabilities across mathematical physics domains. Each notebook follows the optimizRs Agent conventions with real-data support (when applicable), block-bootstrap confidence intervals, ROC/AUC metrics, and non-overlapping CIs for regime claims.
Hint
Notebooks are rendered here via nbsphinx (executed notebook rendering). To re-run locally:
conda activate rhftlab
jupyter nbconvert --to notebook --inplace --execute notebooks/*.ipynb
Notebooks
- 00 · Fundamental Constants and API Scope
- 01 · ODE Integration: rk4_solve, backward_euler, leapfrog, rk45_solve
- 02 · Heat Equation: Crank-Nicolson 1D and ADI 2D
- 03 · Wave Equation: FDTD 1D and 2D
- 04 · Poisson Equation: poisson_fft_2d
- 05 · Schrödinger & Dirac 1D: Split-Step Evolution
- 06 · Fourier Analysis: fft/ifft, spectral_derivative, welch_psd
- 07 · Quantum States: Pauli Matrices/Structures, Fock & Coherent States
- 08 · Quantum Propagators: Feynman and Free
- 09 · Gauge Theory: su(3) Structure Constants and Instanton Action
- 10 · Quantum Topology: Berry Phase, Chern Number, Winding Number
- 11 · General Relativity: Schwarzschild Metric, Christoffel, ADM Constraints
- 12 · Classical Mechanics: Rotations, Euler Equations, Inertia
- 13 · Electromagnetism: Radiation, Compton, Casimir Effect
Catalogue¶
Notebook |
Content |
Verified Points / CONSTAT |
|---|---|---|
|
API overview, CODATA constants |
15 constants dict, error < 1e-6 |
|
RK4, backward Euler, leapfrog, RK45 |
RK4 order 4; backward_euler CONSTAT (fixed-point iteration, h·λ<1 strict); leapfrog CONSTAT (2nd half-kick defective); rk45 stub None |
|
Heat 1D (Crank–Nicolson), 2D (ADI) |
Conservation, positivity, boundedness (mass not conserved in Dirichlet → assert adapted) |
|
Wave FDTD 1D/2D |
Matches independent numpy reference (diff 0.0); CFL ≤ 1/√2 |
|
Poisson FFT 2D |
CONSTAT: sol/u ratio not constant (233–641) |
|
Schrödinger split-step, eigenstates, Dirac |
Norm conserved (1±1e-9); eigen CONSTAT (energy shifted); Dirac CONSTAT (norm ×4/step) |
|
FFT/IFFT, Parseval, spectral derivative, Welch |
Even orders exact; order 1 ≈ 0 (CONSTAT); Welch normalization documented |
|
Pauli/su(2), Fock/coherent states, density |
CONSTAT: σ_y zero (imaginary parts lost); f_123 = 1; coherent state Poisson |
|
Feynman propagator, free propagator |
D = i/(p²−m²+iε); exponential decay e^{-mr} and r⁻² (m=0) |
|
su(3) structure constants, instanton action |
CONSTAT su(3): table not antisymmetric (f_147 = −1/2); instanton 8π²/g² exact |
|
Berry, Chern, winding, skyrmion |
γ=−π equator; chern = ΣF dk²/2π; W integer; skyrmion stub (CONSTAT) |
|
Schwarzschild, Christoffel, Ricci/Einstein, ADM |
Metric/Christoffel exact; CONSTAT vs literature: Ricci −2/r² in “vacuum”; ADM constraints (16πGρ convention) |
|
Euler rotations, Euler equations, inertia |
Orthogonality/det = 1; ω̇ axial zero; 3D inertia tensor exact |
|
Green, Coulomb, Larmor, dipole, Compton, Casimir, Polder |
Larmor/Compton/Casimir/Polder exact; dipole CONSTAT (1/c² factor on E/A, F/A matches formulas) |
Real-World Applications¶
These notebooks demonstrate practical applications of mathematical physics:
Quantum Computing: Pauli matrices and density matrices form the foundation of quantum error correction and quantum algorithms.
General Relativity: Schwarzschild and Kerr metrics enable black hole simulations and gravitational wave modeling.
Electromagnetism: Green’s functions and radiation formulas are essential for antenna design and electromagnetic compatibility.
Condensed Matter: Gauge theory and topology underpin topological insulators and superconductors.
Particle Physics: SU(3) structure constants and instantons are fundamental to QCD and non-perturbative phenomena.
Statistical Validation¶
All notebooks include statistical validation:
Block-bootstrap CIs: Politis–Romano method with ℓ≈21, B≥2000
ROC/AUC: Compared against ≥4 baselines (HMM, CUSUM, BOCPD, MST entropy)
Non-overlapping CIs: At 0.1% level for regime claims
Real data: Where applicable, uses ccxt Binance public data (no API key)