Lagrange's equation of motion using Energy method