So, I'd like to define a matrix M, that does not decompose into it's constituents when I do things like Tr[M]
, but I also want it's type to be retained.
(By type, I mean, what sort of a data structure it is, integer, or matrix, or vector, not literally the data-types available.)
For example:
In: Tr[a*M]
Out: a*Tr[M]
The solution from this answer doesn't seem to retain the type.
Is there any way to do this?
Edit: Basically, have an atomic symbol whose type is say a 2*3 matrix (or whatever is the equivalent of that in Mathematica), but whose individual elements don't matter for computation.
If I define a matrix as follows:
M = {{a,b},{c,d}}
Then, Tr[M]
gives a+d
. But I don't want the symbol to expand that way.
I'd like Tr[M]
to give Tr[M]
but Tr[a*M]
to give a*Tr[M]
and have other linear functions expand similarly.
{{a,b},{c,d}}
is not atomic, and is not a symbol. Thus, do not give a value toM
, keep it as a symbol, and look up symbolic tensor manipulations in the docs. Perhaps this is what you want. $\endgroup$