Lagrangian Mechanics Calculator
Euler-Lagrange & Hamiltonian · RK45 integration · phase portraits & D3 animation
Syntax help
Powers: x^2, dtheta^2 Trig: sin(theta) Multiply: m*g*l
Parameters: m=1, g=9.8, l=1 IC: theta(0)=0.3, dtheta(0)=0
Notation guide
EOM: d/dt(∂L/∂q̇) − ∂L/∂q = 0
Enter T and V, then click Compute
Derive Euler-Lagrange equations, Hamiltonian, conservation laws, and numerical solutions.
Compute a system to see plots.
Compute a system to see the animation.
Hamiltonian Mechanics
Compute a system to see the Hamiltonian formulation.
What is Lagrangian Mechanics?
Lagrangian mechanics is a reformulation of classical mechanics introduced by Joseph-Louis Lagrange in 1788. Instead of forces and accelerations (Newton), it uses energy as the fundamental quantity. The Lagrangian L = T − V (kinetic minus potential energy) encodes all the dynamics of a system.
By applying the principle of least action (Hamilton's principle), we derive the Euler-Lagrange equations — the equations of motion — which are equivalent to Newton's second law but far more powerful for constrained systems, curved geometries, and systems with many degrees of freedom.
Key Concepts
Euler-Lagrange Equation
d/dt(∂L/∂q̇) − ∂L/∂q = 0. This second-order ODE gives the equation of motion for each generalized coordinate q.
Noether's Theorem
Every continuous symmetry of the action yields a conservation law. Time invariance → energy conservation, spatial invariance → momentum conservation.
Hamiltonian Mechanics
H = Σpiq̇i − L. Hamilton's equations q̇ = ∂H/∂p and ṗ = −∂H/∂q give first-order equations in phase space.
Generalized Coordinates
Any independent variables that fully describe a system's configuration. Constraints are built into the coordinates, eliminating constraint forces entirely.
Applications
Celestial Mechanics
Kepler orbits, three-body problem, and orbital mechanics are naturally expressed in Lagrangian form with polar coordinates.
Robotics
Multi-link robot arms are modeled with joint angles as generalized coordinates. Lagrangian methods handle complex constraints elegantly.
Quantum Mechanics
The Lagrangian formulation underlies Feynman's path integral approach and the Standard Model of particle physics.
Coupled Oscillations
Normal modes of vibration in molecules, crystals, and mechanical systems are found systematically using the Lagrangian approach.