Previous Up Next

2.22.1  Fourier coefficients : fourier_an and fourier_bn or fourier_cn

Let f be a T-periodic continuous functions on ℝ except maybe 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 commandsfourier_an and fourier_bn or fourier_cn compute these coefficients.

fourier_an

fourier_an takes four or five arguments : an expression expr depending of a variable, the name of this variable (for example x), the period T, an integer n and a real a (by default a=0).
fourier_an(expr,x,T,n,a) returns the Fourier coefficient an of a function f of variable x defined on [a,a+T[ by f(x)=expr and such that f is periodic of period T:

 an=
2
T
a+T


a
f(x)cos(
2π nx 
T
)dx

To simplify the computations, ons should input assume(n,integer) before calling fourier_an to specify that n is an integer.
Example Let the function f, of period T=2, 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/(pi^2*n^2)

fourier_bn

fourier_bn takes four or five arguments : an expression expr depending of a variable, the name of this variable (for example x), the period T, an integer n and a real a (by default a=0).
fourier_bn(expr,x,T,n,a) returns the Fourier coefficient bn of a function f of variable x defined on [a,a+T[ by f(x)=expr and periodic of period T:

 bn=
2
T
a+T


a
f(x)sin(
2π nx
T
)dx

To simplify the computations, one should input assume(n,integer) before calling fourier_bn to specify that n is an integer.
Examples

fourier_cn

fourier_cn takes four or five arguments : an expression expr depending of a variable, the name of this variable (for example x), the period T, an integer n and a real a (by default a=0).
fourier_cn(expr,x,T,n,a) returns the Fourier coefficient cn of a functionf of variable x defined on [a,a+T[ by f(x)=expr and periodic of period T:

 cn=
1
T
a+T


a
f(x)e
−2iπ nx
T
 
dx

To simplify the computations, one should input assume(n,integer) before calling fourier_cn to specify that n is an integer.
Examples

Remarks :


Previous Up Next