create_ODE_system

cubie.odesystems.create_ODE_system(dxdt: str | Iterable[str] | Callable, precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64] = <class 'numpy.float32'>, states: dict[str, float] | ~typing.Iterable[str] | None=None, observables: Iterable[str] | None = None, parameters: dict[str, float] | ~typing.Iterable[str] | None=None, drivers: Iterable[str] | dict[str, ~typing.Any] | None=None, user_functions: dict[str, ~typing.Callable] | None=None, user_function_derivatives: dict[str, ~typing.Callable] | None=None, name: str | None = None, strict: bool = False, state_priority: dict[str, float] | None=None, irreducible: Iterable[str] | None = None, simplify_options: dict[str, ~typing.Any] | None=None, operation_ordering: str | None = None, swept_parameters: Iterable[str] | None = None) → SymbolicODE[source]

Create a SymbolicODE from SymPy definitions.

Parameters:
  • dxdt – System equations defined as a single string, an iterable of equation strings in lhs = rhs form, or a Python callable. When a callable is provided its signature must be f(t, y, ...) where t is time, y is the state vector, and additional arguments map to parameters or drivers. State access patterns supported: y[0] (positional), y["name"] (string), y.name (attribute). The return value must be a list, tuple, or dict of derivative expressions.

  • states – State labels either as an iterable or as a mapping to default initial values.

  • observables – Observable variable labels to expose from the generated system.

  • parameters – Parameter labels either as an iterable or as a mapping to default values. A parameter that holds one value across a batch is compiled into the generated code as a number.

  • drivers – Names of the drivers you supply at solve time, as a list, or as a dict whose keys are the names. create_ODE_system reads only the keys.

  • user_functions – Custom callables referenced within dxdt expressions.

  • user_function_derivatives – Mapping of user-function names to callables evaluating their analytic derivatives, used when generating Jacobian-based solver helpers. A value may also be a list of callables evaluating the first, second, … derivatives; the order-n callable takes the function’s arguments followed by n argument indices.

  • name – Identifier used for generated files. Defaults to unnamed_ followed by the start of a hash of the equations.

  • precision – Target floating-point precision used when compiling the system.

  • strict – When True require every symbol to be explicitly categorised.

  • state_priority – Per-unknown state-selection priorities (higher values are preferred as solver states).

  • irreducible – Unknowns that must not be eliminated.

  • simplify_options – Extra keyword arguments forwarded to structural_simplify().

  • operation_ordering – Generated-operation ordering policy. "liveness_auto" applies thresholded liveness-based selection; "kahn" preserves stable breadth-first ordering, and "greedy" and "dfs" select fixed alternatives. Defaults to CUBIE_OPERATION_ORDERING (liveness_auto when unset).

  • swept_parameters – Names of the parameters that vary between the runs of a batch. Every other parameter is compiled in at its default value, and when you leave this out every parameter is compiled in. A solve sets the swept parameters to match its inputs, so giving them here saves specialising the system again at the first solve, which can take 10-100 ms.

Returns:

Fully constructed symbolic system ready for compilation.

Return type:

SymbolicODE