This handout uses examples from the course MCS 320: Introduction to Symbolic Computation by UIC
restart;
a := Array(1..3);
a[3] := 4;
a;
h := (i,j) -> i * j mod 13;
h(3,5);
M := Matrix(5,5,h);
M := Matrix(13,13,h);
M[11,12];
A := convert(M,Array);
A := Array(0..1,1..2,[[1,2],[3,4]]);
convert(A,listlist);
M := convert(A,Matrix);
with(LinearAlgebra);
Determinant(A);
Determinant(M);
A := RandomMatrix(3,3);
whattype(A);
b := RandomMatrix(3,1);
whattype(b);
b := convert(b,Vector);
whattype(b);
X := [seq(x[i],i=1..3)];
eqs := GenerateEquations(A,X,b);
sols := solve(eqs);
AA,bb := GenerateMatrix(eqs,X);
B := RandomMatrix(3);
A+B;
MatrixAdd(A,B);
A*B;
A.B;
MatrixMatrixMultiply(A,B);
B.A;
A.b;
MatrixVectorMultiply(A,b);
<A|b>;
Determinant(A);
MatrixInverse(A).b;
sols;
P,L,U := LUDecomposition(A);
P.A;
L.U;
Determinant(A);
Determinant(U);
y := ForwardSubstitute(L,b); # solve L*y = b
sol := BackwardSubstitute(U,y); # solve U*x = y
A.sol;
b;
Eigenvalues(A);
fA := convert(A,float);
lambda := Eigenvalues(fA);
V := Eigenvectors(fA);
ev1 := Column(V[2],1);
fA.ev1;
lambda[1]*ev1;
d := DiagonalMatrix(V[1]);
A.V[2];
V[2].d;
V[2].d.MatrixInverse(V[2]);
A;
GramSchmidt(A);
v := seq(Column(A,i),i=1..ColumnDimension(A));
b := GramSchmidt({v});
Matrix(3,3,(i,j) -> DotProduct(b[i],b[j]));
ob := map(x->x/Norm(x,2),b);
Matrix(3,(i,j) -> ob[i].ob[j]);