normal_forms package

Submodules

normal_forms.bases module

class normal_forms.bases.poly_basis(var)[source]

Bases: object

Basis for polynomials of \(n\) variables.

Parameters:var (tuple of n sympy.symbol objects) – arguments x_0, …, x_{n-1} of polynomial
n

int – number of polynomial arguments

basis

dict of sympy.Matrix objects – basis[j] is a sympy.Matrix object 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\).

add_basis(deg)[source]

Add representation of degree deg basis to dictionary basis.

class normal_forms.bases.vf_basis(pb, m)[source]

Bases: object

Basis for \(m\)-dimensional polynomial vector fields of \(n\) variables.

Parameters:
  • pb (normal_forms.bases.poly_basis object) – 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\).

add_basis(deg)[source]

Add representation of degree deg basis to dictionary basis.

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) of dtype int
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) of dtype int

normal_forms.jet module

class normal_forms.jet.jet(f, x, k, f_args=None, var=None, pb=None)[source]

Bases: object

Truncated 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] where fun_deg[deg]=coeff[deg]*pb[deg] is a symbolic representation of the degree deg term. The expanded form is the list fun_deg of sympy.Matrix(m,1) objects where coeff is a list of k+1 numpy.array objects with shapes \((m,{n+j-1 \choose j})\) for \(0\leq j\leq k\). pb is a dictionary indexed by degree of sympy.Matrix objects with pb[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 monomial pb[deg][term] in coordinate coord of the partial derivative of \(f\) indexed by the term th normal_forms.multiindex.multiindex(deg,n).

Parameters:
  • f (callable) – function that accepts n arguments and returns tuple of length m, corresponding to mathematical function \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\)
  • x (number if n==1 or tuple of length n if n>=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.symbol objects – x_0, x_1, …, x_{n-1} representing arguments of \(f\)

pb

normal_forms.bases.poly_basis – a basis for polynomials in the variables var

coeff

list of k+1 numpy.array objects of shape \((m,{n+j-1\choose j})\) for \(0\leq j\leq k\) – jet coefficients indexed as coeff[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 as fun_deg[deg] for deg=0,...,k

fun

sympy.Matrix(m,1) – symbolic representation of jet

fun_lambdified

callable – lambdified version of fun

update_fun()[source]

Compute symbolic and lambdified versions of the jet from the coefficients.

normal_forms.lie_operator module

class normal_forms.lie_operator.lie_operator(g, var, deg=None, pb=None, vb=None)[source]

Bases: object

Lie 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 degree deg homogenous polynomial vector field in variables var
  • var (list of n sympy.symbol objects) – arguments x_0, x_, …, x_{n-1} of polynomial components of g
  • deg (int, optional) – degree of g. If not supplied, it is guessed from the terms in g.
  • pb (normal_forms.bases.poly_basis, optional) – polynomial basis, see normal_forms.bases
  • vb (normal_forms.bases.vf_basis, opetional) – polynomial vector field basis, see normal_forms.bases
dg

sympy.Matrix(m,n) – coefficients of derivative of g with respect to basis pb

matrix

dict of numpy.array objects – matrix representations of Lie operator acting on homogenous polynomial vector fields

add_matrix(deg)[source]

Add to dict matrix the matrix representation of Lie operator acting on homogenous degree deg \(m\)-dimensional polynomial vector field.

Parameters:deg (int) – degree of vector field argument to Lie operator \(L_g\)

normal_forms.multiindex module

class normal_forms.multiindex.multiindex(n, idx_max)[source]

Bases: object

A 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=2 and with indices less than idx_max=3 are, 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
increment()[source]

Increment multiindex.

to_polynomial(var, x=None)[source]

Convert multiindex to corresponding polynomial.

Parameters:
  • var (tuple of sympy.symbol objects) – list of variables x_0, x_1, …, x_{n-1}
  • x (tuple of length n, optional) – roots of polynomial
Returns:

\(\prod_{i=0}^{n}\) var[i] if x is not supplied, otherwise \(\prod_{i=0}^{n}\) var[i]-x[i]

Return type:

sympy expression

to_var(var)[source]

Convert multiindex to list of variables.

Parameters:var (tuple of sympy.symbol objects) – list of variables x_0, x_1, …, x_{n-1}
Returns:list of var[idx] for idx in self.idx
Return type:list of sympy.symbol objects

normal_forms.normal_form module

class normal_forms.normal_form.normal_form(f, x, k, f_args=None)[source]

Bases: object

A normal form of an autonomous vector field \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\).

Parameters:
  • f (callable) – function that accepts n arguments and returns tuple of length m numbers, corresponding to mathematical function \(f:\mathbb{R}^n\rightarrow\mathbb{R}^m\)
  • x (number if n==1 or tuple of length n if n>=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]\), see normal_forms.lie_operator.lie_operator

g

list of k-1 sympy.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 in g, see normal_forms.lie_operator.lie_operator

eqv

list of shape (k-1,2,.,.) – coefficients and sympy.Matrix(m,1) object representation of normal form equivariant vector fields

fun

sympy.Matrix(m,1) object – symbolic representation of normal form

Module contents