{VERSION 5 0 "IBM INTEL NT" "5.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 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 261 "" 1 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 1 12 0 0 0 0 0 0 2 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "Head ing 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }0 0 0 -1 8 2 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 3" 4 5 1 {CSTYLE "" -1 -1 "" 1 12 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 }{PSTYLE "Title" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 1 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "" 4 256 1 {CSTYLE " " -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 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 18 "" 0 "" {TEXT -1 0 "" }{TEXT 261 0 "" }{TEXT 262 24 "Linear Algebra Powertool" }}{PARA 18 "" 0 "" {TEXT -1 30 "Poly nomial Approximation - III" }}{PARA 256 "" 0 "" {TEXT -1 18 "Jacobi Po lynomials" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 42 "Worksheet by Mike May, S.J., maymk@slu.edu" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 8 "Overview" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 338 "We have been looki ng at polynomial approximations to continuous functions defined on the domain [-1, 1] using orthogonal polynomials of various kinds. In thi s worksheet we use yet another norm, produing the Jacobi polynomials, paying attention to how this changes the definition of best fit and t he polynomials that can be approximated." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 187 "We begin by loading Maple's package for othogonal polynomials. We also load the plots package so that we can graph our results. We repeat the technical commands from the last wo rksheet." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 97 "with(orthopoly) ; with(plots):\nassume('i',integer): assume('j',integer):\ninterface(s howassumed=0):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "For approximati on by orthogonal polynomials, we define the norm by " }}{PARA 257 "" 0 "" {TEXT -1 15 " = " }{XPPEDIT 18 0 "int(wtfunc(x)*f(x)* g(x),x = -1 .. 1);" "6#-%$intG6$*(-%'wtfuncG6#%\"xG\"\"\"-%\"fG6#F*F+- %\"gG6#F*F+/F*;,$F+!\"\"F+" }{TEXT -1 7 "., " }}{PARA 0 "" 0 "" {TEXT -1 323 "where wtfunc(x) is a weight function. For Legandre poly nomials, the weight function is the constant 1, and all points in the \+ domain have equal weight in defining best fit approximation. For Cheb yshev polynomials of the first kind, the weight function is (1-x^2)^(- 1/2), so extra weight is added to the ends of the domain." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 348 "With Jacobi polyn omials, with parameters a and b, the weight function is (1-x)^a*(1+x)^ b, where a and b are both > -1. When a = b = 0 this reduces to the ca se of Legandre polynomials. If a and b are both positive the weight o f the ends of the intervals is decreased. If a and b are negative, th e weight of the ends of the intervals is increased." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 117 "Consider the plot of t he weight functions for Jacobi polynomials with a variety of values fo r the parameters a and b." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 130 "plot(\{1, (1-x)*(1+x), (1-x)^2*(1+x)^3, (1-x)^6*(1+x)^8, \n ( 1-x)^(-.4)*(1+x)^(-.6), (1-x)^(-.9)*(1+x)^(-.9)\}, x=-1..1, y=0..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 211 "We would also like to give a n umeric measure to how the weighting shifts with different parameter va lues. One easy intuitive way is to compute the percent of the weight \+ that is in the middle 60 % of the domain." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 503 "\"w(0, 0)\" = int(1,x=-0.6..0.6)/int(1,x=-1..1);\n \"w(1, 1)\" = int((1-x)*(1+x),x=-0.6..0.6)/int((1-x)*(1+x),x=-1..1);\n \"w(2, 3)\" = int((1-x)^2*(1+x)^3,x=-0.6..0.6)/int((1-x)^2*(1+x)^3,x=- 1..1);\n\"w(6, 8)\" = int((1-x)^6*(1+x)^8,x=-0.6..0.6)/int((1-x)^6*(1+ x)^8,x=-1..1);\n\"w(-.4, -.6)\" = evalf(Int((1-x)^(-0.4)*(1+x)^(-0.6), x=-0.6..0.6))/\n evalf(Int((1-x)^(-0.4)*(1+x)^(-0.6),x=-1..1));\n \"w(-.9, -.9)\" = evalf(Int((1-x)^(-0.9)*(1+x)^(-0.9),x=-0.6..0.6))/\n evalf(Int((1-x)^(-0.9)*(1+x)^(-0.9),x=-1..1));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 463 " As mentioned above, one reason to change the parameter values is to ch ange the way closeness is defined. A second reason is to change the s ubspace of functions over which the inner product makes sense. In par ticular,using positive values for a and b produces an inner product u nder which functions with poles at the end of the domain have finite n orm. Consider what happens to the function f(x) = 1/(1-x) with the Le gandre norm and with the (3,3) Jacobi norm." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "\"_L\" = int(1*(1-x)^(-2), x=-1..1);\n\" _J(3,3)\" = int((1-x^2)^3*(1-x)^(-2), x=-1..1);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 5 "" 0 "" {TEXT 260 3 "Exe" } {TEXT -1 0 "" }{TEXT 259 7 "rcises:" }{TEXT -1 2 " " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 344 "1) Describe the rational functions that have \+ a finite norm under the (a, b) Jacobi norm. (To simplify the problem, assume that the rational functions are in a normal form with partial \+ fraction decomposition, i.e., each function is a sum of proper fractio ns with the denominator a power of an irreducible polynomial with inte ger coefficients.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 137 "2) For the (2,3) Jacobi norm, wh at percentage of the weight is on the interval [0, 1]? Repeat the que stion with the (2, 5) Jacobi norm." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 18 "Jacobi poly nomials" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "As we did in previous \+ worksheets we check the help page for the orthogonal polynomials we ar e looking at in this worksheet." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "?orthopoly,P" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "Once we \+ have loaded the orthopoly package, we obtain the nth (a,b) Jacobi poly nomial with P(n,a,b,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "\"P(3,1,1,x)\"=P(3,1,1,x);\n\"P(3,1,2,x)\"=P(3,1,2,x);\n\"P(3,2,1,x) \"=P(3,2,1,x);\n\"P(3,-.4,-.6,x)\"=P(3,-.4,-.6,x);" }}}{EXCHG {PARA 5 "" 0 "" {TEXT 257 1 "E" }{TEXT -1 0 "" }{TEXT 256 9 "xercise: " }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 184 "3) Find the 2nd and 5th Jacobi p olynomials with parameters (1,1), (2,3), and (6,6). Verify that pair \+ associated with each parameter is orthogonal under the oppropriate inn er product." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 19 "An extended example" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 124 "Time to look at an example to see how this works \+ out in a particular case. Once again we will use sin(3\271x) as our f unction." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "func := x -> si n(3*Pi*x);" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 52 "Computing coeffici ents and approximating polynomials" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 280 "Next we start computing coefficients and defining the approximat ing polynomials up to degree 12 for the inner products of type (0,0), \+ (2,3), and (-.4, -.6). Recall that if P(n,a,b,x) is the nth (a,b) Jac obi polynomial, the projection coeffient of f(x) onto P(n,a,b,x) shoul d be " }{XPPEDIT 18 0 "int((1-x)^a*(1+x)^b*f(x)*P(n,a,b,x),x = -1 .. 1 );" "6#-%$intG6$**),&\"\"\"F)%\"xG!\"\"%\"aGF)),&F)F)F*F)%\"bGF)-%\"fG 6#F*F)-%\"PG6&%\"nGF,F/F*F)/F*;,$F)F+F)" }{TEXT -1 14 " divided by \+ " }{XPPEDIT 18 0 "int((1-x)^a*(1+x)^b*P(n,a,b,x)*P(n,a,b,x),x = -1 .. \+ 1);" "6#-%$intG6$**),&\"\"\"F)%\"xG!\"\"%\"aGF)),&F)F)F*F)%\"bGF)-%\"P G6&%\"nGF,F/F*F)-F16&F3F,F/F*F)/F*;,$F)F+F)" }{TEXT -1 4 " . " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 888 "for i from 0 to 12 do\n nor mP00[i] := evalf(Int((P(i,0,0,x))^2, x=-1..1)):\n coeffP00[i] := evalf (Int(simplify(P(i,0,0,x)*func(x)*1.0), x=-1..1));\nod:\nJacobi00approx := proc(m,x) \n local count:\n sum(P(count,0,0,x)*coeffP00[count]/n ormP00[count],count=0..m):\nend;\nfor i from 0 to 12 do\n normP23[i] : = evalf(Int((1-x)^2*(1+x)^3*(P(i,2,3,x))^2, x=-1..1)):\n coeffP23[i] : = evalf(Int(simplify((1-x)^2*(1+x)^3*P(i,2,3,x)*func(x)*1.0), x=-1..1) ):\nod:\nJacobi23approx := proc(m,x) \n local count:\n sum(P(count,2 ,3,x)*coeffP23[count]/normP23[count],count=0..m):\nend;\nfor i from 0 \+ to 12 do\n normP46[i] := evalf(Int((1-x)^(-.4)*(1+x)^(-.6)*(P(i,-.4,-. 6,x))^2, x=-1..1));\n coeffP46[i] := evalf(Int(simplify((1-x)^(-.4)*(1 +x)^(-.6)*\n P(i,-.4,-.6,x)*func(x)*1.0), x=-1..1));\nod:\nJacob i46approx := proc(m,x) \n local count:\n sum(P(count,-.4,-.6,x)*coef fP46[count]/normP46[count],count=0..m):\nend;" }}}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 28 "Comparing the approximations" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 186 "Our past experience with this function is that the ap proximation start to be interesting with the ninth degree. Note first \+ that the polynomial approximations are significantly different." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 87 "n:= 9:\nsort(Jacobi00approx( n,x));\nsort(Jacobi23approx(n,x));\nsort(Jacobi46approx(n,x));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "Next compare the graphs of the app roximations and of the errors." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 619 "lowy := -1.2: highy := 1.6: n:= 7:\npl1 := plot(func(x), x= -1..1,y=lowy..highy, color=red):\npl2 := plot(Jacobi00approx(n,x), x=- 1..1,y=lowy..highy, color=green):\npl3 := plot(Jacobi23approx(n,x), x= -1..1,y=lowy..highy, color=blue):\npl4 := plot(Jacobi46approx(n,x), x= -1..1,y=lowy..highy, color=black):\nB := textplot(\{[-0.8,highy-(highy -lowy)/20, \n `The function and the `||n||` term Jacobi approx imations`],\n [-0.8,highy-(highy-lowy)/9, \n `(0,0) (green) \+ vs (2,3) (blue), vs (-.4, -.6) (black)`]\},\n align=RIGHT, font = [ TIMES, BOLD, 12] ):\ndisplay(\{pl1, pl2, pl3, pl4, B\},view=[-1..1, lo wy..highy]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 216 "As expected, the (2, 3) approximation tends to be best in the center of the graph, whi le the (-.4, -.6) approximation tends to be best on the ends. This be comes even clearer when we look at the graphs of the errors." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 552 "lowy := -1.0: highy := 1.4 : n:= 10:\npl1 := plot(func(x) - Jacobi00approx(n,x), x=-1..1,y=lowy. .highy, color=green):\npl2 := plot(func(x) - Jacobi23approx(n,x), x=-1 ..1,y=lowy..highy, color=blue):\npl3 := plot(func(x) - Jacobi46approx( n,x), x=-1..1,y=lowy..highy, color=black):\nB := textplot(\{[-0.8,high y-(highy-lowy)/20, \n `The `||n||` term Jacobi error `],\n \+ [-0.8,highy-(highy-lowy)/9, \n `(0,0) (green) vs (2,3) (blue) , vs (-.4, -.6) (black)`]\}, \n align=RIGHT, font = [HELVETICA , BOLD, 12] ):\ndisplay(\{pl1, pl2, pl3, B\});\n " }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 130 "It is clear that the (2,3) Jacobi approximation i s best in the middle and the (-.4, -.6) Jacobi approximation is best o n the ends." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 5 "" 0 "" {TEXT 258 10 "Exercises:" }{TEXT -1 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "4) Describe the kind kind of error you would expect with a (-. 6, 5) Jacobi approximation." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 "5) Plot the function y=c os(2*Pi*x) along with the degree 10 (-.6, 5) Jacobi approximation. In a separate graph plot the error of the approxiamtion." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 0 2" 24 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }