Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Gramschmidt Calculator

Gramschmidt

Function: gramschmidt (<x>)

load (eigen);
 x: matrix ([1, 2, 2, -1], [1, 1, -5, 3], [3, 2, 8, -7]);
 y: gramschmidt (x);
 map (innerproduct, [y[1], y[2], y[3]], [y[2], y[3], y[1]]);
 load (eigen);
 ip (f, g) := integrate (f * g, u, a, b);
 y : gramschmidt ([1, sin(u), cos(u)], ip), a= -%pi/2, b=%pi/2;
 map (ip, [y[1], y[2], y[3]], [y[2], y[3], y[1]]), a= -%pi/2, b=%pi/2;

Function: gramschmidt (<x>, <F>) Carries out the Gram-Schmidt orthogonalization algorithm on <x>, which is either a matrix or a list of lists. <x> is not modified by gramschmidt. The inner product employed by gramschmidt is <F>, if present, otherwise the inner product is the function innerproduct.

If <x> is a matrix, the algorithm is applied to the rows of <x>. If <x> is a list of lists, the algorithm is applied to the sublists, which must have equal numbers of elements. In either case, the return value is a list of lists, the sublists of which are orthogonal and span the same space as <x>. If the dimension of the span of <x> is less than the number of rows or sublists, some sublists of the return value are zero.

factor is called at each stage of the algorithm to simplify intermediate results. As a consequence, the return value may contain factored integers.

load(eigen) loads this function.

Example:

Gram-Schmidt algorithm using default inner product function.

          (%i1) load (eigen)$
          (%i2) x: matrix ([1, 2, 3], [9, 18, 30], [12, 48, 60]);
                                   [ 1   2   3  ]
                                   [            ]
          (%o2)                    [ 9   18  30 ]
                                   [            ]
                                   [ 12  48  60 ]
          (%i3) y: gramschmidt (x);
                                 2      2            4     3
                                3      3   3 5      2  3  2  3
          (%o3)  [[1, 2, 3], [- ---, - --, ---], [- ----, ----, 0]]
                                2 7    7   2 7       5     5
          (%i4) map (innerproduct, [y[1], y[2], y[3]], [y[2], y[3], y[1]]);
          (%o4)                       [0, 0, 0]

Gram-Schmidt algorithm using a specified inner product function.

          (%i1) load (eigen)$
          (%i2) ip (f, g) := integrate (f * g, u, a, b);
          (%o2)          ip(f, g) := integrate(f g, u, a, b)
          (%i3) y : gramschmidt ([1, sin(u), cos(u)], ip), a= -%pi/2, b=%pi/2;
                                         %pi cos(u) - 2
          (%o3)              [1, sin(u), --------------]
                                              %pi
          (%i4) map (ip, [y[1], y[2], y[3]], [y[2], y[3], y[1]]), a= -%pi/2, b=%pi/2;
          (%o4)                       [0, 0, 0]

(%o1)                                true
(%i2) 

Gramschmidt Example

Related Examples

gramschmidt-integrate-load

load(eigen);

V:[[1, 0, 0], [0, t, ...

V1:[1, t, t^2, t^3];

Calculate

gramschmidt-load-matrix

load (eigen);

x: matrix ([1,1,0],[...

y: gramschmidt (x);

Calculate

gramschmidt-load-matrix

load (eigen);

x: matrix ([1,0,0], ...

y: gramschmidt (x);

Calculate

gramschmidt-matrix

x : matrix ([1, 2, 3]...

y: gramschmidt (x);

Calculate

gramschmidt-load-matrix

load (eigen);

x: matrix ([0,1,0,1]...

y: gramschmidt (x);

Calculate

gramschmidt-load-matrix

load (eigen);

x: matrix ([5, 6, 3]...

y: gramschmidt (x);

Calculate

gramschmidt-load-matrix-sqrt

load (eigen);

v1: vector(1, -1/sqr...

v2: vector(1, sqrt(2));

Calculate

gramschmidt-matrix

v1:[1,5,2];

v2:[0,-1,0];

v3:[3,0,-3];

Calculate

gramschmidt-integrate-load-map-matrix

load (eigen);

x: matrix ([1, 2, 3]...

y: gramschmidt (x);

Calculate

gramschmidt-load-matrix

load (eigen);

x: matrix ([-10,-4,-6...

y: gramschmidt (x);

Calculate