Basis and Orthogonal Functions

This is a generalization of the Fourier series.  The orthogonality of the trignometric functions
(i.e., 0 1 Sin[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 1 LegendreP[i,x]  LegendreP[j,x]dx =

2 2 i + 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 2 Integrate [ 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]=

{ 1 2 π Erf [ 1 ] , 0 , 5 ( - 6 + π Erf [ 1 ] ) 8 , 0 , 9 ( - 230 + 57 π Erf [ 1 ] ) 64 , 0 , 13 ( - 7938 + 1955 π Erf [ 1 ] ) 256 , 0 , 17 ( - 1579218 + 388955 π Erf [ 1 ] ) 4096 , 0 , 147 ( - 14740550 + 3630537 π Erf [ 1 ] ) 16384 , 0 , 25 ( - 16734510494 + 4121641293 π Erf [ 1 ] ) 131072 , 0 , 29 ( - 1621927519250 + 399474095163 π Erf [ 1 ] ) 524288 , 0 , 33 ( - 1463595204914978 + 360477495590355 π Erf [ 1 ] ) 16777216 , 0 , 37 ( - 188369607025634322 + 46394661555265595 π Erf [ 1 ] ) 67108864 , 0 , 41 ( - 54487481501236728090 + 13420043196802227271 π Erf [ 1 ] ) 536870912 }

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… "Possible spelling error: new symbol name \\\"\\!\\(Lfuncs\\)\\\" is similar to existing symbol \\\"\\!\\(funcs\\)\\\". \\!\\(\\*ButtonBox[\\\"More\[Ellipsis]\\\", ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, ButtonData:>\\\"General::spell1\\\"]\\)"

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_1.gif]

Out[122]=

Graphics

Try another function

In[123]:=

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

Coefficients out to 10 terms

In[124]:=

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

Out[124]=

{ 1 2 ( 10 Sin [ 1 10 ] - 10 101 Sin [ 101 10 ] ) , 0 , 5 2 ( 300 Cos [ 1 10 ] - 300 Cos [ 101 10 ] 10201 - 2990 Sin [ 1 10 ] - 99010 Sin [ 101 10 ] 1030301 ) , 0 , 9 2 ( - 1049000 Cos [ 1 10 ] - 9151000 Cos [ 101 10 ] 104060401 + 10455010 Sin [ 1 10 ] - 592059010 Sin [ 101 10 ] 10510100501 ) , 0 , 13 2 ( 10382402100 Cos [ 1 10 ] - 100389242100 Cos [ 101 10 ] 1061520150601 - 103477709990 Sin [ 1 10 ] + 6521460203990 Sin [ 101 10 ] 107213535210701 ) , 0 , 17 2 ( - 202432299296400 Cos [ 1 10 ] + 835591477136400 Cos [ 101 10 ] 10828567056280801 + 2017570746870010 Sin [ 1 10 ] + 114086914568321990 Sin [ 101 10 ] 1093685272684360901 ) , 0 , 21 2 ( 6538104407577605500 Cos [ 1 10 ] + 5563454313317994500 Cos [ 101 10 ] 110462212541120451001 - 65162961832469984990 Sin [ 1 10 ] - 1906651913045646525010 Sin [ 101 10 ] 11156683466653165551101 ) }

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_2.gif]

Out[126]=

Graphics


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