Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

matrix.power

Matrix Raised to a Power


Description

This function computes the k-th power of order n square matrix x If k is zero, the order n identity matrix is returned. argument k must be an integer.

Usage

matrix.power(x, k)

Arguments

x

a numeric square matrix

k

a numeric exponent

Details

The matrix power is computed by successive matrix multiplications. If the exponent is zero, the order n identity matrix is returned. If the exponent is negative, the inverse of the matrix is raised to the given power.

Value

An order n matrix.

Author(s)

Frederick Novomestky fnovomes@poly.edu

References

Bellman, R. (1987). Matrix Analysis, Second edition, Classics in Applied Mathematics, Society for Industrial and Applied Mathematics.

Examples

A <- matrix( c ( 1, 2, 2, 1 ), nrow=2, byrow=TRUE)
matrix.power( A, -2 )
matrix.power( A, -1 )
matrix.power( A, 0 )
matrix.power( A, 1 )
matrix.power( A, 2 )

matrixcalc

Collection of functions for matrix calculations

v1.0-3
GPL (>= 2)
Authors
Frederick Novomestky <fnovomes@poly.edu>
Initial release
2012-09-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.