-
Notifications
You must be signed in to change notification settings - Fork 0
integrate
Cristel Chandre edited this page Jun 26, 2025
·
7 revisions
Integrates the equations of motion of the Hamiltonian Lorenz system, from time 0 to tf using either standard or custom numerical solvers.
-
tf: final time of integration. -
x: initial condition vector. Seegenerate_initial_conditionsfor a function to generate initial conditions compatible with the energy and Casimir invariants constraints. -
t_eval: (optional) array of time points to store in the output. Default is None (i.e., use points selected by the solver). -
events: (optional) event functions to monitor during integration. Default is None. -
method: (optional) integration method ('RK45', or custom methods defined inMETHODS). Default is 'BM4'. -
step: (optional) maximum step size (for fixed-step methods). Default is 1e-2. -
tol: (optional) absolute and relative tolerance for adaptive solvers. Default is 1e-8. -
omega: (optional) coupling parameter in the extended phase space (see pyHamSys). Default is 10.
-
Standard methods (
solve_ivp): Ifmethodis inivp.METHODS, use SciPy’ssolve_ivp. -
Custom symplectic methods (
solve_ivp_symp,solve_ivp_sympext):- If
len(x)is divisible byK + 1, use a symplectic solver with internal functions_chiand_chi_star. - Otherwise, set up an extended Hamiltonian system and integrate its transformed state, applying inverse transformation to the output.
- If
Methods include:
- For
solve_ivp: 'RK23', 'RK45', 'DOP853', 'Radau', 'BDF', 'LSODA' - For
solve_ivp_sympandsolve_ivp_sympext: 'Verlet', 'FR', 'BM4' (recommended), 'BM6'. See pyHamSys for more details.
-
sol: A bunch object (as returned bysolve_ivp), containingt,y, and optionallyt_eventsandy_events.
- 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
-
ValueErrorif an unknown method is specified.
HamLorenz is developed under BSD 2-Clause License, Copyright(c) 2025 cristel.chandre@cnrs.fr