I am using NCAlgebra
but I am open to any solution. I would like to simplify some expressions with many terms (a few dozens) using:
- the fact that each term is a scalar (like $v^\top M v$ with $v$ vector and $M$ matrix), hence symmetric;
- the symmetry and skew-symmetry of some variables.
For example, if $v$ is a vector, $M$ a symmetric matrix, $K$ a skew-symmetric matrix, we may want to simplify $v^\top MKv - v^\top KM v$ as $2v^\top MKv$, because $$\mathbb{R}\ni v^\top KM v = (v^\top KM v)^\top = v^\top M^\top K^\top v = -v^\top M K v.$$
How can I do that in Mathematica ? (below, tp
is the transpose in NCAlgebra
)
expr = tp[v] ** m ** k ** v - tp[v] ** k ** m ** v