As i know there are several diffrent way to derive the canonical equations.
Some of them starts from a physical principle like Hamilton's principle or the Lagrange equations.
But it can be derived also by simply make a Legendre transormation on the Lagrange function and then make...