"""Schematic picture of the closed surface of Theorem A in R^3. This is an illustration, NOT a computation of the constructed surface: the profile below is a smooth bump with a few visible ripples, the nonradial amplitude is exaggerated by many orders of magnitude, and the infinitely many small cells near the two edges of the moving ring are not drawn. What the picture does show correctly is the structure: a fixed inner disk, a rippled ring of angular period pi, a planar collar, and a marked cap, with the ripple pattern turning while everything else stays in place. Usage: python3 make_surface_figure.py (writes surface-schematic.png) """ import numpy as np import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap R_IN, R_OUT, R_COLLAR = 0.34, 1.00, 1.13 # moving ring = (R_IN, R_OUT) RIM, DEPTH = 0.15, 0.95 # rim radius, depth of the cap Z_IN, Z_OUT = 0.00, 0.20 # heights of inner disk / collar Q = 0.11 # exaggerated nonradial amplitude MARK_THETA, MARK_T = np.deg2rad(-78.0), 0.20 # position of the mark on the cap ELEV, AZIM = 36.0, -62.0 def flat_step(t): """Smooth step 0 -> 1 on [0,1], flat to infinite order at both ends.""" t = np.clip(t, 0.0, 1.0) a = np.where(t > 0, np.exp(-1.0 / np.maximum(t, 1e-12)), 0.0) b = np.where(t < 1, np.exp(-1.0 / np.maximum(1 - t, 1e-12)), 0.0) return a / (a + b) def flat_bump(t): """Bump on [0,1], flat to infinite order at both ends, maximum 1.""" t = np.clip(t, 1e-9, 1 - 1e-9) return np.exp(4.0 - 1.0 / (t * (1.0 - t))) def surface(phase, nth=241): """One grid (profile parameter, angle) for the whole closed surface.""" # profile parameter: lid (radius 0..R_COLLAR), rim, bowl r_lid = np.concatenate([np.linspace(0, R_IN, 14)[:-1], np.linspace(R_IN, R_OUT, 120)[:-1], np.linspace(R_OUT, R_COLLAR, 8)]) a = np.linspace(0.0, np.pi / 2, 16)[1:] t = np.linspace(0.0, np.pi / 2, 70)[1:] th = np.linspace(0.0, 2 * np.pi, nth) n_lid, n_rim, n_bowl = len(r_lid), len(a), len(t) n = n_lid + n_rim + n_bowl rho = np.empty((n, nth)); z = np.empty((n, nth)) nonrad = np.zeros((n, nth)); kind = np.zeros((n, nth), dtype=int) mark = np.zeros((n, nth)) R, TH = np.meshgrid(r_lid, th, indexing="ij") s = (R - R_IN) / (R_OUT - R_IN) radial = Z_IN + (Z_OUT - Z_IN) * flat_step(s) ripple = flat_bump(s) * np.cos(2.6 * np.pi * (s - 0.5)) wave = np.where((R > R_IN) & (R < R_OUT), Q * ripple * np.cos(2.0 * (TH - phase)), 0.0) rho[:n_lid] = R; z[:n_lid] = radial + wave; nonrad[:n_lid] = wave kind[:n_lid] = np.where(R <= R_IN, 0, np.where(R < R_OUT, 1, 2)) rho[n_lid:n_lid + n_rim] = (R_COLLAR + RIM * np.sin(a))[:, None] z[n_lid:n_lid + n_rim] = (Z_OUT - RIM + RIM * np.cos(a))[:, None] kind[n_lid:n_lid + n_rim] = 3 bump = np.exp(-((t[:, None] / (np.pi / 2) - MARK_T) / 0.085) ** 2 - (np.angle(np.exp(1j * (th[None, :] - MARK_THETA))) / 0.21) ** 2) rho[n_lid + n_rim:] = (R_COLLAR + RIM) * np.cos(t)[:, None] + 0.09 * bump z[n_lid + n_rim:] = (Z_OUT - RIM - DEPTH * np.sin(t))[:, None] + 0 * bump kind[n_lid + n_rim:] = 3 mark[n_lid + n_rim:] = bump THf = np.broadcast_to(th[None, :], rho.shape) return rho * np.cos(THf), rho * np.sin(THf), z, nonrad, kind, mark DIV = LinearSegmentedColormap.from_list( "div", ["#2166ac", "#92c5de", "#e6e6e6", "#f4a582", "#b2182b"]) LIGHT = np.array([-0.35, -0.55, 0.76]); LIGHT = LIGHT / np.linalg.norm(LIGHT) def face_colors(x, y, z, nonrad, kind, mark): """Flat colour by part, times a Lambert factor from the grid normals.""" P = np.stack([x, y, z], axis=-1) du = P[1:, :-1] - P[:-1, :-1] dv = P[:-1, 1:] - P[:-1, :-1] nrm = np.cross(du, dv) # at the axis the first cell is degenerate; use the vertical length = np.linalg.norm(nrm, axis=-1, keepdims=True) nrm = np.where(length > 1e-12, nrm / np.maximum(length, 1e-12), np.array([0.0, 0.0, 1.0])) lam = 0.50 + 0.50 * np.clip(nrm @ LIGHT, 0.0, 1.0) k = kind[:-1, :-1]; w = nonrad[:-1, :-1]; m = mark[:-1, :-1] rgb = np.empty(k.shape + (3,)) rgb[k == 0] = (0.66, 0.84, 0.66) # fixed inner disk rgb[k == 1] = DIV(0.5 + 0.5 * w[k == 1] / Q)[:, :3] # moving ring rgb[k == 2] = (0.93, 0.93, 0.94) # planar collar rgb[k == 3] = (0.80, 0.81, 0.84) # cap red = np.array([0.90, 0.12, 0.12]) wm = np.clip(1.5 * m, 0, 1)[..., None] rgb = (1 - wm) * rgb + wm * red out = np.ones(k.shape + (4,)) out[..., :3] = np.clip(rgb * lam[..., None], 0, 1) return out def draw(ax, phase, title): x, y, z, nonrad, kind, mark = surface(phase) ax.plot_surface(x, y, z, facecolors=face_colors(x, y, z, nonrad, kind, mark), rstride=1, cstride=1, linewidth=0, antialiased=False, shade=False) th = np.linspace(0, 2 * np.pi, 400) for rad, zz, sty in [(R_IN, Z_IN, "-"), (R_OUT, Z_OUT, "--")]: ax.plot(rad * np.cos(th), rad * np.sin(th), zz + 0.006, sty, color="0.2", lw=0.6, zorder=10) ax.set_box_aspect((1, 1, 0.56)) lim = R_COLLAR + RIM ax.set_xlim(-lim, lim); ax.set_ylim(-lim, lim) ax.set_zlim(Z_OUT - RIM - DEPTH, Z_OUT + 0.12) ax.view_init(elev=ELEV, azim=AZIM) ax.set_axis_off() ax.set_title(title, fontsize=12, y=0.90) LABELS = [ ("fixed inner disk", (0.255, 0.555), (0.085, 0.085), "center"), ("moving ring", (0.300, 0.700), (0.500, 0.90), "center"), ("planar collar", (0.405, 0.520), (0.500, 0.36), "center"), ("marker on the fixed cap", (0.222, 0.228), (0.375, 0.085), "center"), ] def main(): fig = plt.figure(figsize=(8.4, 3.5)) for k, (phase, title) in enumerate( [(0.0, "initial position"), (np.deg2rad(50.0), "later position")]): ax = fig.add_subplot(1, 2, k + 1, projection="3d") draw(ax, phase, title) fig.subplots_adjust(left=-0.06, right=1.06, bottom=-0.22, top=1.12, wspace=-0.18) # direct labels on the left panel (figure coordinates) ov = fig.add_axes([0, 0, 1, 1]); ov.set_axis_off() ov.set_xlim(0, 1); ov.set_ylim(0, 1) kw = dict(fontsize=10.5, color="0.1", arrowprops=dict(arrowstyle="-", lw=0.5, color="0.25", shrinkA=1, shrinkB=0)) for text, xy, xytext, ha in LABELS: ov.annotate(text, xy=xy, xytext=xytext, ha=ha, va="center", **kw) fig.savefig("surface-schematic.png", dpi=300) if __name__ == "__main__": main()