fourierseriesonotherintervals
fourierseriesonotherintervals
from Class
In class on W we investigated Fourier series on intervals other than (-p, p). For functions that are 2
L periodic (where 2 L is the wavelength), we compute Fourier coefficients and the Fourier series
making the modifications derived in class :
where :
x dx x cos n p x 2 dx x sin n p x 2 dx
1 2 1 2 1 2
a0 = 2
an = 2
bn = 2
2 -2 2 -2 2 -2
x dx x cos n p x 2 dx
2 2 2 2
a0 = 2
an = 2
bn = 0
2 0 2 0
Now, going the lazy route and letting Mathematica do the heavy lifting :
In[330]:= a0 Integratex2 , x, 0, 2
8
Out[330]=
3
In[332]:= an Integratex2 Cosn x 2, x, 0, 2
-1n
16
an =
n p
2 2
-1n cos n p x 2
so that our Fourier series is :
f x =
¶
4 16
+
3 p2 n=1 n2
2 fourierseriesonotherintervals.nb
Out[339]= 2
-6 -4 -2 2 4 6
Note that the values are consistent with our function (f (2) = 4 ) and the function repeats with a
periodicity of 4.
Now, let' s examine the same function on (0, 4). Since our limits are not symmetric across the
origin, we cannot make use of symmetry arguments. Our integrals become :
x dx x cos n p x 2 dx x sin n p x 2 dx
1 4 1 4 1 4
a0 = 2
an = 2
bn = 2
2 0 2 0 2 0
Even though the limits have changed, L = 2 since the total length of the interval, 2 L = 4.
Computing coefficients :
Cleara0, an, bn, L, f
L 2;
I know I have stressed we should not use capital letters for variables;
In[340]:=
but I know that "L" is not restricted for Mathematica use, so let's use it.
fx_ : x2
a0 1 L Integratefx, x, 0, 4
an 1 L Integratefx Cosn x L, x, 0, 4
bn 1 L Integratefx Sinn x L, x, 0, 4
32
Out[342]=
Out[343]=
n3 3
8 1 1 2 n2 2 Cos2 n 2 n Sin2 n
Out[344]=
n3 3
And we get our three outputs. Knowing that sin (2 n p) is always zero for integer values of n, these
complicated expressions reduce quite nicely, and we have :
16 -16
an = bn =
n2 p 2 np
fourierseriesonotherintervals.nb 3
f x = + +
¶ ¶
32
6 n=1 p2 n2 n=1
p n2
Plotting three cycles of this function using the first 31 terms of the expansion :
In[345]:= Plot32 6 Sum16 2 Cosn x 2 n2 16 Sinn x 2 n, n, 1, 31, x, 4, 8
15
10
Out[345]=
-4 -2 2 4 6 8