solve_ivp
- cubie.batchsolving.solver.solve_ivp(system: BaseODE | str | Callable | Iterable[str], y0: ndarray | Dict[str, ndarray] | None = None, parameters: ndarray | Dict[str, ndarray] | None = None, drivers: DriverSamples | None = None, method: str = 'euler', duration: float = 1.0, settling_time: float = 0.0, t0: float = 0.0, save_variables: List[str] | None = None, summarise_variables: List[str] | None = None, grid_type: str = 'combinatorial', time_logging_level: str | None = None, nan_error_trajectories: bool = True, fix_constant_parameters: bool = True, **kwargs: Any) SolveResult[source]
Solve a batch initial value problem.
- Parameters:
system – System model defining the differential equations. Accepts a prebuilt
BaseODE, or raw equations as a Python callable, an equation string, or an iterable of equation strings. Raw equations are converted withcreate_ODE_system(), taking state names and defaults from ay0dict and parameter names and defaults from aparametersdict; for repeated solves of the same system, build it once withcreate_ODE_systemand reuse aSolverinstead.y0 – Initial state values for each run as arrays or dictionaries mapping labels to arrays.
Nonestarts every run from the system’s default initial values. If you’ve provided raw equations and given either noy0ory0as an array, the state symbols will be inferred from the equations (any symbol with adprefix to indicate a derivative).parameters – Parameter values for each run, as a dict mapping parameter names to values, or as an array. The solver uses the default value of every parameter you leave out of a dict. Give an array either one row per parameter in the system, or one row per swept parameter in parameter name order, in which case the solver uses the default value of every other parameter. For a dict or an array with one row per parameter, any parameters given as a single value will be removed from the array and compiled into the code; see
fix_constant_parameters. Pass None, an empty dict, or an empty 1D array to use the default parameters for all runs.drivers – The
DriverSamplesto interpolate during integration.method – Integration algorithm to use. Default is
"euler".duration – Total integration time. Default is
1.0.settling_time – Warm-up period prior to storing outputs. Default is
0.0.t0 – Initial integration time supplied to the solver. Default is
0.0.save_variables (list of str, optional) – Variable names (states or observables) to save in time-domain output.
None(default) saves all states and observables. An empty list[]explicitly saves no variables. When bothsave_variablesand index parameters (saved_state_indices,saved_observable_indices) are provided, their union is used. For less overhead, you can provide indices directly, which don’t require the solver to look up variable names.summarise_variables (list of str, optional) – Variable names (states or observables) to include in summary calculations.
None(default) summarises the same variables that are saved. An empty list[]explicitly summarises no variables. When bothsummarise_variablesand index parameters are provided, their union is used.grid_type –
"verbatim"pairs each input vector while"combinatorial"produces every combination of provided values.time_logging_level (str or None, default='default') – Time logging verbosity level. Options are ‘silent’, ‘default’, ‘verbose’, ‘debug’, None, or ‘None’ to disable timing.
nan_error_trajectories (bool, default=True) – When
True(default), trajectories with nonzero solver status codes are automatically set to NaN, protecting users from analyzing invalid data. WhenFalse, all trajectories are returned with original values.fix_constant_parameters (bool, default=True) – If
False, leave any parameters that have been given the same value for all runs in the parameters array that the GPU sees. Defaults toTrue, so that constant parameters are compiled into the code and the whole thing runs faster. Set itFalseif you are changing a single value per batch frequently, and the compile time is long enough to make it annoying.**kwargs – Additional keyword arguments passed to
Solver. Any system parameters passed as kwargs are rejected, as they should be in theparametersargument.
- Returns:
Result owning the solve’s host output buffers.
as_numpy,as_numpy_per_summary, andas_pandasbuild RAM representations on demand; disk-backed results release their spill files onclose()or context exit.- Return type: