heyoka.hamiltonian#
- heyoka.hamiltonian(H: expression, qs: list[expression], ps: list[expression]) list[tuple[expression, expression]]#
- Formulate Hamilton’s equations for a Hamiltonian. - Added in version 4.0.0. - Note - A tutorial illustrating the use of this function is available. - This function will formulate the differential equations for the Hamiltonian H. The lists of generalised coordinates and momenta are given in qs and ps respectively. - An error will be raised if one or more input arguments are malformed. Specifically: - qs and ps must be non-empty and have the same length, 
- all expressions in qs and ps must be variables, 
- qs and ps must not contain duplicates, and a variable appearing in one list cannot appear in the other, 
- H must depend only on the variables listed in qs and ps. 
 - Parameters:
- H – the Hamiltonian. 
- qs – the generalised coordinates. 
- ps – the generalised momenta. 
 
- Returns:
- Hamilton’s equations for the Hamiltonian H. 
- Raises:
- ValueError – if one or more input arguments are malformed, as explained above. 
 
