A compound pendulum using Lagrangian logic.
the code with analytic derivatives,
the code with numerical derivatives,
The Original came from here.