How can I let Mathematica tell me that trace(Identity matrix)=n for n by n identity matrix? It's easy for human but what would a Mathematica code be?
A harder task: How can I let Mathematica tell me that Exp[I] is also an n by n diagonal matrix with all diagonal entries equal to Exp[1]?
(I simplified my actual question so that humans already know the answer. My actual matrix M is an (2n+1) by (2n+1) tridiagonal matrix with each entry one. I want the [[n,n]] matrix entry of matrix M^n, so that I will then compute the same entry of Exp[M])
Related: How to define and compute various properties of a variable size matrix. But the problem is not resolved there.
nmax = 20; And @@ Table[MatrixExp[ IdentityMatrix[n]] == E*IdentityMatrix[n], {n, 1, nmax}]$\endgroup$FullSimplify[MatrixExp[IdentityMatrix[n]]]doesn't really give meE*IdentityMatrix[n]$\endgroup$SymbolicIdentityArrayis introduced as an EXPERIMENTAL function, butTrcannot handle it for now. Perhaps next version? $\endgroup$