/

Noncommutative utilities for Geometric Algebra¶

Function Reference¶

sympy.galgebra.ncutil.bilinear_function(expr, fct)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n + expr_11*a_1*a_1
• ... + expr_ij*a_i*a_j + ... + expr_nn*a_n*a_n

where all the a_j are noncommuting symbols in basis then

bilinear_function(expr) = bilinear_product(expr_0) + bilinear_product(expr_1*a_1) + ... + bilinear_product(expr_n*a_n)
• bilinear + product(expr_11*a_1*a_1) + ... + bilinear_product(expr_nn*a_n*a_n)
sympy.galgebra.ncutil.bilinear_product(expr, fct)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_ij*a_i*a_j or expr_0 or expr_i*a_i

where all the a_i are noncommuting symbols in basis and the expr’s

are commuting expressions then

bilinear_product(expr) = expr_ij*fct(a_i, a_j)

bilinear_product(expr_0) = expr_0

bilinear_product(expr_i*a_i) = expr_i*a_i

sympy.galgebra.ncutil.coef_function(expr, fct)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

f(expr) = fct(expr_0) + fct(expr_1)*a_1 + ... + fct(expr_n)*a_n

is returned

sympy.galgebra.ncutil.linear_derivation(expr, fct, x)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

linear_drivation(expr) = diff(expr_0, x) + diff(expr_1, x)*a_1 + ...
• diff(expr_n, x)*a_n + expr_1*fct(a_1, x) + ...
• expr_n*fct(a_n, x)
sympy.galgebra.ncutil.linear_expand(expr)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

(expr_0, ..., expr_n) and (1, a_1, ..., a_n) are returned. Note that expr_j*a_j does not have to be of that form, but rather can be any Mul with a_j as a factor (it doen not have to be a postmultiplier). expr_0 is the scalar part of the expression.

sympy.galgebra.ncutil.linear_function(expr, fct)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

f(expr) = expr_0 + expr_1*f(a_1) + ... + expr_n*f(a_n)

is returned

sympy.galgebra.ncutil.linear_projection(expr, plist=None)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0 + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

proj(expr) returns the sum of those terms where a_j is in plist

sympy.galgebra.ncutil.multilinear_derivation(F, fct, x)[source]

If a sympy ‘Expr’ is of the form (summation convention):

expr = expr_0 + expr_i1i2...ir*a_i1*...*a_ir

where all the a_j are noncommuting symbols in basis then

dexpr = diff(expr_0, x) + d(expr_i1i2...ir*a_i1*...*a_ir)

is returned where d() is the product derivation

sympy.galgebra.ncutil.multilinear_function(expr, fct)[source]

If a sympy ‘Expr’ is of the form summation convention):

expr = expr_0 + Sum{0 < r <= n}{expr_i1i2...ir*a_i1*a_i2*...*a_ir}

where all the a_j are noncommuting symbols in basis then and the dimension of the basis in n then

bilinear_function(expr) = multilinear_product(expr_0)
• Sum{0<r<=n}multilinear_product(expr_i1i2...ir*a_i1*a_i2*...*a_ir)
sympy.galgebra.ncutil.multilinear_product(expr, fct)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_i1i2...irj*a_i1*a_i2*...*a_ir or expr_0

where all the a_i are noncommuting symbols in basis and the expr’s

are commuting expressions then

multilinear_product(expr) = expr_i1i2...ir*fct(a_i1, a_i2, ..., a_ir)

bilinear_product(expr_0) = expr_0

where fct() is defined for r <= n the total number of bases

sympy.galgebra.ncutil.non_scalar_projection(expr)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0*S.One + expr_1*a_1 + ... + expr_n*a_n

where all the a_j are noncommuting symbols in basis then

proj(expr) returns the sum of those terms where a_j is in plist

sympy.galgebra.ncutil.product_derivation(F, fct, x)[source]

If a sympy ‘Expr’ is of the form:

expr = expr_0*a_1*...*a_n

where all the a_j are noncommuting symbols in basis then

product_derivation(expr) = diff(expr_0, x)*a_1*...*a_n
• expr_0*(fct(a_1, x)*a_2*...*a_n + ...
• a_1*...*a_(i-1)*fct(a_i, x)*a_(i + 1)*...*a_n + ...
• a_1*...*a_(n-1)*fct(a_n, x))