This is a port of the Mathematica script to python3.

findpos[source]

findpos(lam)

This determines whether the index string is a strictly ascending sequence.

Parameters

lam : an indexable object of things that are comparable. Usually an array of integers

Returns

bool : the position in the string where two ints are equal.

isstrictlyascending[source]

isstrictlyascending(lam)

This determines whether the index string is a strictly ascending sequence

Parameters

lam : an indexable object of things that are comparable. Usually an array of integers

Returns

bool : true if the sequence is strictly ascending, else false.

alpha[source]

alpha(lam)

The alpha factor. This determines the real alpha coefficient as given by Thalhammer and elaborated by Blanes.

Parameters

lam : A multiindex of integers.

Returns

Rational: alpha(lam)

assert alpha([1,1,1,2])==Rational(1,6)

CreateMuVectors[source]

CreateMuVectors(p, k)

This function creates the set of possible $$\mu$$ vectors.

Parameters

p : the considered order k : 1 <=k<=p

Returns

array : A list of multiindices

CreateLyndonIndices[source]

CreateLyndonIndices(p, k)

This function creates the set of Lyndon indices.

Parameters

p : the considered order k : 1 <=k<=p

Returns

array : A list of Lyndon multiindices

CreateEquation[source]

CreateEquation(mu, bvec, cvec)

This function gives the coefficient for a particular multiindex mu.

It is the real coefficient of a Len(mu) long product of iterated commutators [A, B]_(mu_k).

Parameters

mu : a multiindex bvec : a string of symbols. cvec : a string of symbols(usually the partial sums of the avec).

Returns

expr : a symbolic expression, a polynomial in terms of the contents of bvec and cvec.

CreateConditions[source]

CreateConditions(p, avec, bvec, indexgenerator='CreateLyndonIndices')

This creates the set of equations using by default the Lyndon Basis elements.

Parameters

p : the considered order avec: The set of symbols to use for the first operator. bvec: The set of symbols to use for the second operator. indexgenerator: (optional) by default we use indexgenerator for the Lyndon indices. Using CreateMuVectors the indices from the overcomplete Hall-Basis can be used.

Returns

array : An array of Equations that have to be satisfied to fulfill the requested order p.

Having all the functions available we can compare the reductions due to the Lyndon indices in comparison to the Hall Basis.

avec=[*symarray('a',3)]
bvec=[*symarray('b',3)]
print("Equations in the Lyndon Basis")
print(CreateConditions(3,avec,bvec))
print("=========================")
print("Equations in the Hall Basis")
print(CreateConditions(3,avec,bvec,CreateMuVectors))
Equations in the Lyndon Basis
[Eq(a_0 + a_1 + a_2, 1), Eq(-b_0 - b_1 - b_2 + 1, 0), Eq(-a_0*b_0 - b_1*(a_0 + a_1) - b_2 + 1/2, 0), Eq(-a_0**2*b_0 - b_1*(a_0 + a_1)**2 - b_2 + 1/3, 0), Eq(-a_0*b_0**2/2 - a_0*b_0*b_1 - a_0*b_0*b_2 - b_1**2*(a_0 + a_1)/2 - b_1*b_2*(a_0 + a_1) - b_2**2/2 + 1/6, 0)]
=========================
Equations in the Hall Basis
[Eq(a_0 + a_1 + a_2, 1), Eq(-b_0 - b_1 - b_2 + 1, 0), Eq(-a_0*b_0 - b_1*(a_0 + a_1) - b_2 + 1/2, 0), Eq(-a_0**2*b_0 - b_1*(a_0 + a_1)**2 - b_2 + 1/3, 0), Eq(-b_0**2/2 - b_0*b_1 - b_0*b_2 - b_1**2/2 - b_1*b_2 - b_2**2/2 + 1/2, 0), Eq(-a_0*b_0**2/2 - a_0*b_0*b_1 - a_0*b_0*b_2 - b_1**2*(a_0 + a_1)/2 - b_1*b_2*(a_0 + a_1) - b_2**2/2 + 1/6, 0), Eq(-a_0*b_0**2/2 - b_0*b_1*(a_0 + a_1) - b_0*b_2 - b_1**2*(a_0 + a_1)/2 - b_1*b_2 - b_2**2/2 + 1/3, 0), Eq(-b_0**3/6 - b_0**2*b_1/2 - b_0**2*b_2/2 - b_0*b_1**2/2 - b_0*b_1*b_2 - b_0*b_2**2/2 - b_1**3/6 - b_1**2*b_2/2 - b_1*b_2**2/2 - b_2**3/6 + 1/6, 0)]