--Copyright The Numerical Algorithms Group Limited 1991.

)cl all
v(i:INT):DIRPROD(5, FRAC INT) ==
   directProduct vector [i / (i + j) for j in 0..4]
-- Create several elements of Q^5
V := vector [v i for i in 1..6]
-- Are they linearly dependent over Z?
linearlyDependentOverZ? V
-- Get the linear dependence relation over Z explicitly
linearDependenceOverZ V
-- the Vi's are linearly dependent, express V.2 in terms of the others
solveLinearlyOverQ(delete(V, 2), V.2)
w(i:INT):SQMATRIX(2, INT) ==
   squareMatrix matrix [[i, i + 1], [i - 1, -i]]
-- Create several elements of Z(2)
W := vector [w i for i in 1..3]
-- Are they linearly dependent over Z?
linearlyDependentOverZ? W
-- Get the linear dependence relation over Z explicitly
linearDependenceOverZ W
-- the Wi's are linearly dependent, express W.2 in terms of the others
solveLinearlyOverQ(delete(W, 2), W.2)
