Research Atlas

Home / Seeing the gap on an SU(2) lattice / Computing the improved gap bound

Python program

Computing the improved gap bound

Seeing the gap on an SU(2) lattice

Python programreplay_scalar_tilted_window_gap.py
"""Rational cavity and sliding-window chordal contraction inequalities."""

from fractions import Fraction as Q
from math import factorial


def upper_exp(argument):
    count = 10
    partial = sum((argument**i / factorial(i) for i in range(count + 1)), Q(0))
    ratio = argument / (count + 1)
    assert 0 <= ratio < 1
    return partial + argument**count / factorial(count) * ratio / (1 - ratio)


def round_up(value, denominator=10**8):
    scaled = value * denominator
    return Q(-(-scaled.numerator // scaled.denominator), denominator)


def tilt_error(oscillation):
    density_error = upper_exp(oscillation) - 1
    return Q(7, 24) * density_error + density_error**2 / 12


beta = Q(359, 1250)
alpha = Q(1, 1000)
window = 64
linear = 5 * beta**2 / 4
oscillation = Q(9, 5000)

assert 4 * beta + linear <= 5 * beta
assert (2 * beta**2 * (5 * beta)**2) / 192 < oscillation
residual_from_incoming = beta * (upper_exp(oscillation) - 1) / 2
assert (2 * beta**2 * (4 * beta + linear)**2) / 192 + residual_from_incoming < oscillation
assert max(4 * beta + 2 * linear, 5 * beta + linear, 6 * beta) < 3

inside = round_up(beta * (Q(1, 4) + tilt_error(2 * oscillation)))
end = round_up(beta * (Q(1, 4) + tilt_error(oscillation)))
ordinary = beta / 4
weighted_time = round_up(upper_exp(alpha))
weights = [weighted_time**distance for distance in range(window + 1)]
propagation = [end**distance for distance in range(window)]

row = Q(0)
endpoints = (0, window - 1)
for output in range(window):
    for source in range(window):
        distance = abs(output - source)
        coefficient = end if source in endpoints else inside
        if distance:
            coefficient *= propagation[distance - 1]
            coefficient *= ordinary if output in endpoints else end
        weight = 12 * weights[distance]
        if source == 0:
            weight += weights[output + 1]
        if source == window - 1:
            weight += weights[window - output]
        row += coefficient * weight / window

assert row < Q(9999, 10000)
print("PASS: beta <= 359/1250, exponent 1/1000, weighted chordal row below 9999/10000")

The original records reflect the work at the time of writing. The article gives the final interpretation and scope.

Original file checksum · SHA-2560178614509fdd0db7333668d004bcb72ec3154e548273abe996ddb7211fc2943