Previous Up Next

5.26.1 Fourier coefficients: fourier_an and fourier_bn or fourier_cn

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=−∞
cne
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.

fourier_an

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

Example

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

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

Output:

1
3

Input (to have the coefficient an (n≠ 0)):

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

Output:

4 
−1
n
n2 π 2

fourier_bn

To simplify the computations, you should input assume(n,integer) (see Section 4.4.8) before calling fourier_bn to specify that n is an integer.

Examples

fourier_cn

To simplify the computations, you should input assume(n,integer) (see Section 4.4.8) before calling fourier_cn to specify that n is an integer.

Examples


Remarks.


Previous Up Next