# products in order and makerule

15 views

### Nitol Attar

Jan 26, 2023, 11:31:31 AMJan 26
to xAct Tensor Computer Algebra
Hello all,

For taking a products in order, that is,

(a1+a2)*(a1+a2) = a1a1+a1a2+a2a1+a2a2

where a1a2 and a2a1 are not same, how to implement such product?
Also, how to implement distinct rules using MakeRule for a1a2 and a2a1?

Any feedback would be appreciated.

### Jose

Jan 26, 2023, 10:45:35 PMJan 26
to xAct Tensor Computer Algebra
Hi,

xTensor (and by extension of all xAct) works primarily with the Times product, which is commutative (i.e. Orderless in WL terminology). This means a term Times[b, 1, a] will be automatically converted into Times[a, b], and so on. This is usually enough, but sometimes we need non-commutative products, like the wedge product in differential forms computations, as in xTerior.

The concept of "product" was introduced in xTensor to handle this situation, declared with DefProduct. I suggest that you search this forum for other discussions on using DefProduct. Basically the idea is something like this:

DefManifold[M, 4, {a, b, c, d, e, f}]

DefTensor[T[a, b], M, Antisymmetric[{a, b}]]

This defines a product called CircleDot. You can use any non-protected symbol, but using one of the WL inert operators gives nice visuals:

DefProduct[CircleDot]

CircleDot[T[a, b], T[d, c]] - 3 CircleDot[T[d, c], T[a, b]]

DefProduct has two more arguments and many options to control the properties of the product: (super)(anti)commutativity, associativity, the neutral element, grades, etc. The most general case I wanted to reach is that of Gerstenhaber algebra, but I don't think anybody has ever used this in xTensor.

The key point is that ToCanonical knows how to handle these products, and how to deal simultaneously with the symmetries of the tensors and the properties of the products, though there are limitations, for example not being able to deal automatically with Jacobi identities for commutators. Try ToCanonical in the CircleDot expression I wrote above.

Once you are familiar with how to use one of this product expressions, MakeRule should be able to create rules for it as usual.

Cheers,
Jose.