Hamiltonian Module

The hamiltonians module provides base classes for Hamiltonian representations in the CR3BP.

This module provides the fundamental classes for representing and manipulating Hamiltonian functions in the circular restricted three-body problem. It includes the base Hamiltonian class and Lie generating function class for canonical transformations.

Base Classes

The base module provides the core Hamiltonian framework.

Hamiltonian()

Abstract container for a specific polynomial Hamiltonian representation.

class hiten.system.hamiltonian.Hamiltonian[source]

Bases: _HitenBase

User-facing container delegating Hamiltonian numerics to adapters.

Parameters:
  • poly_H (list[np.ndarray]) – The polynomial Hamiltonian blocks.

  • degree (int) – The degree of the Hamiltonian.

  • ndof (int, default 3) – The number of degrees of freedom.

  • name (str, default "Hamiltonian") – The name of the Hamiltonian.

__call__(coords)[source]

Evaluate the Hamiltonian at the given coordinates.

Parameters:

coords (ndarray)

Return type:

float

property name: str

Return the name of the Hamiltonian.

property degree: int

Return the degree of the Hamiltonian.

property ndof: int

Return the number of degrees of freedom.

property hamsys

Return the Hamiltonian system.

property jacobian: ndarray

Return the Jacobian of the Hamiltonian.

property poly_H: list[ndarray]

Return the polynomial Hamiltonian blocks.

classmethod from_state(other, **kwargs)[source]

Convert another Hamiltonian to this class using the dynamics service.

Parameters:

other (Hamiltonian)

Return type:

Hamiltonian

to_state(target_form, **kwargs)[source]

Convert this Hamiltonian to another form using the dynamics service.

Parameters:

target_form (type[Hamiltonian] | str)

Return type:

Hamiltonian

__setstate__(state)[source]

Restore the Hamiltonian instance after unpickling.

The heavy, non-serialisable dynamical system is reconstructed lazily using the stored value of poly_H, degree, ndof, and name.

Parameters:

state (dict) – Dictionary containing the serialized state of the Hamiltonian.

classmethod load(filepath, **kwargs)[source]

Load a Hamiltonian from a file (new instance).

Parameters:
  • filepath (str or Path) – The path to the file to load the Hamiltonian from.

  • **kwargs – Additional keyword arguments for the load operation.

Return type:

Hamiltonian

static register_conversion(src, dst, converter, required_context, default_params)[source]

Register a conversion function using the shared conversion service.

Parameters:
Return type:

None

LieGeneratingFunction()

Class for Lie generating functions in canonical transformations.

class hiten.system.hamiltonian.LieGeneratingFunction[source]

Bases: _HitenBase

Class for Lie generating functions in canonical transformations.

Parameters:
  • poly_G (list[np.ndarray]) – The polynomial G blocks.

  • poly_elim (list[np.ndarray]) – The polynomial elimination blocks.

  • degree (int) – The degree of the Lie generating function.

  • ndof (int, default 3) – The number of degrees of freedom.

  • name (str, default "LieGeneratingFunction") – The name of the Lie generating function.

__call__(coords)[source]

Evaluate the Lie generating function at the given coordinates.

Parameters:

coords (ndarray)

Return type:

float

property poly_G: list[ndarray]

Return the packed coefficient blocks [G_0, G_2, …, G_N].

property degree: int

Return the maximum total degree N represented in poly_G.

property ndof: int

Return the number of degrees of freedom.

property poly_elim: list[ndarray]

Return the polynomial elimination blocks.

property name: str

Return the name of the Lie generating function.

__setstate__(state)[source]

Restore the LieGeneratingFunction instance after unpickling.

The heavy, non-serialisable dynamical system is reconstructed lazily using the stored value of poly_G, poly_elim, degree, ndof, and name.

Parameters:

state (dict) – Dictionary containing the serialized state of the LieGeneratingFunction.

classmethod load(filepath, **kwargs)[source]

Load a LieGeneratingFunction from a file (new instance).

Parameters:
  • filepath (str or Path) – The path to the file to load the LieGeneratingFunction from.

  • **kwargs – Additional keyword arguments for the load operation.