Make the prime gap entry points runnable again - #204
Open
Chessing234 wants to merge 3 commits into
Open
Conversation
The (hypotheses, exp_pairs) signature replaced a hardcoded list of exponent pairs with "Must supply either hypotheses or exp_pairs", but the three callers - compute_prime_excep, prove_prime_gap2 and compute_best_zero_density - all call it with no arguments, so each dies there. Keep the pairs as a named constant and use them when the caller gives neither argument. They are the pairs the numerical optimisation in approx_bourgain_ep_to_zd found, and passing a hypothesis set instead is not equivalent: the hull computed from the literature set alone yields a weaker bound at 223 of 315 sampled sigma in [3/4, 1), and covers only sigma >= 53/66 rather than sigma >= 3/4.
prime_excep(hypotheses, theta, DISCRETIZATION=100) never reads theta: the loop body opens with "theta = j / DISCRETIZATION", so the parameter is shadowed on the first iteration. Its only caller, compute_prime_excep, passes just the hypothesis set and so raised a TypeError. Remove the parameter and say in the docstring that the function sweeps theta and plots the bound.
compute_gap2 takes each stationary point of alpha and beta and calls float() on the value there. sympy returns a real root of a cubic in the casus irreducibilis form - a sum of complex radicals - so float() raises "Cannot convert complex to float" and prove_prime_gap2 dies on the last few sigma intervals. Evaluate numerically and drop a residual imaginary part below 1e-9, and select the stationary points the same way, so a root whose realness sympy cannot decide symbolically is still used when it evaluates real.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
compute_prime_excep,prove_prime_gap2andcompute_best_zero_densityeach die on the first substantial line they reach. Three separate causes, one per commit:bourgain_ep_to_zdlost its default pairs. The(hypotheses, exp_pairs)signature replaced the hardcoded list withValueError: Must supply either hypotheses or exp_pairs, and all three callers call it with no arguments. The pairs are now a named constant used when the caller supplies neither argument.Passing a hypothesis set instead is not equivalent, which is why I did not simply do that at the call sites: on the literature-only exponent-pair set the computed hull gives a weaker bound at 223 of 315 sampled σ in [3/4, 1), and covers only σ ≥ 53/66 rather than σ ≥ 3/4. The pairs in the constant are the ones the numerical optimisation in
approx_bourgain_ep_to_zdfound.prime_excephas a deadthetaparameter. The loop body opens withtheta = j / DISCRETIZATION, shadowing it, and the only caller does not pass it, so the call was aTypeError. Dropped, with the docstring saying the function sweeps θ.compute_gap2callsfloat()on a real root written with complex radicals. sympy returns the real root of a cubic in casus irreducibilis form, sofloat(beta.subs(x, p))raisesCannot convert complex to floaton the last few σ intervals. Values and stationary points now go through a small helper that evaluates numerically and discards an imaginary part below 1e-9.Verified locally on python 3.13 with
pycddlib<3:derived.compute_prime_excep()runs to completion (~151 s) and prints the zero-density and energy tables plus the μ_PNT(θ) plot data;derived.prove_prime_gap2()runs to completion (~123 s), ending at[1011/1012, 1) 1.4348 …;zd.bourgain_ep_to_zd()with no arguments again returns the 10 estimates startingA(x) ≤ 11/(12(4x-3))on [3/4, 14/15).