normal_forms package¶
Submodules¶
normal_forms.bases module¶
-
class
normal_forms.bases.poly_basis(var)[source]¶ Bases:
objectBasis for polynomials of \(n\) variables.
Parameters: var (tuple of n sympy.symbolobjects) – argumentsx_0, …,x_{n-1}of polynomial-
n¶ int – number of polynomial arguments
-
basis¶ dict of
sympy.Matrixobjects –basis[j]is asympy.Matrixobject of shape \(({n-j+1\choose j},1)\) representing a basis for homogenous \(j^{th}\) degree polynomials in the variables \(x_0,\ldots,x_{n-1}\) of the form \(\begin{pmatrix}x_0^j & x_0^{j-1}x_1 & \cdots & x_{n-1}^j \end{pmatrix}^T\).
-
-
class
normal_forms.bases.vf_basis(pb, m)[source]¶ Bases:
objectBasis for \(m\)-dimensional polynomial vector fields of \(n\) variables.
Parameters: - pb (
normal_forms.bases.poly_basisobject) – basis for polynomials of \(n\) variables - m (int) – dimension of vector fields
-
n¶ int – number of polynomial arguments
-
basis¶ dict of lists of
sympy.Matrix(m,1)objects –basis[j]is a list of length \(m{d-j+1\choose j}\)sympy.Matrix(m,1)objects representing a basis for \(m\)-dimensional homogenous \(j^{th}\) degree polynomial vector fields in the variables \(x_0,\ldots,x_{n-1}\) of the form \(\begin{pmatrix} x_0^j, & \ldots, & 0\end{pmatrix}^T\), \(\begin{pmatrix} x_0^{j-1}x_1, & \ldots, & 0\end{pmatrix}^T\), …, \(\begin{pmatrix} x_{n-1}^{j}, & \ldots, & 0\end{pmatrix}^T\), …, \(\begin{pmatrix} 0, & \ldots, & x_0^j \end{pmatrix}^T\), \(\begin{pmatrix} 0, & \ldots, & x_0^{j-1}x_1 \end{pmatrix}^T\), …, \(\begin{pmatrix} 0, \ldots, & x_{n-1}^{j} \end{pmatrix}^T\).
- pb (
normal_forms.combinatorics module¶
-
normal_forms.combinatorics.factorial_list(n)[source]¶ Return a list of factorials.
Parameters: n (int) – maximum index of factorial list Returns: list of factorials \(0!, \ldots, n!\) Return type: numpy.array(n+1,1)ofdtypeint
-
normal_forms.combinatorics.simplicial_list(n, k)[source]¶ Return a list of simplicial numbers.
The simplicial number \({n+j-1 \choose j}\) is the number of \(j^{th}\) degree partial derivatives of a function \(f\) with domain of dimension \(n\), i.e. the number of homogenous \(j^{th}\) degree monoomials with unitary coefficient.
Parameters: - n (int) – dimension of domain of \(f\)
- k (int) – maximum derivative degree
Returns: list of \({n+j-1 \choose j}\) for \(j=0,\ldots,k\)
Return type: numpy.array(k+1,1)ofdtypeint
normal_forms.jet module¶
-
class
normal_forms.jet.jet(f, x, k, f_args=None, var=None, pb=None)[source]¶ Bases:
objectTruncated Taylor’s series.
The jet is represented in both a closed and expanded form. The closed form is
fun\(=\sum_{0\leq deg \leq k}\)fun_deg[deg]wherefun_deg[deg]=coeff[deg]*pb[deg]is a symbolic representation of the degreedegterm. The expanded form is the listfun_degofsympy.Matrix(m,1)objects wherecoeffis a list ofk+1 numpy.arrayobjects with shapes \((m,{n+j-1 \choose j})\) for \(0\leq j\leq k\).pbis a dictionary indexed by degree ofsympy.Matrixobjects withpb[j]representing a basis for homogenous \(j^{th}\) degree polynomials in the variables \(x_0,\ldots,x_{n-1}\) of the form \(\begin{pmatrix}x_0^j & x_0^{j-1}x_1 & \cdots & x_{n-1}^j \end{pmatrix}^T\).coeff[deg][coord,term]is the coefficient of the monomialpb[deg][term]in coordinatecoordof the partial derivative of \(f\) indexed by thetermthnormal_forms.multiindex.multiindex(deg,n).Parameters: - f (callable) – function that accepts
narguments and returns tuple of lengthm, corresponding to mathematical function \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\) - x (number if
n==1or tuple of lengthnifn>=1) – center about which jet is expanded - k (int) – maximum degree of jet
-
n¶ int – dimension of domain of \(f\)
-
m¶ int – dimension of codomain of \(f\)
-
var¶ list of
n sympy.symbolobjects –x_0,x_1, …,x_{n-1}representing arguments of \(f\)
-
pb¶ normal_forms.bases.poly_basis– a basis for polynomials in the variablesvar
-
coeff¶ list of
k+1 numpy.arrayobjects of shape \((m,{n+j-1\choose j})\) for \(0\leq j\leq k\) – jet coefficients indexed ascoeff[deg][coord,term]where \(0\leq\)deg\(\leq k\), \(0\leq\)coord\(\leq m\), and \(0\leq\)term\(<{m-1+deg \choose deg}\).
-
fun_deg¶ list of
k+1 sympy.Matrix(m,1)objects – symbolic representation of each term in the jet indexed asfun_deg[deg]fordeg=0,...,k
-
fun¶ sympy.Matrix(m,1)– symbolic representation of jet
-
fun_lambdified¶ callable – lambdified version of fun
- f (callable) – function that accepts
normal_forms.lie_operator module¶
-
class
normal_forms.lie_operator.lie_operator(g, var, deg=None, pb=None, vb=None)[source]¶ Bases:
objectLie operator of a vector field.
In this implementation, the Lie bracket of vector fields \(f,g:\mathbb{R}^n\rightarrow\mathbb{R}^n\) is defined as \([f,g]=f'(x)g(x)-g'(x)f(x)\). An object of this class represents the Lie bracket with a particular vector field \(g\), denoted \(L_g(\cdot)=[g,\cdot]\).
Parameters: - g (
sympy.Matrix(m,1)) – symbolic representation of degreedeghomogenous polynomial vector field in variablesvar - var (list of
n sympy.symbolobjects) – argumentsx_0,x_, …,x_{n-1}of polynomial components ofg - deg (int, optional) – degree of
g. If not supplied, it is guessed from the terms ing. - pb (
normal_forms.bases.poly_basis, optional) – polynomial basis, seenormal_forms.bases - vb (
normal_forms.bases.vf_basis, opetional) – polynomial vector field basis, seenormal_forms.bases
-
dg¶ sympy.Matrix(m,n)– coefficients of derivative ofgwith respect to basispb
-
matrix¶ dict of
numpy.arrayobjects – matrix representations of Lie operator acting on homogenous polynomial vector fields
- g (
normal_forms.multiindex module¶
-
class
normal_forms.multiindex.multiindex(n, idx_max)[source]¶ Bases:
objectA multiindex representation.
In this implementation, the multiindex \((m_1,\ldots,m_n)\) corresponds to partial derivative \(\frac{\partial}{\partial x_{m_1}}\cdots\frac{\partial}{\partial x_{m_n}}f\) and homogenous \(n^{th}\) degree monomial \(x_1^{m_1}\cdots x_n^{m_n}\). A ‘telephone-book’ ordering is used and indices within the multiindex are assumed to be non-decreasing. For example, the multiindices with length
n=2and with indices less thanidx_max=3are, in increasing order: (0,0), (0,1), (0,2), (1,1), (1,2), (2,2). The next multiindex is cycled back to the first multiindex.-
n¶ int – number of indices
-
idx_max¶ int – upper bound, indices can take nonnegative values less than
idx_max
-
factorial()[source]¶ Return multiindex factorial.
In this implementation, multiindex \(m=(m_1,\ldots,m_n)\) factorial is defined as \(\alpha_1!\cdots \alpha_n!\) where \(\alpha_i\) is the number of occurences of \(i\) in \(m\).
Returns: multiindex factorial Return type: int
-
to_polynomial(var, x=None)[source]¶ Convert multiindex to corresponding polynomial.
Parameters: - var (tuple of
sympy.symbolobjects) – list of variablesx_0,x_1, …,x_{n-1} - x (tuple of length n, optional) – roots of polynomial
Returns: \(\prod_{i=0}^{n}\)
var[i]ifxis not supplied, otherwise \(\prod_{i=0}^{n}\)var[i]-x[i]Return type: sympyexpression- var (tuple of
-
normal_forms.normal_form module¶
-
class
normal_forms.normal_form.normal_form(f, x, k, f_args=None)[source]¶ Bases:
objectA normal form of an autonomous vector field \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\).
Parameters: - f (callable) – function that accepts
narguments and returns tuple of lengthmnumbers, corresponding to mathematical function \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\) - x (number if
n==1or tuple of lengthnifn>=1) – center about which normal form is computed - k (int) – maximum degree of normal form
-
n¶ int – dimension of domain of \(f\)
-
m¶ int – dimension of codomain of \(f\)
-
jet¶ normal_forms.jet.jet– series representation of normal form
-
L1¶ normal_forms.lie_operator.lie_operator– fundamental operator of the normal form, Lie bracket with the linear term \(f_1(x)=f'(x)x\), that is \(L_{f_1}(\cdot) = [f_1,\cdot]\), seenormal_forms.lie_operator.lie_operator
-
g¶ list of
k-1sympy.Matrix(m,1)objects – generators, i.e. homogenous \(j^{th}\) degree \(m\)-dimensional polynomial vector fields \(g_j\) for \(j\geq2\) used to carry out sequence of near-identity transformations \(e^{L_{g_j}}\) of \(f\)
-
L¶ normal_forms.lie_operator.lie_operator– Lie operators \(L_{g_j}\) of the generators ing, seenormal_forms.lie_operator.lie_operator
-
eqv¶ list of shape
(k-1,2,.,.)– coefficients andsympy.Matrix(m,1)object representation of normal form equivariant vector fields
-
fun¶ sympy.Matrix(m,1) object – symbolic representation of normal form
- f (callable) – function that accepts