A scientific and visual exploration of multi‑pendulum dynamics, inspired by research on chaotic motion of coupled pendulums. This simulator models pendulums with 3 or more masses, solves their motion using rigorous physics, and provides a real‑time visualizer with velocity‑based trails.

pendu.mp4
This project is grounded in scientific research and builds on key references:
-
D. Assêncio, “Double pendulum: Hamiltonian formulation” (Link)
Derivation of double pendulum equations from Hamiltonian/Lagrangian mechanics. -
J. Jiménez‑López & V.J. García‑Garrido, “Chaos and Regularity in the Double Pendulum with Lagrangian Descriptors” (arxiv)
Quantification of chaos using Lagrangian descriptors. -
B. Yesilyurt, “Equations of Motion Formulation of a Pendulum Containing N-point Masses” (arxiv)
General formulation for n‑mass pendulums, providing the framework used for simulations with 3 or more masses.
Key points from these works implemented:
- Equations of motion derived from Lagrangian / Hamiltonian mechanics.
- Double pendulum (n = 2): classical coupled nonlinear ODEs.
- Multi-mass pendulums (n ≥ 3): generalized via mass matrix and coupling terms (see
PendulumSolver.cs). - Runge‑Kutta 4th order (RK4) integration with configurable sub-steps for stability and accuracy.
- Sensitivity to initial conditions and emergence of chaotic dynamics naturally appear in simulations.
-
Double pendulum (n = 2):
-
General n‑mass pendulum (n ≥ 3):
-
Integration: RK4 with
subStepsper frame: -
Chaos and energy: Following Jiménez‑López & García‑Garrido, chaos fraction depends on energy, mass ratios, and length ratios.
- ✅ Supports 3 or more pendulum masses
- ✅ Real-time visualization with velocity-based trail colors
- ✅ Custom shader for smooth, colorful trails
- ✅ Adjustable rod width, mass radius, trail length, and velocity gradient
- ✅ Sensitive dynamics, allowing chaos and regularity studies
- Open the project in Unity.
- Add
PendulumSolverandPendulumFullRendererto an empty GameObject. - Configure mass points (
Mass,AttachedRodLength,InitialAngleDegrees,AngularVelocity). - Adjust
subStepsinPendulumSolverfor numerical stability. - Customize visual parameters in
PendulumFullRenderer(trail length, gradient, rod width, mass radius). - Press Play to simulate and visualize pendulum motion.
- Trails colored by instantaneous angular velocity.
- Rods connecting masses with configurable colors and widths.
- Mass points rendered as spheres, with color indicating speed.
- Z-offsets per mass ensure distinct trails for multiple pendulums.
- Assêncio, D., Double pendulum: Hamiltonian formulation, https://dassencio.org/33
- Jiménez‑López, J. & García‑Garrido, V.J., Chaos and Regularity in the Double Pendulum with Lagrangian Descriptors, arXiv:2403.07000
- Yesilyurt, B., Equations of Motion Formulation of a Pendulum Containing N-point Masses, arXiv:1910.12610