Here is how to find the second order differential equations using sympy for a double pendulum.
python code for the 3d model:
https://trinket.io/glowscript/6aae788c07
Solving the double pendulum by hand
• Equations of motion for a double pendulum
00:00 - Intro
02:35 - Finding Cartesian coordinates
05:40 - Using sympy
21:38 - Numerical Calculations
24:07 - 3d model