"""Check, in exact arithmetic, the algebra and the integral identities behind the bounds on the ratio of the first two eigenvalues of the buckling problem and of the clamped plate. usage: python3 verify_bounds.py [LARGEST_DIMENSION] Standard library only. The exit status is 0 if every check holds and 1 otherwise. """ import sys from fractions import Fraction import ratio_bounds as rb from integral_identities import failures, identities, integrals, shifted_origin from polynomials import determinant3, variables from product_functions import example def algebra_checks(): """The polynomial identities of the proof, as (name, whether it holds).""" n, L, m, R, mu, r, w, g, G, S, T, s, p, q, c0, d, be, ga, Y = variables( 'n', 'L', 'm', 'R', 'mu', 'r', 'w', 'g', 'G', 'S', 'T', 's', 'p', 'q', 'c0', 'd', 'be', 'ga', 'Y') half = Fraction(1, 2) out = [] def buckling_form(a, b, c): return m * a * a + L * b * b + R * c * c - 2 * a * b - n * m * a * c + (n - 2) * b * c out.append(('buckling: the form at (L, 1, 0)', buckling_form(L, 1, 0) == L * (L * m - 1))) out.append(('buckling: the form at (L s, s, 1)', buckling_form(L * s, s, 1) - (R - 2 * s) == (L * s * s - n * s) * (L * m - 1))) out.append(('buckling: the form at (L n m / 2 - (n - 2) / 2, m, L m - 1)', buckling_form(L * n * m * half - (n - 2) * half, m, L * m - 1) == (L * m - 1) * ((L * m - 1) * (R - n * n * m / 4) - m))) out.append(('buckling: the determinant of the form', determinant3([[m, -1, -n * m * half], [-1, L, (n - 2) * half], [-n * m * half, (n - 2) * half, R]]) == (L * m - 1) * (R - n * n * m / 4) - m)) square = ((n + 4) ** 2 * (1 + mu) * (4 + n * n * mu) - (n + 2) * (r + 2 * w) ** 2 * mu * (n + 4 - n * mu) - ((2 * n + (n + 2) * w * r) * mu - 2 * (n + 4)) ** 2) out.append(('buckling: the square identity, with r^2 = n(n + 2) and w^2 = 2', square.with_square('r', n * (n + 2)).with_square('w', 2) == 0)) out.append(('buckling: (r + 2w)^2 = n^2 + 2n + 8 + 4rw', ((r + 2 * w) ** 2 - (n * n + 2 * n + 8 + 4 * r * w)).with_square('r', n * (n + 2)).with_square('w', 2) == 0)) out.append(('buckling: (r + 2w)^2 - (n + 4)(n + 2) = 4 (rw - n)', ((r + 2 * w) ** 2 - (n + 4) * (n + 2) - 4 * (r * w - n)).with_square('r', n * (n + 2)).with_square('w', 2) == 0)) out.append(('buckling: (rw)^2 - n^2 = n (n + 4)', ((r * w) ** 2 - n * n - n * (n + 4)).with_square('r', n * (n + 2)).with_square('w', 2) == 0)) def scalar_form(a, b, c): return a * a + G * b * b + R * c * c - 2 * g * a * b - n * a * c + (n - 2) * g * b * c def vector_form(a, b, c): return (g * a * a + S * b * b + (G * S + 4 * g) * c * c - n * a * b + (n - 2) * g * a * c + 2 * (n - T) * b * c) shift = (6 - n) * (n + 2) / 4 out.append(('plate: the scalar form at (g, 1, 0)', scalar_form(g, 1, 0) == G - g * g)) out.append(('plate: the scalar form at (g (R + 1), R + 1, g)', scalar_form(g * (R + 1), R + 1, g) == (G - g * g) * (R + 1) ** 2 - g * g * (R + 2))) out.append(('plate: the scalar form at (G n / 2 - (n - 2) g^2 / 2, g, G - g^2)', scalar_form(G * n * half - (n - 2) * g * g * half, g, G - g * g) == (G - g * g) * ((R - n * n / 4) * (G - g * g) - g * g))) out.append(('plate: the vector form at (n b - (n - 2) g c, 2 g b, 2 g c)', vector_form(n * be - (n - 2) * g * ga, 2 * g * be, 2 * g * ga) == g * (4 * g * S - n * n) * be * be + 8 * g * g * (n * (n + 2) / 4 - T) * be * ga + 4 * g * g * (G * S + shift * g) * ga * ga)) out.append(('plate: n^2 / 4 + (6 - n)(n + 2) / 4 = n + 3', n * n / 4 + shift == n + 3)) theta = n * half + s cubic_q = (Y - n * n / 4) * (Y + shift) cubic_r = (n * n / 4 - n * half * (Y - n * n / 4)) * (Y + shift) out.append(('plate: the cubic in s = theta - n / 2', s * s * (1 + theta) - (theta * Y - n * n * (1 + theta) / 4) * (Y + shift) == s ** 3 + (1 + n * half) * s * s - cubic_q * s + cubic_r)) rr = variables('rr')[0] t = (d - p) / 3 out.append(('cubic lemma: the identity, with d^2 = p^2 + 3q', (s ** 3 + p * s * s - q * s + rr - (s - t) ** 2 * (s + p + 2 * t) - (27 * rr + 9 * p * q + 2 * p ** 3 - 2 * d ** 3) / 27).with_square('d', p * p + 3 * q) == 0)) return out def positive_from_two(poly_in_n): """Whether every coefficient of the polynomial, written in a = n - 2, is positive. Then the polynomial is positive for every real n >= 2.""" a = variables('a')[0] coefficients = poly_in_n.subs('n', 2 + a).by_power('a') degree = max(coefficients) return all(k in coefficients and coefficients[k].number() > 0 for k in range(degree + 1)) def all_dimension_checks(): """The facts that hold for every n >= 2, as (name, whether it holds).""" n = variables('n')[0] Y = (8 * n * n + 12 * n - 1) / 32 shift = (6 - n) * (n + 2) / 4 p = 1 + n / 2 q = (Y - n * n / 4) * (Y + shift) r = (n * n / 4 - n / 2 * (Y - n * n / 4)) * (Y + shift) gap = (27 * r + 9 * p * q + 2 * p ** 3) ** 2 - 4 * (p * p + 3 * q) ** 3 E = 8 * n * n + 12 * n - 1 return [ ('plate: Y - n^2 / 4 = (12 n - 1) / 32 for Y = (8 n^2 + 12 n - 1) / 32', Y - n * n / 4 == (12 * n - 1) / 32), ('plate: n (n + 2) / 4 - Y = (4 n + 1) / 32', n * (n + 2) / 4 - Y == (4 * n + 1) / 32), ('plate: Y passes the test for every n >= 2', positive_from_two(gap)), ('plate: the rational bound is below the root of Hile and Yeh for every n >= 2', positive_from_two(E * E * (E + 64 * (n + 2)) - 512 * n * n * (n + 2) ** 4)), ] def dimension_row(n, digits=6): """The checks of one dimension and the row of the table.""" step = Fraction(1, 10 ** digits) checks = [] hy_buckling = 1 + rb.hile_yeh_buckling_excess(n) low, high = rb.buckling_excess_enclosure(n) checks.append(('buckling below Hile and Yeh', rb.buckling_excess_below(n, rb.hile_yeh_buckling_excess(n)))) checks.append(('buckling enclosure', low <= high and high - low < step and not rb.buckling_excess_below(n, low) and (low == high or rb.buckling_excess_below(n, high)))) rational = rb.plate_rational_bound(n) best = rb.plate_best_constant(n, digits) checks.append(('plate rational constant passes', rb.plate_test(n, rb.plate_rational_constant(n)))) checks.append(('plate best constant', rb.plate_test(n, best) and not rb.plate_test(n, best + step) and best >= rb.plate_rational_constant(n))) checks.append(('plate below Hile and Yeh', rb.below_hile_yeh_plate(n, rational))) printed = rb.HILE_YEH_PRINTED_PLATE.get(n) if printed is not None: checks.append(('plate below the printed value of Hile and Yeh', rational < Fraction(printed))) row = '%5d | %s | %s | %s | %s | %s | %s' % ( n, rb.round_up(hy_buckling), rb.round_up(1 + high), rb.round_up(rb.hile_yeh_plate_root_below(n, digits) + step), rb.round_up(rational), rb.round_up(rb.plate_bound(n, best)), rb.round_up(best)) return checks, row def main(argv): largest = int(argv[1]) if len(argv) > 1 else 10 bad = [] def record(group, checks): for name, holds in checks: if not holds: bad.append('%s: %s' % (group, name)) return len(checks) print('algebra: %d polynomial identities checked' % record('algebra', algebra_checks())) print('all dimensions: %d facts checked for every n >= 2' % record('all dimensions', all_dimension_checks())) for n in range(2, 6): q = integrals(example(n), shifted_origin(n)) failed = failures(q) bad.extend('dimension %d: %s' % (n, name) for name in failed) print('dimension %d: %d integral identities checked on an explicit function' % (n, len(identities(q)) + 1)) print(' n | Hile-Yeh | buckling | Hile-Yeh | plate | plate, best Y | best Y') for n in list(range(2, largest + 1)) + [k for k in (100, 1000) if k > largest]: checks, row = dimension_row(n) record('dimension %d' % n, checks) print(row) if bad: for line in bad: print('FAILED', line) return 1 print('every check holds; each bound is rounded up to six decimals, and best Y is exact') return 0 if __name__ == '__main__': sys.exit(main(sys.argv))