Indexed text attachment
verify-topology.py
Source for Algebraic and Differential Topology in Higher Categories
View paper · Download original file
Lines 1581–1680 of 1961. Source text is displayed literally.
1581 1582 1583pos = [[1.0, 0.0], [0.0, 1.0]]1584neg = [[0.0, 1.0], [1.0, 0.0]]1585cd = [collapse_degree([(0, 0, pos)]), collapse_degree([(0, 0, neg)]), collapse_degree([(0, 0, pos), (3, 0, pos), (0, 3, neg)])]1586check('F3 the Pontryagin-Thom collapse of framed points in the plane has degree the signed number of points',1587 close(cd[0], 1, 5e-3) and close(cd[1], -1, 5e-3) and close(cd[2], 1, 5e-3), 'degrees %.4f, %.4f, %.4f for frames (+), (-), (+,+,-)' % tuple(cd))1588 1589sec('9. Degree, linking and the Hopf invariant')1590cA = lambda s: [math.cos(s), math.sin(s), 0.0]1591cB = lambda s: [1 + math.cos(s), 0.0, math.sin(s)]1592cC = lambda s: [4 + math.cos(s), 0.0, math.sin(s)]1593def tl(j, k=2):1594 return lambda s: [(2 + 0.6 * math.cos(k * s + j * PI)) * math.cos(s), (2 + 0.6 * math.cos(k * s + j * PI)) * math.sin(s), 0.6 * math.sin(k * s + j * PI)]1595l1, l0, l2 = gauss_link(cA, cB), gauss_link(cA, cC), gauss_link(tl(0), tl(1))1596check('K1 the Gauss integral computes linking numbers: Hopf link 1, unlinked circles 0, the (2,4) torus link 2',1597 close(abs(l1), 1, 1e-3) and abs(l0) < 1e-9 and close(abs(l2), 2, 1e-3), 'values %.8f, %.1e, %.8f' % (l1, l0, l2))1598 1599 1600def stereo(x):1601 return [x[0] / (1 - x[3]), x[1] / (1 - x[3]), x[2] / (1 - x[3])]1602 1603 1604def fibre(zeta):1605 """the Hopf fibre z1 = zeta z2, as a curve in R^3"""1606 n = math.sqrt(1 + abs(zeta) ** 2)1607 def c(t):1608 e = cmath.exp(1j * t)1609 z1, z2 = zeta * e / n, e / n1610 return stereo([z1.real, z1.imag, z2.real, z2.imag])1611 return c1612 1613 1614def total_link(zs, ws):1615 return sum(gauss_link(fibre(a), fibre(b)) for a in zs for b in ws)1616 1617 1618h1 = total_link([0.3 + 0.2j], [-1.0 + 0.5j])1619h4 = total_link([cmath.sqrt(0.3 + 0.2j), -cmath.sqrt(0.3 + 0.2j)], [cmath.sqrt(-1 + 0.5j), -cmath.sqrt(-1 + 0.5j)])1620c3 = lambda w: [abs(w) ** (1 / 3) * cmath.exp(1j * (cmath.phase(w) + 2 * PI * k) / 3) for k in range(3)]1621h9 = total_link(c3(0.3 + 0.2j), c3(-1 + 0.5j))1622check('K2 the Hopf invariant as a linking number: two fibres of the Hopf map link once; for g o h with g of degree d the preimages link d^2 times',1623 close(abs(h1), 1, 1e-3) and close(abs(h4), 4, 1e-3) and close(abs(h9), 9, 1e-3), 'linking %.6f for h; %.6f for z^2 o h; %.6f for z^3 o h' % (h1, h4, h9))1624 1625 1626def twisted_fibre(zeta, d):1627 """preimage of zeta under h o f, f(z1,z2) = (z1^d, z2)/norm: the curve z1^d = zeta z2 on the 3-sphere"""1628 r = bisect(lambda r_: r_ ** d - abs(zeta) * math.sqrt(1 - r_ * r_), 1e-9, 1 - 1e-9)1629 s = math.sqrt(1 - r * r)1630 def c(t):1631 z1 = r * cmath.exp(1j * t)1632 z2 = s * cmath.exp(1j * (d * t - cmath.phase(zeta)))1633 return stereo([z1.real, z1.imag, z2.real, z2.imag])1634 return c1635 1636 1637hd = [gauss_link(twisted_fibre(0.5 + 0.1j, d), twisted_fibre(-0.8 + 1.2j, d), 260) for d in (1, 2, 3)]1638check('K3 for h o f with f of degree d on the 3-sphere the preimages link d times: the Hopf invariant is linear on this side and quadratic on the other',1639 all(close(abs(v), d, 1e-3) for v, d in zip(hd, (1, 2, 3))), 'linking %s' % ', '.join('%.5f' % v for v in hd))1640 1641 1642def framed_pushoff(t, eps=0.25):1643 return lambda s: [(1 + eps * math.cos(t * s)) * math.cos(s), (1 + eps * math.cos(t * s)) * math.sin(s), eps * math.sin(t * s)]1644 1645 1646sl = [gauss_link(cA, framed_pushoff(t)) for t in (0, 1, 2, -3)]1647check('K4 a framing of a circle in space is an integer: the linking number of the circle with its push-off along the frame that turns t times is t',1648 all(close(abs(v), abs(t), 1e-3) for v, t in zip(sl, (0, 1, 2, -3))) and sl[1] * sl[3] < 0, 'linking %s' % ', '.join('%.6f' % v for v in sl))1649 1650 1651def hopf(x):1652 z1, z2 = complex(x[0], x[1]), complex(x[2], x[3])1653 w = 2 * z1 * z2.conjugate()1654 return [w.real, w.imag, abs(z1) ** 2 - abs(z2) ** 2]1655 1656 1657okh = True1658for _ in range(50):1659 x = [random.gauss(0, 1) for _ in range(4)]1660 n = vnorm(x)1661 x = [a / n for a in x]1662 y = hopf(x)1663 th = random.uniform(0, 2 * PI)1664 e = cmath.exp(1j * th)1665 z1, z2 = complex(x[0], x[1]) * e, complex(x[2], x[3]) * e1666 y2 = hopf([z1.real, z1.imag, z2.real, z2.imag])1667 J = [[(hopf([x[k] + (1e-6 if k == j else 0) for k in range(4)])[i] - hopf([x[k] - (1e-6 if k == j else 0) for k in range(4)])[i]) / 2e-6 for j in range(4)] for i in range(3)]1668 # rank of the differential restricted to the tangent space: Gram matrix has rank 2 on the sphere1669 G = [[sum(J[i][k] * J[j][k] for k in range(4)) for j in range(3)] for i in range(3)]1670 ev, _ = jacobi_eig(G)1671 okh = okh and close(vnorm(y), 1, 1e-9) and vnorm(vsub(y, y2)) < 1e-9 and ev[1] > 1.01672check('K5 the Hopf map takes the 3-sphere onto the 2-sphere, is constant on the circles e^{it}(z1,z2), and is a submersion', okh, '50 random points')1673 1674sec('10. Rotations and the first stem')1675 1676 1677def qmul(a, b):1678 return (a[0] * b[0] - a[1] * b[1] - a[2] * b[2] - a[3] * b[3], a[0] * b[1] + a[1] * b[0] + a[2] * b[3] - a[3] * b[2],1679 a[0] * b[2] - a[1] * b[3] + a[2] * b[0] + a[3] * b[1], a[0] * b[3] + a[1] * b[2] - a[2] * b[1] + a[3] * b[0])1680