0
$\begingroup$

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.

$\endgroup$
10
  • 1
    $\begingroup$ For finite dimensions, nmax = 20; And @@ Table[MatrixExp[ IdentityMatrix[n]] == E*IdentityMatrix[n], {n, 1, nmax}] $\endgroup$ Commented Oct 16, 2024 at 1:58
  • $\begingroup$ Thanks! It would be great if Mathematica has the symbolic power for any-size matrices though, that is, return an answer in terms of nmax. I am not sure if Mathematica has some of these features for operators or tensors. $\endgroup$ Commented Oct 16, 2024 at 4:42
  • $\begingroup$ FullSimplify[MatrixExp[IdentityMatrix[n]]] doesn't really give me E*IdentityMatrix[n] $\endgroup$ Commented Oct 16, 2024 at 4:43
  • 3
    $\begingroup$ In version 14.1 SymbolicIdentityArray is introduced as an EXPERIMENTAL function, but Tr cannot handle it for now. Perhaps next version? $\endgroup$ Commented Oct 16, 2024 at 5:31
  • 1
    $\begingroup$ Yeah, though experimental, those functions in 14.1 for symbolic arrays are a big step forward and can already do a lot of interesting things. For more info check reference.wolfram.com/language/guide/SymbolicArrays.html $\endgroup$ Commented Oct 16, 2024 at 6:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.