detools::hasHamiltonian
-- check for Hamiltonian vector field
Introductiondetools::hasHamiltonian(vf,q,p) checks
whether the vector field vf in the variables
q and p is Hamiltonian.
Call(s)detools::hasHamiltonian(vf, p, q)
Parametersvf |
- | the vector field: a list of expressions; its length
must be twice the length of the list q. |
q |
- | the position variables: a list of (indexed) identifiers. |
p |
- | the momentum variables: a list of (indexed)
identifiers; must have the same length as the list q. |
Returnsa list of expressions; each component represents an integrability
condition which must be satisfied for the vector field vf
to be Hamiltonian. If the list is empty, vf is
unconditionally Hamiltonian.
Related
Functions
Detailsdetools::hasHamiltonian computes
necessary and sufficient conditions for the existence of such a
function H; it does not try to determine H.detools::hasHamiltonian assumes that q
and p represent canonical variables; i.e. it tests only
whether vf is Hamiltonian with respect to the standard
symplectic structure of R^(2n) for some integer
n.
Example
1In the following example it is checked whether the
vector field describing the motion of a one-dimensional particle under
the influence of a force F is Hamiltonian.
>> detools::hasHamiltonian([p, -F(q)], [q], [p])
[]
As one can see, in one dimension the motion is
Hamiltonian for any force F. In higher dimensions this is
no longer true, cf. Ex. 2.
Example
2This is basically the same example as Ex. 1 but now in two dimensions.
>> detools::hasHamiltonian([px, py, - F(x, y), - G(x, y)],
[x, y], [px, py])
[diff(G(x, y), x) - diff(F(x, y), y)]
Now we obtain an integrability condition which must be
satisfied by the force components F and
G.