Project Help Notebook by Keith Stroyan

Help NoteBook Copyright 1998 by Academic Press, Inc. - All rights reserved.
Modify this Notebook to prepare your project report.

Project 51: Fourier Series

by A. Student and B. Pupil

with technical help from Da LabMonitor and Help Notebook

The seriesGraphs[] Program

seriesGraphs[f_, series_, radius_, numterms_, opns___Rule] :=
	Block[ {functions, graylevels, i, j},
		Do[
			functions = Table[series, {n, 0, i}] ;
			AppendTo[functions, f] ;
			graylevels = Table[{GrayLevel[j]}, {j, 6/10, 0, -6/(10 (1+i))}] ; 
			Plot[Release[functions], {x, -radius, radius},
					PlotStyle -> graylevels,
				 	PlotLabel ->{"terms =", i}, opns],
		{i, 1, numterms}
		]
		Do[
			Plot[Release[{f, series}],{x, -radius, radius},
				PlotLabel ->{"terms =", n}, opns],
		{n, 1, numterms}
		] ;
	] ;

My Project Introduction

Write this last.  Begin with the basic question and state your main finding clearly, but with few technical details.  You might even modify the title of this section to make it more interesting.

Computer Experiments & Coefficient Computations

Read about the general formulas for Fourier series in the print project and put those formulas here.  You may want to also express the general formulas in Mathematica commands like:

\(Clear[f, x, a, b, Subscript]; 
f\  := \ x\^2; 

    a\_0 = \(1\/\(2  π\)\) 
        \(∫\_\(-π\)\%π f \[DifferentialD]x\)\)

The First  Example from the Print Project & Hint 51.2

Read the print project, work Hint 51.2, and compute the following with  Mathematica.

\(Clear[f, x, a, b, Subscript]; 

    a\_0 = \(1\/\(2  π\)\) 
        \((∫\_\(-π\)\%0\(-x\) \[DifferentialD]x + 
            ∫\_0\%π x \[DifferentialD]x)\)\)(Subscript[a, k]) = 
      (1/π) 
        ((∫_(-π)^0)-x Cos[k x] \[DifferentialD]x + 
            (∫_0^π) x Cos[k x] \[DifferentialD]x)

Clear[f]
Clear[n]
f := Abs[x] /; -N[Pi] < x <= N[Pi]
f := Abs[x + 2 Pi] /; -3 N[Pi] <= x <= -N[Pi]
f := Abs[x - 2 Pi] /; N[Pi] < x <= 3 N[Pi]
series := Pi/2 + (-4/Pi) Sum[(1/(2k + 1)^2) Cos[(2k + 1) x], {k, 0, n}]
radius = 5;
numterms = 7;
seriesGraphs[ f, series, radius, numterms, PlotRange -> {-0.1, Pi}]

Hint 51.3

Use your general formulas to find the Fourier coefficients of the periodic function that equals  x  for  -π < x < π.

Clear[f]
Clear[n]
f := x /; -N[Pi] < x <= N[Pi]
f := x + 2 Pi /; -3 N[Pi] <= x <= -N[Pi]
f := x - 2 Pi /; N[Pi] < x <= 3 N[Pi]
series := 2 Sum[(-1)^(k+1)/k Sin[k x], {k, 1, n}]
radius = 5;
numterms = 7;
seriesGraphs[ f, series, radius, numterms, PlotRange -> {-Pi, Pi}]

Hint 51.5

Use your general formulas to find the Fourier coefficients of the periodic function that equals  Sign[x]  for  -π < x < π.

Clear[f]
Clear[n]
f := Sign[x] /; -N[Pi] < x <= N[Pi]
f := Sign[x + 2 Pi] /; -3 N[Pi] <= x <= -N[Pi]
f := Sign[x - 2 Pi] /; N[Pi] < x <= 3 N[Pi]
series := (4/Pi) Sum[1/(2k+1) Sin[(2k+1) x], {k, 0, n}]
radius = 5;
numterms = 7;
seriesGraphs[ f, series, radius, numterms, PlotRange -> {-1.5, 1.5}]