Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to computing page for the fourth course APMA0360
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to Mathematica tutorial for the fourth course APMA0360
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to the main page for the fourth course APMA0360
Return to Part V of the course APMA0340
Introduction to Linear Algebra with Mathematica
Glossary
Preface
Our presentation of Fourier series in this section is not done in great depth or generality to meet the pure mathematician's criteria for accuracy. For example, we mostly utilize classical Riemann integration in the majority of examples rather than modern Lebesgue's one in order to make all concepts friendly accessible.
Our exposition is intended as a shop window for basic ideas, techniques, and elegant results of Fourier analysis, with suggested references for further study. The process of understanding is always facilitated if more complicated structures are known to be synthesized from simpler.
Although there are many methods for function representations, Fourier analysis involving the resolution of analog and digital signals into sinusoidal components dominates. Periodic functions occur in a wide range of physical phenomena, a few examples of which are acoustic and electromagnetic waves, periodic vibrations of musical instruments, vertical displacement of a mechanical pendulum, and periodic signals in electrical engineering devices. From theoretical or mathematical point of view, a Fourier series of a function is its spectral decomposition with respect to orthogonal basis formed by eigenfunctions corresponding to a Sturm--Liouville problem.
Sturm--Liouville Problems
Let us start with the regular Sturm--Liouville problem for the first order differential equation subject to the periodic condition,
The general solution of the differential equation \( \quad {\mathbf j}\,u'(x) + \mu\, u(x) =0 \quad \) is \( \quad C\,e^{{\bf j}\mu x} , \ \) for some constant C ≠ 0. To satisfy the periodic boundary condition, we have to set μ = nπ/ℓ for some integer n ∈ ℤ = { 0, ±1, ±2, …}. So the eigevalues for this first order differential equation are \( \quad \mu_n = \frac{n\pi}{\ell} = n\,\frac{\pi}{\ell} , \quad n = 0, \pm 1, \pm 2, \ldots , \quad \) to which correspond eigenfunctions \( \quad u_n (x) = e^{{\bf j}\pi n x/\ell} , \quad \) up to some nonzero constant multiple.
Instead of the first order differential operator \( \quad \hat{p} = -{\bf j}\,\texttt{D} = -{\bf j}\,{\text d}/{\text d}x \quad \) with complex coefficient j, it is convenient to square it to obtain \( \quad L_2 [\texttt{D}] = \hat{p}^2 = - \texttt{D}^2 \quad \) in order to get rid of the imaginary unit. This leads to the corresponding Sturm--Liouville problem with a parameter λ:
Since the differential operator L₂ is a square of of the first order momentum operator \( \quad L_2 \left[ \texttt{D} \right] = \hat{p}^2 , \quad \) its eigenvalues must be squares of the latter:
Often, eigenfunctions are organized in two-dimensional vector form:
Any eigenvalue problem can be written in abstract form as \( \quad L\, y = \lambda\,y , \ \) which is actually a spectral representation of the linear operator L. The idea of such representation is to reduce action of the operator L on a function by multiplication operation. In contrast to finite dimensional case (matrices), an unbounded operator has infinite many (maybe continuous) eigenvalues.
Assuming λ≥0, we solve the Sturm--Liouville problem for L₂.
The first order differential operator \( \hat{p} \) acts on complex-valued functions (as well as on real-valued functions). The general solution of \( {\bf j}\,u' + \mu\, u = 0 \) depends on one arbitrary complex number A = 𝑎 + jb (where 𝑎 and b are real numbers):
﹡ ⁎ ✱ ✲ ✳ ✺ ✻ ✼ ✽ ❋
An essential part of the Sturm--Liouville theory includes function expansions with respect to the (infinite) system of eigenfunctions---a complete set for every self-adjoint differential operator of the second order subject to the appropriate boundary conditions. The majority of applications of the Sturm--Liouville theory utilizes expansions of a function f(x) that satisfies the homogeneous boundary conditions (in our case, they are periodic conditions)
Since every eigenfunction ϕₖ(x) in decomposition \eqref{EqFourier.1} satisfies the periodic condition, we expect that the function f(x) also matches this condition, so we require that f(−ℓ) = f(ℓ). Anyway, the Fourier expansion \eqref{EqFourier.1} assigns numerical values at endpoints for f(x). If the values of f(x) at the endpoints do not match, then this just means that there is a discontinuity at that point---don't worry, the Fourier series will correct you. Hence, the Fourier series, if it converges, dictates the determination of f at endpoints according to the average of its one sided limits:
Definition of Fourier Series
Historically, Legendre expansions were first introduced by AdrienโMarie Legendre in 1784 in his work on the gravitational attraction of ellipsoids. However, it was Joseph Fourier who first claimed, in 1807, that "every function" can be expanded into a series of trigonometric functions. It was later discovered that this claim is valid only for certain classes of functions. Nevertheless, the Fourier series provided the first example of an expansion in terms of eigenfunctions of a Sturm--Liouville problem with periodic boundary conditions.
Since a function represented by a Fourier series must satisfy these boundary conditions, we restrict our attention to periodic functions. Moreover, without loss of generality, we assume that all periodic functions have period T = 2ℓ. It therefore suffices to consider real-valued functions f : [−ℓ, ℓ] → ℝ satisfying \( f(-\ell ) = f(\ell ) = \frac{1}{2} \left[ f(-\ell + 0) + f(\ell -0) \right] , \ \) which ensures compatibility with the periodicity condition.
Every expansion can be written in the series form \eqref{EqFourier.1}. Therefore, it consists of two mutually dependent components: the Fourier coefficients { cₖ } and the set of eigenfunctions { ϕₖ }. Mathematicians later proved the existence of eigenvalues and eigenfunctions, since Sturm and Liouville themselves did not provide such a proof, showing that an unbounded self-adjoint second-order differential operator subject to appropriate homogeneous boundary conditions possesses a discrete set of eigenvalues and corresponding eigenfunctions. Reconstructing a function f(x) from its discrete list of Fourier coefficients | f 〉 is referred to as forming its Fourier series. In other words, the Fourier series of a function f(x) represents its decomposition into periodic waves, one of the most useful concepts in physics that also plays a central role in many branches of engineering. However, reconstructing the function from its Fourier coefficients is an ill-posed problem.
There are two equivalent forms of Fourier series based on two eigenfunction expansions corresponding to the first order operator \( \hat{p} = - {\bf j}\,\texttt{D} \) and the second order operator \( L_2 \left[ \texttt{D} \right] = - \texttt{D}^2 = \left( -{\bf j} \texttt{D} \right)^2 = \left( \hat{p} \right)^2 = \hat{H}(p) . \) The former one provides an eigenfunction expansion in a complex form (or exponential form)
Example 1: We expand the following complex-valued function into exponential Fourier series:
Another eigenfunction expansion regarding the second order differential operator \( \displaystyle \quad L_2 (\texttt{D}) = - \texttt{D}^2 = - {\text d}^2/{\text d}x^2 \quad \) gives a trigonometric form of Fourier series
Series \eqref{EqFourier.4} is also understood in the Cauchy principal value sense because generally speaking it should be written as
Sometimes, it is convenient to use polar form:
Example 2: Function ๐(๐ฅ) = 1/๐ฅ is not absolutely integrable on [0, π], so it does not belong to the Lebesgue space 𝔏¹: \[ \int_0^{\pi} \,\left\vert \frac{1}{x} \right\vert {\text d}x = \int_0^{\pi} \,\frac{{\text d}x}{|x|} = \infty . \] However, its Fourier coefficients exist: \[ b_n = \frac{2}{\pi}\,\int_0^{\pi} \,\frac{\sin (nx)}{x}\,{\text d}x = \frac{2}{\pi}\,\mbox{Si}(n\pi) , \] where Si(๐ฅ) is the Sine Inetgral, \[ \mbox{Si}(x) = \int_0^x \,\frac{\sin t}{t}\,{\text d}t . \] Hence one formally obtains the Fourier series \[ \frac{1}{x} \,\sim\,\frac{2}{\pi}\,\sum_{n=1}^{\infty}\,\mbox{Si}(n\pi )\,\sin (nx) . \] Now we utilize Mathematica to plot sine Fourier partial sums.
| Fourier approximation with 100 terms | Fourier approximation with 500 terms | |
|---|---|---|
![]() |
|
Example 3: Let us consider two functions that can be used to generate saw-tooth graphs. One of them is the absolute value function (on a finite interval) and another one is just its shift:
|
  |
We plot with Mathematica:
s20[x_] = 1/2 - (4/Pi^2)*Sum[Cos[k*Pi*x]/(2*k - 1)^2, {k, 1, 20}];
Plot[{Abs[x], s20[x]}, {x, -1.2, 1.2}, PlotStyle -> Thick] |
| Absolute value function and its 20 term Fourier approximation. | Mathematica code |
Now we calculate Fourier coefficients for function f(x)
|
  |
We plot with Mathematica:
s20[x_] = 1/2 + (4/Pi^2)*Sum[Cos[k*Pi*x]/(2*k - 1)^2, {k, 1, 20}];
f[x_] = Piecewise[{{1 + x, x < 0}, {1 - x, x > 0}}]; Plot[{f[x], s20[x]}, {x, -1.2, 1.2}, PlotStyle -> Thickness[0.01]] |
| Function f(x) and its 20 term Fourier approximation. | Mathematica code |
|
  |
We plot with Mathematica 50 term approximation to its conjugate Fourier series (which is very close to sine function):
\[
S^{\ast} [f](x) = \frac{4\ell}{\pi^2} \sum_{k\ge 1} \frac{1}{(2k-1)^2}\,\sin \left( \frac{\pi \left( 2k-1 \right) x}{\ell} \right) .
\]
s50[x_] = (4/Pi^2)*Sum[Sin[k*Pi*x]/(2*k - 1)^2, {k, 1, 50}];
Plot[{(4/Pi^2)*Sin[Pi*x], s50[x]}, {x, -1.2, 1.2}, PlotStyle -> Thickness[0.01]] |
| Function f(x) and its 20 term Fourier approximation. | Mathematica code |
■
A derivation of Euler--Fourier formulas \eqref{EqFourier.3} and \eqref{EqFourier.5} are given in section devoted to orthogonal expansions.
The complex Fourier series \eqref{EqFourier.2} is more elegant and shorter to write down than the one expressed in terms of sines and cosines \eqref{EqFourier.4}, but it has the disadvantage that the coefficients might be complex numbers even if the given function is real-valued. The trigonometric form is based on Euler's formulas:
Here, j is the unit vector in the positive vertical direction on the complex plane ℂ, so j² = −1. Of course, these two decompositions \eqref{EqFourier.2} and \eqref{EqFourier.4} are equivalent when each series \eqref{EqFourier.2} and \eqref{EqFourier.4} converges.
Some representations of functions by trigonometric series was first considered by Leonhard Euler in 1753:
Joseph Fourier was arrested in July 1794 during the Reign of Terror because of his political activities and his defense of political rivals in Orlรฉans. After the fall of Maximilien Robespierre, who was executed by guillotine on 28 July 1794, the political situation changed, and Fourier was released from prison on 11 August 1794. Having narrowly escaped execution during the French Revolution, Fourier subsequently turned his attention to an academic career, which was far safer than political life. He became one of the first students at the newly founded รcole Normale. The following year, he was appointed a teacher there and soon afterward joined the faculty of the รcole Normale, where he worked alongside Monge and Lagrange.
In 1798, Fourier accompanied Napoleon Bonaparte on his Egyptian expedition as a scientific adviser and was appointed secretary of the Institut d'รgypte. During his stay in Egypt, he contributed several mathematical papers to the Institut, which Napoleon had established in Cairo.
In 1801, Napoleon appointed Fourier Prefect (Governor) of the Department of Isรจre in Grenoble, where he supervised road construction and numerous other public works. After returning from the Egyptian expedition, Fourier intended to resume his academic position at the รcole Polytechnique. Napoleon, however, overruled his plans, remarking that Fourier's administrative talents would be of greater service to France.
In a memorable session of the French Academy of Sciences on 21 December 1807, a 39-year-old politician from Grenoble, nearly 600 km from Paris, with few scientific credentialsโhis papers published in the Mรฉmoires sur l'รgypte were little known in Parisโpresented his memoir to the Institute of France. As expected, Fourier's unpublished manuscript, Thรฉorie de la propagation de la chaleur dans les solides, was met with skepticism by several senior members of the Academy, including the great analyst Lagrange.
Fourier claimed that an arbitrary function defined on a finite interval could always be represented as a sum of sine and cosine functions. The academicians had good reason to question this remarkable assertion. Every finite combination of sines and cosines is an infinitely differentiable (indeed, analytic) function, and at the time there was no rigorous theory explaining how an infinite trigonometric series could converge to a function that was not analytic, or even discontinuous.
Subsequent investigations demonstrated that Fourier's claim was entirely justified, although he himself was not able to provide the exact proofs demanded, because the corresponding theory, called after Sturm (1803--1855) and Liouville (1809--1882) appeared only thirty years later.
==============================================
It is well-known that partial Fourier sums display in general a rather irregular behavior as the number of terms grows to infinity. In 1900, Lipรณt Fejรฉr discovered that the Cesร ro means (which is an extension of regular summation method) of the partial sums display a strikingly simpler behavior. This broadened the validity of the Fourier series to a much larger class of functions that does not demand more than mere integrability of functions, without adding any other restrictions concerning continuity or differentiability.
This becomes clear in 1899 when Willard Gibbs reported a phenomenon of conditionally convergent Fourier series that now bare his name. Actually, it was known 50 years before to Henry Wilbraham (1825--1883).
🔶 ❖ ﹡ ⁎ ✱ ✲ ✳ ✺ ✻ ✼
✽ ❋ ❖ 🔶
Fourier's Impact
Fourier uses his mathematics with the delighful freedom mostly because he did not get a solid background studying math during one year. Nevertheless, he put a lot of efforts to catch up the material during his teaching experience and selfeducation.
Fourier dissertation (and successive monograph publication in 1822) initiated further development in mathematics. First of all, the cornerstone concept of function was establish. Before Fourier's discovery, functions were considered either by analytic formula or geometrically if they could be drawn with the hand. Daniel Bernoulli (1700--1782) believed that any functions can be defined by a formula.
In the later development of mathematics, evaluation of Fourier coefficients requres a proper definition of integrability that was successfully addressed by Bernhard Riemann (1826--1866). He developed a concept of " Riemann-integrability" in 1854, but not published in a journal until 1868. Even this definition was not sufficient for the more abstract speculations of modern mathematics and was once more generalized by รmile Borel (1871--1956) and Henri Lebesgue (1875--1941), who in 1904 extending the applicability of the Fourier series to a still larger class of functions.
It took more than a century for mathematician to develop a rigorous theory of Sturm--Liouville theory and corresponding orthogonal expansions, including summability methods for series.
In 1902, Jacques Salomon Hadamard (1865--1963) introduced definition of well-posed problem. Correspondingly, a problem that is not well-posed, is called ill-posed. It turns out that restoration of a function from its set of Fourier coefficients is an ill-posed problem.
Change of Scale
In general, a square integrable function f ∈ 𝔏²([𝑎, b]) on the interval [𝑎, b] of positive length b−𝑎 (b>𝑎) can be expanded into the Fourier series
Example 4: Consider a function f(x) = x² on the interval [0,2]. Its Fourier coefficients can be determined with Mathematica:
S20[x_] = 4/3 + Sum[4/n^2/Pi^2 *Cos[n*Pi*x] - 4/n/Pi*Sin[n*Pi*x], {n, 1, 20}];
S100[x_] = 4/3 + Sum[ 4/n^2/Pi^2 *Cos[n*Pi*x] - 4/n/Pi*Sin[n*Pi*x], {n, 1, 100}];
Plot[{x^2, S10[x]}, {x, -0.5, 2.5}, PlotStyle -> {{Thick, Red}, {Blue, Thick}}] Plot[{x^2, S20[x]}, {x, -0.5, 2.5}, PlotStyle -> {Thick, {Black, Orange}}]
Plot[{x^2, S100[x]}, {x, -0.5, 2.5}, PlotStyle -> {Thick, {Black, Blue}}]
| Fourier approximation with 10 terms | Fourier approximation with 100 terms | |
|---|---|---|
![]() |
|
Now we expand the given function f(x) = x² into complex Fourier series \eqref{EqFourier.2}:
Example 5: We expand the sine function into Fourier series for different values of parameter ℓ that defines the interval from which a function is periodically expanded.
Example 5A: Let us start with ℓ = π. Then sinx itself is its Fourier series; so no work is required.
Example 4B: For ℓ = π/2, we get Fourier coefficients
Plot[{Sin[x], S15[x]}, {x, -Pi, Pi}, PlotStyle -> Thick]
S50[x_] = (8/Pi)*Sum[n/(1 - 4*n^2 )*(-1)^n * Sin[2*n*x], {n, 1, 50}];
Plot[{S50[x]}, {x, -Pi, Pi}, PlotStyle -> Thick]
| Fourier approximation with 15 terms | Fourier approximation with 50 terms | |
|---|---|---|
![]() |
|
Example 5C: For ℓ = π/3, we get Fourier coefficients
Plot[{Sin[x], S12[x]}, {x, -Pi, Pi}, PlotStyle -> Thick]
S55[x_] = (9*Sqrt[3]/Pi)* Sum[n/(1 - 9*n^2)*(-1)^n*Sin[3*n*x], {n, 1, 55}];
Plot[{S55[x]}, {x, -Pi, Pi}, PlotStyle -> Thick]
| Fourier approximation with 12 terms | Fourier approximation with 55 terms | |
|---|---|---|
![]() |
|
Harmonic functions
Fourier series and corresponding formulas become much easier to handle upon introducing the new variable ϑ = π·x/ℓ. Let us consider the series of the form
Series \eqref{EqFourier.8} is known as the trigonometric series. The series are formal series: there is no implication of their convergence for all or any ϑ at this moment. Actually, the trigonometric series above is written in the Cauchy principal value form because it is the sum of two series
The question of whether every trigonometric series is the Fourier series of a function has played a central role in the historical development of Fourier analysis. During the nineteenth century, this problem remained unresolved and stimulated extensive research into the convergence and representation of trigonometric series. It is now known that the answer is negative in general: not every trigonometric series is the Fourier series of a function within the classical function spaces. Nevertheless, for several important classes of functions, necessary and sufficient conditions have been established that determine whether a given trigonometric series is the Fourier series of a function belonging to the class under consideration. These characterizations constitute a fundamental aspect of the theory of Fourier series and illustrate the close relationship between the analytical properties of functions and the behavior of their Fourier coefficients.
Example 6: There are cases when the trigonometric series is given by its coefficients but we do not know whether it is a Fourier series of a certain function or not.
In order to support our claim that not every trigonometric series is a Fourier series, we are going to provide an example. First what comes to anybody mind is a divergence series, say \[ \frac{1}{2} + \sum_{n\ge 1} \ \cos (nt) . \] This series cannot define an ordinary function. Indeed, for any fixed ๐ก,
- it ๐ก = 0, every cosine equals 11, so the series diverges to +โ+โ;
- If ๐ก ≠ 2πk, the partial sums oscillate and do not converge.
However, this series weak converges (in distribution sense) to the 2π-periodic a href="https://en.wikipedia.org/wiki/Dirac_delta_function">Dirac delta function.
For every smooth 2ฯ-periodic test function ๐, \[ \int_{-\pi}^{\pi}\ \left( \frac{1}{2} + \sum_{n\ge 1} \ \cos (nt) \right) f(t) \,{\text d}t = \pi\,f(0) . \] This is exactly the defining action of ฯฮด2ฯ(t)ฯฮด2ฯโ(๐ก). So if you're working with Fourier series on a 2ฯ-periodic interval, the correct identity is \[ \frac{1}{2} + \sum_{n\ge 1} \ \cos (nt) = \pi\,\delta_{2\pi} (t) . \]
Hence, we are forced to consider the case when Coefficients growing too fast. For instance, let \[ c_n = e^{\sqrt{|n|}} , \] then \[ \sum_{n=-\infty}^{\infty} \ c_n\,e^{\mathbf{j}\,nx} \] cannot be the Fourier series of any distribution, since Fourier coefficients of periodic distributions satisfy \[ \left\vert c_n \right\vert = O\left( n^m \right) \] for some m. This series is non-Fourier in the strongest possible sense, although admittedly less interesting analytically because it fails a simple growth condition. ■
In what follows \( \displaystyle \quad z = x + \mathbf{j}\,y = r\,e^{\mathbf{j}\vartheta} \quad \) is a complex variable and \( \displaystyle \quad \overline{z} = z^{\ast} = x - \mathbf{j}\,y = r\,e^{-\mathbf{j}\vartheta} \quad \) is its conjugate. Note that we prefer using asterisk notation for complex conjugate vs overline. To fix our ideas, we suppose 𝑎ₙ and bₙ to be real numbers (so that cₙ and c−ₙ are conjugate).
The trigonometric series \eqref{EqFourier.8} is the real part of the series
Example 7: We consider the signum function \[ \mbox{sign} (t) = \begin{cases} \phantom{-}1, &\qquad \mbox{for } t > 0 , \\ \phantom{-}0, &\qquad t = 0, \\ -1, &\qquad \mbox{for } t < 0 . \end{cases} \] It is odd, so its Fourier series contains only sine terms. \[ \mbox{sign}(t) = \sum_{n\ge 1} b_n \,\sin (nt) , \] where \[ b_n = \frac{2}{\pi}\,\int_0^{\pi} \,\sin (nx)\,{\text d}x = \frac{2}{n\pi} \left( 1 + (-1)^n \right) . \]
As r → 1, we have \[ u (r, \vartheta ) \to \mbox{sign}(\vartheta ) \] for every continuity point of ๐, while \[ v (r, \vartheta ) \to -\frac{2}{\pi}\,\ln \left\vert \tan\frac{\vartheta}{2} \right\vert . \] Thus, the Hilbert transformation of u(1, ϑ) is \[ \mathcal{H}\,\mbox{sogn}(\vartheta ) = -\frac{2}{\pi}\,\ln \left\vert \tan\frac{\vartheta}{2} \right\vert . \] This logarithmic function is the periodic Hilbert transform of the sign function
Finally, we check that functions u(r, ϑ) and v(r, ϑ) are harmonic functions, that is, they satisfy the Laplace equation. To accomplish this task, we emply Mathematica.
If Fourier coefficients are bounded (which we always assume), then the series
Example 8: Let us consider the holomorphic function \[ F(z) = \frac{1+z}{1-z} , \] which maps the unit disk conformally onto the right half-plane. Let z = r (cosϑ + ⅉ sinϑ), 0 ≤ r < 1. Then \[ F(z) = \frac{1 + r\,e^{\mathbf{j}\,\vartheta}}{1 - r\,e^{\mathbf{j}\,\vartheta}} . \] Multiply numerator and denominator by conjugate of the denominator to make it real, we get \[ \left( 1 + r\,e^{\mathbf{j}\,\vartheta} \right) \left( 1 - r\,e^{-\mathbf{j}\,\vartheta} \right) = 1 - r^2 + 2\mathbf{j}\,r\,\sin\vartheta . \] Hence, \[ F \left( r\,e^{\mathbf{j}\,\vartheta} \right) = \frac{1- r^2}{1 - 2r\,\cos\theta + r^2} + \mathbf{j}\,\frac{2r\,\sin\vartheta}{1 - 2r\,\cos\theta + r^2} = u + \mathbf{j}\,v . \] where \[ u = \frac{1- r^2}{1 - 2r\,\cos\theta + r^2} , \qquad v = \frac{2r\,\sin\vartheta}{1 - 2r\,\cos\theta + r^2} . \] So u is the Poisson kernel and v is the conjugate Poisson kernel.
Let us consider when r → 1−0. The real part is zero, while the total integral remains \[ \frac{1}{2\pi}\,\int_{-\pi}^{\pi} \,u(r,\vartheta )\,{\text d}\vartheta = 1 . \] Thus, \[ u(r,\vartheta ) \to 2\pi\,\delta (\vartheta ) \qquad\mbox{as } \ r\to 1 , \] in the distributional sense. The imaginary part \[ v(r, \vartheta ) \to \cos\frac{\vartheta}{2} \qquad\mbox{as } \ r\to 1 , \] again in the principal value sense. This is precisely the kernel of the periodic Hilbert transform.
Expand \[ F(z) = 1 + 2\,\sum_{n\ge 1} \ z^n \] Substituting \( \displaystyle \quad z = r\,e^{\mathbf{j}\,\vartheta} ,\quad \) we have \[ F\left( r\,e^{\mathbf{j}\,\vartheta} \right) = 1 + 2\sum_{n\ge 1}\ r^n\,e^{\mathbf{j}\,n\vartheta} . \] This function has a simple form \[ F\left( r\,e^{\mathbf{j}\,\vartheta} \right) = 1 + \frac{2\,r\,e^{\mathbf{j}\,\vartheta}}{1 - r\,e^{\mathbf{j}\,\vartheta}} = \frac{1 + r\,e^{\mathbf{j}\,\vartheta}}{1 - r\,e^{\mathbf{j}\,\vartheta}} \]
The Hilbert transform of function ๐(๐ฅ), ๐ฅ ∈ ℝ, is defined by the convolution integral
Example 9: We consider the following piecewise continuous function on interval [0, π] (so 2ℓ = π): \[ f(x) = \begin{cases} \sin (x), \qquad& \mbox{for } \ 0 < x < \pi /2 , \\ \frac{1}{2}\,\cos (x), \qquad & \mbox{for }\ \pi /2 < x < \pi . \end{cases} \] The corresponding Fourier coefficients are \begin{align*} a_0 &= \frac{2}{\pi}\, \int_0^{\pi /2} \, \sin (t)\,{\text d}t + \frac{1}{\pi}\,\int_{\pi /2}^{\pi} \,\cos (t)\,{\text d}t = \frac{1}{\pi} , \\ a_n &= \frac{2}{\pi}\, \int_0^{\pi /2} \, \sin (t)\,\cos (2nt)\,{\text d}t + \frac{1}{\pi} \,\int_{\pi /2}^{\pi} \,\cos (t)\,\cos (2nt) \,{\text d}t = \frac{1}{\pi}\cdot \frac{(-1)^n -2}{4 n^2 -1} , \\ b_n &= \frac{2}{\pi}\, \int_0^{\pi /2} \, f(x)\,\sin (2nx)\,{\text d}x = \frac{1}{\pi}\cdot \frac{2n - 4n\,(-1)^n}{4 n^2 -1} , \qquad n=1,2,\ldots . \end{align*}
The second integral is treated similarly, so
\[
\cos t = \cos x\,\cos (x-t) + \sin t\,\sin (x-t) ,
\]
which leads to
\[
\cos t \,\cot (x-t) = \cos x\,\csc (x-t) + \sin t .
\]
Therefore,
\[
I_2 = \mbox{V.P.}\, \int_{\pi /2}^{\pi} \,\cos t\,\cot (x-t)\,{\text d}t = \cos x\,\mbox{V.P.}\,\int_{\pi /2}^{\pi} \,\csc (x-t)\,{\text d}t + \int_{\pi /2}^{\pi} \,\sin t\,{\text d}t .
\]
Since
\[
\int_{\pi /2}^{\pi} \,\sin t\,{\text d}t = 1,
\]
we get
\[
I_2 = \cos x\,\ln \left\vert \frac{\tan (x - \pi /2)/2}{\tan (x-\pi )/2} \right\vert + 1 .
\]
Putting everything together,
\begin{align*}
g(x) &= \frac{1}{\pi}\,I_1 + \frac{1}{2\pi}\,I_2
\\
&= \frac{1}{\pi} \left[ \sin x\,\ln \left\vert \frac{\tan x/2}{\tan (x - \pi /2)/2}| \right\vert -1 \right] + \frac{1}{2\pi} \left[ \cos x\,\ln \left\vert \frac{\tan (x - \pi /2)/2}{\tan (x-\pi )/2}| \right\vert +1 \right] .
\end{align*}
This expression is valid for 0
Function ๐(๐ฅ) and its Fourier approxation with 50 terms
Function ℋ๐(๐ฅ) and its conjugate Fourier approximation with 50 terms

Evaluation of Fourier Coefficients
The following formulas could be helpful for evaluations of Fourier coefficients (\( \texttt{D} = \texttt{D}_t = {\text d}/{\text d}t \) is the derivative operator):
Example 15: Let's consider the following half-wave rectifier of the function cosx on interval [−π/2, ;π/2]:
{ 0 True

Mathematica will treat the function f[t] outside the interval [-π ,
π ] as zero

As we see, Mathematica rescales vertical and horizontal lines so that the picture becomes almost symmetric. You can return to the proper picture by using AspectRatio option:

So we get exactly the same graph. Now we are ready to expand this function into Fourier series by finding its Fourier coefficients:

Example 16: We consider a piecewise continuous function that cannot be extended into Taylor series because it is identically zero on the interval (1,2). However, we can find its Fourier series.
The standard Mathematica command FourierTrigSeries provides you the Fourier series of the function that is extended periodically from the standard interval (-π,π):
9 \[Pi]) + ((2 - 2 Sin[1]) Sin[x])/(2 \[Pi]) - ((-2 + Sin[2]) Sin[2 x])/(4 \[Pi]) - ((-3 + Sin[3]) Sin[3 x])/(9 \[Pi])
With option FourierParameters, it is equivalent to
Plot[curve, {x, -1.5, 13.5}, PlotRange -> {-0.3, 1.3}, Ticks -> {{Pi, 2*Pi, 3*Pi}, {1.09, -0.09}}, PlotStyle -> Thick]

However, it is not what we want: we need the Fourier series of the function f[x] extended periodically from the interval of length 2:
To check, we find the Fourier coefficients manually:
which is 1/(n*π). Hence, its Fourier series becomes

Then we plot some finite sums:
Plot[%, {x, -1, 3}]

Then we repeat calculations with 50 terms:

Next we plot the correct Fourier series partial sums:
Plot[%, {x, -1, 3}]

There is an elegant application of Fourier series involving Bessel functions:
Computing an integral in Mathematica is fairly painless, and it's tempting to simply use a partial Fourier sum depending to the number of terms n. We show how these commands work with several examples.
Mathematica has four default commands to calculate Fourier series:
FourierSeries (* to calculate complex coefficient expansion *)
FourierTrigSeries (* to calculate standard Fourier expansion via sine and cosine *)
FourierCosSeries (* to calculate cosine Fourier series *)
FourierSinSeries (* to calculate sine Fourier series *)
The option FourierParameters has two parameters and when applied, it looks as FourierParameters->{𝑎,b}
In trigonometric form, with setting \( {\bf FourierParameters} \,-> \,\{ a, b \} \) the following series is returned:
Syntax for the FourierSeries command is: FourierSeries [ function , variable , number of terms ]
Changing the FourierParameters setting allows you to control the limits of integration on the coefficients, and therefore, the base frequency of the series. Some work will go into calculating what value for โbโ will give the proper limits of integration. There is ordinarily no reason to change โ𝑎โ from its default setting, which is 1.
Example 6: We consider a pulse function of length h:
f[x_] = Piecewise[{{1, -1/2 < x < 1/2}}];
Plot[{f[x], S12[x]}, {x, -2.5, 2.5}, PlotStyle -> Thick]
S50[x_] = 1/4 + Sum[2*Sin[n*Pi/4]*Cos[n*Pi*x/2]/n/Pi, {n, 1, 50}];
Plot[{S50[x]}, {x, -2.5, 2.5}, PlotStyle -> Thick]
| Fourier approximation with 12 terms | Fourier approximation with 55 terms | |
|---|---|---|
![]() |
|
Example 7: We consider the unnormalized sinc function, which is defined by the formula
Plot[{Sin[x]/x, S12[x]}, {x, -2.5, 3.5}, PlotStyle -> Thick]
S25[x_] = SinIntegral[2]/2 + Sum[(SinIntegral[2 - n \[Pi]] + SinIntegral[2 + n*Pi])* Cos[n*Pi*x/2]/2, {n, 1, 25}];
Plot[{Sin[x]/x, S25[x]}, {x, -2.5, 3.5}, PlotStyle -> Thick]
| Fourier approximation with 12 terms | Fourier approximation with 25 terms | |
|---|---|---|
![]() |
|
Example 8: Consider the function \( f (x) = x^2 \) on the interval [-1,1]. Let us take 16 equally spaced points \( x_k = -1 + \frac{2k}{15} , \quad k=0,1,2,\ldots , 15. \) Suppose we want to find the trigonometric polynomial approximation for M = 6 to the 15 data points \( \left\{ (x_k, y_k ) \right\}_{k=1}^{15} . \)
Since the periodic extension is assumed, at a point of discontinuity x = 1, the function value f(1) must be computed using the formula
Plot[{x^2 , FC6[x]}, {x, -1, 1}, PlotRange -> {-0.1, 1}, PlotStyle -> {{Thick, Blue}, {Thick, Orange}}]

Discretization
Euler--Fourier formulas \eqref{EqFourier.3} or \eqref{EqFourier.5} provide discretization of a corresponding function f, so they can be considered as transferring a signal into discrete sets:
Example 12: Let us consider a piecewise continuous function
Convergence of Fourier Series
Is it true that partial Fourier sums SN(f; x) converge to the function f(x) as N → ∞? In general, that is far too much to hope for because restoration of a function from its Fourier coefficients ∣f 〉 is an ill-posed problem. Not every function is suitable for a Fourier series expansion, but those that satisfy some conditions. For example, the tangent function tan(x) cannot be expanded into the Fourier series on any interval containing the roots of the equation cos(x) = 0 simply because the Fourier coefficients do not exist. For certain kinds of functions convergence is assured; but we will see that some functions are so weird that SN(f; x) diverges for every x.
It was a surprise when the German mathematician Paul David Gustav du Bois-Reymond (1831--1889) was able in 1873 to construct a continuous function whose Fourier series diverges at a point. Despite this negative result, we might ask what happens if we add more smoothness conditions on a generating function. Although we don't know necessary and sufficient conditions for a function to be expanded into a Fourier series, we know some sufficient conditions that guarantee a Fourier series expansion. The Fourier series does not exist unless, for example, 𝑎0 exists (i.e., \( \left\vert \int_{-\ell}^{\ell} f(x) \,{\text d}x \right\vert < \infty \) ). Even when the integral for 𝑎0 exists, the Fourier series may converge to another function.
Example 13:
All expansion formulas involve infinite series; their convergence is based on properties of partial sums, either \eqref{EqFourier.2}
A natural question that comes to your mind is whether the series \eqref{EqFourier.2} or \eqref{EqFourier.4} converges and if they converge, do they converge to generating function f(x)? Mathematicians tell us that none of these questions have simple answers. We still do not know the exact conditions to fully identify the class of functions whose Fourier series pointwise converge to the same functions. Identification of the function from its Fourier coefficients is an ill-posed problem, and in many cases it requires a regularization. One of such possible regularization is discussed in Cesร ro summation section. Nonetheless, Fourier series usually work quite well (especially in situations where they arise from physical problems).
We leave discussion of convergence of Fourier series to two following sections; however, here we use a simple sufficient conditions that is easy to verity.
Recall that the domain of a linear differential operator of order n consists of all functions that have continuous derivatives up to the order n and satisfy the differential equation and the boundary conditions that generate the linear operator. Since a Fourier series is an expansion over eigenfunctions of the second order differential operator \( L_2 \left[ \texttt{D} \right] = - \texttt{D}^2 = - {\text d}^2 /{\text d}x^2 , \) subject to the periodic boundary conditions, the domain of L2 consists of all periodic twice differentiable functions. The equation \( L_2 \left[ \texttt{D} \right] y = \lambda\, y \) to be satisfied requires that the second derivative is also a periodic function.
Remember that a Fourier series is also generated by the first order self-adjoint differential operator \( \hat{p} = - {\bf j}\,\texttt{D} , \) with j being the imaginary unit on ℂ. However, the Sturm--Liouville theory is applicable only to the second order self-adjoint differential operators, and its application to the first order operators requires further development. Nevertheless, we will see later that existence of periodic continuous derivative will be sufficient for convergence of the Fourier series.
Example 14: We consider the the function f(x) = (cosx)4 on interval [−π, π]. Expanding it into Fourier series, we get
p111 = Plot[{S11[t]}, {t, -\[Pi], \[Pi]}, PlotStyle -> {Thickness[0.02], Purple}];
p112 = Plot[(Cos[t])^4, {t, -\[Pi], \[Pi]}, PlotStyle -> {Thickness[0.007], Blue}];
Show[p111, p112]
Operations on Fourier Series
- \[ \overline{f(x)} \sim \mbox{P.V.} \sum_{n=-\infty}^{+\infty} \overline{\hat{f}(n)} \, e^{-{\bf j}\pi nx/\ell} = \sum_{n=-\infty}^{+\infty} \overline{\hat{f}(-n)} \, e^{{\bf j}\pi nx/\ell} ; \]
- \[ e^{{\bf j}\pi mx/\ell} f(x) \sim \mbox{P.V.} \sum_{n=-\infty}^{+\infty} \overline{\hat{f}(n)} \, e^{-{\bf j}\pi \left( n + m \right) x/\ell} = \sum_{n=-\infty}^{+\infty} \hat{f}(n-m)\, e^{{\bf j}\pi nx/\ell} \]
- \[ f(x+y) \sim \mbox{P.V.} \sum_{n=-\infty}^{+\infty} \hat{f}(n)\, e^{{\bf j}\pi nx/\ell} \, e^{{\bf j}\pi ny/\ell} . \]
The kernel f(x−y) g(y) is integrable over the square 0 ≤ x, y ≤ 2ℓ. Thus, for arbitrary integrable functions, \( \left\vert f(x-y)\,g(y)\,e^{{\bf j} n\pi x/\ell} \right\vert \) is integrable over the square and the following argument is also legimate:
Example 23: Of the series
| Approximation with 200 terms \( \sum_2^{200} \frac{\cos kx}{\ln k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\cos kx}{\ln k} . \) | |
|---|---|---|
![]() |
|
| Approximation with 200 terms \( \sum_2^{200} \frac{\sin kx}{\ln k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\sin kx}{\ln k} . \) | |
|---|---|---|
![]() |
|
Of the series,
| Approximation with 200 terms \( \sum_2^{200} \frac{\cos kx}{k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\cos kx}{k} . \) | |
|---|---|---|
![]() |
|
| Approximation with 200 terms \( \sum_2^{200} \frac{\sin kx}{k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\sin kx}{k} . \) | |
|---|---|---|
![]() |
|
Of the series
| Approximation with 200 terms \( \sum_2^{200} \frac{\cos kx}{k\,\ln k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\cos kx}{k\,\ln k} . \) | |
|---|---|---|
![]() |
|
| Approximation with 200 terms \( \sum_2^{200} \frac{\sin kx}{k\,\ln k} . \) | Approximation with 1000 terms \( \sum_2^{1000} \frac{\sin kx}{k\,\ln k} . \) | |
|---|---|---|
![]() |
|
- Let \( \displaystyle \quad f(\vartheta ) = \sum_{n=-\infty}^{\infty} \,c_n \,e^{n\mathbf{j} \vartheta} \quad \) be the trigonometric series in complex form. Find an analytic function F(z) in unit disk |z| < 1 such that \( \displaystyle \quad f(\vartheta ) = 2\,\mbox{Re}\,F\left( e^{\mathbf{j}\vartheta} \right) - c_0 . \)
- Bari, N.K., A Treatise on Trigonometric Series, Oxford, Pergamon Press, 1964.
- Carleson, L., On convergence and growth of partial sums of Fourier series, Acta. Math. 116 (1966), pp. 135โ137.
- Gibbs, J. W., Fourier Series, Nature, 1899, Vol. 59, 200 and 606.
- Grafakos, L., Classical and modern Fourier analysis, Upper Saddle River, N.J. : Pearson/Prentice Hall, 2004. QA 403.5.G73 2004
- Grafakos, L., Classical Fourier analysis, Springer,
- Hunt, R., On the convergence of Fourier series, Orthogonal Expansions and their Continuous Analogues (Proc. Conf. Edwardsville, IL, 1967), Southern University Press, Carbondale, IL, 1968, pp. 235โ255.
- R. Hunt and M. Taibleson, Almost everywhere convergence of Fourier series on the ring of integers of a local field, SIAM J. Math. Anal. 2 (1971), pp. 607โ625.
- Kรถrner, T.W., Fourier Analysis, Cambridge University Press; 1 edition (January 28, 1988).
- Lanczos, C., Discourse on FourierSeries, SIAM, Philadelphia, 1966.
- Stein, E.M., Shakarchi, R., Fourier Analysis: An Introduction, โ Princeton University Press, 2003. ISBN-13 โ : โ 978-0691113845
- Tolstov, G.P., Fourier Series, Dover Publications, 2012.
- Walker, J.S., Fourier Analysis, 1988, Oxford University Press, New York.
- Zhizhiashvili, L.V., Trigonometric Fourier Series and their Conjugates, Kluwer Academic Publishers, Boston, London, 1994.
- Zygmund, A., Trigonometrical Series, Third edition, Volumes I & II combined, Cambridge University Press, London.
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











