# sub2_1958.py -- job #1958 feasibility check: is the residue window u in (4.8, 8] of the all-depth sub-2 certificate (return #101, # fold-arithmetic-bridge Prop. 5) certifiable by the SAME elementary bound with finer pieces? Prop. 5 bounds # c*_real(u) <= f_1(u/2)^2 (1 + 1/D_3(u)), f_1(s) = 2 e^gamma ln(s-1)/s on [2,4], D_3(u) = int_2^{u-1} ln(v-1)/v dv, # and the certificate rounded it to 3120/1000 on (24/5, 6] and 2899/1000 on (6, 8] by taking f_1 at the right end and D_3 at the # left end of coarse pieces. Here: the bound on a fine grid, its maximum on (4.8, 8], and the finest piece width that keeps every # piecewise-constant upper bound below 2 (monotone pieces: f_1 increasing on [2,4], D_3 increasing). Also the sharper bound with # rho_odd >= 1 + D_3 + D_5. All floating point; a rational certificate would be the next step, not this script. import math, sys from scipy.integrate import quad g = 0.5772156649015329; eg = math.exp(g) f1 = lambda s: 2 * eg * math.log(s - 1) / s D3 = lambda u: quad(lambda v: math.log(v - 1) / v, 2, u - 1)[0] if u > 3 else 0.0 def D4(u): return quad(lambda v: D3(v) / v, 3, u - 1)[0] if u > 4 else 0.0 def D5(u): return quad(lambda v: D4(v) / v, 4, u - 1)[0] if u > 5 else 0.0 B1 = lambda u: f1(u / 2) ** 2 * (1 + 1 / D3(u)) B2 = lambda u: f1(u / 2) ** 2 * (1 + 1 / (D3(u) + D5(u))) us = [4.8 + i * 0.01 for i in range(0, 321)] b1 = [(B1(u), u) for u in us]; b2 = [(B2(u), u) for u in us] print('max of f1(u/2)^2 (1 + 1/D_3) on [4.8, 8]: %.4f at u = %.2f ; at u = 8: %.4f ; at u = 4.8: %.4f' % (max(b1)[0], max(b1)[1], B1(8.0), B1(4.8))) print('max with rho >= 1 + D_3 + D_5: %.4f at u = %.2f' % max(b2)) for u in (4.8, 5, 5.5, 6, 6.5, 7, 7.037, 7.5, 8): print(' u=%.3f f1(u/2)^2=%.4f D_3=%.4f D_5=%.4f B1=%.4f B2=%.4f' % (u, f1(u/2)**2, D3(u), D5(u), B1(u), B2(u))) # piecewise certificate feasibility: on a piece (a, b], bound = f1(b/2)^2 (1 + 1/D_3(a)); find the coarsest uniform width w with all pieces < 2 for w in (0.4, 0.2, 0.1, 0.05, 0.02): n = int(round(3.2 / w)); worst = max(f1(min(4.8 + (i + 1) * w, 8.0) / 2) ** 2 * (1 + 1 / D3(4.8 + i * w)) for i in range(n)) print(' uniform piece width %.2f: %d pieces, worst piecewise bound %.4f %s' % (w, n, worst, '< 2 OK' if worst < 2 else 'FAILS')) print('\npiece table, width 0.2 (a, b]: bound = f1(b/2)^2 * (1 + 1/D_3(a)); D_3(a) from quad, to be replaced by a rational lower bound') for i in range(16): a = 4.8 + 0.2 * i; b = min(a + 0.2, 8.0) print(' (%.1f, %.1f]: f1(b/2)^2 = %.4f, D_3(a) = %.4f, bound = %.4f' % (a, b, f1(b / 2) ** 2, D3(a), f1(b / 2) ** 2 * (1 + 1 / D3(a))))