Inertial dissipation: entropy production from positions only

synthetic underdamped linear 2D non-equilibrium thermodynamics

The driven optical trap of the overdamped entropy-production page, but the bead now keeps its inertia — and the camera still records only its positions. How much does it dissipate, and can we tell from positions alone?

As in the overdamped demo, a curl force stirs the trapped bead; with inertia the state is \((\mathbf{x}, \mathbf{v})\), and the bath exerts friction and noise on the velocity,

\[\frac{\mathrm{d}\mathbf{x}}{\mathrm{d}t} = \mathbf{v}, \qquad \frac{\mathrm{d}\mathbf{v}}{\mathrm{d}t} = \underbrace{-k\,\mathbf{x} + \varepsilon\,(\hat z \times \mathbf{x})}_{\text{trap + curl drive}} \;\underbrace{-\;\gamma\,\mathbf{v}}_{\text{friction}} \;+\; \sqrt{2D}\,\boldsymbol{\xi}(t),\]

and — crucially — the velocities are never observed. Underdamped Langevin Inference (ULI) reconstructs them, fits the full acceleration field \(F(\mathbf{x},\mathbf{v})\), and splits it by time-reversal parity into a reversible part \(F^{+}\) (trap and drive) and an irreversible part \(F^{-}\) (friction). The entropy production follows from the fitted model, evaluated on the data.

Inertia is not a detail here. For this linear system the exact rate is

\[\sigma(\gamma) \;=\; \frac{2\,\varepsilon^2\,\gamma}{\gamma^2 k - \varepsilon^2},\]

which grows as friction decreases — diverging at the stability boundary \(\gamma \to \varepsilon/\sqrt{k}\) where the curl overcomes the trap — and only settles onto the overdamped result \(2\varepsilon^2/(\gamma k)\) at strong friction. An overdamped analysis of inertial data misses this amplification.

On this page we fit \(F(\mathbf{x},\mathbf{v})\) from positions and let PASTIS find the trap, curl and friction terms; split the fit by time-reversal parity; measure the entropy production with compute_entropy_production(); sweep the friction to watch inertia amplify dissipation; and coarsen the sampling to see where the measurement stops being reliable.

Tags

synthetic · underdamped · linear · 2D · non-equilibrium · thermodynamics

stamp_output()
[Generated: 2026-10-18 02:36]

An inertial bead in the driven trap

The same trap and rotational drive as the overdamped page (a little stronger here, \(\varepsilon = 0.5\)) — but the bead now carries momentum (think of a levitated microsphere in low-pressure gas rather than a colloid in water). At \(\gamma = \sqrt{k}\) (quality factor near one) the exact rate is already a third above the overdamped formula.

The simulator integrates the phase-space dynamics, but the returned collection contains positions only — exactly what a camera sees. compute_observables=True makes it accumulate the ground-truth entropy along the way, using the true (otherwise discarded) velocities.

import SFI
from SFI.bases import unit_axes, v_components, x_components
from SFI.langevin import UnderdampedProcess

k_true = 1.0       # trap stiffness
eps_true = 0.5     # rotational drive:  F_curl = eps * (z_hat x x)
gamma_true = 1.0   # friction
D_true = 0.5       # velocity-space diffusion
dt = 0.01          # time between recorded frames
Nsteps = 320_000   # frames (3200 velocity relaxation times)

x0c, x1c = x_components(2)
v0c, v1c = v_components(2)
e0, e1 = unit_axes(2)


def make_trap(eps, gamma):
    """Trap + curl drive + friction, as a basis expression F(x, v)."""
    return (
        (-k_true * x0c - eps * x1c - gamma * v0c) * e0
        + (-k_true * x1c + eps * x0c - gamma * v1c) * e1
    )


def simulate_trap(eps, gamma, seed, *, Nsteps=Nsteps):
    proc = UnderdampedProcess(make_trap(eps, gamma), D=D_true)
    proc.initialize(jnp.array([0.5, 0.0], dtype=jnp.float32))
    return proc.simulate(
        dt=dt, Nsteps=Nsteps, key=random.PRNGKey(seed),
        prerun=500, oversampling=8, compute_observables=True,
    )


def sigma_exact(eps, gamma):
    return 2.0 * eps**2 * gamma / (gamma**2 * k_true - eps**2)


coll = simulate_trap(eps_true, gamma_true, seed=3)
sigma = sigma_exact(eps_true, gamma_true)

print(f"{coll.T} frames at dt = {dt} (positions only)")
print(f"exact entropy production rate : {sigma:.4f} kB / time")
print(f"overdamped formula would give : {2 * eps_true**2 / (gamma_true * k_true):.4f} kB / time")
Position vs time: smooth, inertial, The bead's path
320000 frames at dt = 0.01 (positions only)
exact entropy production rate : 0.6667 kB / time
overdamped formula would give : 0.5000 kB / time

Fit the acceleration field from positions

The workflow mirrors the overdamped one; the engine handles the velocity reconstruction. We hand ULI an over-complete polynomial basis in \((\mathbf{x}, \mathbf{v})\) — 30 candidate terms — and let PASTIS decide. The data are clean and finely sampled, hence the "clean" preset and the WeakNoise diffusion estimator.

from SFI.bases import monomials_up_to

inf = SFI.UnderdampedLangevinInference(coll)
inf.compute_diffusion_constant(method="WeakNoise")

B = monomials_up_to(2, dim=2, include_constant=True, include_v=True, rank="vector")
inf.infer_force_linear(B, preset="clean")
inf.compute_force_error()

coeffs_full = np.asarray(inf.force_coefficients_full)
stderr_full = np.asarray(inf.force_coefficients_stderr)

inf.sparsify_force(criterion="PASTIS")
inf.compute_force_error()
inf.print_report()
  --- StochasticForceInference Report ---
Average diffusion tensor:
 [[ 5.0879449e-01 -4.0210460e-04]
 [-4.0210460e-04  5.0745887e-01]]
Measurement noise tensor:
 [[ 5.1027321e-10 -6.0447689e-12]
 [-6.0447689e-12  3.9476983e-10]]
Force estimated information: 3707.63720703125
Force: estimated normalized mean squared error (sampling only): 0.0008091409127044697
Force Gram condition number: 37.2

  Force Coefficient Table
  ───────────────────────────────────────────────────────────────────
  #    Label        Coefficient       Std.Err     SNR  Sig
  ───────────────────────────────────────────────────────────────────
  2    x0·e0       -1.00025e+00   2.17594e-02    46.0  **
  3    x0·e1        5.22413e-01   2.50157e-02    20.9  **
  4    x1·e0       -4.89316e-01   2.52373e-02    19.4  **
  5    x1·e1       -9.95843e-01   2.19053e-02    45.5  **
  6    v0·e0       -1.00567e+00   2.51525e-02    40.0  **
  9    v1·e1       -1.03904e+00   2.53604e-02    41.0  **
  ───────────────────────────────────────────────────────────────────
  6/30 basis functions in support, sig: 6* / 6** / 0*** (|SNR| ≥ 2 / 10 / 100)
  (Std.err. reflects sampling error only; discretization bias is not included.)
  Zeroed (24): 1·e0, 1·e1, v0·e1, v1·e0, x0^2·e0, x0^2·e1, (x0·x1)·e0, (x0·x1)·e1, (x0·v0)·e0, (x0·v0)·e1, (x0·v1)·e0, (x0·v1)·e1, x1^2·e0, x1^2·e1, (x1·v0)·e0, (x1·v0)·e1, (x1·v1)·e0, (x1·v1)·e1, v0^2·e0, v0^2·e1, (v0·v1)·e0, (v0·v1)·e1, v1^2·e0, v1^2·e1

PASTIS keeps exactly six terms: the isotropic trap, the two curl couplings and the two friction terms. From here on we fit these six terms directly.


Sparse model selection, 30 candidate terms (full fit, ±1σ): trap, curl and friction stand out

Split the dynamics by the arrow of time

Under time reversal positions are even and velocities odd, so the fitted field splits into \(\hat F^{\pm}(\mathbf{x},\mathbf{v}) = \tfrac12[\hat F(\mathbf{x},\mathbf{v}) \pm \hat F(\mathbf{x},-\mathbf{v})]\). Here \(\hat F^{+}\) is the trap plus the curl drive (all positional) and \(\hat F^{-}\) is the friction — the part that knows which way time flows.

F_even, F_odd = inf.time_reversal_split()

x_probe = jnp.array([[1.0, 0.0]])
v_probe = jnp.array([[0.0, 1.0]])
print("at x = (1, 0), v = (0, 1):")
print("  F       =", np.round(np.asarray(inf.force_inferred(x_probe, v=v_probe))[0], 3))
print("  F_even  =", np.round(np.asarray(F_even(x_probe, v_probe))[0], 3), "  (reversible)")
print("  F_odd   =", np.round(np.asarray(F_odd(x_probe, v_probe))[0], 3), "  (irreversible)")
$\hat F^{+}(\mathbf{x}, 0)$: trap + drive (even), $\hat F^{-}$: friction (odd)
at x = (1, 0), v = (0, 1):
  F       = [-1.    -0.517]
  F_even  = [-1.     0.522]   (reversible)
  F_odd   = [ 0.    -1.039]   (irreversible)

Measure the dissipation — from positions only

compute_entropy_production() evaluates

\[\Delta\hat S = \sum_t \bigl(\mathrm{d}\hat v_t - \hat F^{+}\,\mathrm{d}t\bigr)^{\!\top} \circ\, \bar D^{-1} \hat F^{-}\]

on the reconstructed kinematics, with a counterterm for their finite-\(\Delta t\) biases; \(\circ\) denotes the Stratonovich (midpoint) product. Its error bar is set by the fluctuations of the odd (friction) sector, which are large even though its mean irreversibility is small.

One more subtlety: evaluating the functional with coefficients fitted on the same trajectory adds a small positive \(O(1/\tau_N)\) plug-in bias. Cross-fitting — fit one half, evaluate on the other, via the coefficients argument — removes it.

B_sel = B[[int(i) for i in inf.force_support]]    # the six PASTIS-selected terms


def entropy_of(coll_run):
    """Fit the selected terms on a recording and measure its dissipation."""
    inf_run = SFI.UnderdampedLangevinInference(coll_run)
    inf_run.compute_diffusion_constant(method="WeakNoise")
    inf_run.infer_force_linear(B_sel, preset="clean")
    return inf_run.compute_entropy_production()


out = entropy_of(coll)

# Cross-fitting: fit each half, evaluate on the other one.
from SFI import TrajectoryCollection

X_ud = coll.to_array()                            # positions, (T, 1, 2)
T_half = coll.T // 2
halves = [TrajectoryCollection.from_arrays(X=X_ud[:T_half], dt=dt),
          TrajectoryCollection.from_arrays(X=X_ud[T_half:], dt=dt)]
fits = []
for coll_h in halves:
    inf_h = SFI.UnderdampedLangevinInference(coll_h)
    inf_h.compute_diffusion_constant(method="WeakNoise")
    inf_h.infer_force_linear(B_sel, preset="clean")
    fits.append(inf_h)
out_xf = [fits[1].compute_entropy_production(coefficients=fits[0].force_coefficients_full),
          fits[0].compute_entropy_production(coefficients=fits[1].force_coefficients_full)]
Sdot_xf = 0.5 * (out_xf[0]["Sdot"] + out_xf[1]["Sdot"])
err_xf = 0.5 * (out_xf[0]["Sdot_error"] ** 2 + out_xf[1]["Sdot_error"] ** 2) ** 0.5

S_sim = coll.datasets[0].meta["observables"]["entropy"]   # simulator ground truth
print(f"exact rate                    : {sigma:.4f} kB / time")
print(f"inferred (same-sample)        : {out['Sdot']:.4f} ± {out['Sdot_error']:.4f}")
print(f"inferred (cross-fitted)       : {Sdot_xf:.4f} ± {err_xf:.4f}")
print(f"true model on this trajectory : {S_sim / out['tauN']:.4f}")
exact rate                    : 0.6667 kB / time
inferred (same-sample)        : 0.6683 ± 0.0428
inferred (cross-fitted)       : 0.6706 ± 0.0499
true model on this trajectory : 0.6562

Both estimates agree with the exact rate within their error bars, and with the entropy the true model produced along this very trajectory. At this recording length (thousands of relaxation times) the plug-in bias is far below the error bar; cross-fitting is the safeguard for short recordings.


Dissipation from positions only

Inertia amplifies dissipation

Now sweep the friction at fixed drive, on shorter runs (800 time units each). The overdamped formula \(2\varepsilon^2/(\gamma k)\) (dashed) already grows as \(\gamma\) decreases; inertia adds to it: the exact rate pulls away and diverges at the stability boundary \(\gamma = \varepsilon/\sqrt{k}\), where the curl overcomes the trap. The estimator, still fed positions only, tracks the exact curve.

gamma_sweep = [0.75, 1.0, 1.5, 2.0, 3.0, 5.0]
sweep = {gam: entropy_of(simulate_trap(eps_true, gam, seed=20 + i, Nsteps=80_000))
         for i, gam in enumerate(gamma_sweep)}
Inertia amplifies dissipation

When sampling is too coarse

Everything above resolved the velocity correlation time \(\tau_v = 1/\gamma\). Subsampling the recording stretches the effective \(\Delta t\). The entropy functional itself carries a finite-\(\Delta t\) counterterm, but the fitted coefficients keep an \(O(\gamma\Delta t)\) error — the curl comes out too strong — which the dissipation amplifies, well outside the error bars (these describe sampling noise only). The method reports a first-order estimate of this coefficient bias as Sdot_dt_bias.

resolution = [(gamma_true * dt, out)]               # stride 1: the measurement above
for s in [10, 20, 40]:
    coll_s = TrajectoryCollection.from_arrays(X=X_ud[::s], dt=dt * s)
    resolution.append((gamma_true * dt * s, entropy_of(coll_s)))

for gdt, o in resolution:
    print(f"gamma*dt = {gdt:4.2f}:  Sdot = {o['Sdot']:.3f} ± {o['Sdot_error']:.3f}"
          f"  = {o['Sdot'] / sigma:.2f} x exact;   reported dt bias {o['Sdot_dt_bias']:+.3f}")
gamma*dt = 0.01:  Sdot = 0.668 ± 0.043  = 1.00 x exact;   reported dt bias +0.014
gamma*dt = 0.10:  Sdot = 0.795 ± 0.051  = 1.19 x exact;   reported dt bias +0.158
gamma*dt = 0.20:  Sdot = 0.969 ± 0.062  = 1.45 x exact;   reported dt bias +0.363
gamma*dt = 0.40:  Sdot = 1.417 ± 0.090  = 2.12 x exact;   reported dt bias +0.969

The estimate climbs by about 20% at \(\gamma\Delta t = 0.1\) and more than doubles by \(0.4\). Subtracting the reported bias (open circles) brings it back to the exact rate up to \(\gamma\Delta t \approx 0.1\); beyond, the first-order estimate over-corrects. Read it as a flag, not a correction: a reported bias comparable to the rate itself means the sampling is too coarse. Inertial dissipation needs inertia resolved, \(\gamma\Delta t \ll 1\).


Velocities must be resolved: $\gamma\Delta t \ll 1$

Next steps

Thumbnail

Total running time of the script: (3 minutes 42.601 seconds)

🏷 Tags: synthetic, underdamped, linear, 2D, non-equilibrium, thermodynamics

Gallery generated by Sphinx-Gallery