04GrmSmt.mws

Partial Differential Equations PowerTool

by Dr. Jim Herod

Section 1.4: The Gramm-Schmidt Process

Maple Packages for Section 1.4

>    restart;

>   

At this point, we should realize that having a set of orthogonal vectors { theta[1] , theta[2] , theta[3] , ... } is an important tool. We understand that we can convert these to an orthonormal set by dividing by the norm of each:

                            phi[n] = theta[n]/abs(theta[n])  .

Such a conversion produces a set of orthonormal vectors: { phi[1] , phi[2] , phi[3] , ... }.

In the previous Section 1.3, we saw that the closest element in the span of some finite number of { phi[1] , phi[2] , phi[3] , ... } is

                              approximation for f   =   sum(a[p]*phi[p],p)  ,

where

                                           a[p]  = < f, phi[p]  >.

To be sure the conversion to orthonormal vectors is not a problem, we say the redundant: we get the best approximation if the collection is orthogonal,

                             approximation for f   =   sum(b[p]*theta[p],p)  ,

choose

                                         b[p]  = < f, theta[p]  > /   abs(theta[p])^2 .

This result about approximating functions is why Fourier Series is a topic of study for scientists and engineers.

Convinced that orthogonal families are important, we ask how they can be generated and since, as we have seen, there might be several orthogonal families in the same space, how can we know which ones to choose? Regarding the second question, there is good news: for many linear partial differential equations with boundary conditions, we do not have to choose the orthogonal family. It arises naturally with the problem. Concerning the first question, there are many ways to generate orthogonal families. In this section, we present one classical method known as the Gramm-Schmidt Process.

It is assumed that a linearly independent set

                                      V  = { v[1], v[2], v[3]  , ... }

is given. The Gramm-Schmidt Process generates an orthogonal family { theta[1] , theta[2] , theta[3] , ... } having these properties:

(1) for each integer n, the generation of { theta[1] , theta[2] , theta[3] , ..., theta[n] } uses { v[1], v[2], v[3]  , ... , v[n] }, and

(2) for each n, the collection { theta[1] , theta[2] , theta[3] , ..., theta[n] }spans exactly the same subspace that { v[1], v[2], v[3]  , ... , v[n] } spans.

Below, we present the process and give an example. We generate an orthogonal family, not necessarily an orthonormal family. We begin with the linearly independent vectors as described in the set V  and generate the orthogonal family.

The Gramm-Schmidt Process

Take theta[1]  to be v[1] .

    theta[1]  = v[1] .

Form theta[2]  from v[2]  and theta[1] .

    theta[2]  = v[2]-`<,>`(v[2],theta[1])*theta[1]/`<,>`(theta[1],theta[1])  ,

Form theta[3]  from v[3] , theta[1] ,  and theta[2] .

    theta[3]  = v[3]-`<,>`(v[3],theta[1])*theta[1]/`<,>`(theta[1],theta[1])-`<,>`(v[3],theta[2])*theta[2]/`<,>`(theta[2],theta[2])  ,

   etc.

 

Question: Show that these three are orthogonal.

Indication of the Answer

We show that < theta[2]  , theta[1]  > = 0. We compute:

   < theta[2] , theta[1]  > = <   v[2]-`<,>`(v[2],theta[1])*theta[1]/`<,>`(theta[1],theta[1])  , theta[1] >

= < v[2]  , v[1]  >  -  < v[2] , theta[1] > < theta[1] , v[1] > / < theta[1] , theta[1] >

= 0

The remaining two dot products work similarly.

>   

>   

To illustrate these ideas, we choose a function in C([-1, 1]) and ask what cubic polynomial makes the best approximation, in the sense that the usual norm is as small as possible

An Example in C([-1,1])

     We perform the Gramm Schmidt Process on the functions 1, x , x^2 , x^3  in C([-1,1]).  Since we form the quotient

                `<,>`(f,g)*g/`<,>`(g,g)

so many times, why not make that a special function of f and g? In this case, the dot product is an integral from -1 to 1. Thus, for convenience, we define a function of f and g that we will call P.

>    P:=(f,g)->g(x)*int(f(t)*g(t),t=-1..1)/int(g(t)^2,t=-1..1);

P := proc (f, g) options operator, arrow; g(x)*int(f(t)*g(t),t = -1 .. 1)/int(g(t)^2,t = -1 .. 1) end proc

Next we define the functions v[0]  through v[3]  .

>    v[0]:=x->1;
v[1]:=x->x;
v[2]:=x->x^2;
v[3]:=x->x^3;

v[0] := 1

v[1] := proc (x) options operator, arrow; x end proc

v[2] := proc (x) options operator, arrow; x^2 end proc

v[3] := proc (x) options operator, arrow; x^3 end proc

>    theta[0]:=v[0];

theta[0] := 1

>    form:=v[1](x)-P(v[1],theta[0]);
theta[1]:=unapply(form,x);

form := x

theta[1] := proc (x) options operator, arrow; x end proc

>    form:=v[2](x)-P(v[2],theta[0])
             -P(v[2],theta[1]);
theta[2]:=unapply(form,x);

form := x^2-1/3

theta[2] := proc (x) options operator, arrow; x^2-1/3 end proc

>    form:=v[3](x)-P(v[3],theta[0])
             -P(v[3],theta[1])
             -P(v[3],theta[2]);
theta[3]:=unapply(form,x);

form := x^3-3/5*x

theta[3] := proc (x) options operator, arrow; x^3-3/5*x end proc

Reality check that we did the Gramm Schmidt process correctly.  Compute the dot product of each pair of the theta functions.

>    int( theta[1](x)*theta[2](x), x=-1..1 );
int( theta[2](x)*theta[3](x), x=-1..1 );
int( theta[1](x)*theta[3](x), x=-1..1 );

0

0

0

     We find the "best approximation" in C([-1, 1]) for the absolute value function with a polynomial of degree three. We follow these four steps.

STEP 1: Perform the Gramm Schmidt Process on 1, x , x^2 , x^3  .

We did that above. We got

>    theta[0](x);
theta[1](x);
theta[2](x);
theta[3](x);

1

x

x^2-1/3

x^3-3/5*x

STEP 2: Form the Fourier coefficients.

>    a[0]:=int(abs(t)*theta[0](t),t=-1..1)/int(theta[0](t)^2,t=-1..1);
a[1]:=int(abs(t)*theta[1](t),t=-1..1)/int(theta[1](t)^2,t=-1..1);
a[2]:=int(abs(t)*theta[2](t),t=-1..1)/int(theta[2](t)^2,t=-1..1);
a[3]:=int(abs(t)*theta[3](t),t=-1..1)/int(theta[3](t)^2,t=-1..1);

a[0] := 1/2

a[1] := 0

a[2] := 15/16

a[3] := 0

STEP 3: Write down the answer.

>    approx:=x->sum(a[p]*theta[p](x),p=0..3);
approx(x);

approx := proc (x) options operator, arrow; sum(a[p]*theta[p](x),p = 0 .. 3) end proc

3/16+15/16*x^2

You might like to see the graph of these two superimposed.

>    plot([abs(x),approx(x)],x=-1..1);

[Maple Plot]

>   

Unassisted Maple

Perhaps it is no surprise that Maple already knows these polynomials on [-1, 1]. After all, polynomial approximations for functions are commonly made. Here is how to access these in Maple. The routine we're interested in is called P .  We form a listing of the first four for comparison with the ones we generated. These polynomials are called Legendre Polynomials .

>    with( orthopoly );

Warning, the name P has been redefined

[G, H, L, P, T, U]

>    theta[0](x);P(0,x);

1

1

>    theta[1](x);P(1,x);

x

x

>    theta[2](x);P(2,x);

x^2-1/3

-1/2+3/2*x^2

>    theta[3](x);P(3,x);

x^3-3/5*x

5/2*x^3-3/2*x

We see that Maple's listing of the Legendre Polynomials differs from our computations only by a constant factor. If we normalized both Maple's listing and ours we would have the same results.

>   

>   

 

EMAIL: herod@math.gatech.edu   or    jherod@tds.net

URL: http://www.math.gatech.edu/~herod

Copyright ©  2003  by James V. Herod

All rights reserved