Consider the following lagrangian for a system, with $\theta$ and $r$ being the system coordinates:
$L = 2m\dot{r}^2+\frac{1}{2}mr^2\dot\theta^2-gmr(3-\cos\theta)$
Which gives us the following differential system:
$ 4m\ddot r-mr\dot \theta^2+gm(3-\cos\theta) = 0 $
$ 2mr\dot \theta \dot r+mr^2\ddot \theta+gmr\sin\theta = 0$
And take the following function:
$ H = r^2 \dot \theta \left (\dot r \cos \frac{\theta}{2} - \frac{r\dot \theta}{2} \sin \frac{\theta}{2} \cos^2 \frac{\theta}{2} \right) $
Now proof, with Maple (or any CAS like SymPy, etc), that
$ \frac{dH}{dt} = 0 $ (that quantity is related to Noether's Theorem)
What I did was to define $L(r, \theta)$, $H(r, \theta)$, and using eval with the expression above and the differential system equations, but it returns the same expression:
How can I evaluate that expression using the differential system obtained from the lagrangian?