Indexed text attachment
verify-pde.py
Source for Partial Differential Equations in Higher Categories
View paper · Download original file
Lines 1620–1640 of 1640. Source text is displayed literally.
1620 'lambda/lambda_1 at amplitude 0.2, 1, 2: %.5f, %.5f, %.5f' % tuple(lams))1621gg, hh = 9.81, 3.01622 1623 1624def ww(kk):1625 om_ = math.sqrt(gg * kk * math.tanh(kk * hh))1626 pot = lambda x, z, t: math.cosh(kk * (z + hh)) * math.sin(kk * x - om_ * t)1627 harm = d2(lambda x: pot(x, -0.7, 0.3), 0.4) + d2(lambda z: pot(0.4, z, 0.3), -0.7)1628 surf = d2(lambda t: pot(0.4, 0.0, t), 0.3) + gg * d1(lambda z: pot(0.4, z, 0.3), 0.0)1629 bott = d1(lambda z: pot(0.4, z, 0.3), -hh)1630 return max(abs(harm), abs(surf), abs(bott)) / math.cosh(kk * hh), om_ / kk1631 1632 1633r1_, cmid = ww(0.9)1634cshal, cdeep = math.sqrt(gg * math.tanh(0.003 * hh) / 0.003), math.sqrt(gg * math.tanh(20.0 * hh) / 20.0)1635check('X10 linear water waves: the potential cosh(k(z+h)) sin(kx - omega t) is harmonic, has no flow through the bottom, and satisfies the surface'1636 ' condition exactly when omega^2 = g k tanh(kh); the speed is sqrt(gh) in shallow water and sqrt(g/k) in deep water',1637 r1_ < 1e-5 and abs(cshal - math.sqrt(gg * hh)) < 1e-3 and abs(cdeep - math.sqrt(gg / 20.0)) < 1e-12)1638 1639footer()1640