matrix.power: Matrix Raised to a Power

Description Usage Arguments Details Value Author(s) References Examples

View source: R/matrix.power.R

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

1

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

1
2
3
4
5
6
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 )

Example output

           [,1]       [,2]
[1,]  0.5555556 -0.4444444
[2,] -0.4444444  0.5555556
           [,1]       [,2]
[1,] -0.3333333  0.6666667
[2,]  0.6666667 -0.3333333
     [,1] [,2]
[1,]    1    0
[2,]    0    1
     [,1] [,2]
[1,]    1    2
[2,]    2    1
     [,1] [,2]
[1,]    5    4
[2,]    4    5

matrixcalc documentation built on May 2, 2019, 1:45 p.m.