
-- Input for page MatrixMoreFunctionsPage
)clear all

m1 := matrix([[1,-2,1],[4,2,-4]])
m2 := matrix([[0,1,2],[2,3,4],[3,4,5]])
m3 := matrix([[1,2,3],[2,4,6]])
m1 + m3
100 * m1
m1 * m2
-m1 + m3 * m2
m2 * m1
v := vector([1,0,1])
m3 * v
m5 : MATRIX POLY INT := new(4,4,1)
vars : LIST POLY INT := [x,y,z,u]
for i in 1..4 repeat for j in 1..3 repeat m5(i,j + 1) := (vars.i)**j
m5
trace(m5)
det := determinant(m5)
factor(det)
m6 := matrix([[1,2,1],[-2,3,4],[-1,5,6]])
m6inv := inverse(m6)
m6 * m6inv
m7 := matrix([[1,2,1],[-2,3,4],[-1,5,5]])
inverse(m7)
determinant(m7)
m8 : SQMATRIX(2,INT) := matrix([[1,2],[2,3]])
m9 : SQMATRIX(2,INT) := matrix([[1,1],[0,1]])
m8 ** 2
m9 ** 3
mm : SQMATRIX(2,SQMATRIX(2,INT)) := matrix([[1,m8],[m9,0]])
100 * mm
m8 * mm
mm * mm
p : POLY SQMATRIX(2,INT) := m8 * x**2 + m9 * x + m8 * m9
100 * p
m8 * p
p * p

-- Input for page MatrixCanonicalFormsPage
)clear all

m1 := matrix([[0,4,1],[5,3,-7],[-5,5,9]])
rank(m1)
rowEchelon(m1)
nullSpace(m1)
t := eigenMatrix(m1)
inverse(t) * m1 * t

-- Input for page MatrixBasicFunctionsPage
)clear all

m1 := matrix([[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7]])
m2 := matrix([[1,0,2],[20,30,10],[0,200,100]])
(m3,m4) : MATRIX PF 7
m3 := matrix([[1,0,1],[5,0,1]])
m4 := matrix([[1],[2],[5],[6]])
m2(1,1)
m2(1,1) := 99
m2
row(m2,2)
setRow!(m2,2,vector [66,77,88])
r := column(m2,1)
setColumn!(m2,2,r)
nrows(m1)
m5 : MATRIX INT := new(12,12,0)
for i in 2..nrows(m5) repeat m5(i-1,i):= 1
m5
d : MATRIX INT := diagonalMatrix([1,2,3,2,1])
m6 := matrix([[0,1,2,3,4],[5,6,7,8,9],[10,11,12,13,14]])
m7 := subMatrix(m6,1,3,2,4)
horizConcat(m6,m7)
vertConcat(m6,subMatrix(m6,1,1,1,5))
transpose(m6)
setsubMatrix(m6,1,3,1,3,transpose(subMatrix(m6,1,3,1,3)))
m6
m8 := matrix([[1,2],[3,4]])
m9 := m8
m10 := copy(m8)
m8(1,1) := 1000000
m8
m9
m10

-- Input for page EigenPage
)clear all

m1 : MATRIX FRAC INT := [[1,2,1],[2,1,-2],[1,-2,4]]
leig := eigenvalues(m1)
eigenvector(first(leig),m1)
eigenvectors(m1)
radicalEigenvectors(m1)
eigenMatrix(m1)
m2 : MATRIX FRAC INT := [[-5,-2],[18,7]]
eigenMatrix(m2)
m3 : MATRIX FRAC INT := [[1,2],[2,1]]
orthonormalBasis(m3)
