{VERSION 6 0 "IBM INTEL NT" "6.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 
1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 
0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }
{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 0 2 2 2 0 
0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 0" -1 
256 1 {CSTYLE "" -1 -1 "Helvetica" 1 18 0 0 0 0 2 1 2 0 0 0 0 0 0 1 }
0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE 
"" -1 -1 "Courier" 1 18 0 0 0 0 2 2 2 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 
0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 3" -1 258 1 {CSTYLE "" -1 -1 "Times" 
1 18 0 0 0 0 1 1 2 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 4" -1 259 1 {CSTYLE "" -1 -1 "Times" 1 24 0 0 0 0 1 
1 2 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 260 
1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 
0 0 0 0 0 0 -1 0 }}
{SECT 0 {EXCHG {PARA 260 "" 0 "" {TEXT -1 27 "Legendre Polynomial Seri
es." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 190 "I
n this worksheet, you will use the Legendre polynomials to approximate
 a function in the same way that you use sines and cosines or exponent
ials to approximate a function in fourier series." }}{PARA 0 "" 0 "" 
{TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "restart:wit
h(plots):with(orthopoly);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "We w
ant to approximate a function " }{XPPEDIT 18 0 "f(z);" "6#-%\"fG6#%\"z
G" }{TEXT -1 27 " with Legendre polynomials " }{XPPEDIT 18 0 "P[l](z);
" "6#-&%\"PG6#%\"lG6#%\"zG" }{TEXT -1 42 " analogously to doing fourie
r series, i.e." }}{PARA 0 "" 0 "" {TEXT -1 10 "          " }{XPPEDIT 
18 0 "f(z) = sum(c[l]*P[l](z),l = 0 .. infinity);" "6#/-%\"fG6#%\"zG-%
$sumG6$*&&%\"cG6#%\"lG\"\"\"-&%\"PG6#F/6#%\"zGF0/F/;\"\"!%)infinityG" 
}}{PARA 0 "" 0 "" {TEXT -1 38 "Let's start with the epsilon function \+
" }{XPPEDIT 18 0 "f(z) = epsilon(z);" "6#/-%\"fG6#%\"zG-%(epsilonG6#%
\"zG" }{TEXT -1 7 " where " }{XPPEDIT 18 0 "epsilon(z);" "6#-%(epsilon
G6#%\"zG" }{TEXT -1 43 " is the integral of the Heaviside function " }
{XPPEDIT 18 0 "theta(z);" "6#-%&thetaG6#%\"zG" }{TEXT -1 3 ".  " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "f:=piecewise(z<0,0,z>0,z);" 
}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plot(f,z=-2..2,scaling=co
nstrained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "First let's check \+
how much each Legendre polynomial look like " }{XPPEDIT 18 0 "epsilon(
z);" "6#-%(epsilonG6#%\"zG" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 5 "l:=0;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "
plot(\{f,P(l,z)\},z=-2..2,scaling=constrained);" }}{PARA 0 "" 0 "" 
{TEXT -1 24 "Now change the value of " }{XPPEDIT 18 0 "l" "6#%\"lG" }
{TEXT -1 42 " to check some other Legendre polynomials." }}{PARA 0 "" 
0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "Now let's ca
lculate the coefficients of the Legendre polynomial expansion.        \+
 " }}{PARA 0 "" 0 "" {XPPEDIT 18 0 "c[l] = int(f*(2*l+1)/2*P(l,z),z = \+
-1 .. 1);" "6#/&%\"cG6#%\"lG-%$intG6$*(%\"fG\"\"\"*&,&*&\"\"#F-F'F-F-F
-F-F-F1!\"\"F--%\"PG6$F'%\"zGF-/%\"zG;,$F-F2F-" }}{PARA 0 "" 0 "" 
{TEXT -1 108 "(Compare this expression to the expression for the coeff
icients in a Fourier series.)  Why is the factor of " }{XPPEDIT 18 0 "
(2*l+1)/2" "6#*&,&*&\"\"#\"\"\"%\"lGF'F'F'F'F'F&!\"\"" }{TEXT -1 17 " \+
in the equation?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "lmax:=3;
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "for l from 0  to lmax d
o" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "c[l]:=int(((2*l+1)/2)*f*P(l,z)
,z=-1..1)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "od;" }}}{EXCHG {PARA 0 
"" 0 "" {TEXT -1 80 "Let's look at the graph of the truncated series, \+
and compare it to the graph of " }{XPPEDIT 18 0 "f(x)" "6#-%\"fG6#%\"x
G" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "r:=sum
(c[m]*P(m,z),m=0..lmax):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 
"plot(\{r,f\},z=-2..2,-1.5..1.5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 
160 "How good a job do the Legendre polynomials do?   Try adding more \+
terms.  How many terms does it take to get decent convergence?  What h
appens outside the range " }{XPPEDIT 18 0 "-1...1" "6#;,$\"\"\"!\"\"F%
" }{TEXT -1 3 "?  " }{TEXT -1 68 "Why?  Compare to the fourier series \+
approximation to the function.  " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 
0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 0 0" 0 }{VIEWOPTS 1 1 0 3 
2 1804 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }
