Status: CANONICAL
Module: src/tnfr/physics/variational.py
Tests: tests/physics/test_variational.py (50 passing)
Date: 2026-03
The TNFR nodal equation
admits a consistent variational formulation. It is the Euler-Lagrange equation of a well-defined action functional in the overdamped (dissipation-dominated) limit.
On a graph the TNFR Lagrangian density at node is
where the transport (kinetic) energy and configuration (potential) energy are
In discrete form (time steps of width ):
The Legendre transform gives the TNFR Hamiltonian:
This is exactly where is the energy density from unified.compute_energy_density(), and the total Hamiltonian equals conservation.compute_energy_functional().
The conservation law structure (Noether theorem, conservation.py) reveals two sectors with natural canonical pairs :
| Sector | Coordinate | Momentum | Continuity |
|---|---|---|---|
| Geometric | (curvature) | (phase current) | |
| Potential | (potential) | (ΔNFR flux) |
Using the EPI-ΔNFR pair with effective mass (from classical_mechanics.py):
This has the same mathematical form as Newton's second law on the structural manifold: with force and mass .
The full TNFR dynamics includes structural dissipation (grammar-compliant evolution has ). Adding the dissipation term:
In the overdamped limit ( or ), the inertial term vanishes:
Identifying and :
Key derived result: Within this variational formulation, is the negative functional gradient of the structural potential .
Each grammar rule U1–U6 maps to a condition on the action functional :
| Rule | Variational Condition | Physical Meaning |
|---|---|---|
| U1a | Boundary condition at : $\delta S/\delta\varphi\big | _{t=0}$ requires initial data |
| U1b | Boundary condition at : final state at action extremum | (attractor basin) |
| U2 | Finite action: | must converge |
| U3 | Coupling regularity: interaction bounded | Phase compatibility prevents singular coupling |
| U4 | Morse condition at bifurcation: Hessian sign | Handlers select correct branch near |
| U5 | Hierarchical factorisation: decomposes across scales | Stabilisers at each level prevent concentration |
| U6 | Potential boundedness: $ | \Phi_s |
In the Hamiltonian formulation, each operator acts as a transformation on the phase space .
| Operator | Type | Effect on | Symplectic |
|---|---|---|---|
| AL (Emission) | Generating | Expansive | |
| EN (Reception) | Canonical | Canonical | |
| IL (Coherence) | Dissipative | Dissipative | |
| OZ (Dissonance) | Generating | Expansive | |
| UM (Coupling) | Canonical | Canonical | |
| RA (Resonance) | Canonical | Canonical | |
| SHA (Silence) | Canonical | Canonical | |
| VAL (Expansion) | Generating | Expansive | |
| NUL (Contraction) | Dissipative | Dissipative | |
| THOL (Self-org.) | Canonical | Canonical | |
| ZHIR (Mutation) | Generating | Expansive | |
| NAV (Transition) | Canonical | Canonical | |
| REMESH (Recursivity) | Canonical | Canonical |
Grammar U2 in variational language: For every generating (expansive) operator, the sequence must include a dissipative operator to restore energy balance, ensuring .
Dual-lever complement: The Hamiltonian classification above (Generating / Canonical / Dissipative) maps onto the experimentally observed dual-lever structure: operators act through the capacity lever () or the pressure lever (NFR), and the resulting sign follows from which lever is engaged. The Generating class corresponds predominantly to pressure-lever operators that inject NFR; the Dissipative class corresponds to pressure-lever operators that absorb it. See STRUCTURAL_OPERATORS.md §17.1 and example 39.
The TNFR potential is quadratic in each field. The canonical thresholds mark transition points where the effective potential (including grammar constraints as Lagrange multipliers) changes character:
| Field | Threshold | Source | Interpretation |
|---|---|---|---|
| U6 / π-derived (half phase-wrap) | Confining well boundary | ||
| $ | \nabla\varphi | $ | |
| Geometric confinement | Torsion limit |
At these values, the restoring force reaches the threshold intensity, and beyond them grammatically non-compliant dynamics sets in.
The bilinear cross-sector coupling is:
This equals unified.compute_action_density(). In the complete Lagrangian with interactions:
The free Lagrangian governs the independent sector dynamics, while mediates the coupling between geometric and potential sectors.
At equilibrium (virialisation), the time-averaged kinetic and potential energies satisfy:
The virial ratio is a diagnostic for system state and proximity to bifurcation.
The variational module is fully consistent with the existing TNFR physics stack:
| Relation | Verification |
|---|---|
compute_hamiltonian_density() vs unified.compute_energy_density() | |
Total Hamiltonian vs conservation.compute_energy_functional() | |
| Charge density from conjugate pair coordinates | |
| action density | compute_interaction_density() vs unified.compute_action_density() |
| under grammar | Lyapunov stability from conservation.compute_lyapunov_derivative() |
All relations verified numerically across Watts-Strogatz, Barabási-Albert, and Grid topologies (57 tests, 100% pass rate).
The 6 canonical structural fields admit three physically meaningful decompositions — different projections of the same 6-dimensional field space. The implementation ensures a single computational path with no duplicated formulae:
unified.py (Layer 3 — RAW quadratic forms)
├── compute_energy_density ℰ(i) = Φ_s² + |∇φ|² + K_φ² + J_φ² + J_ΔNFR²
└── compute_action_density 𝒜(i) = bilinear coupling term
│
├──► variational.py H(i) = ½·ℰ(i), T, V, ℒ = T−V
│ (delegates via _raw_energy_density / _action_density)
│
└──► conservation.py E = ½·Σℰ(i), ρ, div(J), Q
(delegates via _raw_energy_density)| Decomposition | Split | Grouping criterion |
|---|---|---|
| Variational (T / V) | , $V = \tfrac{1}{2}[\Phi_s^2 + | \nabla\varphi |
| Conservation ( / J) | , | |
| Unified () |
All three satisfy the consistency identity at every node, verified by translate_sectors() with residual < .
from tnfr.physics.variational import translate_sectors
result = translate_sectors(G)
# result['variational'] -> {'T': {...}, 'V': {...}}
# result['conservation'] -> {'rho': {...}, 'J_phi': {...}, 'J_dnfr': {...}}
# result['unified_psi'] -> {node: K_φ + i·J_φ}
# result['energy_density'] -> raw ℰ from unified.py
# result['consistency_check'] -> max |T+V − ½ℰ| (should be ~0)from tnfr.physics.variational import (
# Core densities
compute_kinetic_density, # T(i) = ½[J_φ² + J_ΔNFR²]
compute_potential_density, # V(i) = ½[Φ_s² + |∇φ|² + K_φ²]
compute_lagrangian_density, # ℒ(i) = T(i) − V(i)
compute_hamiltonian_density, # H(i) = ½·ℰ(i) — delegates to unified.py
compute_interaction_density, # 𝒜(i) — delegates to unified.compute_action_density
# Sector translation
translate_sectors, # All three decompositions + consistency check
# Phase space
identify_conjugate_pairs, # (K_φ,J_φ), (Φ_s,J_ΔNFR)
compute_phase_space_volume, # Liouville volume
compute_poisson_bracket_estimate,
# Snapshot & tracking
capture_lagrangian_snapshot, # Complete instant analysis
compute_euler_lagrange_residual,
compute_action_functional, # S = ∫ℒ dt
VariationalTracker, # Time-series accumulation
# Canonical checks
check_symplectic_preservation,
classify_operator_canonical,
# Grammar stationarity
analyze_grammar_stationarity, # U1-U6 as δS conditions
analyze_potential_critical_points,
# Comprehensive
compute_variational_suite, # Full analysis in one call
)| Example | Concept from this document |
|---|---|
| 27_variational_principle_demo.py | Lagrangian snapshots, conjugate pairs, Euler-Lagrange residual, action functional, symplectic preservation, grammar stationarity, critical points |
src/tnfr/physics/variational.py — Lagrangian, Hamiltonian, Euler-Lagrange, symplectic checkssrc/tnfr/physics/conservation.py — Energy functional (Lyapunov candidate)src/tnfr/physics/classical_mechanics.py — Classical limit correspondenceTNFR.pdf §2.1, AGENTS.md §Foundational Physicssrc/tnfr/physics/classical_mechanics.pysrc/tnfr/physics/unified.pysrc/tnfr/physics/conservation.py| Physical role (conserved charge / flow) |
| Dual structure (geometry-transport) |