How can I get Mathematica to simplify the following expressions, with $Assumptions including Element[n,Integers], n > 0, and Element[n, Vectors[Reals]]:
IdentityMatrix[n].IdentityMatrix[n]
IdentityMatrix[n].x
Neither TensorReduce nor FullSimplify simplifies the above expressions.
Context for this question: I am frequently implementing new Bayesian statistical models that automated tools such as OpenBUGS can't handle, and so I need to work out expressions for various full conditional probability densities from the (large and complex) joint probability distribution. These expressions need to be simplified as much as possible, for computational efficiency. I want to see if I can use Mathematica to do this more quickly and reliably, instead of always doing it by hand. One of my needs is to be able to manipulate and/or simplify various linear algebra expressions that often arise; the dimensionality of these matrices and vectors is itself a parameter of the problem, not a fixed number.
Dotdoes not seem to be understood in this context, and must be expressed as the contraction of a tensor product in order for the simplifications to proceed. This is inconvenient but it seems to be a fact of life as of Mathematica 9. – Oleksandr R. Jul 14 '13 at 18:41TensorContract[TensorProduct[IdentityMatrix[n],x],{{2,3}}],nor even
TensorContract[IdentityMatrix[n],{{1,2}}].It's beginning to look to me as if Mathematica has no built-in rules relating various ways of creating symbolic vectors and matrices whose dimensions are symbolic expressions with the tensor operations.
– Kevin S. Van Horn Jul 15 '13 at 04:00Tensor. There doesn't seem to be a way to define a tensor that is the identity matrix; the best one can apparently do is to have a symmetric matrix. – Oleksandr R. Jul 15 '13 at 04:21