How does Mathematica compute MatrixPower[m,n]?
The documentation states it is equivalent to Dot @@ ConstantArray[m, {n}], but this construction is limited to $n\leq 4096$ and simple Timing exercises show it is slower.
This answer to a similar question mentions JordanDecomposition, but I don't know if that is what Mathematica actually uses.
In Linear Algebra classes, it is often taught that diagonalization allows for fast exponentiation. But is that actually how Mathematica does it?
JordanDecomposition, but I'm not positive. – GregH Feb 25 '22 at 13:31matrix_powerin numpy.linang appears to simply perform repeated matrix multiplication. It gains some efficiency by (effectively) repeatedly squaring $M$ to get matrices of the form $M^{2n}$ and then using the binary decomposition of the desired exponent to express it as a product of matrices of that form. – Michael Seifert Feb 25 '22 at 14:40MatrixExpuses Putzer's method or Jordan decomposition" for exact numerical results, so maybe you can mention that to your students. – Michael Seifert Feb 25 '22 at 14:59MatrixPowerandMatrixExpdo not work the same way in general. – Daniel Lichtblau May 25 '22 at 18:17