(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; automaticGrouping; currentKernel; ] :[font = title; inactive; preserveAspect; startGroup] Orthogonal series and boundary value problems Approximating functions with polynomials :[font = input; preserveAspect] (c) Copyright 1994,1995,1996 by Evans M. Harrell, II. All rights reserved ;[s] 1:0,1;75,-1; 2:0,12,10,Courier,1,12,0,0,0;1,12,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; fontSize = 18] This is an executed Mathematica notebook, which can be read with MathReader. If you are reading it with Mathematica, you may find it instructive to modify the inputs and see what results. ;[s] 5:0,0;20,1;31,0;106,1;117,0;190,-1; 2:3,19,14,Times,0,18,0,0,0;2,19,14,Times,2,18,0,0,0; :[font = text; inactive; preserveAspect] In this notebook we take a graphical look at approximating functions. We have learned that the r.m.s. distance between two functions defined on an interval a ² x ² b is :[font = input; preserveAspect] RMSDist[f_,g_,a_,b_] \ := Sqrt[Integrate[(f - g)^2, \ {x,a,b}]] :[font = text; inactive; preserveAspect] The RMS norm of a single function f could be obtained with the command RMSDist[f,0,a,b]. ;[s] 2:0,0;71,1;89,-1; 2:1,13,9,Times,0,12,0,0,0;1,13,10,Courier,0,12,0,0,0; :[font = input; preserveAspect; startGroup] RMSDist[1, Cos[Pi x/2], -1,1] :[font = output; output; inactive; preserveAspect; endGroup] (-(8 - 3*Pi)/(2*Pi) + (-8 + 3*Pi)/(2*Pi))^(1/2) ;[o] -(8 - 3 Pi) -8 + 3 Pi Sqrt[----------- + ---------] 2 Pi 2 Pi :[font = input; preserveAspect; startGroup] N[%] :[font = output; output; inactive; preserveAspect; endGroup] 0.6734396116428514 ;[o] 0.67344 :[font = text; inactive; preserveAspect] What is the constant which is most like the cosine? 1/2? 1/4? Let's first check some values? :[font = input; preserveAspect; startGroup] {N[RMSDist[1/2,Cos[Pi x/2], -1,1]], N[RMSDist[1/4,Cos[Pi x/2], -1,1]], N[RMSDist[-1,Cos[Pi x/2], -1,1]]} :[font = output; output; inactive; preserveAspect; endGroup] {0.4761937161122952, 0.6988420620085904, 2.355096407680655} ;[o] {0.476194, 0.698842, 2.3551} :[font = input; preserveAspect; startGroup] Plot[{Cos[Pi x/2], 1,1/2,-1}, {x, -1,1}] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.47619 0.309017 0.294302 [ [(-1)] .02381 .30902 0 2 Msboxa [(-0.5)] .2619 .30902 0 2 Msboxa [(0.5)] .7381 .30902 0 2 Msboxa [(1)] .97619 .30902 0 2 Msboxa [(-1)] .4875 .01472 1 0 Msboxa [(-0.5)] .4875 .16187 1 0 Msboxa [(0.5)] .4875 .45617 1 0 Msboxa [(1)] .4875 .60332 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .30902 m .02381 .31527 L s P [(-1)] .02381 .30902 0 2 Mshowa p .002 w .2619 .30902 m .2619 .31527 L s P [(-0.5)] .2619 .30902 0 2 Mshowa p .002 w .7381 .30902 m .7381 .31527 L s P [(0.5)] .7381 .30902 0 2 Mshowa p .002 w .97619 .30902 m .97619 .31527 L s P [(1)] .97619 .30902 0 2 Mshowa p .001 w .07143 .30902 m .07143 .31277 L s P p .001 w .11905 .30902 m .11905 .31277 L s P p .001 w .16667 .30902 m .16667 .31277 L s P p .001 w .21429 .30902 m .21429 .31277 L s P p .001 w .30952 .30902 m .30952 .31277 L s P p .001 w .35714 .30902 m .35714 .31277 L s P p .001 w .40476 .30902 m .40476 .31277 L s P p .001 w .45238 .30902 m .45238 .31277 L s P p .001 w .54762 .30902 m .54762 .31277 L s P p .001 w .59524 .30902 m .59524 .31277 L s P p .001 w .64286 .30902 m .64286 .31277 L s P p .001 w .69048 .30902 m .69048 .31277 L s P p .001 w .78571 .30902 m .78571 .31277 L s P p .001 w .83333 .30902 m .83333 .31277 L s P p .001 w .88095 .30902 m .88095 .31277 L s P p .001 w .92857 .30902 m .92857 .31277 L s P p .002 w 0 .30902 m 1 .30902 L s P p .002 w .5 .01472 m .50625 .01472 L s P [(-1)] .4875 .01472 1 0 Mshowa p .002 w .5 .16187 m .50625 .16187 L s P [(-0.5)] .4875 .16187 1 0 Mshowa p .002 w .5 .45617 m .50625 .45617 L s P [(0.5)] .4875 .45617 1 0 Mshowa p .002 w .5 .60332 m .50625 .60332 L s P [(1)] .4875 .60332 1 0 Mshowa p .001 w .5 .04415 m .50375 .04415 L s P p .001 w .5 .07358 m .50375 .07358 L s P p .001 w .5 .10301 m .50375 .10301 L s P p .001 w .5 .13244 m .50375 .13244 L s P p .001 w .5 .1913 m .50375 .1913 L s P p .001 w .5 .22073 m .50375 .22073 L s P p .001 w .5 .25016 m .50375 .25016 L s P p .001 w .5 .27959 m .50375 .27959 L s P p .001 w .5 .33845 m .50375 .33845 L s P p .001 w .5 .36788 m .50375 .36788 L s P p .001 w .5 .39731 m .50375 .39731 L s P p .001 w .5 .42674 m .50375 .42674 L s P p .001 w .5 .4856 m .50375 .4856 L s P p .001 w .5 .51503 m .50375 .51503 L s P p .001 w .5 .54446 m .50375 .54446 L s P p .001 w .5 .57389 m .50375 .57389 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p .004 w .02381 .30902 m .06349 .34743 L .10317 .38519 L .14286 .42164 L .18254 .45617 L .22222 .48818 L .2619 .51712 L .30159 .5425 L .34127 .56389 L .38095 .58092 L .42063 .59329 L .44048 .59766 L .4504 .59939 L .46032 .6008 L .47024 .6019 L .4752 .60233 L .48016 .60269 L .48512 .60296 L .4876 .60307 L .49008 .60316 L .49256 .60323 L .4938 .60326 L .49504 .60328 L .49628 .6033 L .49752 .60331 L .49876 .60332 L .5 .60332 L .50124 .60332 L .50248 .60331 L .50372 .6033 L .50496 .60328 L .5062 .60326 L .50744 .60323 L .50992 .60316 L .5124 .60307 L .51488 .60296 L .51984 .60269 L .5248 .60233 L .52976 .6019 L .53968 .6008 L .5496 .59939 L .55952 .59766 L .57937 .59329 L .61905 .58092 L .65873 .56389 L .69841 .5425 L .7381 .51712 L .77778 .48818 L .81746 .45617 L .85714 .42164 L Mistroke .89683 .38519 L .93651 .34743 L .97619 .30902 L Mfstroke P P p p .004 w .02381 .60332 m .06349 .60332 L .10317 .60332 L .14286 .60332 L .18254 .60332 L .22222 .60332 L .2619 .60332 L .30159 .60332 L .34127 .60332 L .38095 .60332 L .42063 .60332 L .46032 .60332 L .5 .60332 L .53968 .60332 L .57937 .60332 L .61905 .60332 L .65873 .60332 L .69841 .60332 L .7381 .60332 L .77778 .60332 L .81746 .60332 L .85714 .60332 L .89683 .60332 L .93651 .60332 L .97619 .60332 L s P P p p .004 w .02381 .45617 m .06349 .45617 L .10317 .45617 L .14286 .45617 L .18254 .45617 L .22222 .45617 L .2619 .45617 L .30159 .45617 L .34127 .45617 L .38095 .45617 L .42063 .45617 L .46032 .45617 L .5 .45617 L .53968 .45617 L .57937 .45617 L .61905 .45617 L .65873 .45617 L .69841 .45617 L .7381 .45617 L .77778 .45617 L .81746 .45617 L .85714 .45617 L .89683 .45617 L .93651 .45617 L .97619 .45617 L s P P p p .004 w .02381 .01472 m .06349 .01472 L .10317 .01472 L .14286 .01472 L .18254 .01472 L .22222 .01472 L .2619 .01472 L .30159 .01472 L .34127 .01472 L .38095 .01472 L .42063 .01472 L .46032 .01472 L .5 .01472 L .53968 .01472 L .57937 .01472 L .61905 .01472 L .65873 .01472 L .69841 .01472 L .7381 .01472 L .77778 .01472 L .81746 .01472 L .85714 .01472 L .89683 .01472 L .93651 .01472 L .97619 .01472 L s P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = text; inactive; preserveAspect] The closest constant to Cos[Pi x/2] would be, geometrically speaking, the projection of the sine onto the direction of the constant functions, or, as we have defined it in the notes, ;[s] 3:0,0;4,1;11,0;185,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,0,0,0; :[font = input; preserveAspect] Projf[f_,g_,a_,b_] \ := g[x] Integrate[f[t] g[t] , {t,a,b}] \ / Integrate[g[t]^2, {t,a,b}] :[font = input; preserveAspect; startGroup] f[x_] := Cos[Pi x/2] One[x_] := 1 Projf[f,One,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] 2/Pi ;[o] 2 -- Pi :[font = input; preserveAspect; startGroup] N[RMSDist[2/Pi,Cos[Pi x/2], -1,1]] :[font = output; output; inactive; preserveAspect; endGroup] 0.4352361782541725 ;[o] 0.435236 :[font = input; preserveAspect; startGroup] Plot[{2/Pi,Cos[Pi x/2]}, {x,-1,1}] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.47619 0.0147151 0.588604 [ [(-1)] .02381 .01472 0 2 Msboxa [(-0.5)] .2619 .01472 0 2 Msboxa [(0.5)] .7381 .01472 0 2 Msboxa [(1)] .97619 .01472 0 2 Msboxa [(0.2)] .4875 .13244 1 0 Msboxa [(0.4)] .4875 .25016 1 0 Msboxa [(0.6)] .4875 .36788 1 0 Msboxa [(0.8)] .4875 .4856 1 0 Msboxa [(1)] .4875 .60332 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .01472 m .02381 .02097 L s P [(-1)] .02381 .01472 0 2 Mshowa p .002 w .2619 .01472 m .2619 .02097 L s P [(-0.5)] .2619 .01472 0 2 Mshowa p .002 w .7381 .01472 m .7381 .02097 L s P [(0.5)] .7381 .01472 0 2 Mshowa p .002 w .97619 .01472 m .97619 .02097 L s P [(1)] .97619 .01472 0 2 Mshowa p .001 w .07143 .01472 m .07143 .01847 L s P p .001 w .11905 .01472 m .11905 .01847 L s P p .001 w .16667 .01472 m .16667 .01847 L s P p .001 w .21429 .01472 m .21429 .01847 L s P p .001 w .30952 .01472 m .30952 .01847 L s P p .001 w .35714 .01472 m .35714 .01847 L s P p .001 w .40476 .01472 m .40476 .01847 L s P p .001 w .45238 .01472 m .45238 .01847 L s P p .001 w .54762 .01472 m .54762 .01847 L s P p .001 w .59524 .01472 m .59524 .01847 L s P p .001 w .64286 .01472 m .64286 .01847 L s P p .001 w .69048 .01472 m .69048 .01847 L s P p .001 w .78571 .01472 m .78571 .01847 L s P p .001 w .83333 .01472 m .83333 .01847 L s P p .001 w .88095 .01472 m .88095 .01847 L s P p .001 w .92857 .01472 m .92857 .01847 L s P p .002 w 0 .01472 m 1 .01472 L s P p .002 w .5 .13244 m .50625 .13244 L s P [(0.2)] .4875 .13244 1 0 Mshowa p .002 w .5 .25016 m .50625 .25016 L s P [(0.4)] .4875 .25016 1 0 Mshowa p .002 w .5 .36788 m .50625 .36788 L s P [(0.6)] .4875 .36788 1 0 Mshowa p .002 w .5 .4856 m .50625 .4856 L s P [(0.8)] .4875 .4856 1 0 Mshowa p .002 w .5 .60332 m .50625 .60332 L s P [(1)] .4875 .60332 1 0 Mshowa p .001 w .5 .03826 m .50375 .03826 L s P p .001 w .5 .0618 m .50375 .0618 L s P p .001 w .5 .08535 m .50375 .08535 L s P p .001 w .5 .10889 m .50375 .10889 L s P p .001 w .5 .15598 m .50375 .15598 L s P p .001 w .5 .17952 m .50375 .17952 L s P p .001 w .5 .20307 m .50375 .20307 L s P p .001 w .5 .22661 m .50375 .22661 L s P p .001 w .5 .2737 m .50375 .2737 L s P p .001 w .5 .29724 m .50375 .29724 L s P p .001 w .5 .32079 m .50375 .32079 L s P p .001 w .5 .34433 m .50375 .34433 L s P p .001 w .5 .39142 m .50375 .39142 L s P p .001 w .5 .41497 m .50375 .41497 L s P p .001 w .5 .43851 m .50375 .43851 L s P p .001 w .5 .46205 m .50375 .46205 L s P p .001 w .5 .50914 m .50375 .50914 L s P p .001 w .5 .53269 m .50375 .53269 L s P p .001 w .5 .55623 m .50375 .55623 L s P p .001 w .5 .57977 m .50375 .57977 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p .004 w .02381 .38943 m .06349 .38943 L .10317 .38943 L .14286 .38943 L .18254 .38943 L .22222 .38943 L .2619 .38943 L .30159 .38943 L .34127 .38943 L .38095 .38943 L .42063 .38943 L .46032 .38943 L .5 .38943 L .53968 .38943 L .57937 .38943 L .61905 .38943 L .65873 .38943 L .69841 .38943 L .7381 .38943 L .77778 .38943 L .81746 .38943 L .85714 .38943 L .89683 .38943 L .93651 .38943 L .97619 .38943 L s P P p p .004 w .02381 .01472 m .06349 .09154 L .10317 .16706 L .14286 .23996 L .18254 .30902 L .22222 .37303 L .2619 .43092 L .30159 .48169 L .34127 .52446 L .38095 .55851 L .42063 .58326 L .44048 .59201 L .4504 .59546 L .46032 .59828 L .47024 .60048 L .4752 .60135 L .48016 .60206 L .48512 .60261 L .4876 .60283 L .49008 .603 L .49256 .60314 L .4938 .6032 L .49504 .60324 L .49628 .60327 L .49752 .6033 L .49876 .60331 L .5 .60332 L .50124 .60331 L .50248 .6033 L .50372 .60327 L .50496 .60324 L .5062 .6032 L .50744 .60314 L .50992 .603 L .5124 .60283 L .51488 .60261 L .51984 .60206 L .5248 .60135 L .52976 .60048 L .53968 .59828 L .5496 .59546 L .55952 .59201 L .57937 .58326 L .61905 .55851 L .65873 .52446 L .69841 .48169 L .7381 .43092 L .77778 .37303 L .81746 .30902 L .85714 .23996 L Mistroke .89683 .16706 L .93651 .09154 L .97619 .01472 L Mfstroke P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = text; inactive; preserveAspect] We ought to do a better job of approximating Cos[Pi x/2] with a polynomial of 3rd or 4th degree. You may initially think of the Taylor series at x = 0, and wish regard Sin[x] as close to 0 + x + 0 - x^3/6. Or you might try the Taylor series at x= Pi, which is built into Mathematica in the Series command. ;[s] 3:0,0;273,1;284,0;308,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0; :[font = input; preserveAspect; startGroup] Series[Cos[Pi x/2], {x, 0, 3}] :[font = output; output; inactive; preserveAspect; endGroup] SeriesData[x, 0, {1, 0, -Pi^2/8}, 0, 4, 1] ;[o] 2 2 Pi x 4 1 - ------ + O[x] 8 :[font = input; preserveAspect; startGroup] Plot[{1-(Pi x)^2 /8, Cos[Pi x/2]}, {x,-1,1}] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.47619 0.126215 0.477104 [ [(-1)] .02381 .12621 0 2 Msboxa [(-0.5)] .2619 .12621 0 2 Msboxa [(0.5)] .7381 .12621 0 2 Msboxa [(1)] .97619 .12621 0 2 Msboxa [(-0.2)] .4875 .03079 1 0 Msboxa [(0.2)] .4875 .22164 1 0 Msboxa [(0.4)] .4875 .31706 1 0 Msboxa [(0.6)] .4875 .41248 1 0 Msboxa [(0.8)] .4875 .5079 1 0 Msboxa [(1)] .4875 .60332 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .12621 m .02381 .13246 L s P [(-1)] .02381 .12621 0 2 Mshowa p .002 w .2619 .12621 m .2619 .13246 L s P [(-0.5)] .2619 .12621 0 2 Mshowa p .002 w .7381 .12621 m .7381 .13246 L s P [(0.5)] .7381 .12621 0 2 Mshowa p .002 w .97619 .12621 m .97619 .13246 L s P [(1)] .97619 .12621 0 2 Mshowa p .001 w .07143 .12621 m .07143 .12996 L s P p .001 w .11905 .12621 m .11905 .12996 L s P p .001 w .16667 .12621 m .16667 .12996 L s P p .001 w .21429 .12621 m .21429 .12996 L s P p .001 w .30952 .12621 m .30952 .12996 L s P p .001 w .35714 .12621 m .35714 .12996 L s P p .001 w .40476 .12621 m .40476 .12996 L s P p .001 w .45238 .12621 m .45238 .12996 L s P p .001 w .54762 .12621 m .54762 .12996 L s P p .001 w .59524 .12621 m .59524 .12996 L s P p .001 w .64286 .12621 m .64286 .12996 L s P p .001 w .69048 .12621 m .69048 .12996 L s P p .001 w .78571 .12621 m .78571 .12996 L s P p .001 w .83333 .12621 m .83333 .12996 L s P p .001 w .88095 .12621 m .88095 .12996 L s P p .001 w .92857 .12621 m .92857 .12996 L s P p .002 w 0 .12621 m 1 .12621 L s P p .002 w .5 .03079 m .50625 .03079 L s P [(-0.2)] .4875 .03079 1 0 Mshowa p .002 w .5 .22164 m .50625 .22164 L s P [(0.2)] .4875 .22164 1 0 Mshowa p .002 w .5 .31706 m .50625 .31706 L s P [(0.4)] .4875 .31706 1 0 Mshowa p .002 w .5 .41248 m .50625 .41248 L s P [(0.6)] .4875 .41248 1 0 Mshowa p .002 w .5 .5079 m .50625 .5079 L s P [(0.8)] .4875 .5079 1 0 Mshowa p .002 w .5 .60332 m .50625 .60332 L s P [(1)] .4875 .60332 1 0 Mshowa p .001 w .5 .04988 m .50375 .04988 L s P p .001 w .5 .06896 m .50375 .06896 L s P p .001 w .5 .08805 m .50375 .08805 L s P p .001 w .5 .10713 m .50375 .10713 L s P p .001 w .5 .1453 m .50375 .1453 L s P p .001 w .5 .16438 m .50375 .16438 L s P p .001 w .5 .18347 m .50375 .18347 L s P p .001 w .5 .20255 m .50375 .20255 L s P p .001 w .5 .24072 m .50375 .24072 L s P p .001 w .5 .2598 m .50375 .2598 L s P p .001 w .5 .27889 m .50375 .27889 L s P p .001 w .5 .29797 m .50375 .29797 L s P p .001 w .5 .33614 m .50375 .33614 L s P p .001 w .5 .35522 m .50375 .35522 L s P p .001 w .5 .37431 m .50375 .37431 L s P p .001 w .5 .39339 m .50375 .39339 L s P p .001 w .5 .43156 m .50375 .43156 L s P p .001 w .5 .45065 m .50375 .45065 L s P p .001 w .5 .46973 m .50375 .46973 L s P p .001 w .5 .48881 m .50375 .48881 L s P p .001 w .5 .52698 m .50375 .52698 L s P p .001 w .5 .54607 m .50375 .54607 L s P p .001 w .5 .56515 m .50375 .56515 L s P p .001 w .5 .58423 m .50375 .58423 L s P p .001 w .5 .01171 m .50375 .01171 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p .004 w .02381 .01472 m .06349 .10873 L .10317 .19457 L .14286 .27223 L .18254 .34172 L .22222 .40303 L .2619 .45617 L .30159 .50113 L .34127 .53792 L .38095 .56653 L .40079 .57777 L .42063 .58697 L .44048 .59412 L .4504 .59693 L .46032 .59923 L .47024 .60102 L .4752 .60172 L .48016 .6023 L .48512 .60274 L .4876 .60292 L .49008 .60306 L .49256 .60318 L .4938 .60322 L .49504 .60326 L .49628 .60328 L .49752 .6033 L .49876 .60331 L .5 .60332 L .50124 .60331 L .50248 .6033 L .50372 .60328 L .50496 .60326 L .5062 .60322 L .50744 .60318 L .50992 .60306 L .5124 .60292 L .51488 .60274 L .51984 .6023 L .5248 .60172 L .52976 .60102 L .53968 .59923 L .5496 .59693 L .55952 .59412 L .57937 .58697 L .59921 .57777 L .61905 .56653 L .65873 .53792 L .69841 .50113 L .7381 .45617 L .77778 .40303 L Mistroke .81746 .34172 L .85714 .27223 L .89683 .19457 L .93651 .10873 L .97619 .01472 L Mfstroke P P p p .004 w .02381 .12621 m .06349 .18849 L .10317 .2497 L .14286 .30879 L .18254 .36477 L .22222 .41666 L .2619 .46358 L .30159 .50473 L .34127 .5394 L .38095 .567 L .42063 .58706 L .44048 .59415 L .4504 .59695 L .46032 .59924 L .47024 .60102 L .4752 .60172 L .48016 .6023 L .48512 .60274 L .4876 .60292 L .49008 .60306 L .49256 .60318 L .4938 .60322 L .49504 .60326 L .49628 .60328 L .49752 .6033 L .49876 .60331 L .5 .60332 L .50124 .60331 L .50248 .6033 L .50372 .60328 L .50496 .60326 L .5062 .60322 L .50744 .60318 L .50992 .60306 L .5124 .60292 L .51488 .60274 L .51984 .6023 L .5248 .60172 L .52976 .60102 L .53968 .59924 L .5496 .59695 L .55952 .59415 L .57937 .58706 L .61905 .567 L .65873 .5394 L .69841 .50473 L .7381 .46358 L .77778 .41666 L .81746 .36477 L .85714 .30879 L Mistroke .89683 .2497 L .93651 .18849 L .97619 .12621 L Mfstroke P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = input; preserveAspect; startGroup] N[RMSDist[1-(Pi x)^2 /8, Cos[Pi x/2], -1,1]] :[font = output; output; inactive; preserveAspect; endGroup] 0.1118357132736736 ;[o] 0.111836 :[font = text; inactive; preserveAspect] Perhaps it is surprising to learn that there are other polynomial expressions which do a much better job of approximating a function such as the sine than does the Taylor series about any point. They are called the Legendre polynomials :[font = input; preserveAspect] P0[x_] := LegendreP[0,x] P1[x_] := LegendreP[1,x] P2[x_] := LegendreP[2,x] P3[x_] := LegendreP[3,x] :[font = input; preserveAspect; startGroup] Projf[f, P0, -1,1] :[font = output; output; inactive; preserveAspect; endGroup] 2/Pi ;[o] 2 -- Pi :[font = input; preserveAspect; startGroup] Projf[f, P2, -1,1] :[font = output; output; inactive; preserveAspect; endGroup] (5*(-((24 - 2*Pi^2)/Pi^3) + (-24 + 2*Pi^2)/Pi^3)*(-1 + 3*x^2))/4 ;[o] 2 2 24 - 2 Pi -24 + 2 Pi 2 5 (-(----------) + -----------) (-1 + 3 x ) 3 3 Pi Pi ------------------------------------------- 4 :[font = input; preserveAspect; startGroup] % + %% + %%% :[font = output; output; inactive; preserveAspect; endGroup] 2/Pi + (5*(-((24 - 2*Pi^2)/Pi^3) + (-24 + 2*Pi^2)/Pi^3)*(-1 + 3*x^2))/4 ;[o] 2 2 24 - 2 Pi -24 + 2 Pi 2 5 (-(----------) + -----------) (-1 + 3 x ) 3 3 2 Pi Pi -- + ------------------------------------------- Pi 4 :[font = input; preserveAspect; startGroup] N[RMSDist[%, Cos[Pi x/2],-1,1]] :[font = output; output; inactive; preserveAspect; endGroup] 0.02441441133097268 ;[o] 0.0244144 :[font = input; preserveAspect; startGroup] Plot[{%%,Cos[Pi x/2]}, {x,-1,1}] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.47619 0.0429923 0.560327 [ [(-1)] .02381 .04299 0 2 Msboxa [(-0.5)] .2619 .04299 0 2 Msboxa [(0.5)] .7381 .04299 0 2 Msboxa [(1)] .97619 .04299 0 2 Msboxa [(0.2)] .4875 .15506 1 0 Msboxa [(0.4)] .4875 .26712 1 0 Msboxa [(0.6)] .4875 .37919 1 0 Msboxa [(0.8)] .4875 .49125 1 0 Msboxa [(1)] .4875 .60332 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .04299 m .02381 .04924 L s P [(-1)] .02381 .04299 0 2 Mshowa p .002 w .2619 .04299 m .2619 .04924 L s P [(-0.5)] .2619 .04299 0 2 Mshowa p .002 w .7381 .04299 m .7381 .04924 L s P [(0.5)] .7381 .04299 0 2 Mshowa p .002 w .97619 .04299 m .97619 .04924 L s P [(1)] .97619 .04299 0 2 Mshowa p .001 w .07143 .04299 m .07143 .04674 L s P p .001 w .11905 .04299 m .11905 .04674 L s P p .001 w .16667 .04299 m .16667 .04674 L s P p .001 w .21429 .04299 m .21429 .04674 L s P p .001 w .30952 .04299 m .30952 .04674 L s P p .001 w .35714 .04299 m .35714 .04674 L s P p .001 w .40476 .04299 m .40476 .04674 L s P p .001 w .45238 .04299 m .45238 .04674 L s P p .001 w .54762 .04299 m .54762 .04674 L s P p .001 w .59524 .04299 m .59524 .04674 L s P p .001 w .64286 .04299 m .64286 .04674 L s P p .001 w .69048 .04299 m .69048 .04674 L s P p .001 w .78571 .04299 m .78571 .04674 L s P p .001 w .83333 .04299 m .83333 .04674 L s P p .001 w .88095 .04299 m .88095 .04674 L s P p .001 w .92857 .04299 m .92857 .04674 L s P p .002 w 0 .04299 m 1 .04299 L s P p .002 w .5 .15506 m .50625 .15506 L s P [(0.2)] .4875 .15506 1 0 Mshowa p .002 w .5 .26712 m .50625 .26712 L s P [(0.4)] .4875 .26712 1 0 Mshowa p .002 w .5 .37919 m .50625 .37919 L s P [(0.6)] .4875 .37919 1 0 Mshowa p .002 w .5 .49125 m .50625 .49125 L s P [(0.8)] .4875 .49125 1 0 Mshowa p .002 w .5 .60332 m .50625 .60332 L s P [(1)] .4875 .60332 1 0 Mshowa p .001 w .5 .06541 m .50375 .06541 L s P p .001 w .5 .08782 m .50375 .08782 L s P p .001 w .5 .11023 m .50375 .11023 L s P p .001 w .5 .13264 m .50375 .13264 L s P p .001 w .5 .17747 m .50375 .17747 L s P p .001 w .5 .19988 m .50375 .19988 L s P p .001 w .5 .2223 m .50375 .2223 L s P p .001 w .5 .24471 m .50375 .24471 L s P p .001 w .5 .28954 m .50375 .28954 L s P p .001 w .5 .31195 m .50375 .31195 L s P p .001 w .5 .33436 m .50375 .33436 L s P p .001 w .5 .35678 m .50375 .35678 L s P p .001 w .5 .4016 m .50375 .4016 L s P p .001 w .5 .42401 m .50375 .42401 L s P p .001 w .5 .44643 m .50375 .44643 L s P p .001 w .5 .46884 m .50375 .46884 L s P p .001 w .5 .51367 m .50375 .51367 L s P p .001 w .5 .53608 m .50375 .53608 L s P p .001 w .5 .55849 m .50375 .55849 L s P p .001 w .5 .58091 m .50375 .58091 L s P p .001 w .5 .02058 m .50375 .02058 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p .004 w .02381 .01472 m .06349 .10695 L .10317 .19117 L .14286 .26737 L .18254 .33554 L .22222 .3957 L .2619 .44783 L .30159 .49194 L .34127 .52804 L .38095 .55611 L .40079 .56714 L .42063 .57616 L .44048 .58318 L .4504 .58594 L .46032 .58819 L .47024 .58995 L .4752 .59064 L .48016 .5912 L .48512 .59164 L .4876 .59181 L .49008 .59195 L .49256 .59206 L .4938 .59211 L .49504 .59214 L .49628 .59217 L .49752 .59219 L .49876 .5922 L .5 .5922 L .50124 .5922 L .50248 .59219 L .50372 .59217 L .50496 .59214 L .5062 .59211 L .50744 .59206 L .50992 .59195 L .5124 .59181 L .51488 .59164 L .51984 .5912 L .5248 .59064 L .52976 .58995 L .53968 .58819 L .5496 .58594 L .55952 .58318 L .57937 .57616 L .59921 .56714 L .61905 .55611 L .65873 .52804 L .69841 .49194 L .7381 .44783 L .77778 .3957 L Mistroke .81746 .33554 L .85714 .26737 L .89683 .19117 L .93651 .10695 L .97619 .01472 L Mfstroke P P p p .004 w .02381 .04299 m .06349 .11613 L .10317 .18802 L .14286 .25742 L .18254 .32316 L .22222 .3841 L .2619 .4392 L .30159 .48753 L .34127 .52825 L .38095 .56067 L .42063 .58423 L .44048 .59255 L .4504 .59583 L .46032 .59853 L .47024 .60062 L .4752 .60144 L .48016 .60212 L .48512 .60264 L .4876 .60285 L .49008 .60302 L .49256 .60315 L .4938 .6032 L .49504 .60324 L .49628 .60328 L .49752 .6033 L .49876 .60331 L .5 .60332 L .50124 .60331 L .50248 .6033 L .50372 .60328 L .50496 .60324 L .5062 .6032 L .50744 .60315 L .50992 .60302 L .5124 .60285 L .51488 .60264 L .51984 .60212 L .5248 .60144 L .52976 .60062 L .53968 .59853 L .5496 .59583 L .55952 .59255 L .57937 .58423 L .61905 .56067 L .65873 .52825 L .69841 .48753 L .7381 .4392 L .77778 .3841 L .81746 .32316 L .85714 .25742 L Mistroke .89683 .18802 L .93651 .11613 L .97619 .04299 L Mfstroke P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = text; inactive; preserveAspect] How are these polynomials constructed? By convention, they are defined on -1 ² x ² 1, as has been done here. The Legendre polynomials are just what you get by applying the Gram-Schmidt procedure to the power functions 1,x,x^2, x^3, etc., except that Legendre chose a convention which makes them orthogonal but not normalized. The normalized Legendre polynomials can be constructed as follows: :[font = input; preserveAspect] v0[x_] := 1 v1[x_] := x v2[x_] := x^2 v3[x_] := x^3 v4[x_] := x^4 :[font = input; preserveAspect; startGroup] p0[x_] = v0[x]/RMSDist[v0[x],0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] 2^(-1/2) ;[o] 1 ------- Sqrt[2] :[font = input; preserveAspect; startGroup] v1[x] - Projf[v1,p0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] x ;[o] x :[font = input; preserveAspect; startGroup] p1[x_] = %/RMSDist[%,0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] (3/2)^(1/2)*x ;[o] 3 Sqrt[-] x 2 :[font = input; preserveAspect; startGroup] v2[x] - Projf[v2,p0,-1,1] \ - Projf[v2,p1,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] -1/3 + x^2 ;[o] 1 2 -(-) + x 3 :[font = input; preserveAspect; startGroup] p2[x_] = %/RMSDist[%,0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] (3*(5/2)^(1/2)*(-1/3 + x^2))/2 ;[o] 5 1 2 3 Sqrt[-] (-(-) + x ) 2 3 --------------------- 2 :[font = input; preserveAspect; startGroup] v3[x] - Projf[v3,p0,-1,1] \ - Projf[v3,p1,-1,1] \ - Projf[v3,p2,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] (-3*x)/5 + x^3 ;[o] -3 x 3 ---- + x 5 :[font = input; preserveAspect; startGroup] p3[x_] = %/RMSDist[%,0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] (5*(7/2)^(1/2)*((-3*x)/5 + x^3))/2 ;[o] 7 -3 x 3 5 Sqrt[-] (---- + x ) 2 5 --------------------- 2 :[font = input; preserveAspect; startGroup] v4[x] - Projf[v4,p0,-1,1] \ - Projf[v4,p1,-1,1] \ - Projf[v4,p2,-1,1] \ - Projf[v4,p3,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] -1/5 + x^4 - (3*(5/2)^(1/2)*((3*(5/2)^(1/2))/7 - 10^(-1/2))*(-1/3 + x^2))/2 ;[o] 5 3 Sqrt[-] 5 2 1 1 2 3 Sqrt[-] (--------- - --------) (-(-) + x ) 1 4 2 7 Sqrt[10] 3 -(-) + x - -------------------------------------------- 5 2 :[font = input; preserveAspect; startGroup] Simplify[%] :[font = output; output; inactive; preserveAspect; endGroup] 3/35 - (6*x^2)/7 + x^4 ;[o] 2 3 6 x 4 -- - ---- + x 35 7 :[font = input; preserveAspect; startGroup] p4[x_] = %/RMSDist[%,0,-1,1] :[font = output; output; inactive; preserveAspect; endGroup] (105*(3/35 - (6*x^2)/7 + x^4))/(8*2^(1/2)) ;[o] 2 3 6 x 4 105 (-- - ---- + x ) 35 7 -------------------- 8 Sqrt[2] :[font = text; inactive; preserveAspect] It may be interesting to Plot the Legendre polynomials and try to visualize their orthogonality: :[font = input; preserveAspect; startGroup] Plot[{LegendreP[0,x], LegendreP[1,x], LegendreP[2,x], \ LegendreP[3,x], LegendreP[4,x]}, {x,-1,1}] :[font = postscript; PostScript; formatAsPostScript; output; inactive; preserveAspect; pictureLeft = 34; pictureWidth = 282; pictureHeight = 174] %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart %% Graphics /Courier findfont 10 scalefont setfont % Scaling calculations 0.5 0.47619 0.309017 0.294302 [ [(-1)] .02381 .30902 0 2 Msboxa [(-0.5)] .2619 .30902 0 2 Msboxa [(0.5)] .7381 .30902 0 2 Msboxa [(1)] .97619 .30902 0 2 Msboxa [(-1)] .4875 .01472 1 0 Msboxa [(-0.5)] .4875 .16187 1 0 Msboxa [(0.5)] .4875 .45617 1 0 Msboxa [(1)] .4875 .60332 1 0 Msboxa [ -0.001 -0.001 0 0 ] [ 1.001 .61903 0 0 ] ] MathScale % Start of Graphics 1 setlinecap 1 setlinejoin newpath [ ] 0 setdash 0 g p p .002 w .02381 .30902 m .02381 .31527 L s P [(-1)] .02381 .30902 0 2 Mshowa p .002 w .2619 .30902 m .2619 .31527 L s P [(-0.5)] .2619 .30902 0 2 Mshowa p .002 w .7381 .30902 m .7381 .31527 L s P [(0.5)] .7381 .30902 0 2 Mshowa p .002 w .97619 .30902 m .97619 .31527 L s P [(1)] .97619 .30902 0 2 Mshowa p .001 w .07143 .30902 m .07143 .31277 L s P p .001 w .11905 .30902 m .11905 .31277 L s P p .001 w .16667 .30902 m .16667 .31277 L s P p .001 w .21429 .30902 m .21429 .31277 L s P p .001 w .30952 .30902 m .30952 .31277 L s P p .001 w .35714 .30902 m .35714 .31277 L s P p .001 w .40476 .30902 m .40476 .31277 L s P p .001 w .45238 .30902 m .45238 .31277 L s P p .001 w .54762 .30902 m .54762 .31277 L s P p .001 w .59524 .30902 m .59524 .31277 L s P p .001 w .64286 .30902 m .64286 .31277 L s P p .001 w .69048 .30902 m .69048 .31277 L s P p .001 w .78571 .30902 m .78571 .31277 L s P p .001 w .83333 .30902 m .83333 .31277 L s P p .001 w .88095 .30902 m .88095 .31277 L s P p .001 w .92857 .30902 m .92857 .31277 L s P p .002 w 0 .30902 m 1 .30902 L s P p .002 w .5 .01472 m .50625 .01472 L s P [(-1)] .4875 .01472 1 0 Mshowa p .002 w .5 .16187 m .50625 .16187 L s P [(-0.5)] .4875 .16187 1 0 Mshowa p .002 w .5 .45617 m .50625 .45617 L s P [(0.5)] .4875 .45617 1 0 Mshowa p .002 w .5 .60332 m .50625 .60332 L s P [(1)] .4875 .60332 1 0 Mshowa p .001 w .5 .04415 m .50375 .04415 L s P p .001 w .5 .07358 m .50375 .07358 L s P p .001 w .5 .10301 m .50375 .10301 L s P p .001 w .5 .13244 m .50375 .13244 L s P p .001 w .5 .1913 m .50375 .1913 L s P p .001 w .5 .22073 m .50375 .22073 L s P p .001 w .5 .25016 m .50375 .25016 L s P p .001 w .5 .27959 m .50375 .27959 L s P p .001 w .5 .33845 m .50375 .33845 L s P p .001 w .5 .36788 m .50375 .36788 L s P p .001 w .5 .39731 m .50375 .39731 L s P p .001 w .5 .42674 m .50375 .42674 L s P p .001 w .5 .4856 m .50375 .4856 L s P p .001 w .5 .51503 m .50375 .51503 L s P p .001 w .5 .54446 m .50375 .54446 L s P p .001 w .5 .57389 m .50375 .57389 L s P p .002 w .5 0 m .5 .61803 L s P P 0 0 m 1 0 L 1 .61803 L 0 .61803 L closepath clip newpath p p p .004 w .02381 .60332 m .06349 .60332 L .10317 .60332 L .14286 .60332 L .18254 .60332 L .22222 .60332 L .2619 .60332 L .30159 .60332 L .34127 .60332 L .38095 .60332 L .42063 .60332 L .46032 .60332 L .5 .60332 L .53968 .60332 L .57937 .60332 L .61905 .60332 L .65873 .60332 L .69841 .60332 L .7381 .60332 L .77778 .60332 L .81746 .60332 L .85714 .60332 L .89683 .60332 L .93651 .60332 L .97619 .60332 L s P P p p .004 w .02381 .01472 m .06349 .03924 L .10317 .06377 L .14286 .08829 L .18254 .11282 L .22222 .13734 L .2619 .16187 L .30159 .18639 L .34127 .21092 L .38095 .23544 L .42063 .25997 L .46032 .28449 L .5 .30902 L .53968 .33354 L .57937 .35807 L .61905 .38259 L .65873 .40712 L .69841 .43164 L .7381 .45617 L .77778 .48069 L .81746 .50522 L .85714 .52974 L .89683 .55427 L .93651 .57879 L .97619 .60332 L s P P p p .004 w .02381 .60332 m .06349 .53281 L .10317 .46843 L .14286 .41018 L .18254 .35807 L .22222 .31208 L .2619 .27223 L .30159 .23851 L .34127 .21092 L .38095 .18946 L .40079 .18103 L .42063 .17413 L .44048 .16876 L .4504 .16666 L .46032 .16493 L .47024 .16359 L .4752 .16306 L .48016 .16263 L .48512 .1623 L .4876 .16217 L .49008 .16206 L .49256 .16197 L .4938 .16194 L .49504 .16191 L .49628 .16189 L .49752 .16188 L .49876 .16187 L .5 .16187 L .50124 .16187 L .50248 .16188 L .50372 .16189 L .50496 .16191 L .5062 .16194 L .50744 .16197 L .50992 .16206 L .5124 .16217 L .51488 .1623 L .51984 .16263 L .5248 .16306 L .52976 .16359 L .53968 .16493 L .5496 .16666 L .55952 .16876 L .57937 .17413 L .59921 .18103 L .61905 .18946 L .65873 .21092 L .69841 .23851 L .7381 .27223 L .77778 .31208 L Mistroke .81746 .35807 L .85714 .41018 L .89683 .46843 L .93651 .53281 L .97619 .60332 L Mfstroke P P p p .004 w .02381 .01472 m .06349 .14696 L .10317 .25111 L .14286 .32971 L .1627 .36023 L .18254 .38532 L .20238 .4053 L .22222 .42049 L .24206 .43121 L .25198 .43499 L .25694 .4365 L .2619 .43777 L .26687 .4388 L .27183 .4396 L .27431 .43991 L .27679 .44017 L .27927 .44037 L .28051 .44044 L .28175 .44051 L .28299 .44056 L .28423 .4406 L .28547 .44062 L .28671 .44063 L .28795 .44063 L .28919 .44061 L .29043 .44058 L .29167 .44054 L .29415 .44042 L .29663 .44024 L .29911 .44001 L .30159 .43973 L .30655 .43903 L .31151 .43813 L .32143 .43576 L .33135 .43268 L .34127 .42892 L .38095 .40788 L .42063 .37919 L .46032 .34538 L .5 .30902 L .53968 .27266 L .57937 .23885 L .61905 .21015 L .63889 .19852 L .65873 .18912 L .66865 .18535 L .67857 .18227 L .68353 .181 L .68849 .17991 L .69345 .17901 L Mistroke .69841 .1783 L .70089 .17802 L .70337 .1778 L .70585 .17762 L .70709 .17755 L .70833 .17749 L .70957 .17745 L .71081 .17742 L .71205 .1774 L .71329 .1774 L .71453 .17741 L .71577 .17744 L .71701 .17747 L .71825 .17752 L .72073 .17767 L .72321 .17787 L .72569 .17812 L .72817 .17843 L .73313 .17923 L .7381 .18026 L .74802 .18304 L .75794 .18683 L .77778 .19755 L .79762 .21274 L .81746 .23272 L .85714 .28832 L .89683 .36692 L .93651 .47107 L .97619 .60332 L Mfstroke P P p p .004 w .02381 .60332 m .04365 .49182 L .06349 .40113 L .08333 .32916 L .10317 .2739 L .1131 .25194 L .12302 .23345 L .13294 .2182 L .14286 .20598 L .15278 .19658 L .1627 .18978 L .16766 .1873 L .17262 .18539 L .17758 .18404 L .18006 .18356 L .1813 .18337 L .18254 .18321 L .18378 .18309 L .18502 .18299 L .18626 .18293 L .1875 .18289 L .18874 .18289 L .18998 .18292 L .19122 .18297 L .19246 .18306 L .1937 .18317 L .19494 .18331 L .19742 .18368 L .1999 .18416 L .20238 .18474 L .20734 .18622 L .2123 .18809 L .22222 .19293 L .24206 .20641 L .2619 .22395 L .30159 .26659 L .34127 .31265 L .38095 .35543 L .42063 .38972 L .44048 .40245 L .4504 .40756 L .46032 .41178 L .47024 .41509 L .4752 .4164 L .48016 .41747 L .48512 .4183 L .4876 .41863 L .49008 .4189 L .49256 .41911 L .4938 .41919 L Mistroke .49504 .41926 L .49628 .41931 L .49752 .41935 L .49876 .41937 L .5 .41938 L .50124 .41937 L .50248 .41935 L .50372 .41931 L .50496 .41926 L .5062 .41919 L .50744 .41911 L .50992 .4189 L .5124 .41863 L .51488 .4183 L .51984 .41747 L .5248 .4164 L .52976 .41509 L .53968 .41178 L .55952 .40245 L .57937 .38972 L .61905 .35543 L .65873 .31265 L .69841 .26659 L .7381 .22395 L .75794 .20641 L .76786 .19909 L .77778 .19293 L .78274 .19033 L .7877 .18809 L .79266 .18622 L .79762 .18474 L .8001 .18416 L .80258 .18368 L .80506 .18331 L .8063 .18317 L .80754 .18306 L .80878 .18297 L .81002 .18292 L .81126 .18289 L .8125 .18289 L .81374 .18293 L .81498 .18299 L .81622 .18309 L .81746 .18321 L .81994 .18356 L .82242 .18404 L .82738 .18539 L .83234 .1873 L .8373 .18978 L .84722 .19658 L Mistroke .85714 .20598 L .86706 .2182 L .87698 .23345 L .89683 .2739 L .91667 .32916 L .93651 .40113 L .97619 .60332 L Mfstroke P P P % End of Graphics MathPictureEnd :[font = output; output; inactive; preserveAspect; endGroup] The Unformatted text for this cell was not generated. Use options in the Actions Preferences dialog box to control when Unformatted text is generated. ;[o] -Graphics- :[font = text; inactive; preserveAspect] What happens if the interval is not -1 ² x ² 1? Let's examine a similar example on another interval. Specifically, let's try to approximate the sin(x) on the interval 0 ² x ² Pi. (The following calculations have not been performed ahead of time. If you carry them out, remember to define Projf, etc as above by going to the appropriate cell and pressing enter; otherwise Mathematica won't know what these commands mean.) ;[s] 3:0,0;376,1;387,0;427,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect] The closest constant to Sin[x] would be, geometrically speaking, the projection of the sine onto the direction of the constant functions: ;[s] 3:0,0;4,1;11,0;139,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,1,12,0,0,0; :[font = input; preserveAspect] f[x_] := Sin[x] One[x_] := 1 Projf[f,One,0, Pi] :[font = input; preserveAspect] N[RMSDist[2/Pi,Sin[x], 0, Pi]] :[font = input; preserveAspect] Plot[{2/Pi,Sin[x]}, {x,0, Pi}] :[font = text; inactive; preserveAspect] We ought to do a better job of approximating Sin[x] with a polynomial of 3rd or 4th degree. You may initially think of the Taylor series at x = 0, and wish regard Sin[x] as close to 0 + x + 0 - x^3/6. Or you might try the Taylor series at x= Pi, :[font = input; preserveAspect] {Series[Sin[x], {x, 0, 3}], Series[Sin[x], {x, Pi, 3}]} :[font = input; preserveAspect] Plot[{x-x^3/6, -(-Pi+x) + (-Pi+x)^3/6, Sin[x]}, {x,0,Pi}] :[font = input; preserveAspect] N[RMSDist[x-x^3/6,Sin[x], 0, Pi]] :[font = input; preserveAspect] Series[Sin[x], {x, Pi/2, 3}] :[font = input; preserveAspect] Plot[{1 - (-Pi/2 + x)^2/2, Sin[x]}, {x,0,Pi}] :[font = input; preserveAspect] N[RMSDist[1 - (-Pi/2 + x)^2/2, Sin[x],0,Pi]] :[font = text; inactive; preserveAspect] Perhaps it is surprising to learn that there are other polynomial expressions which do a much better job of approximating a function such as the sine than does the Taylor series about any point. Let :[font = input; preserveAspect] P0[x_] = LegendreP[0,2 (x-Pi/2)/Pi] P1[x_] = LegendreP[1,2 (x-Pi/2)/Pi] P2[x_] = LegendreP[2,2 (x-Pi/2)/Pi] P3[x_] = LegendreP[3,2 (x-Pi/2)/Pi] P4[x_] = LegendreP[4,2 (x-Pi/2)/Pi] :[font = input; preserveAspect] Projf[f, P0,0,Pi] :[font = input; preserveAspect] Projf[f, P1,0,Pi] :[font = input; preserveAspect] Projf[f, P2,0,Pi] :[font = input; preserveAspect] % + %% + %%% :[font = input; preserveAspect] N[RMSDist[%, Sin[x],0,Pi]] :[font = input; preserveAspect] Plot[{%%,Sin[x]}, {x,0,Pi}] :[font = input; preserveAspect; endGroup] Above, the input variable was written as 2 (x-Pi/2)/Pi in order to shift this interval to 0 ² x ² Pi. Study question. What is the general rule to shift to an interval a ² x ² b? ;[s] 3:0,1;106,2;120,1;183,-1; 3:0,12,10,Courier,1,12,0,0,0;2,12,9,Times,0,12,0,0,0;1,12,9,Times,1,12,0,0,0; ^*)