Under gauge transformation : A → → A + ∇ ∇ f , φ φ → → φ φ − − f ˙ ˙ , where f (r, t) is any scalar function of space and time. The aforementioned Lagrangian, the canonical momenta, and the Hamiltonian transform like: L → → L ′ = L + q d f d t , p → → p ′ = p + q ∇ ∇ f , H → → H ′ = H − − q ∂ ∂ f ∂ ∂ t , which still produces the same Hamilton's equation: ∂ ∂ H ′ ∂ ∂ x i | p i ′ = ∂ ∂ ∂ ∂ x i | p i ′ ( x ˙ ˙ i p i ′ − − L ′ ) = − − ∂ ∂ L ′ ∂ ∂ x i | p i ′ = − − ∂ ∂ L ∂ ∂ x i | p i ′ − − q ∂ ∂ ∂ ∂ x i | p i ′ d f d t = − − d d t ( ∂ ∂ L ∂ ∂ x ˙ ˙ i | p i ′ + q ∂ ∂ f ∂ ∂ x i | p i ′ ) = − − p ˙ ˙ i ′