{VERSION 5 0 "APPLE_PPC_MAC" "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 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Title " -1 18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 } 3 1 0 0 12 12 1 0 1 0 2 2 19 1 }} {SECT 0 {EXCHG {PARA 18 "" 0 "" {TEXT -1 39 "Fourier Series of Piecewi se Polynomials" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 39 " Define some functions on -Pi< x < Pi." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "f1:=x->piecewise(x<-3*Pi/4,0,x<-Pi/4,-(x+Pi/4)*(x+3*P i/4),0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "f2:=x->piecewis e(x<0,0,x " 0 "" {MPLTEXT 1 0 20 "f : =x-> f1(x)+f2(x);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plot(\{f1,f2\} ,-Pi..Pi,numpoints=200);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 35 " calculate zero cosine coefficient " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "(1/Pi)*Int(f(x),x=-Pi..Pi); " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "a0:=evalf(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 72 " calculate cos ine coefficients, a(n), which needs to be a function of n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "a:=n-> value((1/Pi)*Int(f(x)*cos(n* x),x=-Pi..Pi));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 75 " calculate sine coefficients, b(n), which also need s to be a function of n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 " b:=n-> value((1/Pi)*Int(f(x)*sin(n*x),x=-Pi..Pi)) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 23 " check out the results" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "a(n); b(n);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 24 " \+ sum a truncated series" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 " S:=x-> value((a0)/2+Sum(a(n)*cos(n*x)+b(n)*sin(n*x),n=1..5));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 47 " \+ plot the original function & truncated series" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "plot(\{f(x), S(x)\}, x=-Pi..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 40 " plot th e error of the truncated series" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "plot(abs(f(x)-S(x)), x=-Pi..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 68 " a low-tech way of findi ng the max error is to focus in on the plot" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "plot(abs(f(x)-S(x)), x=-.786...-0.784);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "23" 0 } {VIEWOPTS 1 1 0 3 2 1804 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }