From 72e70b335d1116f6e8350accc7a1c9a9638b902f Mon Sep 17 00:00:00 2001 From: Julian Piribauer Date: Mon, 17 Aug 2026 19:01:35 +0200 Subject: [PATCH] Adding test for 4.2.1 --- tests/test_period_computation.py | 42 ++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/tests/test_period_computation.py b/tests/test_period_computation.py index efa942e..d48e4ba 100644 --- a/tests/test_period_computation.py +++ b/tests/test_period_computation.py @@ -40,14 +40,6 @@ def test_apply_operator_truncates_to_order(): assert result.order == 2 -def test_apply_operator_rejects_variable_count_mismatch(): - period = Period(no_variables=1, coefficients={}) - op = PFOperator("z0*theta1", no_variables=2) - - with pytest.raises(ValueError): - period.apply_operator(op) - - def test_find_annihilating_operators_recovers_theta_squared(): # theta0^2 annihilates log(z0): theta0(log z0) = 1, theta0^2(log z0) = theta0(1) = 0. # Among degree-(0, 2) Ansatze this should be the only solution, up to scaling. @@ -134,8 +126,7 @@ def test_find_power_series_solution_handles_rational_indicial(): def test_ideal_finds_holomorphic_solution_and_recovers_first_operator(): - # Ideal generated by two operators (paper's z1, z2, theta1, theta2 <-> code's z0, z1, - # theta0, theta1): + # Picard--Fuchs ideal for P_{22211}[8]: # M1 = theta2*(-2*theta1+2*theta2-1) + 2*(theta1-2*theta2-1)*(theta1-2*theta2)*z2 # M2 = theta1^2*(2*(theta1-2*theta2)*z2-theta2) - 16*(2*theta1+1)*(4*theta1+1)*(4*theta1+3)*z1*z2 M1 = PFOperator( @@ -171,3 +162,34 @@ def test_ideal_finds_holomorphic_solution_and_recovers_first_operator(): ) assert ratio != 0 assert recovered[0].operator == ratio * M1.operator + + +def test_single_operator_recovers_itself_from_its_holomorphic_period(): + # Ensuring methods work for operator 4.2.1: + L = PFOperator( + "theta0^4 - 4*z0*(2*theta0 + 1)^2*(7*theta0^2 + 7*theta0 + 2) " + "- 128*z0^2*(2*theta0 + 1)^2*(2*theta0 + 3)^2", + no_variables=1, + ) + ideal = PFIdeal([L]) + + solutions = ideal.find_power_series_solution(indicials=[0], order=15) + assert len(solutions) == 1 + + period = solutions[0] + assert period.apply_operator(L).coefficients == {} + assert period.coefficients[(0,)][(0,)] == 1 + assert period.coefficients[(0,)][(1,)] == 8 + assert period.coefficients[(0,)][(2,)] == 360 + + # L lives entirely within z_degree <= 2, theta_degree <= 4, its stated level. + recovered = period.find_annihilating_operators(z_degree=2, theta_degree=4) + assert len(recovered) == 1 + + # recovered[0] should be a scalar multiple of L - compare via the coefficient of the + # bare theta0^4 monomial, which is 1 in L. + ratio = recovered[0].operator.monomial_coefficient(L.theta_gens[0] ** 4) / L.operator.monomial_coefficient( + L.theta_gens[0] ** 4 + ) + assert ratio != 0 + assert recovered[0].operator == ratio * L.operator