The typical way to arrive at Hamiltonian mechanics is through Lagrangian mechanics, defining canonical momentum and the hamiltonian itself in reference to the Lagrangian and its derivatives, but I'm interested in whether there's any way to formulate it directly from Newtonian mechanics without any Lagrangian.
My thoughts so far are that you could define the Hamiltonian as a function of your coordinates and their canonical momenta that gives Hamilton's equations. The issue here is how do you define canonical momentum?
You could define canonical momentum as the variable $p$ so that $\dot q = \frac{\mathrm dH}{\mathrm dp}$, but then you've got a circular definition since you're referencing the Hamiltonian to define the canonical momentum, which you then use to define the Hamiltonian...