This is a small library written to convert Sympy expressions into Matlab code (Funktions, S-Funktions, ...).
The first thing introduced with this library is a new "type" of variable. These variables are symengine variables but also include some additional functionality.
There are two types Dynamic and Static Symbols.
The difference is that Dynamic Symbols are represented as Funktions of
from System_to_Matlab import DynamicSymbol
ds = DynamicSymbol("x", number_of_variables=2, number_of_derivatives=1).vars
display(ds)
$ \left[ \left[\begin{matrix}x_{1}{\left(t \right)}\x_{2}{\left(t \right)}\end{matrix}\right], \ \left[\begin{matrix}\dot{x}{1}{\left(t \right)}\\dot{x}{2}{\left(t \right)}\end{matrix}\right]\right]$
All Dynamic Symbols depend on the variable t.
x = ds[0]
t = DynamicSymbol._derivation_variable
disp(x)
disp(se.diff(x, t))
from System_to_Matlab import diff_t
disp(diff_t(x))
$$ \left[\begin{matrix}\dot{x}{1}{\left(t \right)}\\dot{x}{2}{\left(t \right)}\end{matrix}\right] $$
These variables can be differentiated without any issue. The diff_t function can be used to directly replace the derivative with the corresponding symbol.
The Static Symbol represents a variable without a dependency.
ds = StaticSymbol("x", number_of_variables=2).vars
disp(ds)