简短的回答
计算非整数指数的矩阵幂的方式中的数值精度问题.
答案很长
Z = X^y is X to the y power if y is a scalar and X is square. If y
is an integer greater than one, the power is computed by repeated
squaring. For other values of y the calculation involves
eigenvalues and eigenvectors.
一^ INF
[S,D] = eig(a);
result = S * D^inf * inv(S);
(很可能逆矩阵实际上并未计算,但该方法与此相当).
对于你,我们得到
>> a = [1/2 1/4 1/4; 1/4 1/2 1/4; 1/4 1/4 1/2];
>> [S,D] = eig(a)
>> format long
>> D
D =
0.250000000000000 0 0
0 0.250000000000000 0
0 0 1.000000000000000
看起来很无辜.可是等等:
>> D(3,3)-1
ans =
-3.330669073875470e-16
由于D的所有条目的绝对值严格小于1,因此D ^ inf给出全零:
>> D^inf
ans =
0 0 0
0 0 0
0 0 0
然后S * D ^ inf * inv(S)也是如此,它解释了^ inf的结果.
一^ 1e99
指数1e99超过了可以精确表示为双精度浮点数(is 2 ^ 53)的最大整数,但它仍然表示为整数:
>> mod(1e99,1)
ans =
0
因此,通过重复平方的方法计算^ 1e99.使用此方法,结果中的所有条目都保持接近0.3333:
>> a^10
ans =
0.333333969116211 0.333333015441895 0.333333015441895
0.333333015441895 0.333333969116211 0.333333015441895
0.333333015441895 0.333333015441895 0.333333969116211
>> a^100
ans =
0.333333333333333 0.333333333333333 0.333333333333333
0.333333333333333 0.333333333333333 0.333333333333333
0.333333333333333 0.333333333333333 0.333333333333333