我认为你应该使用
for (t in 1:Periods) {
V(g)$prob <- M %*% matrix(V(g)$prob)
}
如果要跟踪动态,可以使用Reduce
Reduce(
function(x, A) A %*% x,
rep(list(M), Periods),
init = matrix(V(g)$prob),
accumulate = TRUE
)
这让你V(g)$prob
随着时间的推移从0
到length(Periods)
[[1]]
[,1]
[1,] 0.5
[2,] 0.0
[3,] 0.5
[4,] 0.0
[5,] 0.0
[6,] 0.0
[7,] 0.0
[8,] 0.0
[9,] 0.0
[10,] 0.0
[[2]]
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
[8,] 8
[9,] 9
[10,] 10
[[3]]
[,1]
[1,] 55
[2,] 110
[3,] 165
[4,] 220
[5,] 275
[6,] 330
[7,] 385
[8,] 440
[9,] 495
[10,] 550
[[4]]
[,1]
[1,] 3025
[2,] 6050
[3,] 9075
[4,] 12100
[5,] 15125
[6,] 18150
[7,] 21175
[8,] 24200
[9,] 27225
[10,] 30250
[[5]]
[,1]
[1,] 166375
[2,] 332750
[3,] 499125
[4,] 665500
[5,] 831875
[6,] 998250
[7,] 1164625
[8,] 1331000
[9,] 1497375
[10,] 1663750
[[6]]
[,1]
[1,] 9150625
[2,] 18301250
[3,] 27451875
[4,] 36602500
[5,] 45753125
[6,] 54903750
[7,] 64054375
[8,] 73205000
[9,] 82355625
[10,] 91506250
[[7]]
[,1]
[1,] 503284375
[2,] 1006568750
[3,] 1509853125
[4,] 2013137500
[5,] 2516421875
[6,] 3019706250
[7,] 3522990625
[8,] 4026275000
[9,] 4529559375
[10,] 5032843750
[[8]]
[,1]
[1,] 27680640625
[2,] 55361281250
[3,] 83041921875
[4,] 110722562500
[5,] 138403203125
[6,] 166083843750
[7,] 193764484375
[8,] 221445125000
[9,] 249125765625
[10,] 276806406250
[[9]]
[,1]
[1,] 1.522435e+12
[2,] 3.044870e+12
[3,] 4.567306e+12
[4,] 6.089741e+12
[5,] 7.612176e+12
[6,] 9.134611e+12
[7,] 1.065705e+13
[8,] 1.217948e+13
[9,] 1.370192e+13
[10,] 1.522435e+13
[[10]]
[,1]
[1,] 8.373394e+13
[2,] 1.674679e+14
[3,] 2.512018e+14
[4,] 3.349358e+14
[5,] 4.186697e+14
[6,] 5.024036e+14
[7,] 5.861376e+14
[8,] 6.698715e+14
[9,] 7.536054e+14
[10,] 8.373394e+14
[[11]]
[,1]
[1,] 4.605367e+15
[2,] 9.210733e+15
[3,] 1.381610e+16
[4,] 1.842147e+16
[5,] 2.302683e+16
[6,] 2.763220e+16
[7,] 3.223757e+16
[8,] 3.684293e+16
[9,] 4.144830e+16
[10,] 4.605367e+16