;; Given a list G1, G2, G3, ... of vectors, we compute ; an orthogonal system ; B1, B2, B3, ... with the same span. ;; A more interesting example, in 4-dim'al space. % (setq G1 (mat-make-initseq 4 1 '(1 0 3 0))) [ 1 ] [ 0 ] [ 3 ] [ 0 ] % (setq G2 (mat-make-initseq 4 1 '(4 2 2 -2))) [ 4 ] [ 2 ] [ 2 ] [ -2 ] % (setq G3 (mat-make-initseq 4 1 '(-1 0 -1 2))) [ -1 ] [ 0 ] [ -1 ] [ 2 ] ;; Technically, B1 is the orthogonal-vector of G1 ;; with respect to the trivial-subspace. % (setq B1 G1) [ 1 ] [ 0 ] [ 3 ] [ 0 ] % (setq B2 (mat-sub G2 (proj G2 B1))) ;Is Orth_B1(G2) [ 3 ] [ 2 ] [ -1 ] [ -2 ] ;; This next is the orthogonal-vector of G3 ;; w.r.t Span(B1, B2). % (setq B3 (mat-sub G3 (mat-add (proj G3 B1) (proj G3 B2))) ) [ 2/5 ] [ 2/3 ] [ -2/15 ] [ 4/3 ] ;; Let's multiply to make all the entries integers. % (setq B3 (mat-scal-mult 15 B3)) [ 6 ] [ 10 ] [ -2 ] [ 20 ] ;; We verify that the pairwise inner-products of the ;; B-vectors are zero: % (list (ip B1 B2) (ip B1 B3) (ip B2 B3)) -> (0 0 0) ;; Let's check that Span(B1, B2, B3) = Span(G1, G2, G3). % (setq bob (mat-Horiz-concat B1 B2 B3 G1 G2 G3)) [ 1 3 6 1 4 -1 ] [ 0 2 10 0 2 0 ] [ 3 -1 -2 3 2 -1 ] [ 0 -2 20 0 -2 2 ] % (rref-mtab-beforecol bob) JK: Found 3 pivots before the sixth column. c0 c1 c2 c3 c4 c5 |---------------------------------| r0 | 1 0 0 1 1 -2/5 | r1 | 0 1 0 0 1 -1/3 | r2 | 0 0 1 0 0 1/15 | r3 | 0 0 0 0 0 0 | ; Yay, Gram-Schmidt. |---------------------------------|