aquakin.solve_with_events#

aquakin.solve_with_events(rhs, y0, args, *, t0, t1, t_eval, events, rtol, atol, max_steps=100000, dtmax=None, adjoint=None, order=5, factormax=None, solver=None, root_rtol=1e-06, root_atol=1e-09, max_segments=10000)[source]#

Integrate rhs from t0 to t1 with located events + state resets.

The solve is split into segments at the event times; between segments the fired events’ apply resets produce the new state. With only time events the segment boundaries are static and every sub-solve is differentiable, so jax.grad flows through the whole call. With any state event the driver runs eagerly (the firing times are discovered at runtime) and is forward-simulation only.

Parameters:
  • rhs (callable) – rhs(t, y, args) -> dy/dt.

  • y0 (jnp.ndarray) – Initial state, shape (n_state,).

  • args – Parameter argument threaded to rhs, the event cond_fn / apply.

  • t0 (float) – Integration interval.

  • t1 (float) – Integration interval.

  • t_eval (jnp.ndarray, optional) – Output times (must be sorted, within [t0, t1]). None returns only the final state.

  • events (sequence of Event) – The events to locate.

  • rtol (float) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • atol – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • max_steps (int) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • dtmax (float | None) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • adjoint (AbstractAdjoint | None) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • order (int) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • factormax (float | None) – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • solver – Integrator settings (as for the plain solve), threaded into every segment so the event path’s integration matches a plain solve exactly.

  • root_rtol (float) – Tolerances of the root find that locates a state event.

  • root_atol (float) – Tolerances of the root find that locates a state event.

  • max_segments (int) – Safety cap on the number of state-event segments (a runaway-event guard).

Return type:

EventedResult