Basis and Orthogonal Functions

This is a generalization of the Fourier series.  The orthogonality of the trignometric functions
(i.e., ∫_0^1Sin[2 π n  x]  Sin[2 π m x]dx =

1/2 if    n=m
0 if   n≠m
)
was the key to the ``trick''  that permitted calculation of the Fourier coefficients.
This is a generalization of dot or scalar vector product, but for functions.  The norm that is defined above for the trignometric functions is fairly simple, it is the l2-norm:
f(x) • g(x) ≡  f(x) g(x) dx        (l2-norm)
However, there can be many other types of norms, for instance a Gaussian weighted l2-norm
f(x) • g(x) ≡  f(x) g(x) ^(-x^2) dx        (Gaussian weighted l2-norm)
and many many others.

Both the norm and the domain of integration must be defined.

To represent a function in terms of a sum of basis functions with coefficients, a orthogonality relation must be obtained for the basis functions.
We will do a few examples of orthogonality relations, the coefficients can be found as a straightforward extension of the Fourier method.

Establish by example the orthogonality relations for the Lengendre Polynomials

In[115]:=

Table[Integrate[LegendreP[i, x] LegendreP[5, x], {x, -1, 1}], {i, -10, 10}]

Out[115]=

{0, 0, 0, 0, 2/11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2/11, 0, 0, 0, 0, 0}

Calculate the norm as a function of the order of the Legendre polynomial

In[116]:=

Table[Integrate[LegendreP[i, x] LegendreP[i, x], {x, -1, 1}], {i, 0, 15}]

Out[116]=

{2, 2/3, 2/5, 2/7, 2/9, 2/11, 2/13, 2/15, 2/17, 2/19, 2/21, 2/23, 2/25, 2/27, 2/29, 2/31}

Make a guess at what the norm looks like

In[117]:=

Table[2/(2 i + 1), {i, 0, 15}]

Out[117]=

{2, 2/3, 2/5, 2/7, 2/9, 2/11, 2/13, 2/15, 2/17, 2/19, 2/21, 2/23, 2/25, 2/27, 2/29, 2/31}

The orthogonality relation is plausibly: ∫_ (-1)^1LegendreP[i,x]  LegendreP[j,x]dx =

2/(2i + 1) if | i|=|j|
0 if |i |≠|j|

In fact, this is correct

Representation of a function in terms of the Legendre basis

This demonstrates how to take a specific set (basis) of orthogonal functions and represent an arbitrary function in terms of an infinite sum of terms involving the basis functions, each with its own coefficient.  This is a direct analog to what we did with Fourier series.

A function to calculate the coefficients

In[118]:=

LegendreCoefficient[f_, i_]    := (2 i + 1)/2Integrate[f[x] LegendreP[i, x], {x, -1, 1}]

Use Legendre functions to represent the function ^(-x^2)

This is an example function:

In[119]:=

AFunc[x_] := Exp[-x^2]

Calculate the first twenty coefficients

In[120]:=

Lcofs = Table[LegendreCoefficient[AFunc, i], {i, 0, 20}]

Out[120]=

Construct a vector of the eigenfunctions

In[121]:=

Lfuncs = Table[LegendreP[i, x], {i, 0, 20}] ;

General :: spell1 : Possible spelling error: new symbol name \"Lfuncs\" is similar to existing symbol \"funcs\".  More…

Visualize the approximation of the first twenty terms

In[122]:=

Plot[{Lcofs . Lfuncs, Exp[-x^2]}, {x, -1, 1}, PlotStyle→ {{Hue[0], Thickness[0.01]}, {Hue[0.66], Thickness[0.005]}}]

[Graphics:HTMLFiles/Lecture-27_20.gif]

Out[122]=

-Graphics -

Try another function

In[123]:=

AFunc[x_] := Sin[5x] Sin[(5 + 1/10) x]

Coefficients out to 10 terms

In[124]:=

Lcofs = Table[LegendreCoefficient[AFunc, i], {i, 0, 10}]

Out[124]=

In[125]:=

Lfuncs = Table[LegendreP[i, x], {i, 0, 10}] ;

Visualize the approximation

In[126]:=

Plot[{Lcofs . Lfuncs, AFunc[x]}, {x, -1, 1}, PlotStyle→ {{Hue[0], Thickness[0.01]}, {Hue[0.66], Thickness[0.005]}}]

[Graphics:HTMLFiles/Lecture-27_27.gif]

Out[126]=

-Graphics -


Created by Mathematica  (November 26, 2005) Valid XHTML 1.1!