Example 4.  Given the 12  equally spaced data points
[Graphics:Images/FourierSeriesMod_gr_198.gif][Graphics:Images/FourierSeriesMod_gr_199.gif][Graphics:Images/FourierSeriesMod_gr_200.gif][Graphics:Images/FourierSeriesMod_gr_201.gif]
which can be extended periodically over [Graphics:Images/FourierSeriesMod_gr_202.gif], if we define  [Graphics:Images/FourierSeriesMod_gr_203.gif].  
Find the Fourier polynomial of degree n = 5  for the 12  equally spaced points over interval  [Graphics:Images/FourierSeriesMod_gr_204.gif].  
Use Mathematica's Fit subroutine to find the coefficients.

Solution 4.

Note.  The data are computed using the function  [Graphics:../Images/FourierSeriesMod_gr_205.gif], which is the function that was used in examples 1 - 3.  

Construct the data points to be used.

[Graphics:../Images/FourierSeriesMod_gr_206.gif]


[Graphics:../Images/FourierSeriesMod_gr_207.gif]

[Graphics:../Images/FourierSeriesMod_gr_208.gif]
[Graphics:../Images/FourierSeriesMod_gr_209.gif]

Remark.  Notice that precisely 12 data points are used and a point corresponding to [Graphics:../Images/FourierSeriesMod_gr_210.gif] is not used.   

Remark.  The Mathematica procedure  Fit  can be used to numerically compute the trigonometric polynomial.

[Graphics:../Images/FourierSeriesMod_gr_211.gif]


[Graphics:../Images/FourierSeriesMod_gr_212.gif]

[Graphics:../Images/FourierSeriesMod_gr_213.gif]

[Graphics:../Images/FourierSeriesMod_gr_214.gif]
[Graphics:../Images/FourierSeriesMod_gr_215.gif]
[Graphics:../Images/FourierSeriesMod_gr_216.gif]

[Graphics:../Images/FourierSeriesMod_gr_217.gif]

[Graphics:../Images/FourierSeriesMod_gr_218.gif]
[Graphics:../Images/FourierSeriesMod_gr_219.gif]
[Graphics:../Images/FourierSeriesMod_gr_220.gif]

Caveat.  The underlying function f(x) is even which requires that only cosine terms be used for the Fourier trigonometric polynomial.
Since f(x) has period [Graphics:../Images/FourierSeriesMod_gr_221.gif], if data points were used at both end of the interval [Graphics:../Images/FourierSeriesMod_gr_222.gif] then the "least squares" algorithm would weight the function value [Graphics:../Images/FourierSeriesMod_gr_223.gif] twice, whereas all other function values would have weight 1.  If 13 data points were used which included the right end point, then a wrong answer will result, and spurious terms appear in the trigonometric polynomial. Look at the wrong answer.

Wrong Answer.

[Graphics:../Images/FourierSeriesMod_gr_224.gif]



[Graphics:../Images/FourierSeriesMod_gr_225.gif]
[Graphics:../Images/FourierSeriesMod_gr_226.gif]
[Graphics:../Images/FourierSeriesMod_gr_227.gif]

[Graphics:../Images/FourierSeriesMod_gr_228.gif]

[Graphics:../Images/FourierSeriesMod_gr_229.gif]

[Graphics:../Images/FourierSeriesMod_gr_230.gif]

[Graphics:../Images/FourierSeriesMod_gr_231.gif]
[Graphics:../Images/FourierSeriesMod_gr_232.gif]
[Graphics:../Images/FourierSeriesMod_gr_233.gif]
[Graphics:../Images/FourierSeriesMod_gr_234.gif]
[Graphics:../Images/FourierSeriesMod_gr_235.gif]
[Graphics:../Images/FourierSeriesMod_gr_236.gif]
[Graphics:../Images/FourierSeriesMod_gr_237.gif]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004