Jump to content

SymPy

From The Invariance Itself

SymPy: Symbolic Mechanics, Euler-Lagrange Equations and Units in Python

Added to the survey on 2026-10-06 by the Research Toolkit's research pass. The scores below are that pass's assessment from the evidence cited under References, on the survey's four axes and scale; they are not the original survey's (2026-09-26), and no rule of the Principia Machina reads them. See the additions on the front page.

Overview & Architectural Fit

SymPy is a computer algebra library written in pure Python. Its mechanics module, sympy.physics.mechanics, derives equations of motion by Lagrange's and Kane's methods; sympy.calculus.euler derives Euler-Lagrange equations for functions of several variables; sympy.physics.units carries units through expressions and converts between systems. It is the free reference for the derive by machine step: write the Lagrangian once, have the equations derived, and compare them line by line with a hand derivation.

Mathematical Evaluation for TPM

  • Lagrangian / Action (8/10): LagrangesMethod takes a Lagrangian, generalized coordinates, holonomic and nonholonomic constraints and non-conservative forces, and returns the system in mass-matrix and forcing form, M(q,t)q¨=f(q,q˙,t), from ddt∂L∂q˙i−∂L∂qi=Qi. No packaged Noether-current routine exists.
  • Field / PDE (5/10): Field Lagrangian densities can be varied symbolically, but SymPy has no production numerical solver for partial differential equations.
  • Relativity (4/10): Generic tensor and differential-geometry modules exist; they are much weaker than xAct or SageManifolds for curvature work (not re-tested in this pass).
  • Quantum / Data (3.5/10): Operator algebra exists in sympy.physics.quantum (not re-checked); nothing learns from data.

Integration Pipeline

  1. Write the Lagrangian in SymPy's symbols, with each coordinate a function of time.
  2. Derive with LagrangesMethod or euler_equations.
  3. Check the result's dimensions with physics.units and its limits by substitution.
  4. Build conserved quantities by hand from pi=∂L/∂q˙i and check that their time derivatives vanish on the equations of motion.
  5. Export the equations as code for SciPy or Dedalus to solve.

Status, Licence and Limits

  • Status: Active. Latest stable release 1.14.0, 27 April 2025; the development documentation shows 1.15.0.dev, with no 1.15 release found.
  • Licence: New BSD.
  • Home: https://www.sympy.org
  • Limits: Expression swell and simplification cost grow quickly for coupled fields. The mechanics module targets multibody systems of ordinary differential equations, not covariant field theory. Noether currents, boundary terms and gauge redundancy are all manual.

On the Principia Machina

A tool runs only where the sponsor installed and bound it, and what it returns is untrusted input, vetted before use; its numbers are never values of the site's calculator, TPC. An equation it derives is transcribed into the kernel's form grammar before anything checks it, and lands as a RESULT of regime L with EQUATION and ROLE. See Agent/Tools and the operator's guide.

References