# Symbolic Tensor Algebra

I need to perform basic tensor algebra in order to double check some very complicated simplification. It's nothing fancy, it just has so many factors by the end that it's hard to tell if an error has been made. The function is

El[t_]:= Exp[I*Transpose[k].(r + v*t + S.r*t + rdif[t])]*
Exp[-Transpose[(r + v*t + rdif[t])].Z.(r + v*t + rdif[t])]


I then need to work out El[t].Conjugate[El[t]] and El[t].Conjugate[El[t+tau]], separated as much as possible by grouping by r, v, and rdif. However when I try to do anything with El I don't get anything simplified, it just feeds back the expression with functions attached, and nothing I do can make it, for example, separate the sums in the exponent. I think part of this is that I can't find a way to tell Mathematica that k, r, v, and rdif are n-D column vectors, S is a non-symmetric square (nxn) tensor and Z is a symmetric square (nxn) tensor (Transpose[Z]==Z), so it doesn't know what it can safely do (All of them are real). This seems basic but then I need to include other things such as rdif[t+tau] == rdif[t]+rdif[tau] and perform some integrals (I can do the integrals by hand easily but I want to make sure the inputs are ok and then I need to simplify the results).

Is there a way for me to use Mathematica to Simplify these?

• Tried to do this by writing it as dot products El[t_] := Exp[I*k.(r + v*t + S.r*t + rdif[t])]* Exp[-TensorExpand[((r + v*t + rdif[t]).z)^2]] (where Z=z.Transpose[z] from the tensor version) but I can't make it proceed because it can't tell what is real so it just sticks Conjugate around everything. Even tried being explict with Assumptions = r \[Element] Vectors[n, Reals] && v \[Element] Vectors[n, Reals] && k \[Element] Vectors[n, Reals] && rdif \[Element] Vectors[n, Reals] && z \[Element] Reals && S \[Element] Reals;. – Elliot Jan 8 '15 at 22:42
• Had to use TensorExpand in the exponent of the definition or it would not ever expand the square. – Elliot Jan 8 '15 at 22:46
• I think (not that I thought too hard about this one) you are going to have some trouble with Dot; Mathematica apparently doesn't recognize it directly as a contraction of a tensor product. See also (26688). – Oleksandr R. Jan 9 '15 at 1:45
• Even with TensorProduct mathematica still has trouble. Was able to get it going by manual specifying the conjugate. Worked fine till I ran into an irreducible matrix (diagonal) in a probability density. But I should have been able to do it in tensor form anyway. – Elliot Jan 12 '15 at 20:36