On this page I'll try to solve the two-dimensional pendulum problem
in various ways, including using rational trigonometry.

I'll start with the simple pendulum, and then maybe the double one and arbitrary long ones.

# The Simple Pendulum

## Lagrangian

The Lagrangian for the simple pendulum is
$$ L = \frac{1}{2}mv^2 - mgh $$

With an appropriate choice of length, mass and time units, this
can be written:
$$ L = \frac{v^2}{2} - h $$

## Using trigonometric functions

With trigonometric functions, the speed \(v\) and elevation \(h\) become respectively \(\dot\theta\) and
\(1 - \cos(\theta)\).

The Lagrangian then becomes:
$$ L = \frac{\dot{\theta}^2}{2} + \cos(\theta) - 1 $$

The Euler-Lagrange equation
then gives:

$$ \ddot{\theta} = -\sin{\theta} $$
which we can turn into a first order derivative by considering
\(\dot{\theta}\) as an additional variable.

## Using only rational numbers

We're going to use the following rational parametrization of the circle:

$$\mathrm{M}(\mu) = (\frac{1-\mu^2}{1+\mu^2}, \frac{2\mu}{1+\mu^2}) $$
The squared speed becomes:
$$ v^2 = \frac{4\dot{\mu}^2}{(1+\mu^2)^2} $$

Thus the Lagragian is now:
$$ L = \frac{2\dot{\mu}^2}{(1+\mu^2)^2} + \frac{1-\mu^2}{1+\mu^2} $$

And the Euler-Lagrange equation:

$$ \frac{d}{dt}(\frac{4\dot{\mu}}{(1+\mu^2)^2}) =
-\frac{8\dot{\mu}^2\mu}{(1+\mu^2)^3}
- \frac{4\mu}{(1+\mu^2)^2}
$$
...turns into:

$$ \frac{4\ddot{\mu}}{(1+\mu^2)^2} - \frac{16\dot{\mu}^2\mu}{(1+\mu^2)^3} =
-\frac{8\dot{\mu}^2\mu}{(1+\mu^2)^3}
- \frac{4\mu}{(1+\mu^2)^2}
$$
$$ \ddot{\mu} = \frac{2\dot{\mu}^2\mu}{1+\mu^2} - \mu $$
### Dealing with the exceptional case

The naive approach described above has a major issue : it can not
deal with full swings. Indeed the point
$$\lim_{\mu\to\infty}\mathrm{M}(\mu) = (-1, 0)$$
can never be reached with that parametrization.

A simple solution is to switch to a different parametrization when it is
expedient.
$$\mathrm{N}(\nu) = (-\frac{1-\nu^2}{1+\nu^2}, -\frac{2\nu}{1+\nu^2}) $$

The dynamics should not be much different. Indeed there is only one sign change:
$$ \ddot{\nu} = \frac{2\dot{\nu}^2\nu}{1+\nu^2} + \nu $$

We then need a relation between \(\mu\) and \(\nu\). That is, we must find the solution
to
$$ \mathrm{M}(\mu) = \mathrm{N}(\nu)$$

It is not too hard to see that
$$ \nu = -\frac{1}{\mu} $$
is a solution, as long as \(\mu\ne 0\).

From this we can derive the relation between the generalized velocities
$$ \dot{\nu} = \frac{\dot\mu}{\mu^2},\qquad \dot{\mu} = \frac{\dot\nu}{\nu^2} $$