powerM#

Purpose#

Returns the power n of a matrix A, as the matrix product of n copies of A.

Format#

B = powerM(A, n)#
Parameters:
  • A (NxN square matrix) – Data.

  • n (Scalar) – The power or exponent.

Returns:

B (NxN square matrix) – The power of a matrix A.

Examples#

A = { 1 2,
      3 4 };

// Compute power matrix
B = powerM(A, 3);

print "A = " A;
print ;
print "B = " B;

After the code above:

A=
1.0000000        2.0000000
3.0000000        4.0000000

B=
37.000000        54.000000
81.000000        118.00000

Remarks#

If \(n = 0\), then the function will return an identity matrix.

See also

Functions crossprd()