---
id: wiki-2026-0508-principle-of-least-action
title: Principle of Least Action
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Stationary Action, Hamilton's Principle, Maupertuis Principle]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [physics, variational-calculus, lagrangian, optimization]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
  language: python
  framework: jax/sympy
---

# Principle of Least Action

## 매 한 줄
> **"매 Nature 의 action S 의 stationary 의 path 의 select"**. Maupertuis(1744) → Lagrange → Hamilton 의 발전 의 매 classical/quantum/field theory 의 unified backbone — 매 modern ML 의 neural ODEs / Hamiltonian networks 의 기반.

## 매 핵심

### 매 정의
- **Action**: S[q] = ∫ L(q, q̇, t) dt, 매 L = T − V (Lagrangian).
- **Stationary**: δS = 0 (not 항상 minimum — 매 stationary point).
- **Euler-Lagrange**: d/dt (∂L/∂q̇) − ∂L/∂q = 0.
- **Hamiltonian**: H(q,p) = p·q̇ − L; 매 q̇ = ∂H/∂p, ṗ = −∂H/∂q.

### 매 형식
- **Lagrangian (q, q̇)**: 매 generalized coords 의 자연.
- **Hamiltonian (q, p)**: 매 phase-space 의 symplectic structure.
- **Path Integral (Feynman)**: 매 amplitude = ∫ Dq exp(iS/ℏ) — 매 quantum extension.

### 매 응용
1. 매 classical mechanics 의 EoM 의 derive.
2. Optical path (Fermat) — light follows least-time.
3. Geodesics in GR (least proper-time worldline).
4. Symplectic ODE integrators (leapfrog).
5. Hamiltonian Neural Networks, Lagrangian NN.

## 💻 패턴

### SymPy — symbolic Euler-Lagrange (pendulum)
```python
import sympy as sp
t, m, g, l = sp.symbols("t m g l", positive=True)
q = sp.Function("q")(t)
T = sp.Rational(1,2) * m * (l*sp.diff(q, t))**2
V = -m*g*l*sp.cos(q)
L = T - V
EL = sp.diff(sp.diff(L, sp.diff(q,t)), t) - sp.diff(L, q)
print(sp.simplify(EL))   # m*l^2*q'' + m*g*l*sin(q) = 0
```

### Symplectic leapfrog integrator (preserves H)
```python
import numpy as np
def leapfrog(q, p, dHdq, dHdp, dt, n):
    for _ in range(n):
        p = p - 0.5 * dt * dHdq(q)
        q = q + dt * dHdp(p)
        p = p - 0.5 * dt * dHdq(q)
    return q, p
```

### JAX — automatic Lagrangian → EL residual
```python
import jax, jax.numpy as jnp
def lagrangian(q, qdot):
    return 0.5*jnp.sum(qdot**2) - potential(q)

def el_residual(q, qdot, qddot):
    dL_dq    = jax.grad(lagrangian, 0)(q, qdot)
    dL_dqdot = jax.grad(lagrangian, 1)(q, qdot)
    # d/dt(∂L/∂q̇) along trajectory:
    H = jax.hessian(lagrangian, argnums=(1,1))(q, qdot)
    d_dt = H @ qddot   # simplified for autonomous L
    return d_dt - dL_dq
```

### Lagrangian Neural Network (Cranmer 2020)
```python
# Parameterize L_θ(q,q̇) by an MLP; learn dynamics by enforcing EL eq.
class LNN(nn.Module):
    def __call__(self, q, qdot):
        return self.mlp(jnp.concatenate([q, qdot]))

def predicted_qddot(params, q, qdot):
    L = lambda q,qd: lnn.apply(params, q, qd)
    H_qd_qd = jax.hessian(L, 1)(q, qdot)
    grad_q  = jax.grad(L, 0)(q, qdot)
    return jnp.linalg.solve(H_qd_qd, grad_q)
```

### Hamiltonian Neural Network
```python
# Greydanus 2019: parameterize H_θ(q,p); use symplectic gradients.
def hnn_dynamics(params, q, p):
    H = lambda q,p: hnn.apply(params, q, p)
    return jax.grad(H, 1)(q,p), -jax.grad(H, 0)(q,p)
```

### Geodesic integration (general metric)
```python
# Christoffel symbols Γ from g; geodesic eq: q̈^μ + Γ^μ_αβ q̇^α q̇^β = 0
```

## 매 결정 기준
| 상황 | Approach |
|---|---|
| 매 holonomic constraints | Lagrangian (gen coords) |
| 매 phase-space analysis / chaos | Hamiltonian |
| 매 long-horizon energy preservation | Symplectic integrator (leapfrog, Verlet) |
| 매 learn dynamics from data | LNN / HNN / Neural ODE |
| 매 quantum / sum-over-paths | Path integral |
| 매 optics / wave fronts | Fermat / eikonal form |

**기본값**: 매 Lagrangian + EL → leapfrog symplectic integration.

## 🔗 Graph
- 부모: [[Optimal-Control-Theory]]
- Adjacent: [[Optimization]]

## 🤖 LLM 활용
**언제**: 매 conservative system 의 dynamics learn / simulate — 매 long-horizon stability 의 priority. 매 physics-informed ML.
**언제 X**: 매 strongly dissipative / non-conservative — 매 Hamiltonian assumption 의 violate. 매 stochastic — 매 Langevin / SDE.

## ❌ 안티패턴
- **"Least" action 으로 misinterpret**: 매 stationary, 매 not 항상 min — 매 saddle 도 valid.
- **Non-symplectic integrator + long horizon**: 매 energy drift.
- **Constraints 의 ad-hoc 처리**: 매 generalized coords 또는 Lagrange multipliers 의 use.
- **Time-dependent L 의 Hamiltonian 으로 conserve assume**: 매 ∂L/∂t ≠ 0 → H 의 not conserved.

## 🧪 검증 / 중복
- Verified (Goldstein *Classical Mechanics* 3e; Arnold *Mathematical Methods of CM*; Feynman Vol II).
- 신뢰도 A.

## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Lagrangian/Hamiltonian/symplectic + LNN/HNN modern ML link |
