Skip to content

Module 2 — Hamiltonian vector fields and symplectic integrators

Lecture notes written against midi-sink as shipped (libsumi 1.12.0, Voxo 0.26.0, 2026-10-25) and checked claim by claim against the engine before this fold (2026-10-26; libsumi is unchanged since, and Voxo’s later versions add the sampler’s second generation and touch no synth claim here). Code citations and gate numbers refer to docs/PROJECT_SPEC.md (spec v6), docs/DECISIONS.md Part XIII (cited DECISIONS_13 #n), and the Kessho proposal medium_specs_v3.md (in git history; its substance §10.7). The lab beside the module is a standalone teaching re-implementation, never the engine; the engine’s own lab is the Suzu lab.


2.1 From Energy Landscapes to Flows: The Hamiltonian Vector Field XHX_H

Section titled “2.1 From Energy Landscapes to Flows: The Hamiltonian Vector Field XHX_HXH​”

In Module 1, we built the phase space M=T∗QM = T^*Q and endowed it with the canonical symplectic 2-form ω=−dθ=∑i=1ndqi∧dpi\omega = -d\theta = \sum_{i=1}^n dq_i \wedge dp_i. We proved that ω\omega is closed (dω=0d\omega = 0) and non-degenerate (det⁡Ω≠0\det \Omega \neq 0). Now we put that geometry to work: how does a scalar energy function H:M→RH : M \to \mathbb{R} generate motion?

On a Riemannian manifold with metric gg, a function HH induces the gradient vector field ∇H\nabla H via g(∇H,v)=dH(v)g(\nabla H, v) = dH(v). Trajectories of ∇H\nabla H climb steepest-ascent slopes (or descend them under −∇H-\nabla H), so HH changes monotonically along the flow and every local minimum is a sink (div⁡(−∇H)<0\operatorname{div}(-\nabla H) < 0).

On a symplectic manifold (M,ω)(M, \omega), we replace the symmetric metric gg with the skew-symmetric 2-form ω\omega. Because ω\omega is non-degenerate, the bundle map ω♭:TM→T∗M\omega^\flat : TM \to T^*M defined by v↦ivω=ω(v,⋅)v \mapsto i_v\omega = \omega(v, \cdot) is a linear isomorphism at every point. Given any smooth Hamiltonian H∈C∞(M)H \in C^\infty(M), there exists a unique vector field XHX_H — the Hamiltonian vector field of HH — satisfying:

iXHω=dHi_{X_H}\omega = dH

Evaluating both sides on an arbitrary tangent vector vv means ω(XH,v)=dH(v)\omega(X_H, v) = dH(v). Let us compute XHX_H in canonical Darboux coordinates (q1,…,qn,p1,…,pn)(q_1, \dots, q_n, p_1, \dots, p_n). Write:

XH=∑i=1n(Ai∂∂qi+Bi∂∂pi),dH=∑i=1n(∂H∂qi dqi+∂H∂pi dpi)X_H = \sum_{i=1}^n \left( A_i \frac{\partial}{\partial q_i} + B_i \frac{\partial}{\partial p_i} \right), \qquad dH = \sum_{i=1}^n \left( \frac{\partial H}{\partial q_i}\,dq_i + \frac{\partial H}{\partial p_i}\,dp_i \right)

Taking the interior product of XHX_H with ω=∑i=1ndqi∧dpi\omega = \sum_{i=1}^n dq_i \wedge dp_i using the anti-derivation rule from Module 1 (§1.1):

iXHω=∑i=1n((iXHdqi) dpi−(iXHdpi) dqi)=∑i=1n(Ai dpi−Bi dqi)i_{X_H}\omega = \sum_{i=1}^n \Big( (i_{X_H}dq_i)\,dp_i - (i_{X_H}dp_i)\,dq_i \Big) = \sum_{i=1}^n \left( A_i\,dp_i - B_i\,dq_i \right)

Matching coefficients of dqidq_i and dpidp_i against dHdH yields Ai=∂H∂piA_i = \frac{\partial H}{\partial p_i} and −Bi=∂H∂qi-B_i = \frac{\partial H}{\partial q_i}, which are Hamilton’s equations:

q˙i=∂H∂pi,p˙i=−∂H∂qi⟺z˙=J ∇H(z),J=Ω−1=(0In−In0)\dot{q}_i = \frac{\partial H}{\partial p_i}, \qquad \dot{p}_i = -\frac{\partial H}{\partial q_i} \qquad \Longleftrightarrow \qquad \dot{z} = J\,\nabla H(z), \quad J = \Omega^{-1} = \begin{pmatrix} 0 & I_n \\ -I_n & 0 \end{pmatrix}

Notice the immediate geometric consequence of skew-symmetry: the rate of change of HH along its own Hamiltonian flow is

LXHH=dH(XH)=(iXHω)(XH)=ω(XH,XH)=0\mathcal{L}_{X_H} H = dH(X_H) = (i_{X_H}\omega)(X_H) = \omega(X_H, X_H) = 0

Unlike gradient flow, which crosses level sets of HH orthogonally, Hamiltonian flow is everywhere tangent to the iso-energy surfaces H=constH = \text{const}. Energy conservation is not a dynamical accident; it is the statement that a 2-form evaluated on a repeated vector vanishes.

Stream Functions on the Suminagashi Sheet (libsumi)

Section titled “Stream Functions on the Suminagashi Sheet (libsumi)”

As we saw in Module 1 (§1.2), the two-dimensional canvas M=R2M = \mathbb{R}^2 with coordinates (x,y)(x, y) and area form ω=dx∧dy\omega = dx \wedge dy is itself a 1-DoF symplectic manifold with q=xq = x and p=yp = y. Any scalar stream function ψ(x,y)\psi(x, y) acts as a Hamiltonian on the tank surface:

iXψ(dx∧dy)=dψ⟹Xψ=(∂ψ∂y,  −∂ψ∂x),∇⋅Xψ=∂2ψ∂x∂y−∂2ψ∂y∂x=0i_{X_\psi}(dx \wedge dy) = d\psi \quad \Longrightarrow \quad X_\psi = \left( \frac{\partial \psi}{\partial y},\; -\frac{\partial \psi}{\partial x} \right), \qquad \nabla \cdot X_\psi = \frac{\partial^2 \psi}{\partial x \partial y} - \frac{\partial^2 \psi}{\partial y \partial x} = 0

Every incompressible velocity field on the sheet is locally a Hamiltonian vector field XψX_\psi. However, integrating x˙=Xψ(x)\dot{x} = X_\psi(x) for a finite step Δt\Delta t on a pixel grid requires care: evaluating a curved velocity field at a single point and taking a straight Euler step Psrc=P−Δt Xψ(P)P_{src} = P - \Delta t\,X_\psi(P) does not follow the curved streamlines of ψ\psi, and its discrete Jacobian ceases to be unimodular (det⁡J≠1\det J \neq 1). libsumi handles this across its operator suite (PROJECT_SPEC.md §10, PROJECT_SPEC.md §10.8.2) in three distinct ways:

  1. Exact directional shear splitting (chladni_fs, §10.3): The Chladni cellular operator is governed by the Taylor–Green vortex stream function: ψ(x,y)=Ψcos⁡ ⁣(kx(x−x0))cos⁡ ⁣(ky(y−y0))\psi(x, y) = \Psi \cos\!\big(k_x(x - x_0)\big)\cos\!\big(k_y(y - y_0)\big) Integrating XψX_\psi directly by Euler would spiral outward from every cell centre. Instead, chladni_fs applies the trigonometric identity cos⁡Acos⁡B=12[cos⁡(A−B)+cos⁡(A+B)]\cos A \cos B = \frac{1}{2}[\cos(A - B) + \cos(A + B)] with u=kx(x−x0)u = k_x(x - x_0) and v=ky(y−y0)v = k_y(y - y_0) to split the Hamiltonian into two diagonal plane waves: ψ=ψ−+ψ+,ψ∓(u,v)=Ψ2cos⁡(u∓v)\psi = \psi_- + \psi_+, \qquad \psi_\mp(u, v) = \frac{\Psi}{2}\cos(u \mp v) Because ψ−\psi_- depends only on the combination u−vu - v, its Hamiltonian vector field Xψ−X_{\psi_-} moves points purely along the lines u−v=constu - v = \text{const}! Along each such line, u−vu - v is constant during the entire motion, so the velocity is constant along each trajectory and a single step is the exact time-1 flow of ψ−\psi_- — a pure shear in (u,v)(u, v) with det⁡J−=1\det J_- = 1 identically. The second half-step along u+v=constu + v = \text{const} is an exact shear with det⁡J+=1\det J_+ = 1 reading the already-advected coordinate (u1,v1)(u_1, v_1): In the tree each wave is its own pass: chladni_fs applies ONE wave per pass, for any pair of wavevectors (a rectangular pair is Taylor–Green’s, an oblique pair the Jankó’s staggered rows), stage 0 then stage 1:

    // deform.glsl, chladni_fs — one wave of ψ = ½Ψ[cos(w1·P') + cos(w2·P')]
    float s = wx * (P.x - p0x) + wy * (P.y - p0y);
    vec2 P_src = P + 0.5 * psi * weight * sin(s) * vec2(wy, -wx);

    The flow of 12Ψcos⁡s\frac{1}{2}\Psi\cos s is a pure shear along (wy,−wx)(w_y, -w_x), the direction where ss is constant, so the lookup is exact at any amplitude; the second stage reads the field the first already advected. By the chain rule, det⁡J=det⁡J+⋅det⁡J−=1⋅1=1\det J = \det J_+ \cdot \det J_- = 1 \cdot 1 = 1 for any amplitude amp. Moreover, because two shears along non-parallel axes do not commute, the exact inverse of a step is both shears negated in reversed order (s2s_2 first, then s1s_1) — a sign flip alone is not (DECISIONS_5 #17, #23); it is the conservation gate (midi-sink --dev --soak chladni) that holds the operator to its class, not a round-trip function.

  2. Strang-composed Lamb–Oseen rotations and Kirchhoff’s point-vortex Hamiltonian (SUMI_DEFORM_BRAID, §10.8.2): When a musical chord is held on the keyboard, each active note k∈{1,…,N}k \in \{1, \dots, N\} spawns a regularized Lamb–Oseen vortex at xk=(xk,yk)x_k = (x_k, y_k) with circulation Γk=sign⁡(Ck) Γvel (0.3+0.7 ∣Ck∣)\Gamma_k = \operatorname{sign}(C_k)\,\Gamma_{\text{vel}}\,(0.3 + 0.7\,|C_k|) — CkC_k the Sethares consonance of the note against the bass, Γvel=0.036\Gamma_{\text{vel}} = 0.036 canvas²/s at full velocity — and core radius rcr_c. The total stream function on the canvas is the superposition: ψ(x)=∑k=1NΓk ψLO(∥x−xk∥;rc)\psi(x) = \sum_{k=1}^N \Gamma_k\,\psi_{\text{LO}}(\|x - x_k\|; r_c) Because each single vortex Hamiltonian ψk(x)=Γk ψLO(∥x−xk∥;rc)\psi_k(x) = \Gamma_k\,\psi_{\text{LO}}(\|x - x_k\|; r_c) is radially symmetric around xkx_k, its exact flow for any time step is a pure differential rotation (vortex_fs, det⁡Jk=1\det J_k = 1 identically). Rather than summing the velocity fields on a grid and losing area preservation, libsumi integrates the superposed Hamiltonian ψ=∑kψk\psi = \sum_k \psi_k by second-order Strang splitting: a forward sweep k=1…Nk = 1 \dots N with half-angle 12ΓkΔt\frac{1}{2}\Gamma_k \Delta t followed by a reverse sweep k=N…1k = N \dots 1 with 12ΓkΔt\frac{1}{2}\Gamma_k \Delta t (30 exact rotation passes at the 15-voice cap). Every pass has det⁡J=1\det J = 1, and the symmetric ordering cancels the O(Δt2)\mathcal{O}(\Delta t^2) commutator error [Xψj,Xψk][X_{\psi_j}, X_{\psi_k}].

    Furthermore, in free mode (braid_mode = SUMI_BRAID_FREE, the D key; pinned is the default), the vortex centres {xk=(Xk,Yk)}k=1N\{x_k = (X_k, Y_k)\}_{k=1}^N are not static: they mutually advect one another as a finite-dimensional Hamiltonian system of NN interacting point vortices! With the circulation-weighted symplectic form ωvortex=∑k=1NΓk dXk∧dYk\omega_{\text{vortex}} = \sum_{k=1}^N \Gamma_k\,dX_k \wedge dY_k, the motion is governed by Kirchhoff’s regularized Hamiltonian: HKirchhoff(x1,…,xN)=−14π∑1≤j<k≤NΓjΓkln⁡ ⁣(∥xj−xk∥2+RjRk)H_{\text{Kirchhoff}}(x_1, \dots, x_N) = -\frac{1}{4\pi} \sum_{1 \le j < k \le N} \Gamma_j \Gamma_k \ln\!\left( \|x_j - x_k\|^2 + R_j R_k \right) (the regulariser is the product of the two cores, rc2[j][k], not one rc2r_c^2). So that the vortex centres never spiral apart during a ten-minute performance, libsumi steps HKirchhoffH_{\text{Kirchhoff}} on the CPU with the implicit midpoint rule (sumi_braid_step: resolved by fixed-point iteration in double to 10−1510^{-15}, at most sixteen rounds), which is a 2nd-order symplectic integrator on (R2N,ωvortex)(\mathbb{R}^{2N}, \omega_{\text{vortex}}). In tests/normalizer_tests.cpp, a consonant triad braided for 72 000 steps at 1/120 s (ten minutes) holds HKirchhoffH_{\text{Kirchhoff}} within ∣dH/H∣<10−6|dH/H| < 10^{-6}, and the linear impulse ∑kΓkxk\sum_k \Gamma_k x_k and the angular impulse ∑kΓk∥xk∥2\sum_k \Gamma_k \|x_k\|^2 within 10−910^{-9} (sumi_braid_invariants).

  3. First-order backward-characteristic steps and the folding horizon (wake_fs, burst_fs, §10.2): When an operator does not split into closed-form shears or rotations — such as the potential dipole wake (wake_fs, wake_profile 0 — the default) or the viscous regularized Stokeslet wake (wake_profile 1) — libsumi takes a backward-characteristic step Psrc=P−u(P)P_{src} = P - u(P). For the potential doublet of radius aa and step length dd, the velocity field is divergence-free (∇⋅u=0\nabla \cdot u = 0, so tr⁡(∇u)=0\operatorname{tr}(\nabla u) = 0), which kills the O(d/a)\mathcal{O}(d/a) term in det⁡(I−∇u)=1−tr⁡(∇u)+det⁡(∇u)\det(I - \nabla u) = 1 - \operatorname{tr}(\nabla u) + \det(\nabla u). However, the quadratic term det⁡(∇u)\det(\nabla u) survives! At the rear stagnation point (r=a,θ=π)(r = a, \theta = \pi), the eigenvalues of I−∇uI - \nabla u are 1−2d/a1 - 2d/a and 1+2d/a1 + 2d/a, giving: det⁡Jdoublet∣rear=1−4d2a2=0at d=a2\det J_{\text{doublet}}\big|_{\text{rear}} = 1 - \frac{4d^2}{a^2} = 0 \quad \text{at } d = \frac{a}{2} At d=a/2d = a/2, the map folds phase space onto a curve (det⁡J=0\det J = 0); beyond d>a/2d > a/2, det⁡J<0\det J < 0 and the wake turns the ink inside out. The sub-step is the engine’s — a stroke is cut into n=⌈len/(tip/4)⌉n = \lceil \text{len}/(\text{tip}/4) \rceil steps of at most a/4a/4, and the shader’s comment says only “area-preserving to first order per sub-step, hence the ≤ a/4 budget (measured)”; the fold at d=a/2d = a/2 from the rear stagnation point is this lesson’s own derivation of why that budget is the right one. The Stokeslet is the viscous profile (wake_profile 1); the inviscid doublet (0) is the default.


2.2 Poisson Brackets, Lie Series & Non-Canonical Port-Hamiltonian Brackets

Section titled “2.2 Poisson Brackets, Lie Series & Non-Canonical Port-Hamiltonian Brackets”

Given two smooth observables f,g∈C∞(M)f, g \in C^\infty(M) on a symplectic manifold (M,ω)(M, \omega), each generates its own Hamiltonian vector field XfX_f and XgX_g via iXfω=dfi_{X_f}\omega = df and iXgω=dgi_{X_g}\omega = dg. The Poisson bracket {f,g}\{f, g\} measures the rate of change of ff along the flow generated by gg:

{f,g}:=ω(Xf,Xg)=(iXfω)(Xg)=df(Xg)=LXgf\{f, g\} := \omega(X_f, X_g) = (i_{X_f}\omega)(X_g) = df(X_g) = \mathcal{L}_{X_g} f

In canonical Darboux coordinates (q,p)(q, p), substituting Xf=(∂pf,−∂qf)X_f = (\partial_p f, -\partial_q f) and Xg=(∂pg,−∂qg)X_g = (\partial_p g, -\partial_q g) into ω=∑idqi∧dpi\omega = \sum_i dq_i \wedge dp_i yields:

{f,g}=∑i=1n(∂f∂qi∂g∂pi−∂f∂pi∂g∂qi)=(∇f)TJ(∇g)\{f, g\} = \sum_{i=1}^n \left( \frac{\partial f}{\partial q_i}\frac{\partial g}{\partial p_i} - \frac{\partial f}{\partial p_i}\frac{\partial g}{\partial q_i} \right) = (\nabla f)^T J (\nabla g)

The time evolution of any observable f(q,p)f(q, p) along the flow of a Hamiltonian HH is therefore governed by:

dfdt=LXHf={f,H}(and dfdt={f,H}+∂f∂t if f depends explicitly on t)\frac{df}{dt} = \mathcal{L}_{X_H} f = \{f, H\} \qquad \left(\text{and } \frac{df}{dt} = \{f, H\} + \frac{\partial f}{\partial t} \text{ if } f \text{ depends explicitly on } t\right)

The Poisson bracket equips C∞(M)C^\infty(M) with the structure of a Lie algebra over R\mathbb{R} and acts as a derivation in each slot (a Poisson algebra):

  1. Skew-symmetry: {f,g}=−{g,f}\{f, g\} = -\{g, f\} (since ω\omega is alternating; in particular, {H,H}=0\{H, H\} = 0, recovering energy conservation).
  2. Leibniz rule: {f,gh}={f,g}h+g{f,h}\{f, gh\} = \{f, g\}h + g\{f, h\} (since XfX_f is a first-order differential operator).
  3. Jacobi identity: {{f,g},h}+{{g,h},f}+{{h,f},g}=0\{\{f, g\}, h\} + \{\{g, h\}, f\} + \{\{h, f\}, g\} = 0.

Why Module 1’s dω=0d\omega = 0 is the Jacobi identity: Using Cartan’s identity on a 2-form, one can express the exterior derivative dω(Xf,Xg,Xh)d\omega(X_f, X_g, X_h) solely in terms of triple Poisson brackets: dω(Xf,Xg,Xh)=−2({{f,g},h}+{{g,h},f}+{{h,f},g})d\omega(X_f, X_g, X_h) = -2\Big( \{\{f, g\}, h\} + \{\{g, h\}, f\} + \{\{h, f\}, g\} \Big) Thus, the algebraic Jacobi identity for {⋅,⋅}\{ \cdot, \cdot \} is equivalent to the geometric closedness dω=0d\omega = 0! And as a corollary of the Jacobi identity, the map f↦Xff \mapsto X_f is a Lie-algebra homomorphism (up to sign convention) between functions under the Poisson bracket and vector fields under the Lie bracket: [Xf,Xg]=−X{f,g}[X_f, X_g] = -X_{\{f, g\}}.

Formal Exponential Flows and Baker–Campbell–Hausdorff (BCH) Splitting

Section titled “Formal Exponential Flows and Baker–Campbell–Hausdorff (BCH) Splitting”

Because f˙={f,H}=LXHf\dot{f} = \{f, H\} = \mathcal{L}_{X_H} f, the exact time-hh flow ΦHh:M→M\Phi_H^h : M \to M pulls observables back by the formal Lie series:

f∘ΦHh=exp⁡ ⁣(h LXH)f=f+h{f,H}+h22!{{f,H},H}+h33!{{{f,H},H},H}+⋯f \circ \Phi_H^h = \exp\!\left(h\,\mathcal{L}_{X_H}\right) f = f + h\{f, H\} + \frac{h^2}{2!}\{\{f, H\}, H\} + \frac{h^3}{3!}\{\{\{f, H\}, H\}, H\} + \cdots

For a general nonlinear Hamiltonian H(q,p)H(q, p), we cannot evaluate exp⁡(hLXH)\exp(h\mathcal{L}_{X_H}) in closed form. However, almost every mechanical and acoustic Hamiltonian in midi-sink is separable:

H(q,p)=T(p)+V(q)H(q, p) = T(p) + V(q)

Taken alone, the kinetic Hamiltonian T(p)T(p) generates the vector field XT=(∇pT(p), 0)X_T = (\nabla_p T(p),\, 0), where pp is constant during the entire step! Thus the exact time-hh flow of T(p)T(p) is a trivial drift shear:

ΦTh(q,p)=(q+h ∇pT(p),  p),det⁡DΦTh=det⁡(Ih ∇p2T(p)0I)=1\Phi_T^h(q, p) = \big(q + h\,\nabla_p T(p),\; p\big), \qquad \det D\Phi_T^h = \det \begin{pmatrix} I & h\,\nabla_p^2 T(p) \\ 0 & I \end{pmatrix} = 1

Similarly, the potential Hamiltonian V(q)V(q) generates XV=(0, −∇qV(q))X_V = (0,\, -\nabla_q V(q)), where qq is constant during the step. Its exact time-hh flow is a trivial kick shear:

ΦVh(q,p)=(q,  p−h ∇qV(q)),det⁡DΦVh=det⁡(I0−h ∇q2V(q)I)=1\Phi_V^h(q, p) = \big(q,\; p - h\,\nabla_q V(q)\big), \qquad \det D\Phi_V^h = \det \begin{pmatrix} I & 0 \\ -h\,\nabla_q^2 V(q) & I \end{pmatrix} = 1

What happens when we compose these two exact flows? Because {T,V}≠0\{T, V\} \neq 0, the operators LXT\mathcal{L}_{X_T} and LXV\mathcal{L}_{X_V} do not commute. By the Baker–Campbell–Hausdorff (BCH) formula, the composition of two exponentials in a Lie algebra is the exponential of a single series of nested commutators (Poisson brackets):

exp⁡(hLXV)∘exp⁡(hLXT)=exp⁡ ⁣(h LXH~SE),H~SE=T+V+h2{T,V}+h212({T,{T,V}}+{V,{V,T}})+O(h3)\exp(h\mathcal{L}_{X_V}) \circ \exp(h\mathcal{L}_{X_T}) = \exp\!\big(h\,\mathcal{L}_{X_{\tilde{H}_{\text{SE}}}}\big), \qquad \tilde{H}_{\text{SE}} = T + V + \frac{h}{2}\{T, V\} + \frac{h^2}{12}\Big(\{T, \{T, V\}\} + \{V, \{V, T\}\}\Big) + \mathcal{O}(h^3)

This one-pass composition ΦSEh=ΦTh∘ΦVh\Phi_{\text{SE}}^h = \Phi_T^h \circ \Phi_V^h is Symplectic Euler (kick-then-drift). If instead we sandwich a full drift between two half-kicks — Strang splitting, known in mechanics as 2nd-order Störmer–Verlet / Leapfrog:

ΦSVh=ΦVh/2∘ΦTh∘ΦVh/2\Phi_{\text{SV}}^h = \Phi_V^{h/2} \circ \Phi_T^h \circ \Phi_V^{h/2}

then the map is time-reversible (ΦSV−h=(ΦSVh)−1\Phi_{\text{SV}}^{-h} = (\Phi_{\text{SV}}^h)^{-1}), which forces every odd power of hh in the symmetric BCH expansion to vanish identically:

H~SV=T+V+h212{T,{T,V}}−h224{V,{V,T}}+O(h4)\tilde{H}_{\text{SV}} = T + V + \frac{h^2}{12}\{T, \{T, V\}\} - \frac{h^2}{24}\{V, \{V, T\}\} + \mathcal{O}(h^4)

Notice the miracle: both ΦSEh\Phi_{\text{SE}}^h and ΦSVh\Phi_{\text{SV}}^h are exact compositions of canonical transformations (det⁡J=1\det J = 1 at every point in phase space), and for sufficiently small hh, they are the exact time-hh flow of a nearby shadow (modified) Hamiltonian H~\tilde{H}.

Non-Canonical Brackets & Port-Hamiltonian Dirac Networks (suzu::Dirac, voice_kind 12)

Section titled “Non-Canonical Brackets & Port-Hamiltonian Dirac Networks (suzu::Dirac, voice_kind 12)”

Not every physical voice in Suzu is naturally written in canonical (q,p)(q, p) pairs. Consider suzu::Dirac (voxo/src/suzu.h, DECISIONS_13 #3), which models an interconnected acoustic network — specifically, a chain of masses coupled by springs to a loaded instrument bridge (mb,kbm_b, k_b) with a unilateral rattle stop (like a sitar jawari, sawari, or clarinet lay) and a stick-slip bow port.

Instead of displacements qiq_i and momenta pip_i, suzu::Dirac chooses as its state vector x∈Rnx \in \mathbb{R}^n the spring extensions ej=qj+1−qje_j = q_{j+1} - q_j (j=0…mj = 0 \dots m) together with the mass momenta pip_i (i=1…mi = 1 \dots m) and the bridge states (eb,pb)(e_b, p_b). Why? Because in extension-momentum variables, the total quadratic energy is purely diagonal:

H(x)=12xTQx=∑j=0m12k ej2+∑i=1m12pi2+12kb eb2+12mbpb2,Q=diag⁡(k,…,k,1,…,1,kb,mb−1)≻0H(x) = \frac{1}{2} x^T Q x = \sum_{j=0}^m \frac{1}{2} k\,e_j^2 + \sum_{i=1}^m \frac{1}{2} p_i^2 + \frac{1}{2} k_b\,e_b^2 + \frac{1}{2 m_b} p_b^2, \qquad Q = \operatorname{diag}(k, \dots, k, 1, \dots, 1, k_b, m_b^{-1}) \succ 0

There are m+1m + 1 spring extensions for mm interior masses (fixed at both ends), so dim⁡x=2m+3\dim x = 2m + 3 is odd (Dirac::chain: m+1m + 1 extensions, mm momenta, the bridge’s extension and momentum)! An odd-dimensional state space cannot carry a non-degenerate symplectic 2-form ω\omega. Instead, it carries a non-canonical Poisson bracket (and more generally, a Dirac structure) defined by the constant skew-symmetric incidence matrix J=−JT∈Rn×nJ = -J^T \in \mathbb{R}^{n \times n}:

{f,g}J:=(∇f)TJ(∇g),J=(0B−BT0)\{f, g\}_J := (\nabla f)^T J (\nabla g), \qquad J = \begin{pmatrix} 0 & B \\ -B^T & 0 \end{pmatrix}

Adding a symmetric positive semi-definite dissipation matrix R=RT⪰0R = R^T \succeq 0 (which damps the momenta to set the string’s T60T_{60} and the bridge’s broader radiation loss γb\gamma_b) and external boundary ports uportu_{\text{port}} gives the Port-Hamiltonian system:

x˙=(J−R)∇H(x)+uport=(J−R)Qx+uport\dot{x} = (J - R)\nabla H(x) + u_{\text{port}} = (J - R)Q x + u_{\text{port}}

Along any port-free trajectory (uport=0u_{\text{port}} = 0), the skew-symmetry of JJ guarantees xTQJQx=0x^T Q J Q x = 0, so the energy balance is governed purely by RR:

dHdt=(∇H)Tx˙=xTQ(J−R)Qx=−xTQRQx≤0\frac{dH}{dt} = (\nabla H)^T \dot{x} = x^T Q (J - R) Q x = -x^T Q R Q x \le 0

How does suzu::Dirac integrate x˙=Ax\dot{x} = A x with A=(J−R)QA = (J - R)Q so that this energy balance holds to machine precision over a ten-minute sustain? It applies the Cayley transform (the linear implicit midpoint rule):

xk+1−xkh=A xk+1+xk2⟺xk+1=Mxk,M=(I−h2A)−1 ⁣(I+h2A)\frac{x_{k+1} - x_k}{h} = A\,\frac{x_{k+1} + x_k}{2} \quad \Longleftrightarrow \quad x_{k+1} = M x_k, \qquad M = \left(I - \frac{h}{2}A\right)^{-1}\!\left(I + \frac{h}{2}A\right)

In Dirac::build (voxo/src/suzu.h), M is computed once at voice setup in double via Gauss–Jordan elimination with partial pivoting. Let us check the energy norm ∥x∥Q2=xTQx=∥Q1/2x∥22\|x\|_Q^2 = x^T Q x = \|Q^{1/2} x\|_2^2. In energy-normalized coordinates y=Q1/2xy = Q^{1/2} x, the generator becomes A~=Q1/2AQ−1/2=Q1/2(J−R)Q1/2\tilde{A} = Q^{1/2} A Q^{-1/2} = Q^{1/2}(J - R)Q^{1/2}, whose symmetric part is −Q1/2RQ1/2⪯0-Q^{1/2} R Q^{1/2} \preceq 0. When R=0R = 0, A~=Q1/2JQ1/2\tilde{A} = Q^{1/2} J Q^{1/2} is purely skew-symmetric (A~T=−A~\tilde{A}^T = -\tilde{A}), so the Cayley matrix M~=Q1/2MQ−1/2=(I−h2A~)−1(I+h2A~)\tilde{M} = Q^{1/2} M Q^{-1/2} = (I - \frac{h}{2}\tilde{A})^{-1}(I + \frac{h}{2}\tilde{A}) is orthogonal:

M~TM~=I⟺MTQM=Q(M is Q-orthogonal!)\tilde{M}^T \tilde{M} = I \quad \Longleftrightarrow \quad M^T Q M = Q \qquad (\text{$M$ is $Q$-orthogonal!})

Gate delta from DECISIONS_13 #3: An early draft of the spec asked whether MM itself is orthogonal (MTM=IM^T M = I). Unless QQ is a scalar multiple of the identity (equal spring constants and unit masses everywhere), MM is QQ-orthogonal (MTQM=QM^T Q M = Q), meaning ∥Q1/2MQ−1/2∥2=1\|Q^{1/2} M Q^{-1/2}\|_2 = 1, not ∥M∥2=1\|M\|_2 = 1. Dirac::build verifies this at runtime via 120 steps of power iteration on the Gram matrix of Q1/2MQ−1/2Q^{1/2} M Q^{-1/2} (storing gain_q), and tests/voxo_suzu_tests.cpp (gate 59) checks twelve random skew matrices JJ (nn from 6 to 16, at a step fifty times the engine’s): ∣gainq−1∣<10−9|\text{gain}_q - 1| < 10^{-9} when R=0R = 0 — measured 2e-16 — and strictly < 1 when R≻0R \succ 0. Notice also why Dirac stores x and M in double: a matrix that misses QQ-orthogonality by float’s unit-in-the-last-place (10−710^{-7}) multiplies the energy by (1±10−7)N(1 \pm 10^{-7})^N every sample — a runaway gain or loss over ten minutes at 192 kHz!


2.3 Liouville’s Theorem, Symplectomorphisms & Ping-Pong Advection

Section titled “2.3 Liouville’s Theorem, Symplectomorphisms & Ping-Pong Advection”

Symplectomorphisms and Liouville’s Theorem

Section titled “Symplectomorphisms and Liouville’s Theorem”

A diffeomorphism Φ:M→M\Phi : M \to M is called a symplectomorphism (or canonical transformation) if it preserves the symplectic 2-form under pullback:

Φ∗ω=ω⟺(DΦz)TΩ (DΦz)=Ω∀z∈M\Phi^*\omega = \omega \qquad \Longleftrightarrow \qquad (D\Phi_z)^T \Omega\,(D\Phi_z) = \Omega \quad \forall z \in M

When DOES a continuous flow ΦXt\Phi_X^t consist of symplectomorphisms? Taking the time derivative at t=0t = 0 gives the Lie derivative LXω\mathcal{L}_X \omega. By Cartan’s Magic Formula from Module 1 (§1.3) and the closedness of ω\omega (dω=0d\omega = 0):

ddt∣t=0(ΦXt)∗ω=LXω=d(iXω)+iX(dω⏟= 0)=d(iXω)\frac{d}{dt}\Big|_{t=0} (\Phi_X^t)^*\omega = \mathcal{L}_X\omega = d(i_X\omega) + i_X(\underbrace{d\omega}_{=\,0}) = d(i_X\omega)

For a Hamiltonian vector field XHX_H, we have iXHω=dHi_{X_H}\omega = dH, and since d2=0d^2 = 0:

LXHω=d(dH)=0⟹(ΦHt)∗ω=ω∀t∈R\mathcal{L}_{X_H}\omega = d(dH) = 0 \qquad \Longrightarrow \qquad (\Phi_H^t)^*\omega = \omega \quad \forall t \in \mathbb{R}

Liouville’s Theorem is the immediate consequence: because ΦHt\Phi_H^t preserves ω\omega, it also preserves the nn-fold wedge power Ωvol=1n!ω∧n=dq1∧dp1∧⋯∧dqn∧dpn\Omega_{\text{vol}} = \frac{1}{n!}\omega^{\wedge n} = dq_1 \wedge dp_1 \wedge \cdots \wedge dq_n \wedge dp_n (the Liouville phase-space volume form):

LXHΩvol=0,det⁡(DΦHt)=1\mathcal{L}_{X_H}\Omega_{\text{vol}} = 0, \qquad \det(D\Phi_H^t) = 1

In 2D2\text{D} (n=1n = 1), Ωvol=ω=dq∧dp\Omega_{\text{vol}} = \omega = dq \wedge dp, so symplecticity and oriented area preservation are identical (det⁡J=1\det J = 1). (In dimension 2n≥42n \ge 4, symplecticity (DΦ)TΩ(DΦ)=Ω(D\Phi)^T \Omega (D\Phi) = \Omega is strictly stronger than volume preservation det⁡DΦ=1\det D\Phi = 1: it preserves the sum of the oriented area projections onto the conjugate (qi,pi)(q_i, p_i) planes — that much is linear algebra, ω\omega-preservation itself — and, far deeper, it forbids embedding a ball of radius rr into the cylinder B2(R)×R2n−2B^2(R) \times \mathbb{R}^{2n-2} for any R<rR < r, which volume preservation alone would allow: Gromov’s non-squeezing theorem.)

Why Standard Numerical Integrators Violate Liouville’s Theorem

Section titled “Why Standard Numerical Integrators Violate Liouville’s Theorem”

Suppose we integrate a 1-DoF separable Hamiltonian H(q,p)=12p2+V(q)H(q, p) = \frac{1}{2}p^2 + V(q) with equations of motion q˙=p\dot{q} = p, p˙=−V′(q)\dot{p} = -V'(q) across a finite time step hh. Let us compute the Jacobian matrix J=∂(qn+1,pn+1)∂(qn,pn)J = \frac{\partial(q_{n+1}, p_{n+1})}{\partial(q_n, p_n)} and its determinant det⁡J\det J for five standard schemes:

IntegratorUpdate Rule (qn,pn)↦(qn+1,pn+1)(q_n, p_n) \mapsto (q_{n+1}, p_{n+1})Jacobian Determinant det⁡J\det JGeometric Behaviour in Phase Space
Forward Eulerqn+1=qn+hpnq_{n+1} = q_n + h p_n
pn+1=pn−hV′(qn)p_{n+1} = p_n - h V'(q_n)
det⁡(1h−hV′′(qn)1)=1+h2V′′(qn)\det \begin{pmatrix} 1 & h \\ -h V''(q_n) & 1 \end{pmatrix} = \mathbf{1 + h^2 V''(q_n)}Artificial source inside potential wells (V′′>0  ⟹  det⁡J>1V'' > 0 \implies \det J > 1). Phase-space area expands by (1+h2ω02)N(1 + h^2 \omega_0^2)^N; orbits spiral outward to ∞\infty.
Backward Eulerqn+1=qn+hpn+1q_{n+1} = q_n + h p_{n+1}
pn+1=pn−hV′(qn+1)p_{n+1} = p_n - h V'(q_{n+1})
det⁡(1−hhV′′(qn+1)1)−1=11+h2V′′(qn+1)\det \begin{pmatrix} 1 & -h \\ h V''(q_{n+1}) & 1 \end{pmatrix}^{-1} = \mathbf{\frac{1}{1 + h^2 V''(q_{n+1})}}Artificial sink inside potential wells (V′′>0  ⟹  det⁡J<1V'' > 0 \implies \det J < 1). Phase-space area contracts every step; orbits spiral inward to a dead point.
Classical RK44-stage Runge–Kutta weighted average zn+1=zn+h6(k1+2k2+2k3+k4)z_{n+1} = z_n + \frac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)For V(q)=12ω02q2V(q) = \frac{1}{2}\omega_0^2 q^2 (ε=ω0h\varepsilon = \omega_0 h):
1−136ε6+1576ε8≠1\mathbf{1 - \frac{1}{36}\varepsilon^6 + \frac{1}{576}\varepsilon^8 \neq 1}
Higher-order non-symplectic drift. Locally accurate to O(h4)\mathcal{O}(h^4), but det⁡J≠1\det J \neq 1! Over thousands of steps, area shrinks (or expands near hyperbolic points).
Symplectic Eulerpn+1=pn−hV′(qn)p_{n+1} = p_n - h V'(q_n)
qn+1=qn+hpn+1q_{n+1} = q_n + h p_{n+1}
det⁡[(1h01)(10−hV′′(qn)1)]=1\det \left[\begin{pmatrix} 1 & h \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ -h V''(q_n) & 1 \end{pmatrix}\right] = \mathbf{1}Exact symplectomorphism (1st-order kick-then-drift). Preserves phase-space area to machine precision for any nonlinear V(q)V(q) and any hh.
Störmer–Verlet (Strang Leapfrog)pn+1/2=pn−h2V′(qn)p_{n+1/2} = p_n - \frac{h}{2} V'(q_n)
qn+1=qn+hpn+1/2q_{n+1} = q_n + h p_{n+1/2}
pn+1=pn+1/2−h2V′(qn+1)p_{n+1} = p_{n+1/2} - \frac{h}{2} V'(q_{n+1})
det⁡(Jkick,h/2⋅Jdrift,h⋅Jkick,h/2)=1⋅1⋅1=1\det(J_{\text{kick}, h/2} \cdot J_{\text{drift}, h} \cdot J_{\text{kick}, h/2}) = 1 \cdot 1 \cdot 1 = \mathbf{1}Exact time-reversible symplectomorphism (2nd-order). Preserves phase-space area identically and centers the shadow Hamiltonian to O(h2)\mathcal{O}(h^2).

Look closely at the Classical RK4 row. For a harmonic oscillator with dimensionless step ε=ω0h\varepsilon = \omega_0 h, the single-step RK4 update matrix is MRK4=(1−ε22+ε424)I+(ε−ε36)JM_{\text{RK4}} = \left(1 - \frac{\varepsilon^2}{2} + \frac{\varepsilon^4}{24}\right)I + \left(\varepsilon - \frac{\varepsilon^3}{6}\right)J, whose determinant is:

det⁡MRK4=(1−ε22+ε424)2+(ε−ε36)2=1−ε672+ε8576\det M_{\text{RK4}} = \left(1 - \frac{\varepsilon^2}{2} + \frac{\varepsilon^4}{24}\right)^2 + \left(\varepsilon - \frac{\varepsilon^3}{6}\right)^2 = 1 - \frac{\varepsilon^6}{72} + \frac{\varepsilon^8}{576}

For ε<22\varepsilon < 2\sqrt{2}, det⁡MRK4<1\det M_{\text{RK4}} < 1: RK4 is slightly dissipative on elliptic orbits! Over 10 steps, ε6/72\varepsilon^6/72 is tiny; over 10510^5 audio samples or thousands of shader frames at moderate hh, (1−ε6/72)N→0(1 - \varepsilon^6/72)^N \to 0. Even worse, on a nonlinear pendulum H(q,p)=12p2−cos⁡qH(q, p) = \frac{1}{2}p^2 - \cos q, the local frequency ωloc(q)=cos⁡q\omega_{\text{loc}}(q) = \sqrt{\cos q} varies across the phase portrait (and becomes imaginary near the hyperbolic saddles q=±πq = \pm\pi where cos⁡q<0\cos q < 0), so det⁡JRK4(q,p)\det J_{\text{RK4}}(q, p) varies from pixel to pixel — compressing elliptic islands while stretching saddle regions!

Ping-Pong Advection, Phase-Space Stretching & Displacement Re-Basing (libsumi)

Section titled “Ping-Pong Advection, Phase-Space Stretching & Displacement Re-Basing (libsumi)”

In Part 1 of this module’s lab, we advect an initial circular phase-space distribution (a “Gibbs ensemble” blob of radius R0R_0 centered at (q0,p0)(q_0, p_0)) under the nonlinear pendulum Hamiltonian:

H(q,p)=12p2−cos⁡(q),q˙=p,p˙=−sin⁡(q)H(q, p) = \frac{1}{2}p^2 - \cos(q), \qquad \dot{q} = p, \quad \dot{p} = -\sin(q)

Why does a circular blob in the pendulum’s phase space stretch into a long, razor-thin spiral filament (a whorl)? Because the pendulum is anharmonic: orbits near the bottom of the well (H≈−1H \approx -1) oscillate at period T0=2πT_0 = 2\pi, whereas orbits approaching the separatrix (H=+1H = +1, the homoclinic orbit connecting the unstable saddle points (q,p)=(±π,0)(q, p) = (\pm\pi, 0)) slow down near the inverted top and have period T(H)→∞T(H) \to \infty! Consequently, the outer edge of the blob lags behind the inner edge, shearing the disc into an ever-tighter spiral filament. Yet by Liouville’s Theorem, as the filament stretches in length by a factor of 100×100\times and thins in width by 100×100\times, its total enclosed 2D area ∬blobdq dp\iint_{\text{blob}} dq\,dp must remain strictly constant.

How do we advect a field across thousands of steps using two alternating WebGL framebuffers (ping-pong FBOs)? To update pixel P=(q,p)P = (q, p) from frame nn to frame n+1n+1, a backward-characteristic shader traces PP backward in time by one step −h-h using the inverse integrator Psrc=Φ−h(P)P_{src} = \Phi^{-h}(P) and samples the previous framebuffer at PsrcP_{src}. Here we hit the central architectural insight of libsumi (PROJECT_SPEC.md §4.2, KESSHO §2.1, the Kessho proposal medium_specs_v3.md (in git history; its substance §10.7)):

  • Why Direct Density Ping-Pong (C'(P) = texture(C, P_src)) blurs filaments: If you store the dye density C(q,p)C(q, p) directly in the ping-pong texture and resample texture(u_prev, P_src) with GL_LINEAR bilinear filtering every frame, each step applies a spatial averaging kernel of variance ∼O(Δx2)\sim \mathcal{O}(\Delta x^2). Over NN frames, numerical diffusion grows as N Δx\sqrt{N}\,\Delta x. As soon as the pendulum shears the Liouville filament down to a few pixels in width, Eulerian bilinear resampling smears the filament away — destroying pixel area even when the underlying integrator has det⁡J=1\det J = 1!
  • Why libsumi Advects Cumulative Displacement (d'(P) = d(P_src) + (P_src - P)): Instead of resampling the pigment every frame, libsumi’s displacement field — the ping-pong texture, RGBA16F by default (RGBA32F behind a desktop flag) — stores the total cumulative Lagrangian displacement vector d(P)=Pinitial(P)−Pd(P) = P_{\text{initial}}(P) - P pointing from the current pixel PP all the way back to its origin at t=0t = 0. When an operator steps backward to Psrc=Φ−h(P)P_{src} = \Phi^{-h}(P), every operator pass (deform.glsl’s *_fs) updates the displacement vector by re-basing:
    // libsumi displacement re-basing (PROJECT_SPEC.md §4.2):
    vec2 P_src = step_inverse(P, h);
    vec2 d_prev = texture(u_disp_prev, uv_from_phase(P_src)).xy;
    vec2 d_new = d_prev + (P_src - P); // total vector back to t = 0: P + d_new = P_src + d_prev = P_0
    Then, in the composite pass (composite.glsl), the initial blob C0(P0)C_0(P_0) is evaluated once at P0=P+d(P)P_0 = P + d(P)! Because d(P)d(P) is a smooth mapping P↦P0(P)P \mapsto P_0(P) whose Jacobian is Jtotal(P)=I+∇d(P)J_{\text{total}}(P) = I + \nabla d(P), a razor-thin filament remains infinitely crisp, and Kessho (composite.glsl’s kessho_col) reads the cumulative Jacobian by central differences over texels — the short stencil for ψ\psi and σ\sigma, ±3 texels at 512 for tr⁡J\operatorname{tr} J — and its determinant det⁡(I+∇d)\det(I + \nabla d) in the --kessho-flat view at z=1z = 1 to verify ∣det⁡J−1∣|\det J - 1|.

2.4 Symplectic Integrators at 48 kHz: Shadow Hamiltonians, Solitons & What Breaks Them

Section titled “2.4 Symplectic Integrators at 48 kHz: Shadow Hamiltonians, Solitons & What Breaks Them”

Now let us move from 60 Hz framebuffers to the audio thread running at 48 kHz (and up to 192 kHz with m≤8m \le 8 inner sub-steps) in voxo/src/suzu.h. Why does symplectic geometry matter even more for audio than for graphics? Because over a 10-minute ambient performance at 48 kHz, a single voice executes N=28,800,000N = 28,800,000 time steps. Even a tiny per-step determinant defect ∣det⁡J−1∣=10−6|\det J - 1| = 10^{-6} compounds to (1±10−6)2.88×107≈e±28.8(1 \pm 10^{-6})^{2.88 \times 10^7} \approx e^{\pm 28.8}, either blowing the oscillator up — until its block is no longer finite and the bus breaker cuts it (the engine has no level threshold; the Suzu lab’s worklet mutes at full scale and restarts) — or killing the note into silence!

Backward Error Analysis and the Shadow Hamiltonian of the Magic Circle

Section titled “Backward Error Analysis and the Shadow Hamiltonian of the Magic Circle”

As we proved in Module 1 (§1.4), Suzu’s core resonator Cell::step (voxo/src/suzu.h) is the magic circle (symplectic Euler / kick-drift on H(x,y)=12(x2+y2)H(x, y) = \frac{1}{2}(x^2 + y^2) with ε=2sin⁡(ω0Δt/2)\varepsilon = 2\sin(\omega_0 \Delta t / 2)):

xn+1=xn−εyn,yn+1=yn+εxn+1,Msym=(1−εε1−ε2),det⁡Msym=1x_{n+1} = x_n - \varepsilon y_n, \qquad y_{n+1} = y_n + \varepsilon x_{n+1}, \qquad M_{\text{sym}} = \begin{pmatrix} 1 & -\varepsilon \\ \varepsilon & 1 - \varepsilon^2 \end{pmatrix}, \quad \det M_{\text{sym}} = 1

If you compute the true continuous Hamiltonian H(xn,yn)=12(xn2+yn2)H(x_n, y_n) = \frac{1}{2}(x_n^2 + y_n^2) along a trajectory of Cell::step, you will notice that H(xn,yn)H(x_n, y_n) is not constant from sample to sample! Specifically:

H(xn+1,yn+1)−H(xn,yn)=ε22(xn+12−yn2)=O(ε)H(x_{n+1}, y_{n+1}) - H(x_n, y_n) = \frac{\varepsilon^2}{2}\big(x_{n+1}^2 - y_n^2\big) = \mathcal{O}(\varepsilon)

Does this mean the magic circle leaks or gains energy? No! As shown by backward error analysis (and verified algebraically in Module 1 Problem 1.3), Cell::step exactly conserves a nearby quadratic form — its shadow (modified) Hamiltonian:

H~MC(x,y)=12(x2+y2−εxy)⟹H~MC(xn+1,yn+1)=H~MC(xn,yn)∀n≥0\tilde{H}_{\text{MC}}(x, y) = \frac{1}{2}\big(x^2 + y^2 - \varepsilon x y\big) \qquad \Longrightarrow \qquad \tilde{H}_{\text{MC}}(x_{n+1}, y_{n+1}) = \tilde{H}_{\text{MC}}(x_n, y_n) \quad \forall n \ge 0

For ∣ε∣<2|\varepsilon| < 2, the level sets of H~MC\tilde{H}_{\text{MC}} are tilted ellipses in the (x,y)(x, y) plane with semi-axis ratio (2+ε)/(2−ε)≈1+ε/2\sqrt{(2+\varepsilon)/(2-\varepsilon)} \approx 1 + \varepsilon/2. Because the discrete orbit walks faithfully around this fixed shadow ellipse forever, the continuous circular energy H(xn,yn)=12(xn2+yn2)H(x_n, y_n) = \frac{1}{2}(x_n^2 + y_n^2) simply oscillates (“breathes”) at twice the oscillator frequency (2ω02\omega_0) within a tight band of width ±ε/2\pm \varepsilon/2 around H~MC\tilde{H}_{\text{MC}}, with zero secular drift (+0.0001 dB+0.0001\text{ dB} over 600 s at 440 Hz in suzu_test.cpp).

If instead we use the symmetric 2nd-order Störmer–Verlet (Leapfrog) half-kick / drift / half-kick:

yn+1/2=yn+ε2xn,xn+1=xn−εyn+1/2,yn+1=yn+1/2+ε2xn+1y_{n+1/2} = y_n + \frac{\varepsilon}{2}x_n, \qquad x_{n+1} = x_n - \varepsilon y_{n+1/2}, \qquad y_{n+1} = y_{n+1/2} + \frac{\varepsilon}{2}x_{n+1}

the tilted cross-term −εxy-\varepsilon x y cancels out completely, and the exact shadow Hamiltonian becomes axis-aligned:

H~SV(x,y)=12 ⁣((1−ε24)x2+y2)\tilde{H}_{\text{SV}}(x, y) = \frac{1}{2}\!\left(\left(1 - \frac{\varepsilon^2}{4}\right)x^2 + y^2\right)

so the breathing of the true energy H(xn,yn)H(x_n, y_n) shrinks from O(ε)\mathcal{O}(\varepsilon) to O(ε2)\mathcal{O}(\varepsilon^2)!

This exact mechanism carries over to nonlinear separable Hamiltonians, where no closed-form quadratic invariant exists, via the BCH asymptotic shadow series H~=H+h2H2+h4H4+⋯\tilde{H} = H + h^2 H_2 + h^4 H_4 + \cdots:

  • The Duffing oscillator (suzu::Duffing, voxo/src/suzu.h): Adding the cubic restoring force to the kick shear (c.y += c.eps * (x + beta * x * x * x)) integrates H(x,y)=12y2+12x2+β4x4H(x, y) = \frac{1}{2}y^2 + \frac{1}{2}x^2 + \frac{\beta}{4}x^4. Even though x3x^3 is strongly nonlinear (bending the pitch upward with amplitude for β>0\beta > 0), the kick depends only on the already-updated xn+1x_{n+1}, so its Jacobian is still unit lower-triangular with det⁡J=1\det J = 1 identically.

The Toda Lattice Soliton Ring (suzu::TodaRing, voice_kind 10)

Section titled “The Toda Lattice Soliton Ring (suzu::TodaRing, voice_kind 10)”

The crown jewel of nonlinear symplectic integration in midi-sink is the Toda Lattice Soliton Ring (suzu::TodaRing, voxo/src/suzu.h; PROJECT_SPEC.md §13.13; DECISIONS_13 #1; the Toda ring chapter). Morikazu Toda discovered in 1967 that a 1D ring of NN unit masses interacting via an exponential nearest-neighbour spring is completely integrable (possessing NN independent Lax-pair invariants in involution) and supports exact supersonic cnoidal waves and solitons:

H(q,p)=∑n=0N−112pn2+ab∑n=0N−1(e−brn+brn−1),rn=q(n+1) mod N−qn,k=abH(q, p) = \sum_{n=0}^{N-1} \frac{1}{2}p_n^2 + \frac{a}{b}\sum_{n=0}^{N-1} \left( e^{-b r_n} + b r_n - 1 \right), \qquad r_n = q_{(n+1)\bmod N} - q_n, \quad k = a b

Notice that as the nonlinearity parameter b→0b \to 0, Taylor-expanding e−brn≈1−brn+12b2rn2e^{-b r_n} \approx 1 - b r_n + \frac{1}{2}b^2 r_n^2 reduces HH to the linear harmonic mass-spring ring H→∑n(12pn2+12krn2)H \to \sum_n \big(\frac{1}{2}p_n^2 + \frac{1}{2}k r_n^2\big). For b>0b > 0, compression (rn<0r_n < 0) stiffens exponentially while extension (rn>0r_n > 0) softens, allowing localized compression pulses sech⁡2(κ(n−ct))\operatorname{sech}^2(\kappa(n - ct)) to travel around the ring faster than the sound speed k\sqrt{k} and pass right through one another without losing their shape!

Let us examine TodaRing::step (voxo/src/suzu.h):

// From voxo/src/suzu.h — TodaRing::step (Voxo 0.23.0; checked word for word at the review):
inline void step(float damp) { // the kick from the pre-update q, then the drift; damp the declared contraction on p
double E[TODA_NODES_MAX];
double x[TODA_NODES_MAX];
for (int i = 0; i < n; i++) x[i] = -b * r_at(i);
for (int i = 0; i < n; i++) E[i] = toda_exp(x[i]);
for (int i = 0; i < n; i++) if (E[i] > 0.5 * kcap) E[i] = kcap - 0.25 * kcap * kcap / E[i];
double sum_p = 0.0;
for (int i = 0; i < n; i++) { const double f = a * (E[i > 0 ? i - 1 : n - 1] - E[i]); p[i] = (p[i] + f) * (double)damp; sum_p += p[i]; }
for (int i = 0; i < n; i++) q[i] += p[i];
pick_xi -= sum_p / (double)n; // the pickup stands still against the mean drift
if (pick_xi >= (double)n) pick_xi -= (double)n; else if (pick_xi < 0.0) pick_xi += (double)n;
}

Every line of TodaRing teaches a concrete lesson about symplectic integration at audio rate:

  1. Why double state (q, p) is mandatory: With damp = 1.0f, the kick-then-drift leapfrog is an exact symplectomorphism (det⁡J=1\det J = 1) in exact arithmetic. However, at 192 kHz (1.15×1081.15 \times 10^8 steps over 10 minutes), single-precision float rounding of q[i] += p[i] alone behaves like a tiny random non-symplectic perturbation, walking the energy by 0.009 dB/min (failing the 0.001 dB 10-minute gate). Promoting the ring’s state to double drops the 10-minute minute-mean drift to 0.000017 dB (0.000004 dB re-measured with suzu::toda_exp, a degree-11 Taylor after Cody–Waite range reduction, 10−1410^{-14} relative — the same bits on every platform), while the instantaneous continuous energy H(q,p)H(q, p) breathes by ±0.06 dB around the shadow Hamiltonian H~\tilde{H}! Over 1,000 ring transits, the soliton’s amplitude holds within 0.26 %, its width×amplitude product within 0.72 %, and total ring momentum ∑ipi\sum_i p_i (the Noether invariant of translation around the ring) to 1e-14.
  2. Why the stiffness cap must be C1C^1 (E = kcap - kcap²/(4E)): Under a massive MIDI strike or multi-soliton collision, e−brne^{-b r_n} could spike past the leapfrog’s stability ceiling. If you clamp e−brne^{-b r_n} with a hard std::min(E, kcap), the potential V(r)V(r) has a C1C^1 derivative kink (V′′(r)V''(r) jumps discontinuously to zero at the knee). Whenever a soliton crosses a non-smooth C1C^1 kink, the BCH shadow Hamiltonian expansion breaks down and the leapfrog feeds energy on the corner! Replacing min with the smooth rational saturation Ecap(E)=EE_{\text{cap}}(E) = E for E≤12kcapE \le \frac{1}{2}k_{\text{cap}} and kcap−kcap24Ek_{\text{cap}} - \frac{k_{\text{cap}}^2}{4E} above it makes V(r)V(r) C2C^2-smooth across the knee rc=−1bln⁡(12kcap)r_c = -\frac{1}{b}\ln(\frac{1}{2}k_{\text{cap}}).

What Can Break a Symplectic Integrator? (Four Engineering Failure Modes)

Section titled “What Can Break a Symplectic Integrator? (Four Engineering Failure Modes)”

Because a symplectic integrator has det⁡J=1\det J = 1, students sometimes assume it is unconditionally stable and can never blow up. That is false. Here are the four ways a symplectic integrator can fail, and how midi-sink prevents each one:

  1. Non-Separable Hamiltonians (suzu::DoublePendulum, voxo/src/suzu.h): Consider the chaotic double pendulum modulator (§13.14), whose kinetic energy T(θ1,θ2,ω1,ω2)=ω12+12ω22+ω1ω2cos⁡(θ1−θ2)T(\theta_1, \theta_2, \omega_1, \omega_2) = \omega_1^2 + \frac{1}{2}\omega_2^2 + \omega_1 \omega_2 \cos(\theta_1 - \theta_2) depends on both the angles θ\theta and the angular velocities ω\omega through the coupling cos⁡(θ1−θ2)\cos(\theta_1 - \theta_2). Because HH is not separable (H(θ,p)≠T(p)+V(θ)H(\theta, p) \neq T(p) + V(\theta)), the “drift” step θ˙=∂pH(θ,p)\dot{\theta} = \partial_p H(\theta, p) depends on θ\theta, and the “kick” step p˙=−∂θH(θ,p)\dot{p} = -\partial_\theta H(\theta, p) depends on pp! If you apply an explicit leapfrog to a non-separable Hamiltonian, the individual sub-steps are no longer triangular shears (det⁡J≠1\det J \neq 1), the scheme is not symplectic, and as documented in voxo/src/suzu.h, “the first probe drifted from E=−2E = -2 to +1.4+1.4 in ten minutes (and to NaN from a hard kick).” Because a true symplectic integrator for a non-separable Hamiltonian requires an implicit solve at every sub-step, DoublePendulum instead belongs to Suzu’s declared Projected class: it steps in double using classical 4th-order Runge–Kutta (substep()) and then projects the state back onto the initial strike energy surface H=EsetH = E_{\text{set}} via a velocity rescale r=(Eset−V)/Tr = \sqrt{(E_{\text{set}} - V)/T} (a single-step projection factor within 9×10−89 \times 10^{-8} of 1.01.0).

  2. Time-Dependent Potentials & Live-Peak Limiter Pumping (DECISIONS_13 #1): Remember from §2.2 that along a Hamiltonian trajectory, dHdt={H,H}+∂H∂t=∂H∂t\frac{dH}{dt} = \{H, H\} + \frac{\partial H}{\partial t} = \frac{\partial H}{\partial t}. If a programmer makes a potential parameter depend on time during the sustain — for instance, adjusting a stiffness limiter or soft-cap threshold kcap(t)k_{\text{cap}}(t) dynamically on every audio block based on the ring’s current peak compression — then the Hamiltonian becomes explicitly time-dependent: H=H(q,p,t)H = H(q, p, t) with ∂H∂t≠0\frac{\partial H}{\partial t} \neq 0! As found during step 83 (DECISIONS_13 #1, item 3 — a development finding, never a shipped control; this module’s standalone lab offers it as its own red control), modulating the Toda cap from the live peak compression acts like a child pumping a swing: the time-varying potential does net positive work on each soliton transit, pumping +162 dB/s into the ring. The ring’s shipped red control is a different one: toda_gate 0 lifts the resolution rule, and the energy climbs +19 dB in a second at C8 (gate 52). That is why TodaRing fixes its resolution sub-stepping m∈{2,4,6,8}m \in \{2, 4, 6, 8\} (to satisfy the Resolution Rule s=k⋅c^⋅b≤0.15s = \sqrt{k}\cdot\hat{c}\cdot b \le 0.15) and its C1C^1 cap kcap once at the strike, keeping ∂H∂t=0\frac{\partial H}{\partial t} = 0 throughout the sustain.

  3. Exceeding the Linear Stability Horizon (∣tr⁡J∣>2|\operatorname{tr} J| > 2 / CFL Violation): A 2×22 \times 2 unimodular matrix (det⁡J=1\det J = 1) has characteristic polynomial λ2−(tr⁡J)λ+1=0\lambda^2 - (\operatorname{tr} J)\lambda + 1 = 0.

    • When ∣tr⁡J∣<2|\operatorname{tr} J| < 2, the eigenvalues λ±=e±iθ\lambda_\pm = e^{\pm i\theta} lie on the unit circle (elliptic stability; shadow Hamiltonian is an ellipse).
    • When ∣tr⁡J∣>2|\operatorname{tr} J| > 2, the eigenvalues λ+>1\lambda_+ > 1 and λ−=1/λ+<1\lambda_- = 1/\lambda_+ < 1 are real and reciprocal! Even though det⁡J=λ+λ−=1\det J = \lambda_+ \lambda_- = 1 (area is still preserved: one axis stretches while the other shrinks!), the shadow Hamiltonian turns into a hyperbola and the state explodes exponentially along the unstable eigenvector as λ+n\lambda_+^n. For the magic circle / 1D leapfrog, tr⁡Msym=2−ε2\operatorname{tr} M_{\text{sym}} = 2 - \varepsilon^2, so stability requires ε<2\varepsilon < 2 (ω0Δt<π\omega_0 \Delta t < \pi, the Nyquist limit; Suzu’s bounds are each voice’s own: the chain’s Courant number s≤1s \le 1 (string_cfl; 1.05 is the red control), the ring’s k⋅cap≤0.9k \cdot \text{cap} \le 0.9 at the note together with the resolution rule k c^ b≤0.15\sqrt{k}\,\hat{c}\,b \le 0.15, and f<1.9f < 1.9 the SVF’s).
  4. Nonlinear Parametric (Mathieu) Resonance on the 2D Gong (suzu::Membrane, voice_kind 9, §13.9): Even below the linear Courant bound λ2D<2\lambda_{2D} < 2, a nonlinear symplectic system can suffer parametric resonance. On Suzu’s 2D Rectangular Membrane (voxo/src/suzu.h), the linear leapfrog stability bound is λ2D=c Δtdx−2+dy−2≤1.95\lambda_{2D} = c\,\Delta t \sqrt{dx^{-2} + dy^{-2}} \le 1.95. However, when the von Kármán gong nonlinearity (α>0\alpha > 0) is enabled, the global membrane tension c2+αEc^2 + \alpha E (where E=∑∣∇hu∣2=−∑uΔhuE = \sum |\nabla_h u|^2 = -\sum u \Delta_h u) is modulated by the fundamental (1,1)(1, 1) mode’s oscillation at 2ω112\omega_{11}. Even though the gong’s kick-drift step is an exact momentum shear with det⁡J=1\det J = 1 in 2nxny2 n_x n_y-dimensional phase space, in this lesson’s reading this periodic tension modulation turns the highest grid mode’s equation of motion into the Mathieu equation: when the top mode sits near the tr⁡J=−2\operatorname{tr} J = -2 stability boundary (λ2D∈[1.82,1.95]\lambda_{2D} \in [1.82, 1.95]), its conjugate unit-circle eigenvalues collide at λ=−1\lambda = -1 and split onto the real axis (det⁡J=1\det J = 1 still holds while the top mode’s energy grows without bound). The record says only what was measured — a swelling sheet at 1.95 diverged — and the gong’s bar is 1.80 (MEMBRANE_CFL_GATE_GONG), which in this reading keeps the top mode’s Floquet multiplier away from −1-1; the ten-minute energy drift measured inside 0.0002 dB (−0.00016-0.00016 dB on the 8 × 6 grid at 96 kHz).


Open the module’s lab (a standalone page — a teaching re-implementation, never the engine) in a WebGL2 + WebAudio browser. The interactive lab is divided into two synchronized workspaces matching the lecture notes.

Part 1: Shader Lab — Ping-Pong Phase-Space Advection & Area Preservation

Section titled “Part 1: Shader Lab — Ping-Pong Phase-Space Advection & Area Preservation”

The top workspace runs a real-time WebGL2 RGBA32F Ping-Pong Framebuffer Pipeline on the phase space (q,p)∈[−π,π]2(q, p) \in [-\pi, \pi]^2 of the nonlinear pendulum H(q,p)=12p2−cos⁡(q)H(q, p) = \frac{1}{2}p^2 - \cos(q):

  1. Compare Symplectic Störmer–Verlet vs. Classical RK4 vs. Euler:

    • Start with the default 2nd-Order Symplectic Störmer–Verlet (Leapfrog) integrator and click Reset Phase Blob. Watch the circular phase-space ensemble (placed across the anharmonic shear zone near the separatrix H=+1H = +1) stretch into a long, razor-thin spiral whorl over thousands of frames.
    • Observe the live GPU readback telemetry in the top bar: Blob Area Ratio A(t)/A0A(t)/A_0 stays locked at 100.0 %, and the --kessho-flat Gate max⁡∣det⁡J−1∣\max|\det J - 1| remains near 0.000 (up to discrete pixel-grid finite differences along the whorl edge).
    • Now switch the Integrator Scheme to 4th-Order Runge–Kutta (RK4) and increase the step size hh (or sub-steps/frame). Even though RK4 is fourth-order accurate per step, watch det⁡JRK4≠1\det J_{\text{RK4}} \neq 1 steadily shrink (or distort) the total pixel area of the blob over thousands of frames!
    • Switch to Forward Euler (det⁡J=1+h2cos⁡q>1\det J = 1 + h^2\cos q > 1) or Backward Euler (det⁡J<1\det J < 1) — the red controls — to see immediate catastrophic phase-space area creation (the blob balloons out of the well) or artificial dissipation (the blob collapses into the origin (0,0)(0,0)).
  2. Test libsumi Displacement Re-Basing vs. Naive Density Ping-Pong:

    • Toggle the Advection Architecture selector between:
      • libsumi Displacement Re-Basing (d'(P) = d(P_src) + (P_src - P)): The ping-pong FBO advects the 2D Lagrangian origin offset RGBA32F, and the composite pass evaluates the sharp initial blob C0(P+d(P))C_0(P + d(P)) once. Notice how the stretched filament stays razor-sharp even after 5,000 steps.
      • Direct Density Ping-Pong (C'(P) = texture(C, P_src)): The ping-pong FBO resamples the scalar pigment density every frame using bilinear filtering. Watch how numerical diffusion smears the thin filament into a blurry cloud and erodes the thresholded pixel area — proving why libsumi stores cumulative displacements in Layer A!
  3. Inspect with Kessho Birefringence & the z=1z = 1 --kessho-flat Gate:

    • Switch the Display Mode between Phase-Space Filament + H(q,p)H(q,p) Contours, Kessho Birefringence & Caustics (det⁡J\det J), and --kessho-flat (z=1z=1) ∣det⁡J−1∣|\det J - 1| Gate (where green means ∣det⁡J−1∣≤0.05|\det J - 1| \le 0.05 and red flags area compression/expansion).
    • Click anywhere on the phase canvas to drop the ensemble at a new initial (q0,p0)(q_0, p_0) — try placing it right on the hyperbolic saddle (q,p)=(π,0)(q, p) = (\pi, 0) or astride the separatrix!

Part 2: Sound Lab — Audifying Symplectic Shadow Hamiltonians at 48 kHz

Section titled “Part 2: Sound Lab — Audifying Symplectic Shadow Hamiltonians at 48 kHz”

The bottom workspace runs a 48 kHz WebAudio synthesizer integrating a fast physical oscillator alongside a Reference Energy-Pitch Drone whose frequency is exponentially mapped to the instantaneous energy ratio:

fdrone(t)=fref⋅2 γ H(q(t), p(t))−H0H0(or mapped to the exact shadow Hamiltonian H~(q,p))f_{\text{drone}}(t) = f_{\text{ref}} \cdot 2^{\,\gamma \, \frac{H(q(t),\,p(t)) - H_0}{H_0}} \qquad \left(\text{or mapped to the exact shadow Hamiltonian } \tilde{H}(q, p)\right)

When H(q(t),p(t))=H0H(q(t), p(t)) = H_0, the reference drone forms a pure unison (or exact octave) with the oscillator:

  1. Hear the Integrators by Ear:

    • Click Start 48 kHz Audio and select Symplectic Störmer–Verlet (Leapfrog) or Symplectic Euler (Magic Circle). The pitch of the reference drone locks indefinitely!
    • Toggle the Drone Pitch Mapping between True Continuous Energy H(q,p)H(q, p) and Shadow Hamiltonian H~(q,p)\tilde{H}(q, p) while pushing the dimensionless step ε=ω0Δt\varepsilon = \omega_0 \Delta t up toward 0.8–1.4. On H(q,p)H(q, p), you will see (on the live Energy Strip Chart) and hear (as a subtle FM shimmer at 2ω02\omega_0) the bounded O(ε)\mathcal{O}(\varepsilon) or O(ε2)\mathcal{O}(\varepsilon^2) shadow breathing of HH around H~\tilde{H}, with zero secular pitch drift. Switch the mapping to H~(q,p)\tilde{H}(q, p) and the FM breathing vanishes completely — the line is flat to machine precision!
    • Click Forward Euler (Red Control): Because det⁡J=1+ε2>1\det J = 1 + \varepsilon^2 > 1, the energy grows exponentially every sample (Hn=(1+ε2)nH0H_n = (1 + \varepsilon^2)^n H_0), producing an unmistakable upward pitch glissando on the reference drone until the lab’s safety breaker clamps the voice (the lab’s own, at +14 dB over the strike’s energy; the engine’s bus breaker has no level threshold — it cuts a block that is no longer finite)!
    • Click Backward Euler (Red Control): Because det⁡J=(1+ε2)−1<1\det J = (1 + \varepsilon^2)^{-1} < 1, the energy decays exponentially, pulling the reference drone in a downward pitch spiral while the oscillator fades into silence.
    • Click Classical RK4: Push ε\varepsilon to 0.9–1.3. You will hear RK4 hold pitch briefly and then sag flat in a slow downward glissando as (1−ε6/72)N(1 - \varepsilon^6/72)^N drains the phase-space area over hundreds of thousands of audio samples!
  2. Switch Nonlinear Potentials & Trigger the Live-Cap Pumping Red Control:

    • Switch the Oscillator Hamiltonian between Harmonic (V=12q2V = \frac{1}{2}q^2), Duffing Hardening Spring (V=12q2+β4q4V = \frac{1}{2}q^2 + \frac{\beta}{4}q^4), and 2-Body Toda Soliton Bond (V=ab(e−bq+bq−1)V = \frac{a}{b}(e^{-bq} + bq - 1)).
    • Enable the Time-Dependent Live Cap (∂H/∂t ≠ 0 Red Control): This modulates the stiffness cap dynamically from the oscillator’s live peak every block (the failure mode found at step 83, DECISIONS_13 #1 — the lab’s own control; the engine never shipped one). Even under Symplectic Leapfrog, watch and hear the energy ratchet upward step after step as dHdt=∂H∂t≠0\frac{dH}{dt} = \frac{\partial H}{\partial t} \neq 0 pumps work into the orbit!

Problem 2.1: RK4 Determinant Defect & The Störmer–Verlet Shadow Hamiltonian

Section titled “Problem 2.1: RK4 Determinant Defect & The Störmer–Verlet Shadow Hamiltonian”

Consider the 1D harmonic oscillator H(q,p)=12ω0(q2+p2)H(q, p) = \frac{1}{2}\omega_0(q^2 + p^2) integrated with dimensionless time step ε=ω0h\varepsilon = \omega_0 h.

  1. Classical RK4 is not symplectic: For the linear system z˙=εJz\dot{z} = \varepsilon J z with J=(01−10)J = \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix} and J2=−IJ^2 = -I, the 4-stage Runge–Kutta update matrix is the truncated Taylor series of exp⁡(εJ)\exp(\varepsilon J): MRK4(ε)=I+εJ+ε22!J2+ε33!J3+ε44!J4=(1−ε22+ε424)I+(ε−ε36)JM_{\text{RK4}}(\varepsilon) = I + \varepsilon J + \frac{\varepsilon^2}{2!}J^2 + \frac{\varepsilon^3}{3!}J^3 + \frac{\varepsilon^4}{4!}J^4 = \left(1 - \frac{\varepsilon^2}{2} + \frac{\varepsilon^4}{24}\right)I + \left(\varepsilon - \frac{\varepsilon^3}{6}\right)J Compute det⁡MRK4(ε)\det M_{\text{RK4}}(\varepsilon) explicitly as a polynomial in ε\varepsilon and verify that: det⁡MRK4(ε)=1−ε672+ε8576\det M_{\text{RK4}}(\varepsilon) = 1 - \frac{\varepsilon^6}{72} + \frac{\varepsilon^8}{576} At f0=2000 Hzf_0 = 2000\text{ Hz} and fs=48 kHzf_s = 48\text{ kHz} (ε=2πf0/fs≈0.2618\varepsilon = 2\pi f_0 / f_s \approx 0.2618), by how many decibels (10log⁡10(det⁡MRK4)N10\log_{10}(\det M_{\text{RK4}})^N) does RK4’s energy drift over a 10-minute sustain (N=2.88×107N = 2.88 \times 10^7 samples)? Compare this against Suzu’s 0.001 dB gate.

  2. Exact Shadow Hamiltonian of 2nd-Order Störmer–Verlet: Write the single-step matrix MSV(ε)M_{\text{SV}}(\varepsilon) of the symmetric half-kick / drift / half-kick leapfrog: MSV(ε)=(10−ε/21)(1ε01)(10−ε/21)M_{\text{SV}}(\varepsilon) = \begin{pmatrix} 1 & 0 \\ -\varepsilon/2 & 1 \end{pmatrix} \begin{pmatrix} 1 & \varepsilon \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ -\varepsilon/2 & 1 \end{pmatrix} Multiply the three matrices out, verify det⁡MSV(ε)=1\det M_{\text{SV}}(\varepsilon) = 1 for all ε∈R\varepsilon \in \mathbb{R}, and prove that the quadratic form H~SV(q,p)=12 ⁣(1−ε24)q2+12p2\tilde{H}_{\text{SV}}(q, p) = \frac{1}{2}\!\left(1 - \frac{\varepsilon^2}{4}\right)q^2 + \frac{1}{2}p^2 is conserved identically (H~SV(qn+1,pn+1)=H~SV(qn,pn)\tilde{H}_{\text{SV}}(q_{n+1}, p_{n+1}) = \tilde{H}_{\text{SV}}(q_n, p_n)) along every discrete trajectory whenever ∣ε∣<2|\varepsilon| < 2. Why does H~SV\tilde{H}_{\text{SV}} have no qpqp cross-term unlike the magic circle’s Iε(q,p)=12(q2+p2−εqp)I_\varepsilon(q, p) = \frac{1}{2}(q^2 + p^2 - \varepsilon q p), and why does the true energy H(qn,pn)H(q_n, p_n) breathe by O(ε2)\mathcal{O}(\varepsilon^2) instead of O(ε)\mathcal{O}(\varepsilon)?


Problem 2.2: Toda Lattice Solitons, The C1C^1 Cap & Time-Dependent Pumping (suzu::TodaRing)

Section titled “Problem 2.2: Toda Lattice Solitons, The C1C^1C1 Cap & Time-Dependent Pumping (suzu::TodaRing)”

In voxo/src/suzu.h, suzu::TodaRing integrates the NN-node exponential lattice with bond strain ri=q(i+1) mod N−qir_i = q_{(i+1)\bmod N} - q_i:

H(q,p)=∑i=0N−112pi2+∑i=0N−1V(ri),V(r)=ab(e−br+br−1),k=abH(q, p) = \sum_{i=0}^{N-1} \frac{1}{2}p_i^2 + \sum_{i=0}^{N-1} V(r_i), \qquad V(r) = \frac{a}{b}\left(e^{-br} + br - 1\right), \quad k = ab

  1. Noether Momentum Conservation & Symplecticity: Prove that the kick-then-drift update in TodaRing::step(1.0f): pin+1=pin+a(Ei−1(qn)−Ei(qn)),qin+1=qin+pin+1p_i^{n+1} = p_i^n + a\left(E_{i-1}(q^n) - E_i(q^n)\right), \qquad q_i^{n+1} = q_i^n + p_i^{n+1} has unit Jacobian determinant det⁡∂(qn+1,pn+1)∂(qn,pn)=1\det \frac{\partial(q^{n+1}, p^{n+1})}{\partial(q^n, p^n)} = 1 on R2N\mathbb{R}^{2N} for any bond force law Ei(qn)E_i(q^n), and preserves the total ring momentum Ptot=∑i=0N−1piP_{\text{tot}} = \sum_{i=0}^{N-1} p_i identically at every step. Explain why TodaRing must subtract the mean drift pˉ=Ptot/N\bar{p} = P_{\text{tot}} / N from the pickup coordinate (pick_xi -= sum_p / n) when the swirl impulse (kick_all) is non-zero.

  2. Continuity of the Rational Stiffness Cap: To prevent extreme compressions (r<rcr < r_c) from violating the leapfrog stability ceiling, TodaRing::step replaces E(r)=e−brE(r) = e^{-br} past the knee E(rc)=12kcapE(r_c) = \frac{1}{2}k_{\text{cap}} (so rc=−1bln⁡(12kcap)r_c = -\frac{1}{b}\ln(\frac{1}{2}k_{\text{cap}})) with: Esat(r)={e−brr≥rckcap−kcap24e−brr<rcE_{\text{sat}}(r) = \begin{cases} e^{-br} & r \ge r_c \\ k_{\text{cap}} - \dfrac{k_{\text{cap}}^2}{4 e^{-br}} & r < r_c \end{cases} Show that both Esat(r)E_{\text{sat}}(r) and its derivative Esat′(r)E_{\text{sat}}'(r) are continuous at r=rcr = r_c, so the corresponding capped potential Vcap(r)V_{\text{cap}}(r) in TodaRing::energy() is C2C^2-smooth, and its local stiffness −Vcap′′(r)=a Esat′(r)-V_{\text{cap}}''(r) = a\,E_{\text{sat}}'(r) attains a maximum of 12k kcap\frac{1}{2}k\,k_{\text{cap}} right at the knee r=rcr = r_c.

  3. Why Live-Peak Limiting Breaks Energy Conservation: Suppose that instead of fixing kcapk_{\text{cap}} at the strike, we set kcap(t)k_{\text{cap}}(t) dynamically on every audio block as a function of the instantaneous peak compression. Using dHdt={H,H}+∂H∂t\frac{dH}{dt} = \{H, H\} + \frac{\partial H}{\partial t}, compute ∂Vcap∂kcap k˙cap\frac{\partial V_{\text{cap}}}{\partial k_{\text{cap}}}\,\dot{k}_{\text{cap}} for a bond in the capped regime (r<rcr < r_c) and explain why a time-varying cap acts as a parametric energy pump even when the single-step map has det⁡J=1\det J = 1.


Problem 2.3: QQ-Orthogonality of the Cayley Transform in suzu::Dirac

Section titled “Problem 2.3: QQQ-Orthogonality of the Cayley Transform in suzu::Dirac”

In voxo/src/suzu.h, suzu::Dirac integrates the port-Hamiltonian network x˙=(J−R)∇H(x)\dot{x} = (J - R)\nabla H(x) with quadratic energy H(x)=12xTQxH(x) = \frac{1}{2}x^T Q x (Q=QT≻0Q = Q^T \succ 0, JT=−JJ^T = -J, R=RT⪰0R = R^T \succeq 0) using the Cayley / implicit-midpoint matrix:

M=(I−h2A)−1 ⁣(I+h2A),A=(J−R)QM = \left(I - \frac{h}{2}A\right)^{-1}\!\left(I + \frac{h}{2}A\right), \qquad A = (J - R)Q

  1. Proof of Passivity and QQ-Orthogonality: For any trajectory xk+1=Mxkx_{k+1} = M x_k, define the midpoint vector z=12(xk+1+xk)=(I−h2A)−1xkz = \frac{1}{2}(x_{k+1} + x_k) = \left(I - \frac{h}{2}A\right)^{-1} x_k, so that xk=z−h2Azx_k = z - \frac{h}{2}Az and xk+1=z+h2Azx_{k+1} = z + \frac{h}{2}Az. Expand the one-step energy change H(xk+1)−H(xk)=12xk+1TQxk+1−12xkTQxkH(x_{k+1}) - H(x_k) = \frac{1}{2}x_{k+1}^T Q x_{k+1} - \frac{1}{2}x_k^T Q x_k in terms of zz and prove the exact identity: H(xk+1)−H(xk)=h zTQAz=h zTQ(J−R)Qz=−h zTQRQz≤0H(x_{k+1}) - H(x_k) = h\,z^T Q A z = h\,z^T Q(J - R)Q z = -h\,z^T Q R Q z \le 0 Conclude that when R=0R = 0, MTQM=QM^T Q M = Q (MM is QQ-orthogonal and preserves H(x)H(x) for every h>0h > 0), and when R⪰0R \succeq 0, ∥Q1/2MQ−1/2∥2≤1\|Q^{1/2} M Q^{-1/2}\|_2 \le 1 (strictly passive for all h>0h > 0).

  2. Why M is QQ-Orthogonal, Not Orthogonal: Give an explicit 2×22 \times 2 example with J=(01−10)J = \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}, R=0R = 0, and Q=diag⁡(k,1)Q = \operatorname{diag}(k, 1) (k≠1k \neq 1) showing that MTQM=QM^T Q M = Q holds while MTM≠IM^T M \neq I (\|M\|_2 > 1). Why does Dirac::build conjugate MM by Q1/2Q^{1/2} and Q−1/2Q^{-1/2} inside its power-iteration loop when computing gain_q?

midi-sink 2.0.0 · AGPL-3.0 · source