Previous Up Next

15.6.5  Gram-Schmidt orthonormalization

The gramschmidt command uses the Gram-Schmidt procedure to find an orthonormal set of vectors with the same span as a given set.

Examples

normal(gramschmidt([[1,1,1],[0,0,1],[0,1,0]]))

or:

normal(gramschmidt([[1,1,1],[0,0,1],[0,1,0]],dot))
     
⎡
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎢
⎣
√
3
3
√
3
3
√
3
3
−
√
6
6
−
√
6
6
√
6
3
−
√
2
2
√
2
2
0
⎤
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎥
⎦
          

Define a scalar product on the vector space of polynomials by P· Q=∫−11P(x) Q(x) dx. Then:

p_scal(p,q):=integrate(p*q,x,-1,1):; gramschmidt([1,1+x],p_scal)
     
⎡
⎢
⎢
⎢
⎢
⎢
⎣
1
√
2
,
1+x−1
√
6
3
⎤
⎥
⎥
⎥
⎥
⎥
⎦
          

Previous Up Next