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TYLE "" 0 260 1 {CSTYLE " " -1 -1 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 261 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 262 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 263 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 256 "" 0 "" {TEXT -1 11 "MATH 2270-2" }}{PARA 257 "" 0 " " {TEXT 256 39 "MAPLE PROJECT 2b - Inner product spaces" }}{PARA 258 " " 0 "" {TEXT -1 16 "October 22, 2001" }}{PARA 0 "" 0 "" {TEXT 257 0 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 91 " W e will explore two interesting inner product spaces. Refer to section \+ 5.5 of the text." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 260 "" 0 "" {TEXT -1 61 "A good dot product and interval for orthogonal polynomial s: " }}{PARA 0 "" 0 "" {TEXT -1 185 " The first inner product and interval we mention are used in numerical analysis algorithms. We'll call the inner product ``dot1''. It is the inner product of example \+ 7, page 231. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "restart:with(plots):" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 93 "dot1:=(f,g)->int(f(t)*g(t),t=-1..1);\n #our first inner product, for the\n #interval -1%%dot1Gf*6$%\"fG%\"gG6\"6$%)operatorG%&arrowGF)-%$intG 6$*&-9$6#%\"tG\"\"\"-9%F3F5/F4;!\"\"F5F)F)F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 102 "dot1(t->t,t->1);\n #the dot product of f(t)=t with g(t)=1\n #you should get zero. Meaning what?\n " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 305 "Meaning you jus t showed that f(t)=t and g(t)=1 are orthogonal for the dot1 inner prod uct! Does this surprise you? In fact, once the inner product is def ined, you can define magnitude, distance, angle between vectors, and y ou can even do projection problems. This is discussed in detail in se ction 5.5." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "mag1:=f->sqrt(dot1 (f,f)): \n # the magnitude of a vector " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "dist1:=(f,g)->mag1 (f-g): \n # the ``distance'' between two functions" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 102 "cosangle1:=(f,g)->(dot1(f,g)/(mag1 (f)*mag1(g))):\n #computes the \"cos of the angle\" between function s" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 83 "fangle1:=(f,g)->evalf( arccos(cosangle1(f,g))):\n #computes angle between functions" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 112 "For exam ple we may use Gram-Schmidt to find an orthonormal basis for the polyn omial subspace P2=span\{1, t, t^2\}:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "P0:=t->1;\nP1:=t->t;\nP2:=t->t^2;\n #our usual \"na tural\" basis" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P0G\"\"\"" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P1Gf*6#%\"tG6\"6$%)operatorG%&arrow GF(9$F(F(F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P2Gf*6#%\"tG6\"6$%)o peratorG%&arrowGF(*$)9$\"\"#\"\"\"F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 312 "W0:=P0/mag1(P0):\n #first orthonormal vector\nZ1:= P1-dot1(P1,W0)*W0:\n #P1 was orthogonal to P0, so don't really \n \+ #need the usual projection formuula, but\n #here it is anyway.\nW1:= Z1/mag1(Z1):\n #second orthonormal vector\nZ2:=P2-dot1(P2,W0)*W0-dot 1(P2,W1)*W1:\nW2:=Z2/mag1(Z2):\n #third orthonormal vector" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "W0(t);W1(t);W2(t);\n #the \+ orthonormal polynomials we get" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$*$ -%%sqrtG6#\"\"#\"\"\"#F)F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$*&%\"t G\"\"\"-%%sqrtG6#\"\"'F&#F&\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$ *&,&*$)%\"tG\"\"#\"\"\"F*#!\"\"\"\"$F*F*-%%sqrtG6#\"#5F*#F-\"\"%" }}} {PARA 259 "" 0 "" {TEXT -1 11 "Projection:" }}{PARA 0 "" 0 "" {TEXT -1 194 "Now that we have an orthonormal basis for P2 we can do project ion problems. We will try to find the closest degree 2 polynomial to \+ f(t)=exp(t), using our inner product dot1 to measure distance:" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 176 "proj2:=f->evalf(dot1(f,W0)* W0+dot1(f,W1)*W1+dot1(f,W2)*W2);\n #this is the usual projection for mula, but we use evalf to \n #get decimals rather than messy algebra ic numbers." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "f:=t->exp(t) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "g:=t->proj2(f)(t);" }} }{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 164 "This p olynomial g is \"closer\" to exp(t) than the usual Taylor polynomial p (t)=1+t+t^2/2, when we use the distance which we get from dot1. We ca n compare distances:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "p:=t ->1+t+t^2/2;" }}{PARA 11 "" 1 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "evalf(dist1(f,g));\nevalf(dist1(f,p));" }}} {EXCHG {PARA 11 "" 1 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 199 "So, at least for our distance, the function g does about three times \+ as well as the Taylor polynomial. You can also see this geometrically , by plotting the three graphs on the interval from -1 to 1:" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 141 "actual:=plot(f(t),t=-1..1,color=re d):\nbest:=plot(g(t),t=-1..1,color=black):\ntayl:=plot(p(t),t=-1..1,co lor=blue):\ndisplay(\{actual,best,tayl\});" }}{PARA 13 "" 1 "" {GLPLOT2D 349 262 262 {PLOTDATA 2 "6'-%'CURVESG6$7S7$$!\"\"\"\"!$\"1** ***R?sPH%!#;7$$!1nmm;p0k&*F-$\"1BO\"4#e87K-Hh`F-7$$!1nmm\">s%HaF-$\"1An ([+xHb&F-7$$!1+++]$*4)*\\F-$\"1#4\\]2Iwy&F-7$$!1+++]_&\\c%F-$\"1yKs\\Z MVgF-7$$!1+++]1aZTF-$\"18\"QvuG)3jF-7$$!1nm;/#)[oPF-$\"1/6eBu6mlF-7$$! 1MLL$=exJ$F-$\"1v>K_B8#*oF-7$$!1MLLL2$f$HF-$\"1wg%zxr`=(F-7$$!1++]PYx \"\\#F-$\"1`]V4%pha(F-7$$!1MLLL7i)4#F-$\"1g&R?%[?$)yF-7$$!1++]P'psm\"F -$\"1d$>Iru?F)F-7$$!1++]74_c7F-$\"1m!f%Qb$4m)F-7$$!1JLL$3x%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wPK?Fgs7$Fix$\"1J]$\\l(p>@ Fgs7$F^y$\"1i!=R[RK?#Fgs7$Fcy$\"1=Ad$*[/.BFgs7$Fhy$\"1`]xri8'R#Fgs7$F] z$\"1WqM`&R&*\\#Fgs7$Fbz$\"1sQsflo-EFgs7$Fgz$\"1X!f%G=G=FFgs-F\\[l6&F^ [lFgdlF*F*-%+AXESLABELSG6$Q\"t6\"%!G-%%VIEWG6$;F(Fgz%(DEFAULTG" 1 2 0 1 10 0 2 9 1 4 2 1.000000 45.000000 45.000000 0 0 "Curve 1" "Curve 2" "Curve 3" }}}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 471 "The orthogonal polynomials whi ch you have been constructing are called the Legendre polynomials. Ma ple knows about them. To see the first few you can load the `orthopol y' package. By the way, if you define different weighted inner produc ts you get different (famous to experts) orthogonal polynomial familie s, you can read about some of them on the help windows, starting at `o rthopoly'. Orthogonal polynomials are used in approximation problems, as you might expect." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "with(orthopoly):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 141 "P(0,x);P(1,x);P(2,x);P(3,x);P(4,x);P(5,x );\n #these should look familiar, after what you just did!\n #they haven't been normalized, though." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 261 "" 0 "" {TEXT -1 0 "" }}{PARA 262 "" 0 "" {TEXT -1 15 "Fourier Series:" }}{PARA 0 "" 0 "" {TEXT -1 131 " Here's an interval and dot product which makes the usual tri g functions into an orthonormal family! See page 233 of the text!" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "dot2:=(f,g)->1/Pi*int(f(t)* g(t),t=-Pi..Pi);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%%dot2Gf*6$%\"fG% \"gG6\"6$%)operatorG%&arrowGF)*&-%$intG6$*&-9$6#%\"tG\"\"\"-9%F4F6/F5; ,$%#PiG!\"\"F " 0 "" {MPLTEXT 1 0 64 "f:=t->sin(5*t) ;\ng:=t->cos(3*t);\ndot2(f,f);\ndot2(g,g);\ndot2(f,g);" }}}{PARA 0 "" 0 "" {TEXT -1 82 "We add the constant function to our collection, but \+ it will need to be normalized:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 166 "dot2(1,1);\ndot2(f,1);\ndot2(g,1);\n #the constant function ha s norm squared\n #equal to 2, however. But it is orthogonal\n #to a ll cos(kt),sin(kt), k a natural number" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 483 "Thus, for any n, the family \{1/sqr t(2), cos(t), cos(2t), ..., cos(nt), sin(t), sin(2t), ...sin(nt)\} is \+ an orthonormal basis of a 2n+1 dimensional subspace of functions. So \+ it is easy to project onto this subspace using our usual projection fo rmulas. It is an amazing fact that if f(t) is any piecewise continuou s function on the interval -Pi<=t<=Pi, then as as n approaches infinit y the distances between these projections and f converges to zero. He re's an example, see page 236:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "f:=t->t:\n #the function we shall decompose into trigonometric \+ pieces\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "a0:=int(f(t),t= -Pi..Pi);\n #could you have predicted the answer?" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%#a0G\"\"!" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 154 "#now get projection coefficients\n#AKA Fourier coefficients\nfo r i from 1 to 10 do\ng1:=t->cos(i*t):\ng2:=t->sin(i*t):\na[i]:=dot2(g1 ,f):\nb[i]:=dot2(g2,f):\nod:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "fsum:=t-> a0/(2*Pi)+ sum(a[ j]*cos(j*t),j=1..10) +\n sum(b[j]*sin(j*t),j=1..10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "fsum(t);\n #why are there no cosin e terms?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 103 "plot1:=plot(fs um(t),t=-Pi..Pi,color=black):\nplot2:=plot(t,t=-Pi..Pi,color=red):\ndi splay(\{plot1,plot2\});" }}}{PARA 263 "" 0 "" {TEXT -1 109 "There are \+ problems for you to do, on the template 2270proj2b.mws, which you can \+ download from our Maple page." }}}{MARK "57 0 0" 19 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }