Skip to content

Make the prime gap entry points runnable again - #204

Open
Chessing234 wants to merge 3 commits into
teorth:mainfrom
Chessing234:fix-bourgain-ep-to-zd-callers
Open

Make the prime gap entry points runnable again#204
Chessing234 wants to merge 3 commits into
teorth:mainfrom
Chessing234:fix-bourgain-ep-to-zd-callers

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

compute_prime_excep, prove_prime_gap2 and compute_best_zero_density each die on the first substantial line they reach. Three separate causes, one per commit:

  1. bourgain_ep_to_zd lost its default pairs. The (hypotheses, exp_pairs) signature replaced the hardcoded list with ValueError: 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_zd found.

  2. prime_excep has a dead theta parameter. The loop body opens with theta = j / DISCRETIZATION, shadowing it, and the only caller does not pass it, so the call was a TypeError. Dropped, with the docstring saying the function sweeps θ.

  3. compute_gap2 calls float() on a real root written with complex radicals. sympy returns the real root of a cubic in casus irreducibilis form, so float(beta.subs(x, p)) raises Cannot convert complex to float on 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 starting A(x) ≤ 11/(12(4x-3)) on [3/4, 14/15).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant