Previous Up Next

21.4.1  Fourier coefficients

Let f be a T-periodic continuous function on ℝ except perhaps at a finite number of points. One can prove that if f is continuous at x, then;

     
  f(x)
=
a0
2
+
+∞
n=1
 an cos


nx
T



+bn sin


2π nx
T



         
 
=
+∞
n=−∞
 cn e
2iπ nx
T
 
         

where the coefficients an, bn, nN, (or cn, nZ) are the Fourier coefficients of f. The fourier_an and fourier_bn or fourier_cn commands compute these coefficients.

To simplify the computations, you should input assume(n,integer) (see Section 3.3.8) before calling the above commands with an unspecified n to specify that it is an integer.

Examples

Let the function f, with period T=2, be defined on [−1,1) by f(x)=x2. To obtain the coefficient a0, input:

fourier_an(x^2,x,2,0,-1)
     
1
3
          

To obtain the coefficient an (n≠ 0), input:

assume(n,integer):; fourier_an(x^2,x,2,n,-1)
     

−1
n
n2 π 2
          

Let the function f, with period T=2, defined on [−1,1) by f(x)=x2. To get the coefficient bn (n≠ 0), input:

assume(n,integer):; fourier_bn(x^2,x,2,n,-1)
     
0           

Let the function f, with period T=2, defined on [−1,1) by f(x)=x3. To get the coefficient b1, input:

fourier_bn(x^3,x,2,1,-1)
     
2 π 2−12
π 3
          

Find the Fourier coefficients cn of the periodic function f of period 2 and defined on [−1,1) by f(x)=x2. To get c0, input:

fourier_cn(x^2,x,2,0,-1)
     
1
3
          

Input (to get cn):

assume(n,integer); fourier_cn(x^2,x,2,n,-1)
     

−1
n
n2 π 2
          

Find the Fourier coefficients cn of the periodic function f, of period 2, and defined on [0,2) by f(x)=x2. To get c0, input:

fourier_cn(x^2,x,2,0)
     
4
3
          

To get cn, input:

assume(n,integer):; fourier_cn(x^2,x,2,n)
     
2 π i  n+2
n2 π 2
          

Find the Fourier coefficients cn of the periodic function f of period 2π and defined on [0,2π) by f(x)=x2.

assume(n,integer):; fourier_cn(x^2,x,2*pi,n)
     
i  n+2
n2
          

You must also compute cn for n=0:

fourier_cn(x^2,x,2*pi,0)
     
4
3
 π 2
          
Remarks.

Previous Up Next