| def classify_regime(lam: float, tol: float) -> str: | |
| # Near-boundary if |λ| ≤ tol | |
| if abs(lam) <= tol: | |
| return "Near-boundary" | |
| return "Stable" if lam < 0 else "Unstable" | |
| def fragility_level(F: float) -> str: | |
| # Smaller F => closer to boundary => more fragile | |
| if F < 0.05: | |
| return "High" | |
| if F < 0.15: | |
| return "Moderate" | |
| return "Low" |