Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to Part V of the course APMA0340
Introduction to Linear Algebra with Mathematica
where, for simplicity, we assume that the function is defined on interval [−ℓ, ℓ]. Here x is a real variable and the the coefficients 𝑎k, bk are evaluated according to the Euler--Fourier formulas, so they independent of x. Since we consider real-valued functions, the Fourier coefficients are real numbers. The factor ½ in the constant term of Eq.\eqref{EqComplex.1a} will be found to be a convenient convention. Since the terms of \eqref{EqComplex.1a} are all of period 2ℓ, it is sufficient to study trigonometric series in an interval of length 2ℓ, for instance in {−ℓ, ℓ].
on the unit circle \( z = e^{{\bf j} \pi x/\ell} , \) where j is the imaginary unit vector on complex plane ℂ, so j² = −1. The series \eqref{EqComplex.1a} is the real part of the latter, and the series
is its imaginary part, which is called the series conjugate to \eqref{EqComplex.1a}.
To compensate the imaginary part of series in z, we add the series to it
The complex exponential form of Fourier series is a representation of a periodic function (which is usually a signal) with period \( 2\ell \) as infinite series:
because restoring a function from its Fourier coefficients is an ill-posed problem.
Formula \eqref{EqComplex.2} is based on the orthogonality property of exponential functions:
Here, j is the unit vector in positive vertical direction on the complex plane, so \( {\bf j}^2 =-1. \) For example the Fourier series for the Dirac delta function on a symmetric interval (−&ell, ℓ) is
The FourierSeries command has an option FourierParameters that involves two parameters and when applied, it looks as FourierParameters->{a,b}
This means that complex Fourier coefficient is evaluated according to the formula:
Example 1:
Consider a piecewise constant function on the interval [-2 , 2]:
\[
f(x) = \left\{
\begin{array}{ll}
1, & \ \mbox{on the interval } -2 < x < -1, \\
0 , & \ \mbox{on the interval } -1 < x < 0 , \\
2, & \ \mbox{on the interval } 0 < x < 2.
\end{array}
\right.
\]
There is no need to define the function at the points of discontinuity \( x=-2, -1, 0, 2 \) because the corresponding Fourier series will specify the values at these points to be the averages of left and right limit values. Therefore, \( f(-2) = 3/2, \ f(-1) = 1/2, \ f(0) = 1, \ f(2) =3/2 . \) We can find the Fourier coefficients either by evaluating integrals
When the complex Fourier series is used to represent a periodic function, then the amplitude spectrum, sketched below, is two-sided. It consists of the points \( \left( \frac{k\pi}{\ell} , \left\vert \alpha_k \right\vert \right) , \quad k= 0, \pm 1, \pm 2, \ldots \) that in our case become
The power spectrum for f is also two-sided, consisting of the points \( \left( \frac{k\pi}{\ell} , \left\vert \alpha_k \right\vert^2 \right) , \quad k= 0, \pm 1, \pm 2, \ldots \) that in our case become
where \( p(x) = b_n x^n + b_{n-1} x^{n-1} + \cdots + b_1 x + b_0 \) is a polynomial of degree n.
Example 2:
Find complex and regular Fourier series expansion of the function \( f(x) = \frac{1-a\,\cos x}{1- 2a\,\cos x + a^2} , \) where real number a has absolute value less than 1: \( |a| <1 . \)
First, we substitute Euler's representation \( \cos x = \frac{1}{2}\,e^{{\bf j}x} + \frac{1}{2}\,e^{-{\bf j}x} . \)
instead of cos(x).
Then
Using the geometric series formula \( \frac{1}{1-q} = \sum_{n\ge 0} q^n \) twice, first time with \( q= a\,e^{-{\bf j}x} \) and second time with \( q= a\,e^{{\bf j}x} , \) we obtain the required complex Fourier series:
The function is a pulse function with amplitude 1, and pulse width h, and period T. Using Mathematica, we can define the pulse function in many ways; however, we demonstrate application of command Which. The Which command provides a logical expression that allows us to evaluate a function in only one statement like the one given in the equation, defining the pulse function. The "Which" command has the general form :
Which[condition1, value1, condition2, value2 ...]
The command will return the value that is true; let us see how this works in practice in an example of the pulse function:
PI[x_, h_, T_] := Which[0 < x < h, 1, h < x < T, 0]
We expand the pulse function into exponential Fourier series:
Note that the corresponding k = 0 value α0 = h/T does not follow from the general formula directly. The above Fourier series defines the pulse functions at the points of discontinuity as the mean values from left and right:
Actually, the function h(x) is a ladder function that coinside with the Heaviside function on the interval (−2ℓ, 2ℓ), as the folloing plots confirm:
Stein, E.M., Shakarchi, R., Fourier Analysis: An Introduction, Princeton University Press, 2003. ISBN-13 : 978-0691113845
Return to Mathematica page
Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions