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) | = | | + | | an cos | ⎛
⎜
⎜
⎝ | | ⎞
⎟
⎟
⎠ | +bn sin | ⎛
⎜
⎜
⎝ | | ⎞
⎟
⎟
⎠ |
| | | | | | | | | |
| | | | | | | | | | |
|
where the coefficients an, bn, n∈ N, (or cn, n ∈ Z) are the
Fourier coefficients of f.
The fourier_an and
fourier_bn or
fourier_cn
commands compute these coefficients.
-
fourier_an takes four mandatory and one optional argument:
-
expr, an expression depending on a variable.
- x, the name of this variable.
- T, the period.
- n, a non-negative integer.
- Optionally, a, a real number (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 with period T:
an= | | ∫ | | f(x)cos | ⎛
⎜
⎜
⎝ | | ⎞
⎟
⎟
⎠ | dx
|
- fourier_bn takes four mandatory and one optional argument:
-
expr, and expression depending on a variable.
- x, the name of this variable.
- T, the period.
- n, an integer.
- Optionally, a, a real number (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 such that f is
periodic with period T:
bn= | | ∫ | | f(x)sin | ⎛
⎜
⎜
⎝ | | ⎞
⎟
⎟
⎠ | dx
|
- fourier_cn takes four mandatory and one optional argument:
-
expr, and expression depending on a variable.
- x, the name of this variable.
- T, the period.
- n, an integer.
- Optionally, a, a real number (by default a=0).
- fourier_cn(expr,x,T,n ⟨,a⟩) returns the
Fourier coefficient cn of a function f of variable x defined on
[a,a+T) by f(x)=expr and such that f is
periodic with period T:
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:
To obtain the coefficient an (n≠ 0), input:
assume(n,integer):;
fourier_an(x^2,x,2,n,-1) |
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) |
Let the function f, with period T=2, defined on [−1,1) by
f(x)=x3.
To get the coefficient b1, input:
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:
Input (to get cn):
assume(n,integer);
fourier_cn(x^2,x,2,n,-1) |
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:
To get cn, input:
assume(n,integer):;
fourier_cn(x^2,x,2,n) |
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) |
You must also compute cn for n=0:
Remarks.
-
Input purge(n) (see Section 3.3.9) to
remove the hypothesis done on n.
- Input about(n) or assume(n), to know
the hypothesis done on the variable n.