Getting from Forces to Equations of Motion Without Losing Your Mind
I used to solve mechanics problems by drawing free-body diagrams until my wrist cramped. Then I started using energy methods and the whole thing got about ten times cleaner. Here is how it actually works when you are not doing textbook examples with frictionless blocks on inclined planes. Both frameworks are ways of writing the same physics using energy instead of forces. The Lagrangian is defined as L = T - V, kinetic energy minus potential energy. You plug it into the Euler-Lagrange equation d/dt(dL/dq_dot) - dL/dq = 0 and out come your equations of motion. The Hamiltonian is H = sum(p_i*q_dot_i) - L, which for most standard systems just equals the total energy T + V. You then write Hamilton's equations as q_dot = dH/dp and p_dot = -dH/dq. That is the entire machinery. The reason people bother is that coordinates stop mattering. With Newtonian mechanics you need to track constraint forces explicitly. With Lagrange you pick whatever generalized coordinates make sense and the constraints are baked in automatically. Pendulums, double pendulums, particles on rotating rings. Pick theta, pick phi, write T and V in those variables, take derivatives, done. No tension vectors. No normal force decompositions.
The Hamiltonian side matters when you care about phase space structure or when you are moving toward quantum mechanics. It also makes canonical transformations tractable, which is useful if you need to simplify a messy system rather than just solve it straight.
The Practical Workflow
Write down your kinetic and potential energies in terms of generalized coordinates. Make sure every constraint is eliminated before you start differentiating. Compute the Lagrangian. Apply the Euler-Lagrange equation for each coordinate. Convert to momenta p_i = dL/dq_dot_i if you need the Hamiltonian. Legendre transform to get H. Check that your H matches total energy if your constraints are time-independent and your potential is velocity-independent. If it does not match, you probably made a sign error somewhere or your coordinates have explicit time dependence. I spent an afternoon on a problem involving a bead sliding on a rotating parabolic wire where the axis was itself oscillating vertically. The coordinate choice was z, the height along the parabola. The wire equation was r = a*z^2. Computing T required the chain rule across three coupled time-dependent terms. I got an equation of motion that had a term growing like t^3, which is physically wrong for a conservative system. The issue was that I had written the potential energy using only gravitational PE but forgotten that the rotation induced a Coriolis contribution that showed up in the kinetic energy through the cross term 2*omega*z_dot*r. Once I included the full expression for r_dot = 2*a*z*z_dot*theta_dot and kept all the coupling terms, the spurious growth disappeared. That took me about forty minutes to trace. You can save yourself that by writing out every velocity component separately before combining them.
Get the Full Details

Where This Stuff Breaks Down
Nonholonomic constraints are the main problem. If your constraint involves velocities in a way that cannot be integrated into a positional constraint, the standard Lagrangian formulation does not apply directly. You need Lagrange multipliers with the Chetaev rule or you need to step outside this framework entirely. I ran into this with a rolling disk problem where the no-slip condition couples translation and rotation velocity-wise. The multiplier method works but it gets messy fast and the physical interpretation of the multiplier is not always clear. Dissipative systems are another weak point. Friction and drag do not have potential functions in the standard sense. You can add a Rayleigh dissipation function for linear drag, which adds a term dR/dq_dot to the Euler-Lagrange equation. It works for viscous damping. It does not work for Coulomb friction because that is discontinuous at zero velocity. When I modeled a slider-crank with dry friction, the equations flipped sign unpredictably near the stopping point and the numerical solver diverged. The workaround was to switch to a regularized friction model with a small transition band around zero velocity, or just go back to Newtonian force balance for that segment and splice the solutions together. Hamiltonian mechanics assumes you can perform a Legendre transform, which requires the Hessian d^2L/dq_dot_i*dq_dot_j to be invertible. Singular Lagrangians violate this. Constrained systems like electromagnetism with gauge fields or systems with reparametrization invariance fall into this category. You need Dirac's theory of constrained Hamiltonian systems, which adds primary and secondary constraints and modifies the Poisson brackets to Dirac brackets. It is doable but it is a whole separate topic and not something you pick up from a first course.
Common Mistakes I See Regularly
People forget that T and V must be expressed in the same generalized coordinates before you compute derivatives. Mixing Cartesian and angular coordinates in the same expression is a fast path to wrong equations. Another mistake is assuming H is always conserved. It is conserved only if the Lagrangian has no explicit time dependence. If your constraints or coordinate choices introduce time dependence, H changes even in a closed system. I once labeled a time-dependent rotating frame problem as conservative because H came out constant, then realized the constancy was a coincidence of my particular parameter choice, not a general property. A third frequent error is treating the Euler-Lagrange equation as a shortcut that replaces understanding. It does not. You still need to know what your coordinates represent physically, what the boundary conditions are, and whether your solution actually satisfies the original constraints. A correct-looking equation of motion can hide an incorrect coordinate transformation.
When to Use Which Framework
Use Lagrangian mechanics when you have holonomic constraints and you want equations of motion efficiently. It is usually faster than Newtonian vector methods for multi-body systems with constraints. Use Hamiltonian mechanics when you need phase space analysis, canonical perturbation theory, or a path toward quantum mechanics. For simple projectile problems with no constraints, neither framework gives you much over F=ma. The overhead of setting up L or H is not worth it for a single particle in free fall. If you are simulating these systems, Hamiltonian formulations have a practical advantage. Symplectic integrators preserve phase space volume and energy behavior better over long integration times than standard Runge-Kutta methods. For orbital mechanics or molecular dynamics, this matters a lot. A simple Verlet integrator on Hamilton's equations will drift far less than a fourth-order RK on Newtonian form over thousands of orbits.

Resources That Actually Help
Marion and Thornton's Classical Dynamics is the standard text and it covers both frameworks with enough worked examples to be useful. Goldstein is more advanced and better for the Hamiltonian side, especially canonical transformations and perturbation theory. If you want something shorter, Landau and Lifshitz Volume 1 has the essentials in about eighty pages, though it assumes you can fill in gaps on your own. For implementation practice, write a small script that takes a Lagrangian symbolically and outputs the Euler-Lagrange equations. SymPy handles this in a few lines. Then take a double pendulum and verify that your output matches the known equations. From there, move to a constrained system like a spherical pendulum and check that eliminating the constraint via generalized coordinates gives the same result as keeping it with a multiplier. The mismatch between those two approaches on a nonholonomic system is where you learn what the method can and cannot do.