Symbolic derivation - SymPy
"SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python."
While there is an abundance of physics engines for simulating multibody dynamics (Mujoco, Drake, Dart, ...) it is still often useful to have analytically derived equations of motion. During your studies you might have come across Lagrangian mechanics, specifically Lagrange's equations of the second kind
which also allows us to simply express
\
/\
/ \
/ \
l \
/ >< m_p
/ //
/ //
\/ //
\ //
\ //
| |------\--//------|
| | \//\ |
g | m_c ( ) theta |
| | |_/ |
V |========|========|
_________OOO___|___OOO_________
|
//|-----s----->|
where