# we can enter a matrix into Maple in several ways
# the following way enters the matrix by specifying the columns
A := <<1, 1>|<1, 0>>;
# The following way enters the matrix by specifying the rows
with(LinearAlgebra):
A := Matrix([[1,1], [1, 0]]);
# You multiply matrices using a period for the
# multiplication symbol. That tells Maple that
# you want to do matrix multiplication rather
# than entry-wise multiplication.
A.A;
# You can also take an arbitrary power of a matrix:
with(LinearAlgebra):
MatrixPower(A, 5);
# You can use this to find the long-run dynamics
# with any initial population size vector, X
with(LinearAlgebra):
X := <1, 0>;
MatrixPower(A, 10).X;
#You can find the largest eigenvalue of A using
#code like:
with(LinearAlgebra):
phi := Eigenvalues(A)[1]
# You should find that
phi := (1 + sqrt(5))/2;
# You can compute the long-run frequencies in each
# strata with code like:
with(LinearAlgebra):
W := evalf(MatrixPower(A, 5).X/(phi^5));
W := W/(W[1]+W[2]);
# You can compute the eigenvectors with code like:
with(LinearAlgebra):
E := Eigenvectors(A, output='vectors');
evalf(E[1..2, 1]/(E[1,1] + E[2,1]));