integrate - cchandre/HamLorenz GitHub Wiki

integrate (function)

Purpose

Integrates the system's equations of motion from time 0 to tf using either standard or custom numerical solvers.

Parameters

  • tf: Final time of integration.
  • x: Initial condition vector.
  • t_eval: Optional array of time points to store in the output.
  • events: Optional event functions to monitor during integration.
  • method: Integration method ('RK45', or custom methods defined in METHODS).
  • step: Maximum step size (for fixed-step methods).
  • tol: Absolute and relative tolerance for adaptive solvers.

Method Selection

  • Standard methods (solve_ivp): If method is in ivp.METHODS, use SciPy’s solve_ivp.

  • Custom symplectic methods (solve_ivp_symp, solve_ivp_sympext):

    • If len(x) is divisible by K + 1, use a symplectic solver with internal functions _chi and _chi_star.
    • Otherwise, set up an auxiliary Hamiltonian system and integrate its transformed state, applying inverse transformation to the output.

Methods include:

  • For solve_ivp: 'RK23', 'RK45', 'DOP853', 'Radau', 'BDF', 'LSODA'
  • For solve_ivp_symp and solve_ivp_sympext: 'Verlet', 'FR', 'BM4' (recommended), 'BM6'. See pyhamsys for more details.

Outputs

  • sol: A Bunch object (as returned by solve_ivp), containing t, y, and optionally t_events and y_events.

Notes

  • Computes integration error relative to the initial state.
  • Prints the runtime of the integration process.
  • More information on the custom symplectic integrators is available at pyhamsys

Raises

  • ValueError if an unknown method is specified.