"""Verify the regular projection, first variation and quadratic local deficit.""" from fractions import Fraction as F from certify_annular_trials import D0, D1, P, main as check_corrected_trials from certify_pentagon import continuous_bound, get_inertia, verify_geometry from certify_vertex_kernel import check as check_first_variations from kernel_poly import avg, energy, mul def main(): verify_geometry() regular_area_upper = 5 * F(".951057") / 2 coarse_shift, fine_shift, third_shift = F("10.347"), F("10.3524"), F("26.49") assert get_inertia(16, coarse_shift) == (1, 1959) assert get_inertia(16, third_shift) == (3, 1957) assert get_inertia(48, fine_shift) == (1, 17399) print("Regular-pentagon inertia counts at all three shifts passed.") lambda_lower = continuous_bound(48, fine_shift) / regular_area_upper assert continuous_bound(16, third_shift) > F("26.29233") third_lower = F("26.29233") / regular_area_upper assert third_lower > 11 conjugate = {(b, a): coefficient for (a, b), coefficient in P.items()} mass_lower, mass_upper = avg(mul(P, conjugate)) stiffness_lower, stiffness_upper = avg(energy(P, conjugate)) ritz_upper = stiffness_upper / mass_lower assert F('1.99765839') < mass_lower <= mass_upper < F('1.99765840') assert F('8.69938239') < stiffness_lower <= stiffness_upper < F('8.69938240') assert F("4.352639") < lambda_lower < ritz_upper < F("4.354790") assert mass_upper < F("1.415")**2 and stiffness_upper < F("2.954")**2 # The real and imaginary components have the same Rayleigh quotient. # For either normalized component, the variance carried by higher modes # is bounded by the spectral gap between the doublet and the next mode. # The separate check_flux.py job verifies this stronger lower endpoint. flux_lower = F('4.354463') assert lambda_lower < flux_lower < ritz_upper fraction = (ritz_upper - flux_lower) / (third_lower - flux_lower) assert fraction < F(".017906")**2 assert third_lower * fraction < F(".059544")**2 assert mass_upper * fraction < D0**2 assert mass_upper * third_lower * fraction < D1**2 assert F("7.493") / ritz_upper > F("1.7") print("Squared norms enclosed in (1.99765839, 1.99765840) and (8.69938239, 8.69938240).") print("Verified the real-component and complex projection errors.") check_first_variations() check_corrected_trials() if __name__ == "__main__": main()