Let M := Matrix([[0.94, 0.09], [0.06, 0.91]]); and u[0] = Vector([0.8, 0.2]);. What command could I use to get u^k = M^k u_0 for k=5, 10, ..., 50?
Let M := Matrix([[0.94, 0.09], [0.06, 0.91]]); and u[0] = Vector([0.8, 0.2]);. What command could I use to get u^k = M^k u_0 for k=5, 10, ..., 50?
I'm guessing you mistyped, and you want to call the result of M^k . u[0] as u[k] rather than (as you wrote it) u^k.
restart;
with(LinearAlgebra):
M := Matrix([[0.94, 0.09], [0.06, 0.91]]):
u[0] := Vector([0.8, 0.2]):
# One (inefficient) way
seq(M^k . u[0],k=5..50,5);
# Another way
M5 := M^5:
for k from 5 to 50 by 5 do
u[k] := M5 . u[k-5];
end do;
# Another way
(evals,evecs) := simplify([Eigenvectors(M)])[]:
seq(evecs . DiagonalMatrix(map(`^`,evals,k))
. evecs^(-1).u[0],
k=5..50,5);