Cococubed.com The pendulum

Home

Astronomy research
Software instruments
Stellar equation of states
EOS with ionization
EOS for supernovae
Chemical potentials
Stellar atmospheres

Voigt Function
Jeans escape
Polytropic stars
Cold white dwarfs
Adiabatic white dwarfs

Cold neutron stars
Stellar opacities
Neutrino energy loss rates
Ephemeris routines
Fermi-Dirac functions

Polyhedra volume
Plane - cube intersection
Coating an ellipsoid

Nuclear reaction networks
Nuclear statistical equilibrium
Laminar deflagrations
CJ detonations
ZND detonations

Fitting to conic sections
Unusual linear algebra
Derivatives on uneven grids
Pentadiagonal solver
Quadratics, Cubics, Quartics

Supernova light curves
Exact Riemann solutions
1D PPM hydrodynamics
Hydrodynamic test cases
Galactic chemical evolution

Universal two-body problem
Circular and elliptical 3 body
The pendulum
Phyllotaxis

MESA
MESA-Web
FLASH

Zingale's software
Brown's dStar
GR1D code
Iliadis' STARLIB database
Herwig's NuGRID
Meyer's NetNuc
Presentations
Illustrations
cococubed YouTube
Bicycle adventures
Public Outreach
Education materials
2023 ASU Solar Systems Astronomy
2023 ASU Energy in Everyday Life

AAS Journals
AAS YouTube
2023 MESA VI
2023 MESA Marketplace
2023 MESA Classroom
2022 Earendel, A Highly Magnified Star
2022 White Dwarfs & 12C(α,γ)16O
2022 Black Hole Mass Spectrum
2022 MESA in Don't Look Up
2021 Bill Paxton, Tinsley Prize

Contact: F.X.Timmes
my one page vitae,
full vitae,
research statement, and
teaching statement.

Referring to the diagram in the upper left, the pendulum obeys the conservation of angular momentum $$\ddot{\theta} + g/l \ \sin(\theta) = 0 \hskip 0.5in \theta(t_0) = \theta_0 \hskip 0.5in \dot{\theta}(t_0) = \dot{\theta}_0 \ . \label{eq1} \tag{1}$$ The analytical solution when the pendulum has enough energy to swing over is $$\begin{split} A & = {\rm sgn}(\dot{\theta}) k \omega [t - t_0] + F(\sin^{-1}(k_0),\kappa) \\ \theta & = 2 \sin^{-1}({\rm sn}(A,\kappa)) \cdot {\rm sgn}({\rm cn}(A,\kappa)) \\ \dot{\theta} & = {\rm sgn}(\dot{\theta}) \ \sqrt{E_0} \ {\rm dn}(A,\kappa) \end{split} \label{eq2} \tag{2}$$ where $$\begin{split} {\rm sgn}(\zeta) & = 1 \ {\rm for} \ \zeta \ge 0 \ ; -1 \ {\rm for} \ \zeta \lt 0 \hskip 0.55in {\rm ! \ signum \ function } \\ \omega & = \sqrt{g / l} \hskip 2.3in {\rm ! \ angular \ frequency} \\ k_0 & = \sin(\theta_0 / 2) \hskip 1.95in {\rm ! \ sine \ half \ angle} \\ E_p & = 4 \omega^2 \hskip 2.45in {\rm ! \ maximum \ potential \ energy} \\ E_0 & = \dot{\theta}_0^2 + E_p \sin^2(\theta_0) \hskip 1.35in {\rm ! \ total \ energy } \\ k & = \sqrt{E_0 / E_p} \ge 1\\ \kappa & = 1/k \end{split} \label{eq3} \tag{3}$$ $g$ is the gravitational acceleration, $F(\phi,m)$ is the Legendre form of the first incomplete elliptic integral, and ${\rm sn}(u,m)$, ${\rm cn}(u,m)$, and ${\rm dn}(u,m)$ are the Jacobi elliptic functions.

The solution when the pendulum does not have enough energy to swing over (now $k \le 1$ and $\kappa \gt 1$) is found by swapping $k$ and $\kappa$ in the above expressions, and applying properties of the Jabobi elliptic functions: $$\begin{split} A & = {\rm sgn}(\dot{\theta}) \omega [t - t_0] + F(\sin^{-1}(\kappa k_0),k) \\ \theta & = 2 \sin^{-1}(k \ {\rm sn}(A,\kappa)) \\ \dot{\theta} & = {\rm sgn}(\dot{\theta}) \ \sqrt{E_0} \ {\rm cn}(A,\kappa) \end{split} \label{eq4} \tag{4}$$ The tool pendulum.tbz implements this complete analytical solution to the classic nonlinear pendulum. The solution is valid for any initial conditions and holds if the pendulum swings over or not.

 Phase diagram of the pendulum.

 Family of $\theta$ (red hues) and $\dot{\theta}$ (blue hues) solutions for $E_0 \lt E_p$ (pendulum does not swing over).

Please cite the relevant references if you publish a piece of work that use these codes, pieces of these codes, or modified versions of them. Offer co-authorship as appropriate.