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
Hotter white dwarfs

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

Galactic chemical evolution
Coating an ellipsoid
Universal two-body problem

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

Fitting to conic sections
Unusual linear algebra
Derivatives on uneven grids

Supernova light curves
Exact Riemann solutions
1D PPM hydrodynamics
Verification problems
Plane - cube Intersection

Phyllotaxis
The pendulum
Circular and elliptical 3 body

MESA
MESA-Web
FLASH

Zingale's software
Brown's dStar
GR1D code
Herwig's NuGRID
Meyer's NetNuc
Presentations
Illustrations
Videos

AAS Journals
2019 JINA R-process Workshop
2019 MESA Marketplace
2019 MESA Summer School
Teaching materials
Education and Public Outreach

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.25in {\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$, applying properties of the Jabobi elliptic functions, and simplifying: $$\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}$$ This code implements this complete analytical solution to the classic nonlinear pendulum. The solution valid for any initial conditions and holds if the pendulum swings over or not. This code generated these plots:

 Phase diagram of the pendulum.

 Family of $\theta$ (red hue) and $\dot{\theta}$ (blue hue) 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.