matrix.powerni: Matrix Power of Non Integer

Description Usage Arguments Value Author(s) References Examples

Description

Square matrix power of non integer.

Usage

1

Arguments

A

square matrix

p

non integer (real) number

Value

square matrix

Author(s)

Josef Brejcha

References

Donald R. Burleson, Ph.D., "ON NON-INTEGER POWERS OF A SQUARE MATRIX", http://www.blackmesapress.com/Eigenvalues.htm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require(MPkn)
require(matrixcalc)
matmult <- function(A, B){
	C = matrix(numeric(4), 2, 2)
	for (i in 1:2){
		for (j in 1:2){ C[i, j] = sum(A[i, ]*B[, j])}
	}
	return(C)
}
I = diag(1, 2, 2)
P = matrix(c(0.9, 0.3, 0.1, 0.7), 2, 2)
M1 = P
M2 = matmult((I + P), M1)
M4 = matmult((I + t(matrix.power(P, 2))), M2)
M8 = matmult((I + t(matrix.power(P, 4))), M4)
M16 = matmult((I + t(matrix.power(P, 8))), M8)
## =====================
Q = list()
Q[[1]] = M1
Q[[2]] = matmult(M2, matrix.inverse(M1)) - I
Q[[3]] = matrix.powerni(matmult(M4, matrix.inverse(M2)) - I, 1/2)
Q[[4]] = matrix.powerni(matmult(M8, matrix.inverse(M4)) - I, 1/4)
Q[[5]] = matrix.powerni(matmult(M16, matrix.inverse(M8)) - I, 1/8)
print("Q"); print(Q)
S = as.matrix(Q[[1]], 2, 2)
for (i in 2:5){
  S = S + as.matrix(Q[[i]], 2, 2)
}
Qs = S/5
print("Qs"); print(Qs)

Example output

Loading required package: matrixcalc
[1] "Q"
[[1]]
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

[[2]]
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

[[3]]
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

[[4]]
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

[[5]]
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

[1] "Qs"
     [,1] [,2]
[1,]  0.9  0.1
[2,]  0.3  0.7

MPkn documentation built on May 2, 2019, 2:36 a.m.