Module 3 — Darboux's theorem, Moser's trick and generating functions
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), voxo/src/suzu.h, and site/src/content/docs/operators/. The lab beside the module is a standalone teaching re-implementation, never the engine; the engine’s own lab is the Suzu lab.
Lecture Notes
Section titled “Lecture Notes”3.1 Riemannian Curvature vs. Symplectic Flexibility: Darboux’s Theorem
Section titled “3.1 Riemannian Curvature vs. Symplectic Flexibility: Darboux’s Theorem”Why do two-dimensional fluid sheets, phase spaces, and canonical mechanical systems behave so differently from curved elastic surfaces? The answer lies in the fundamental contrast between Riemannian geometry and symplectic geometry:
| Geometric Structure | Defining Tensor on | Algebraic Symmetry | Differential Condition | Local Equivalence (Normal Form) | Local Invariants |
|---|---|---|---|---|---|
| Riemannian Manifold | Metric | Symmetric (), positive-definite | None (Levi-Civita connection determined by ) | $g | p = \delta{ij}pg_{ij}(x) = \delta_{ij} - \frac{1}{3}R_{ikjl}x^k x^l + \mathcal{O}(|x|^3)$) |
| Symplectic Manifold | 2-Form | Skew-symmetric (), non-degenerate | Closed: | on an entire open neighbourhood (Darboux’s Theorem) | None! (Only the dimension ) |
In Riemannian geometry, Gauss’s Theorema Egregium proves that the Gaussian curvature of a 2D surface is a local isometric invariant: no smooth coordinate transformation can flatten a hemisphere () or a saddle () onto the Euclidean plane () without stretching distances.
In symplectic geometry, the situation is the exact opposite:
Theorem 3.1 (Darboux’s Theorem, 1882): Let be a smooth -dimensional symplectic manifold ( and ). Around every point , there exists a local coordinate chart centered at in which takes the constant canonical form: Such coordinates are called canonical or Darboux coordinates. Consequently, all symplectic manifolds of the same dimension are locally indistinguishable.
How libsumi’s Kessho Medium Separates Riemannian Strain from Symplectic Flatness
Section titled “How libsumi’s Kessho Medium Separates Riemannian Strain from Symplectic Flatness”You can see the contrast between Riemannian invariants and Darboux’s Theorem directly inside libsumi’s Kessho crystal/interference medium (composite.glsl’s kessho_col, the spec draft’s §10.7, the Minerals page).
After exact suminagashi passes (drop_fs, vortex_fs, chladni_fs, tine_fs), the displacement field — the ping-pong texture, RGBA16F by default — stores the cumulative Lagrangian displacement mapping current canvas coordinates back to their initial origin with Jacobian matrix , read by central differences over texels. From this single Jacobian , Kessho extracts two completely different geometric pullbacks:
-
The Symplectic 2-Form Pullback (the
--kessho-flatview at ): Pulling the canonical area 2-form back by gives: Because every exact operator is a symplectomorphism (), everywhere! Symplectically, the wildly swirled suminagashi sheet is completely flat — in the Lagrangian coordinates , the 2-form is still . -
The Riemannian Metric Pullback (Layer A, the birefringence) and the Rotation Side (Layer B, the trace discriminant): Pulling the Euclidean metric back by yields the symmetric Cauchy–Green deformation tensor: Even though , the matrix is not the identity! Its eigenvalues are and , where is the principal stretch along the sheared ink filament and is the principal strain angle. In Kessho (
minerals.mdx), this Riemannian anisotropy drives photoelastic birefringence: light splits into fast and slow axes with optical path retardation , painting the Michel-Lévy interference fringes and the uniaxial Maltese cross ! Meanwhile, Layer B reads the rotation side of the same Jacobian, where the metric is blind. The trace discriminant sorts each texel as elliptic (, a cool tint) or hyperbolic (, a warm one): a pure rotation has and no birefringence at all, yet tints it. The caustic is the determinant of the sheet lifted to a viewing depth — for an area-preserving , — so its fold is the iso-trace contour , read at three depths by Barite’s dispersion. There is no heightfield and no curvature in the medium. Where and — near the parabolic line of , where the two eigenvalues of coincide — Barite’sconical_ringreads the caustic through a ring kernel of eight points: Hamilton’s conical refraction, a stylisation of the hollow cone on the fold (Module 1 §1.5 lists these observables with their thresholds).
3.2 Moser’s Homotopy Trick ()
Section titled “3.2 Moser’s Homotopy Trick (ddtψt∗ωt=0\frac{d}{dt}\psi_t^*\omega_t = 0dtdψt∗ωt=0)”How do we actually construct the coordinate transformation that flattens a spatially varying closed 2-form into the constant canonical 2-form ?
In 1965, Jürgen Moser introduced one of the most powerful tools in differential geometry — Moser’s Trick (or the homotopy method). Instead of trying to solve a nonlinear partial differential equation for the static map directly, Moser builds a continuous family of diffeomorphisms () generated by a time-dependent vector field !
Step-by-Step Derivation of Moser’s Flow
Section titled “Step-by-Step Derivation of Moser’s Flow”Suppose and are two closed 2-forms () on a star-shaped neighbourhood such that is exact, and the convex linear interpolation
is non-degenerate for every . We seek a smooth 1-parameter family of maps starting at the identity () such that:
If we can find such a family, then at we have , and are our desired Darboux coordinates!
Let be the time-dependent velocity field generating :
Now differentiate with respect to . By the product rule for pullbacks and Cartan’s Magic Formula ():
Because , the Poincaré Lemma guarantees the existence of a 1-form on such that:
Substituting into the time derivative yields:
Therefore, to guarantee identically for all , it suffices to choose at each instant so that the 1-form inside vanishes:
Look at how clean Moser’s Equation () is:
- Because is non-degenerate for every , the bundle map is invertible at every point and every . Thus is uniquely and explicitly determined by linear algebra!
- If vanishes at a point (or along a submanifold), then for all , so stays fixed while the surrounding space flows into canonical Darboux form.
Explicit 2D Formula for the Shader Lab ()
Section titled “Explicit 2D Formula for the Shader Lab (ω1=f(q,p) dq∧dp\omega_1 = f(q, p)\,dq \wedge dpω1=f(q,p)dq∧dp)”On (or on a phase-space slice), let and let with strictly positive everywhere. Notice that:
- Because , the homotopy density is strictly positive for all ! Thus never degenerates.
- Any 1-form satisfying obeys: For instance, we can construct by integrating along (the horizontal gauge ), or symmetrically along rays from the origin, or via a Poisson potential where .
- Writing , we compute the interior product with : Equating coefficients of and gives the explicit Moser Homotopy Vector Field:
Let us check what happens when we integrate from to :
- Along any trajectory , the Jacobian determinant evolves by Liouville’s trace formula .
- Because , we have for all !
- At , : regions where (dense phase-space metric) expand by , while regions where (sparse phase-space metric) contract by , morphing a warped coordinate grid into uniform canonical Darboux squares of equal -area!
Hamilton’s 1832 Crystal Drop (drop_fs, drop.mdx) as a Darboux Coordinate Map
Section titled “Hamilton’s 1832 Crystal Drop (drop_fs, drop.mdx) as a Darboux Coordinate Map”Look at the Drop page (the crystal drop’s habits) and the Minerals page. On the punctured plane , naive polar coordinates are not Darboux coordinates because the Euclidean area form has a spatially varying density :
How do we flatten into canonical Darboux form ? Applying Moser’s radial integration gives Hamilton’s polar action-angle coordinates :
In the Darboux chart :
- A circular ink drop of radius at centre is simply a uniform translation in :
- A crystal habit drop (
drop_habit: calcite cleavage rhomb, quartz/muscovite hexagon, or barite desert-rose rosette , mixed toward the circle by the roundness) replaces the constant with any angular profile : In Darboux coordinates , this map is a pure triangular shear with Jacobian: Because is Darboux (), the composed map in Cartesian texels is exact and area-preserving at any size and for any star-shaped crystal habit, with zero sub-stepping!
3.3 Generating Functions of Canonical Transformations ( & )
Section titled “3.3 Generating Functions of Canonical Transformations (S(q,Q)S(q, Q)S(q,Q) & F2(q,P)F_2(q, P)F2(q,P))”Darboux’s Theorem tells us that canonical coordinates always exist locally, and Moser’s trick constructs them by flowing along . Is there a direct, algebraic way to parameterize canonical transformations without integrating a differential equation at every step?
Recall from Module 1 (§1.2) that the canonical symplectic form is the negative exterior derivative of the tautological (Liouville) 1-form:
A diffeomorphism is a canonical transformation (symplectomorphism) if and only if , which we can rewrite using :
By the Poincaré Lemma, the 1-form is closed () on a simply connected domain if and only if it is the exact differential of a scalar function — called a Generating Function! Depending on which of the coordinates we choose as independent variables on the -dimensional graph of , Legendre transforms give the Four Classical Types of Generating Functions:
| Type | Independent Variables | Exact 1-Form Identity | Implicit / Explicit Canonical Equations | Non-Degeneracy (Twist) Condition |
|---|---|---|---|---|
| Type 1 | (old & new positions) | |||
| Type 2 | (old pos, new mom) | |||
| Type 3 | (old mom, new pos) | |||
| Type 4 | (old & new momenta) |
Let us look at three concrete families of generating functions that power midi-sink:
-
Type-1 Generating Functions & Twist Maps (
chirikov.mdx,suzu::Rotor): Choose the Type-1 generating function: Applying and yields: That is Symplectic Euler (kick-then-drift)! In particular, when , generates the Chirikov Standard Map (site/src/content/docs/operators/chirikov.mdxandsuzu::Rotorinvoxo/src/suzu.h). Notice why holds automatically for any potential : the map is generated by a single scalar function with twist ! -
Type-1 Cross-Coupled Nonlinear Warps and Type-2 Point-Shear Warps :
- If we choose where is any smooth invertible coordinate warp (), then: which inverts explicitly in forward form from canonical oscillator coordinates to warped physical coordinates : Let us check the Jacobian of : it is the composition of the horizontal shear () followed by the canonical point-cotangent lift , , whose Jacobian matrix is: Look at the physical meaning of : whenever a coordinate transformation compresses the position axis (), it must proportionally stretch the conjugate momentum axis () so that phase-space area remains invariant!
- Similarly, if we start from a Type-1 generating function with twist , or compose a sequence of exact canonical shears generated by : we obtain an explicit, invertible canonical transformation that folds and warps phase space into complex multi-lobed filaments while keeping .
3.4 Action-Angle Coordinates () & Canonical Timbre Warping at 48 kHz
Section titled “3.4 Action-Angle Coordinates (∮p dq=2πI\oint p\,dq = 2\pi I∮pdq=2πI) & Canonical Timbre Warping at 48 kHz”Why does a canonical transformation allow us to warp an audio oscillator’s timbre (harmonic overtone spectrum) as aggressively as we like without ever detuning its fundamental pitch?
The Action Integral and Fundamental Frequency
Section titled “The Action Integral ∮p dq\oint p\,dq∮pdq and Fundamental Frequency”For any 1-DoF Hamiltonian whose level sets are closed periodic orbits , Action-Angle Theory (the 1D global version of Darboux’s Theorem, known as the Liouville–Arnold Theorem) defines the action variable as the enclosed symplectic area divided by :
Together with the conjugate angle variable advancing uniformly in time, form canonical Darboux coordinates () in which depends on the action alone! Hamilton’s equations in are simply:
Thus the exact fundamental angular frequency of the orbit at energy is the derivative of energy with respect to enclosed phase-space area:
Now compare two ways of adding nonlinear waveshaping to a harmonic oscillator (where , so is completely independent of amplitude):
-
Method A — Non-Canonical In-Loop Force Shear (
Cell::step_shearedinvoxo/src/suzu.h): Insuzu.h,Cell::step_sheared(s_of_y)modifies the restoring kick inside the recurrence: Even though this single-step map has , it changes the Hamiltonian itself from to . Because the level curve encloses a different area , the derivative changes! As documented invoxo/src/suzu.h:- For the cubic hardening spring
shape_cubic(u) = u³, the frequency shifts sharp by to first order, leaving 110 cents of detuning at . - For the triangle wavefolder
shape_tri(u), the first-order describing function leaves a massive 555 cents (nearly a tritone!) of detuning at . To keepstep_shearedin tune across the keyboard,suzu.hmust precompute a 17-point numerical period-calibration table (shear_table_fill/shear_period_ratio) by running a test cell for 80 cycles at and rescaling by the measured period ratio!
- For the cubic hardening spring
-
Method B — Canonical Coordinate Transformation via a Generating Function : Suppose instead that we evolve the canonical harmonic oscillator under (or equivalently, evolve under the pullback Hamiltonian ), where is a canonical transformation generated by or : By Stokes’ Theorem, for every closed orbit in the plane and its warped image in the plane, the action integral is strictly preserved: Because for every energy and every generating function , the fundamental frequency is: Geometrically, as the canonical transformation folds, pinches, or twists the circular orbit into a figure-eight, star, or S-shaped wavefolder contour in , every lobe that stretches outward in is compensated by a proportional narrowing in so that the total enclosed area never changes by a single bit! Thus:
- The fundamental pitch remains locked at with zero calibration tables;
- The waveform acquires rich, dynamic harmonic overtones (wavefolding) as the generating function’s warp depth increases;
- Driving stereo speakers in quadrature (, as in Module 1) lets you hear both the nonlinear coordinate wavefolder on and the conjugate momentum compression that keeps the symplectic area constant!
Three More Places Where Darboux & Canonical Coordinate Maps Appear in Suzu
Section titled “Three More Places Where Darboux & Canonical Coordinate Maps Appear in Suzu”- MPE Pitch-Glide Re-Basing (
Cell::retunevs.Cell::retune_plain,voxo/src/suzu.h): In Module 2, we saw that the magic circleCell::stepconserves the tilted quadratic form . Writing and puts into canonical Darboux form , where the peak amplitude of is . When an MPE performer slides pitch by semitones, changes every sample. If you simply overwriteeps = e(Cell::retune_plain), the state lands on a new -ellipse with an amplitude that depends on the phase at the retune — , the old state read under the new — a ripple across the glide.Cell::retune(e)reads that implied amplitude and rescales both coordinates (s = amp / sqrtf(a2)) onto the new ellipse of the held peak -amplitude : a homothety that keeps the amplitude, not the action — the orbit encloses , which changes with (Module 1 §1.6.2; the suite’s ripple figures are there). - Lagrangian vs. Eulerian Pickup Coordinates on the Toda Ring (
TodaRing::pickup,voxo/src/suzu.h): Onsuzu::TodaRing, each node has lattice index and physical lab position . Reading the compression in the Eulerian lab coordinate (a nonlinear coordinate transformation on the ring whose Jacobian is ) sharpens a hard soliton’s density spike where the lattice nearly touches () — and that reading was rejected at step 83: it put dB of content in the top octave, which aliases. What ships reads the compression in the lattice’s own coordinate, the pickup standing still against the mean drift ( runs back by a step, a Catmull–Rom cubic over the bonds). Two charts, the same physics, two spectra: the coordinate change is audible, and the engine chose the one that does not alias. - Specular Wavefolding in the Stadium Billiard (
suzu::Billiard,voxo/src/suzu.h): Insuzu::Billiard, the interior flight is the exact harmonic oscillator rotation at in and . When the orbit strikes the convex stadium boundary at sub-sample fraction , the velocity reflects across the wall normal (, on ). For the circular wall (), the system is integrable and acts as an exact 2D symplectic wavefolder whose fundamental pitch is set by while wall reflections fold the waveform and generate bright overtones (anti-aliased by the two-point polyBLAMP residual of each kink through a one-sample delay — dB of alias, gate 61).
Lab Instructions (module_03_lab.html)
Section titled “Lab Instructions (module_03_lab.html)”Open the module’s lab (a standalone page — a teaching re-implementation, never the engine) in a WebGL2 + WebAudio browser. The lab is split into two interactive parts matching the lecture notes.
Part 1: Shader Lab — Moser’s Homotopy Flow () & Riemannian vs. Symplectic Duality
Section titled “Part 1: Shader Lab — Moser’s Homotopy Flow (ddtψt∗ωt=0\frac{d}{dt}\psi_t^*\omega_t = 0dtdψt∗ωt=0) & Riemannian vs. Symplectic Duality”The top WebGL2 canvas visualizes a spatially varying closed 2-form (with strictly positive everywhere) and integrates Moser’s time-dependent homotopy ODE:
directly inside the shader (via 16-step RK4 integration from to the slider value ):
-
Morph Warped Metric Cells into Canonical Darboux Squares ():
- At (), the grid shows the warped density : cells where carry excess symplectic weight (), and cells where are rarefied ().
- Drag the Homotopy Time slider from
0.00to1.00(or click Animate Homotopy ). Watch the shader integrate in real time: dense regions expand and sparse regions contract until, at , the pulled-back 2-form becomes uniformly equal to across the entire canvas, morphing the warped coordinate grid into uniform canonical Darboux squares! - Watch the live GPU readback telemetry in the HUD: as , Pullback Defect drops from its initial warp down to
~0.000!
-
Compare 4 Density Profiles & Inspect Kessho’s Riemannian Strain :
- Switch the Target 2-Form Density between:
- Gaussian Density Lens: (radial Moser flow).
- Periodic Chladni Egg-Carton: (2D periodic Moser potential).
- Dipole / Asymmetric Pinch: (shifts the Darboux grid asymmetrically while fixing the boundary).
- Hamilton’s Crystal Drop Habit (
drop_fs): Polar density with -blade crystal habit modulation .
- Switch the View Mode to Kessho Riemannian Birefringence ( at )! Even at , where the symplectic 2-form is completely flat (, zero symplectic curvature!), you will see vivid Michel-Lévy interference fringes and Maltese cross brushes because the Riemannian metric pullback has non-trivial shear !
- Switch the Target 2-Form Density between:
Part 2: Sound Lab — Canonical Timbre Warping via Generating Functions ( & )
Section titled “Part 2: Sound Lab — Canonical Timbre Warping via Generating Functions (S(q,Q)S(q, Q)S(q,Q) & F2(q,P)F_2(q, P)F2(q,P))”The bottom 48 kHz WebAudio lab lets you apply a nonlinear coordinate transformation to an audio oscillator’s phase space and compare Canonical Generating-Function Warping (, 0.00 cents detuning) against Non-Canonical In-Loop Force Shearing (Cell::step_sheared without table compensation, which detunes up to +555 cents!):
-
Lock the Pitch While Warping the Timbre ( & ):
- Click Start 48 kHz Audio and sweep the Warp / Wavefold Depth slider from
0.00to1.00. - Select any of the three Canonical Generating Functions ():
- Type-2 Sinusoidal Wavefolder: (folds the position waveform into rich odd/even Buchla-style harmonic overtones while scaling so ).
- Type-1 Cross-Coupled S-Fold: twist composition , ( twists the circular orbit into a multi-lobed figure-eight / braid in phase space while preserving enclosed area to machine precision!).
- Type-2 Cubic Pinch (
shape_cubicCotangent Lift): .
- Look at the three synchronized live scopes:
- Phase-Space Loop & Enclosed Action : Watch the cyan curve fold and twist wildly away from the dashed gold circle , while the live numerical line integral Action Ratio stays locked at
1.0000! - Time-Domain Waveform (Left) & (Right): Watch crease into a folded wave while its zero-crossings stay pinned at the exact fundamental period .
- Live FFT Harmonic Spectrum: Watch upper harmonics () bloom by
+35 dBas increases, while the fundamental peak never moves by a tenth of a cent!
- Phase-Space Loop & Enclosed Action : Watch the cyan curve fold and twist wildly away from the dashed gold circle , while the live numerical line integral Action Ratio stays locked at
- Click Start 48 kHz Audio and sweep the Warp / Wavefold Depth slider from
-
Compare Against the Non-Canonical In-Loop Shear (
Cell::step_shearedRed Control):- Switch the mode to
[RED] Uncalibrated In-Loop Force Shear (Cell::step_sheared)and sweep from0to1. - Because modifying the restoring force inside the loop without a canonical coordinate conjugation alters the enclosed action , you will immediately hear the pitch bend sharp by hundreds of cents (up to
+110 centson cubic and+555 centson triangle fold, exactly as documented invoxo/src/suzu.h) and see the enclosed area shrink on the phase-space scope! - Then toggle
suzu::shear_period_ratio17-Point Calibration Table ON (voxo/src/suzu.h) to hear howSuzupre-calibrates to restore tuning when usingstep_sheared.
- Switch the mode to
Problem Set
Section titled “Problem Set”Problem 3.1: Moser’s Homotopy ODE for a Radially Varying 2-Form & Hamilton’s Crystal Drop
Section titled “Problem 3.1: Moser’s Homotopy ODE for a Radially Varying 2-Form & Hamilton’s Crystal Drop”Let be the standard area 2-form on , and consider a radially weighted 2-form:
-
Explicit 1-Form Primitive and Moser Vector Field : Look for a rotationally symmetric 1-form satisfying and regular at the origin ().
- Prove that , or in Cartesian coordinates:
- Show that Moser’s equation (where ) yields a purely radial vector field:
- Integrate explicitly from to (hint: compute ) and show that the time-1 map satisfies the exact finite-area conservation law:
-
Hamilton’s 1832 Crystal Drop (
drop_fs,site/src/content/docs/operators/drop.mdx): Verify that in polar Darboux coordinates , the crystal habit drop map is generated by the Type-2 generating function . Compute the Cartesian Jacobian matrix for , verify that for any smooth habit , and explain why a corner where jumps (such as the cleavage vertices of the calcite rhomb athabit_roundness = 0) creates a discontinuity in along the vertex ray that Kessho renders as a birefringence cleavage line.
Problem 3.2: Generating Functions, Action Invariance & Zero-Detune Wavefolding
Section titled “Problem 3.2: Generating Functions, Action Invariance & Zero-Detune Wavefolding”Let be a canonical harmonic oscillator of action and fundamental frequency .
-
Type-2 Canonical Point-Cotangent Wavefolder: Consider the Type-2 generating function:
- Write out the canonical relations and , and show that the transformation is a global diffeomorphism on whenever .
- Express the pullback Hamiltonian explicitly in terms of :
- Prove directly from (by substituting and around the closed loop ) that the enclosed phase-space area is independent of and , so every periodic orbit of the highly nonlinear Hamiltonian above has exact fundamental frequency !
-
Type-1 Twist Generating Function for the Chirikov Standard Map (
suzu::Rotor): Show that the Type-1 generating function generates the Chirikov standard map , (site/src/content/docs/operators/chirikov.mdx,voxo/src/suzu.h). Under what condition on is the twist condition satisfied?
Problem 3.3: Why Cell::step_sheared Detunes & How Cell::retune Re-Bases Orbits (voxo/src/suzu.h)
Section titled “Problem 3.3: Why Cell::step_sheared Detunes & How Cell::retune Re-Bases Orbits (voxo/src/suzu.h)”-
First-Order Perturbation of Action for
Cell::step_sheared(voxo/src/suzu.h): In the continuous limit ,Cell::step_shearedwithshape_cubic( at unit amplitude) integrates the separable Hamiltonian: Notice that modifies the -potential without rescaling the conjugate -term by as a canonical point transformation would!- Using polar coordinates , show that to first order in near the unit orbit , the enclosed action shrinks by:
- Differentiate to find at unit amplitude (), and verify the comment in
voxo/src/suzu.hthat the cubic shear sharpens the frequency by to first order (and whysuzu.huses the 17-point numericalshear_period_ratiotable to eliminate the remaining 110-cent and 555-cent errors at ).
-
Symplectic Orbit Re-Basing in
Cell::retune(voxo/src/suzu.h): Show that the linear transformation defined by has determinant — it is not a linear symplectomorphism; it is the conjugation that turns the tilted ellipse into a circle, and the problem is to say exactly that — and pulls the magic circle’s shadow invariant back to the canonical circle (with peak -amplitude ). Use this to explain whyCell::retune(e)(s = amp / sqrtf(a2)) keeps the peak amplitude constant across a -semitone MPE glide, whereasCell::retune_plain(e)changes the amplitude by — the old state read under the new — which depends on the phase at the retune and is not a fixed ratio.
midi-sink 2.0.0 · AGPL-3.0 · source
