DADiSP Worksheet Functions > Function Categories > Matrix Math and Special Matrices > ^^ (Matrix Power)
Raises a matrix to a scalar power or a scalar to a matrix power.
A ^^ p
A |
- |
A non-singular, square matrix or a scalar. The base. |
p |
- |
A square matrix or scalar if A is a matrix. The exponent. |
A matrix.
a = {{1, 2, 3},
{4, 5, 6},
{7, 8, 0}}
b = a^^3
b == {{279, 360, 306},
{684, 873, 684},
{738, 900, 441}}
c = a^^1.5
c == {{ 7.245 - 2.116i, 9.115 - 1.718i, 6.304 + 2.891i},
{17.096 - 2.596i, 21.508 - 2.608i, 14.875 + 4.099i},
{15.465 + 6.185i, 19.456 + 5.746i, 13.457 - 9.250i}}
d = 1.5^^a
d == {{24.009, 29.166, 20.401},
{54.739, 69.769, 47.985},
{49.996, 62.783, 43.550}}
A^^0 == eye(size(A)) the identity matrix.
A^^-1 == inv(A) the matrix inverse.
A^^1 == A
Given matrix A and scalar p:
For p a positive integer, A^^p is equivalent to:
A *^ A ^* A *^ A ... *^ A (p times.)
For p a negative integer, A^^p is equivalent to the positive case except the inverse of A is multiplied.
For p a real or complex number, the function computes the matrix power using eigenvectors and eigenvalues as follows:
(v, d) = eig(A)
A^^p == (v *^ (d ^ p)) /^ v
For p^^A, the matrix power is calculated as:
(v, d) = eig(A)
(v *^ diag(p ^ diag(d))) /^ v
If neither p nor A are matrices, ^^ defaults to the standard ^ operator. For example:
4 ^^ 3 == 64
If both p and A are matrices, an error occurs.
See the ^ operator to raise each element of an array to a power.
See DADiSP/MatrixXL to significantly optimize ^^.