Skip to content

Class DiscreteDynamics

dim property

Returns the dimension of the system.

Returns:

Type Description
int

The dimension of the system.

param_dim property

Returns the dimension of the parameters.

Returns:

Type Description
int

The dimension of the parameters.

__init__(trans_func, dim, param_dim=0)

Initializes the dynamics object with a transition function, state dimension, and optional parameter dimension.

Parameters:

Name Type Description Default
trans_func torch.Tensor -> torch.Tensor

The transformation function that defines the dynamics.

required
dim int

The dimension of the state space.

required
param_dim int

The dimension of the parameter space.

0

step(x, u)

Advances the system dynamics by one time step using the given state and parameter/control input.

Parameters:

Name Type Description Default
x Tensor

The current state of the system.

required
u Tensor

The control input to be applied.

required

Returns:

Type Description
Tensor

The next state of the system after applying the control input.

traj(x0, u0, traj_len)

Simulate trajectory of a dynamical system.

Parameters:

Name Type Description Default
x0 Tensor

The initial state of the system. Expected shape is (N, number of state).

required
u0 Tensor or None

The control input or parameter. If None, a zero tensor is used. If time-independent, should have shape (1, number of control inputs). If time-dependent, should have shape (traj_len - 1, number of control inputs).

required
traj_len int

The length of the trajectory to simulate.

required

Returns:

Type Description
Tensor

A tensor containing the simulated trajectory. The shape is (N, traj_len, number of state).