(*^ ::[ frontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.1"; macintoshStandardFontEncoding; paletteColors = 128; automaticGrouping; currentKernel; 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"; ; ] :[font = special1; inactive; preserveAspect; ] Analyzing a Periodic Function The cell below illustrates the basic step for finding a component of the form a cos(2 Pi t / Lambda) + b sin(2 Pi t / Lambda) in a function f(t) on the interval [0, Lambda]. Evaluate it now. Warning: Many of the functions in this module either have discontinuities or places where they are not differentiable. This causes problems for the standard numerical integration routines built into Mathematica. Sometimes they will give warning message because they cannot achieve their usual degree of precision and other times they may give up. ;[s] 11:0,1;69,0;186,1;233,0;291,1;325,0;327,2;342,0;346,3;547,4;558,3;696,-1; 5:4,13,9,Times,0,12,0,0,0;3,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0;2,13,9,Times,1,12,65535,0,65535;1,13,9,Times,3,12,65535,0,65535; :[font = input; preserveAspect; ] Clear[Lambda, f, a, b, g] f[t_] := If[t < 1, -1, 1] Lambda = 2; a = (2/Lambda) NIntegrate[ f[t] Cos[2 Pi t/Lambda], {t, 0, Lambda}] b = (2/Lambda) NIntegrate[ f[t] Sin[2 Pi t/Lambda], {t, 0, Lambda}] g[t_] := a * Cos[2 Pi t/Lambda] + b * Sin[2 Pi t/Lambda] Plot[{f[t], g[t]}, {t, 0, Lambda}, PlotStyle -> {{RGBColor[0, 0, 0]}, {RGBColor[1, 0, 0]}}] :[font = special1; inactive; preserveAspect; ] The cell below computes and graphs the n-th Fourier polynomial of a function f(t) on the interval [0, Lambda]. Evaluate it now. ;[s] 9:0,0;39,1;40,0;77,1;82,0;100,1;111,0;114,2;129,0;131,-1; 3:5,13,9,Times,0,12,0,0,0;3,13,9,Times,1,12,0,0,0;1,13,9,Times,1,12,65535,0,0; :[font = input; preserveAspect; ] Clear[Lambda, f, a, b, g, n] f[t_] := If[t < 1, -1, 1] Lambda = 2; n = 3; a[0] = (1/Lambda) NIntegrate[f[t], {t, 0, Lambda}]; a[k_] := a[k] = (2/Lambda) NIntegrate[ f[t] Cos[2 Pi k t/Lambda], {t, 0, Lambda}]; b[k_] := b[k] = (2/Lambda) NIntegrate[ f[t] Sin[2 Pi k t/Lambda], {t, 0, Lambda}]; g[t_] := a[0] + Sum[ a[k] Cos[2 Pi k t/Lambda] + b[k] Sin[2 Pi k t/Lambda], {k, 1, n}] Plot[{f[t], g[t]}, {t, 0, Lambda}, PlotStyle -> {{RGBColor[0, 0, 0]}, {RGBColor[1, 0, 0]}}] ^*)