QuickGS.mws

Linear Algebra Powertool

Quick Gram-Schmidt with Maple

Worksheet by Russell Blyth

> with(linalg);

Warning, the protected names norm and trace have been redefined and unprotected

[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...
[BlockDiagonal, GramSchmidt, JordanBlock, LUdecomp,...

After loading the linalg package, it is worthwhile to look at the help page for the GramSchmidt command that Maple provides.

> ?GramSchmidt

To demonstrate the command, I want to construct a series of 5 vectors in which the ith vector has a 1 in the first i positions and fills out with zeroes.

> del := (x,y) -> piecewise(x<y,0,1);
for i from 1 to 5 do
vec[i] := vector(5,[seq(del(i,j),j=1..5)]); od;

del := proc (x, y) options operator, arrow; piecewi...

vec[1] := vector([1, 0, 0, 0, 0])

vec[2] := vector([1, 1, 0, 0, 0])

vec[3] := vector([1, 1, 1, 0, 0])

vec[4] := vector([1, 1, 1, 1, 0])

vec[5] := vector([1, 1, 1, 1, 1])

Now we look at the results of Gram Schmidt on the set of vectors in the two obvious orders.

> GramSchmidt([seq(vec[k],k=1..5)]);

[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],...

> GramSchmidt([seq(vec[6-k],k=1..5)]);

[[1, 1, 1, 1, 1], [1/5, 1/5, 1/5, 1/5, -4/5], [1/4,...

>

>