heyoka.var_ode_sys#

class heyoka.var_ode_sys#

Class to represent variational ODE systems.

Added in version 5.0.0.

Note

A tutorial explaining the use of this class is available.

Methods

__init__(self, sys, args[, order])

Constructor.

Attributes

n_orig_sv

The number of original state variables.

order

The differentitation order.

sys

The full system of equations (including partials).

vargs

The list of variational arguments.

__init__(self, sys: list[tuple[expression, expression]], args: var_args | list[expression], order: int = 1)#

Constructor.

A variational ODE system is constructed from two mandatory arguments: the original ODE system sys and an args parameter representing the quantities with respect to which the variational equations will be formulated.

If args is of type var_args, then the variational equations will be constructed with respect to arguments deduced from sys. E.g., if sys contains the two state variables \(x\) and \(y\) and args is the vars enumerator of var_args, then the variational equations will be formulated with respect to the initial conditions of \(x\) and \(y\). Similarly, if sys contains two parameters par[0] and par[1] and args is the params enumerator of var_args, then the variational equations will be formulated with respect to the two parameters.

If args is a list of expression, then the variational equations will be formulated with respect to the quantities contained in the list. Specifically:

  • variable expression are used to request derivatives with respect to the intial conditions for that state variable;

  • parameter expressions are used to request derivatives with respect to those parameters;

  • heyoka.time is used to request the derivative with respect to the initial integration time.

Several checks are run on the input arguments. Specifically:

  • sys must be a valid ODE system;

  • if args is of type var_args, it must be either one of the valid enumerators or a combination of the valid enumerators;

  • if args is a list of expressions:

    • it must not be empty,

    • it must consists only of variables, parameters or the heyoka.time placeholder,

    • it must not contain duplicates,

    • any variable expression must refer to a state variable in sys.

Additionally, the differentiation order order must be at least 1.

Parameters:
  • sys – the input ODE system.

  • args – the variational arguments.

  • order – the differentiation order.

Raises:

ValueError – if one or more input arguments are malformed, as explained above.

property n_orig_sv#

The number of original state variables.

Return type:

int

property order#

The differentitation order.

Return type:

int

property sys#

The full system of equations (including partials).

Return type:

list[tuple[expression, expression]]

property vargs#

The list of variational arguments.

Return type:

list[expression]