Mathematica does not respect tensor order?

I’m trying to verify an identity involving symmetric traceless tensors over the reals. What I tried was:

In[11]:= $Assumptions = d \[Element] Matrices[{3, 3}, Reals, Symmetric[{1, 2}]]
Out[11]= d \[Element] Matrices[{3, 3}, Reals, Symmetric[{1, 2}]]
In[24]:= dd = d – Tr[d] IdentityMatrix[3]/3
Out[24]= {{d – Tr[d]/3, d, d}, {d, d – Tr[d]/3, d}, {d, d,d – Tr[d]/3}}

I think the output in 24 is assuming that d is now a scalar. That gets me into trouble later when I tried to compute outer products of dd and use TensorReduce. For example

lh = TensorReduce[TensorContract[dd\[TensorProduct]dd, {{1, 3}, {2, 4}}]]
TensorDimensions::fscl: Nonscalar expression d encountered as an argument of numeric function Power. >>
TensorDimensions::inhom: Inhomogeneous dimensions in sum d-Tr[d]/3. >>

Why is this not working, and what is the right way to do computations on traceless matrices?
Sune

=================

  

 

Related: Inequalities with assumptions and constraints
– Jens
Apr 11 ’14 at 15:10

=================

1 Answer
1

=================

Assumptions are not used in normal evaluation, but only in certain functions like Simplify. Another, simpler example:

In[1]:= $Assumptions = x \[Element] Reals

Out[1]= x \[Element] Reals

In[2]:= Conjugate[x]

Out[2]= Conjugate[x]

In[3]:= Simplify[%]

Out[3]= x

You see, during normal evaluation Mathematica doesn’t recognize that x is supposed to be real, only during Simplify.

You can identify the functions which take $Assumptions into account by the fact that they also accept an option Assumption. On Mathematica 8, using

Select[Names[“System`*”],Options[Symbol@#,Assumptions]!={}&]

I get the following list:

ContinuedFractionK
Convolve
DifferenceDelta
DifferenceRootReduce
DifferentialRootReduce
DirichletTransform
DiscreteConvolve
DiscreteRatio
DiscreteShift
Expectation
ExpectedValue
ExponentialGeneratingFunction
FinancialBond
FourierCoefficient
FourierCosCoefficient
FourierCosSeries
FourierCosTransform
FourierSequenceTransform
FourierSeries
FourierSinCoefficient
FourierSinSeries
FourierSinTransform
FourierTransform
FourierTrigSeries
FullSimplify
FunctionExpand
GeneratingFunction
Integrate
InverseFourierCosTransform
InverseFourierSequenceTransform
InverseFourierSinTransform
InverseFourierTransform
InverseZTransform
LaplaceTransform
Limit
PiecewiseExpand
PossibleZeroQ
PowerExpand
Probability
ProbabilityDistribution
Product
Refine
Residue
Series
SeriesCoefficient
Simplify
Sum
SumConvergence
TimeValue
ToRadicals
TransformedDistribution
ZTransform

2

 

To be more precise, $Assumptions only works on functions with Assumptions option 🙂
– xzczd
Apr 11 ’14 at 12:24

  

 

@xzczd: I already suspected that, but wasn’t quite sure, so I didn’t include that. But now that you say so, I think it can be safely included. Thank you.
– celtschk
Apr 11 ’14 at 12:26

  

 

Thanks – got it. So perhaps the only way of approaching my problem would be to define SymmetrizedArrays with proper symmetries and then subtract the trace explicitly?
– Sune
Apr 12 ’14 at 8:34

  

 

I don’t have experience with SymmetrizedArray (it’s a Mathematica 9 feature, and I only have access to Mathematica 8), so I cannot tell you whether that would be the correct or best approach. The problem here is that Mathematica treats all unbound variables as scalars during evaluation, and there’s AFAIK no way to override that behaviour for specific variables.
– celtschk
Apr 12 ’14 at 9:01