{VERSION 3 0 "SUN SPARC SOLARIS" "3.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 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 }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 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "" 3 256 1 {CSTYLE " " -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 3 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 256 "" 0 "" {TEXT -1 37 "Calculating Fourier Series with Maple" }}{PARA 257 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 125 "Here are some Maple procedures to calculate the Fourier coefficie nts and the partial sum of the Fourier series of a function " } {XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 1 "\000" }{TEXT -1 53 ". I ass ume the function is defined on the interval [" }{XPPEDIT 18 0 "-L,L;" "6$,$%\"LG!\"\"F$" }{TEXT -1 30 "]. I need to tell Maple that " } {XPPEDIT 18 0 "L;" "6#%\"LG" }{TEXT -1 22 " is positive and that " } {XPPEDIT 18 0 "k;" "6#%\"kG" }{TEXT -1 78 " (the index for the Fourier coefficients) is an integer. I do this with the " }{TEXT 256 6 "ass ume" }{TEXT -1 121 " command. When you have assumed something about a variable, Maple indicates that by following the variable with a tilde ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "assume(L,positive);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "assume(k,integer);" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 52 "The following procedure calculates the coefficients " } {XPPEDIT 18 0 "a[k];" "6#&%\"aG6#%\"kG" }{TEXT -1 18 " for the functio n " }{XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 31 ". I have called the p rocedure " }{TEXT 257 1 "a" }{TEXT -1 1 "," }}{PARA 0 "" 0 "" {TEXT -1 18 "and it depends on " }{XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "k;" "6#%\"kG" }{TEXT -1 1 "." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "a := proc( f,k)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 43 " integrate(f(x)*cos(k*Pi* x/L),x=-L..L)/L;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "end;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 63 "Similarly, the \+ following procedure calculates the coefficients " }{XPPEDIT 18 0 "b[k] ;" "6#&%\"bG6#%\"kG" }{TEXT -1 18 " for the function " }{XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "b := proc(f,k)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 43 " integrate(f(x)*sin(k*Pi*x/L),x=-L..L)/L;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "end;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 39 "The following procedure calculates the " }{XPPEDIT 18 0 "n;" "6#%\"nG" }{TEXT -1 54 "th partial sum of t he Fourier series for the function " }{XPPEDIT 18 0 "f;" "6#%\"fG" } {TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "L := 'L';" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "fourier_partial_sum := " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 " proc(f,n)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 79 " a(f,0)/2 + \+ sum(a(f,k)*cos(k*Pi*x/L)+b(f,k)*sin(k*Pi*x/L),k=1..n);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 " end;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 50 "Here is an example of how to use it. I will take " }{XPPEDIT 18 0 "f(x) = abs(x);" "6#/-%\"fG6#%\"xG-%$absG6 #F'" }{TEXT -1 0 "" }{TEXT -1 3 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f := x -> abs(x);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "a(f,k);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "b(f,k);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 53 "Here is the second partial sum of the Fou rier series." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "fourier_partial_sum(f,2);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 30 "Here is the fifth partial sum." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "fourier_partial_sum(f,5);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 10 "By taking " }{XPPEDIT 18 0 "n; " "6#%\"nG" }{TEXT -1 7 " to be " }{XPPEDIT 18 0 "infinity;" "6#%)infi nityG" }{TEXT -1 40 ", I can even write down the full series." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "fourier_partial_sum(f,infinity);" }}}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 93 "I can compare the graph of the origin al function. To do this, I need to specify a value for " }{XPPEDIT 18 0 "L;" "6#%\"LG" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "L := 1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "plot(\{f(x),fourier_partial_sum(f,2)\},x=-1.. 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "plot(\{f(x),fourier_ partial_sum(f,5)\},x=-1..1);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(\{f(x),fourier_partial_ sum(f,10)\},x=-1..1);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22 "Now I'll do this with " }{XPPEDIT 18 0 "f(x) = x;" " 6#/-%\"fG6#%\"xGF'" }{TEXT -1 17 ". I;ll think of " }{XPPEDIT 18 0 "f ;" "6#%\"fG" }{TEXT -1 90 " as defined on (-1,1) and extend it to be p iecewise continuous and periodic with period 2." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "f := x -> pi ecewise(x>=-3 and x < -1,x+2,x>-1 and x<1, x, x>1 and x<=3, x-2);" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22 "What does the plot of " }{XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 11 " look like? " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "plot(f,-3..3,discont=true,scaling=constrained);\n" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 14 "Now I'll plot " } {XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 232 " with the second partial s um of its Fourier series. This time I didn't tell Maple that it is pl otting a discontinuous function, so Maple adds straight vertical lines connecting the values from the two sides at a jump discontinuity." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "plot(\{f(x),fourier_partial_sum(f,2)\},x=-3..3,scaling=constrained );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "plot(\{f(x),fourier_p artial_sum(f,5)\},x=-3..3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(\{f(x),fourier_partial_sum(f,10)\},x=-1..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(\{f(x),fourier_partial_sum(f,2 0)\},x=-1..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "plot(\{f( x),fourier_partial_sum(f,50)\},x=-1..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "plot(\{f(x),fourier_partial_sum(f,50)\},x=-1..1,numpo ints=1000);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "35 0" 5 }{VIEWOPTS 1 1 0 1 1 1803 }