# How to define and compute various properties of a variable size matrix

I have a rather simple question, but I have not been able to figure out how to implement a solution in Mathematica. I would like to define a variable size square matrix, say an N x N matrix A, whose entries A_ij are of the form Kroneceker-delta_ij (N+1-2k)/2. (In fact, the matrices I want to deal with are N dimensional irreducible representations of SU(2)). Eventually, I would like to compute traces of products of certain matrices, but I can not even get tr(IdentityMatrix[N] = N) to work. How should I approach this problem?

-

For most matrix calculations you need to specify the dimension as a number. Exceptions are (in version 9) TensorReduce and relatives, e.g.:

Clear[d];
Assuming[a \[Element] Matrices[{d, d}],
TensorReduce[Inverse[a].a == a.Inverse[a]]
]

(* ==> True *)


However, Tr isn't one of the functions that work in this way. For your specific application, it may be worth pointing out that there is a built-in function for the irreps of SO(3): WignerD

-
+1 Neat, new functionality ;) –  Vitaliy Kaurov Jan 25 '13 at 18:55
Thanks for the answers. It does not help much however. Also WignerD is for the group elements, what I have is the irreps of of the lie algebra. –  seckin Jan 26 '13 at 22:25
Sorry to hear that. Maybe if you gave a more specific example of your matrices someone could come up with a solution. –  Jens Jan 26 '13 at 23:05