The next step in constructing the Hamiltonian formalism is to compute the canonical Hamiltonian. The canonical Hamiltonian \(H_C\)  is defined from the usual prescription by writing \(p_i \dot{q}_i - L(q,\dot{q})\)  in terms of \(p\) 's and \(q\) 's. Although we cannot solve for all of the \(\dot{q}\) 's in terms of \(p\) 's and \(q\) 's,
it can be shown that the combination
\(p_i \dot{q}_i - L(q,\dot{q})\)  depends only on the phase space variables [1]}, [2]}. For our example problem the canonical Hamiltonian is
\(H_C = \frac{1}{2} \Bigl [ p_3^2 + p_4^2 - 2p_3 q_1 - (q_1 + 2q_2)(q_1+ 2q_4) \Bigr ] \ .\) 
