SilverSight/experiments/bosonic_continuous/tests/test_lambda_interpolation.py
allaun 93c6b0a691 exp(bosonic): continuous interpolation experiment for regime transition
Testing λ(p) = exp(-p²/N) to remove hard p≥5 regime switch.
- ryser_continuous.py: unified estimator skeleton
- test_lambda_interpolation.py: smooth transition verification

Build: 2987 jobs, 0 errors
2026-06-22 01:19:10 -05:00

42 lines
No EOL
1.2 KiB
Python

#!/usr/bin/env python3
"""
Test lambda interpolation for bosonic Monte Carlo regime transition.
"""
import math
import sys
sys.path.insert(0, "/home/allaun/SilverSight/experiments/bosonic_continuous/kernel")
def test_lambda_values():
"""Verify lambda interpolation at key photon numbers."""
N = 2000
cases = [
(p, N, "expected behavior")
for p in [2, 3, 4, 5, 6]
for N in [2000]
]
print("p | lambda | regime")
print("--|---------|----------")
for p, N, _ in cases:
lam = math.exp(-p * p / N)
regime = "bosonic" if lam > 0.9 else "crossover" if lam > 0.5 else "classical"
print(f"{p} | {lam:.4f} | {regime}")
def test_entropy_continuity():
"""Mock test for entropy continuity across p values."""
N = 2000
total_entropy = 0.0
for p in range(1, 7):
lam = math.exp(-p * p / N)
# Mock: entropy should vary smoothly
mock_entropy = 10.0 + (1 - lam) * 2
total_entropy += mock_entropy
print(f"p={p}: entropy~{mock_entropy:.2f}")
print(f"Total: {total_entropy:.2f}")
if __name__ == "__main__":
test_lambda_values()
print()
test_entropy_continuity()