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
The Gibbs phenomenon was first noticed and analyzed by the English mathematician Henry Wilbraham (1825--1883) in 1848, and rediscovered by an American scientist J. Willard Gibbs (1839--1903) 50 years later. The term "Gibbs phenomenon" was introduced by the American mathematician Maxime Bôcher in 1906.
The history of this discovery can be found in an
article by Hewitt&Hewitt. This phenomenon assures that the Fourier series of a
piecewise continuously differentiable periodic function oscillates near the
jump of discontinuity by overshooting and undershooting it by about 9%.
This lack of improvement in the approximations near the discontinuity manifested in the continual presence of the overshoot or undershoot is called the Gibbs phenomenon.
Henry Wilbraham received a BA in 1846 and an
MA in 1849 from Cambridge.
where the Fourier coefficients 𝑎k and bk were defined previously.
The Gibbs
phenomenon is the peculiar manner in which
the Fourier
series of a piecewise continuously differentiable periodic
function behaves at a jump of discontinuity. The partial Fourier sums ripple
near every point of discontinuity in an amount proportional to the finite jump.
So finite Fourier sums (as well as other eigenfunction series) provide an
overshoot/undershoot (or "ringing") occurring
at discontinuities of finite length. Mathematically, it reflects the difference between uniform convergence and pointwise convergence. The Nth partial sum of the Fourier series has large oscillations near the jump, which increases/decreases the maximum/minimum of the partial sum of the function itself. The overshoot does not die out as N increases, but instead approaches a finite limit.
If a function f(x) has a discontinuity at the
point \( x_0 \) of
amount \( c = f(x_0 +0) - f(x_0 -0) , \)
then finite Fourier sums experience overshoot and undershoot in a
neighborhood of the amount c w where w =
0.0894899… is the Wilbraham constant and c is the value of jump at that point. These undershoots or overshoots cannot be
eliminated by increasing the number of terms in the finite
Fourier partial sums; actually these finite sums swap the range
a special function that can be evaluated by Mathematica with a one
line built-in command
N[SinIntegral[Pi]]
1.851937051982466
Division by π/2
N[Pi/2]
1.5707963267948966
yields
N[SinIntegral[Pi]/Pi*2]
1.1789797444721672
So the overshoot/undershoot of a finite Fourier series for a function having a
unit jump of discontinuity will exceed the actual value of the function at
that point by the Wilbraham constant
which is evaluated with 20 decimal places by Mathematica as
w = N[(SinIntegral[Pi]/Pi*2 - 1)/2, 20]
0.089489872236083635116
If the function is a periodic continuation on all real axis, we do not observe the Gibbs phenomenon.
The considered examples show that if a function is a piecewise continuous with finite jumps, its Fourier coefficients decay at a rate of 1/k; if a continuous function has corners (not differentiable), then its Fourier coefficients decay at a rate of 1/k2. The more derivatives exist, the faster Fourier coefficients decay. The general case provides the following lemma.
Riemann--Lebesgue lemma:
If a periodic function f of period T is absolutely integrable (so \( \int_{T} \left\vert f(x) \right\vert {\text d}x < \infty ), \) then its Fourier coefficients tend to zero.
The shape of the Dirichlet kernel causes two distinct problems at a discontinuity:
The 9% Overshoot: The function Si(ξ) reaches its absolute maximum at ξ = π. At this exact peak, the value is approximately 1.8519. When scaled by 2/π
and shifted, this yields a value of ≈ 1.179, which is exactly an 8.95% (rounded to 9%) overshoot above and undershoot below the true step height of 1.
The Ringing Tail: The subsequent peaks and valleys of Si(ξ) at ξ = 2π, 3π, …
correspond to the side lobes of the Dirichlet kernel. This creates the "ringing" waves that propagate away from the jump.
As N → ∞, the overshoot does not disappear; it simply compresses closer to the discontinuity because the peak location is 𝑥 = π/N.
The Gibbs phenomenon occurs because the Dirichlet kernel contains negative side lobes and fails to absorb oscillations under integration. Increasing N narrows the width of the ringing ripples but fails to reduce the maximum height of the overshoot.
Example 1:
Consider a piecewise continuous function (which is actually piecewise constant):
In the graph shown, the orange curve was calculated with n=10 terms while the blue curve was calculated with n=50 terms. As a result, when the number of terms in the Fourier series is increased, the overshoot and undershoot cannot be removed, but the “ripples” will move closer and closer (horizontally) to the point of discontinuity.
There are four points of discontinuity on the interval [-2,2]; at three of them (x = -2, -1, 2) the given function experiences jump of discontinuity of 1 and at the point x = 0 it has jump of value 2.
At point x = -2, Fourier series has undershoot value of \( 1 - 0.0894899 \approx 0.91051 \) because 0.0894899 ≈ 0.1789797444721675 /2 = 2*Si(π)/π - 1. Correspondingly, at point x = -1, we have overshoot 1 + 0.0894899 ≈ 1.0894899… . At point x = 2, the overshoot will be about 2.0894899 and undershoot will be about 0.91051. However, at point x = 0, the jump of discontinuity is 2; therefore, we expect Gibbs phenomenon at this point to be
\( 1- 1.1789797444721675 \approx - 0.1789797444721675\ldots \) for undershoot;
\( 2+ 0.1789797444721675 \approx 2.1789797444721675\ldots \) for overshoot.
Changing the FourierParameters setting allows control over the limits of integration on the coefficients, and therefore, the base frequency of the series.
Some work will go into calculating what values for parameters will give the proper limits of integration. There is ordinarily no reason to change the first parameter from its default setting, which is 1.
We usually define a function in an open interval because its values at endpoints are dictated by its Fourier expansion.
Its Fourier coefficients were found previously in
section iv:
So, at point x = -1 the function experiences a jump of 1 unit
and at the point x = 2 it has a jump of 2 units. Therefore, the
undershoot at point x = -1 will be closed to -w ≈
-0.089489872 (Wilbraham number) and overshoot of 1+w ≈ 1.089489872
as the number of terms in the partial Fourier sums approaches infinity.
At another point of discontinuity x = 2, the given function will have
the undershoot of the amount 2w, which will be about 2.82102.
Correspondingly, its overshoot will approach 3.1789797. Upon making a
computational experiment with plotting partial sums in neighborhoods of these
two points, we see that indeed, the predicted overshoots and undershoots are
very closed to the predicted ones.
Since the signum function has a finite jump of 2 at the origin, the overshoot is about 1.18 (which is 2 times the Wilbraham constant) and undershoot is −1.18.
■
The Lanczos σ-factorse multipliers applied directly to the Fourier coefficients. They smooth out the abrupt cutoff of high-frequency terms by scaling each coefficient using a normalized sinc function. They were introduced by Cornelius Lanczos (1893--1974) in 1956, who also invented what is now called the Fast Fourier Transform. For an N-th partial sum, the factors
are defined as (independently on of the period):
The mathematical magic of the σ-factor lies in how it translates to the spatial domain. Multiplying coefficients by a sinc function in the frequency domain is equivalent to taking a local moving average in the spatial domain.
Specifically, the modified sum is exactly equal to the average of the original partial sum over a small window of width 2π/N:
Because the window size 2π/N
matches the exact period of the highest-frequency oscillation in the partial sum, the integration flattens out the rapid peaks and valleys of the Gibbs ringing.
By modifying the Fourier coefficients, the underlying convolution kernel changes. The standard Dirichlet kernel is replaced by the Lanczos Kernel (LN):
Dirichlet Kernel: Has sharp, tall side lobes with negative values that cause integration overshoots.
Lanczos Kernel: Forces the side lobes to decay much more aggressively.
While it does not completely eliminate negative side lobes like the Fejér kernel (Cesàro summation) does, it reduces them significantly enough to suppress the overshoot from 9% down to less than 1.2%, while preserving a much sharper main lobe (better resolution at the jump).
Lanczos σ-factors smooth out the overshoot by acting as a low-pass window function. They implement a spatial moving average of width 2π/N, which successfully cancels out the high-frequency oscillations of the Gibbs phenomenon
Now we derive the moving average identity by starting with the spatial moving average of the standard partial sum SN(𝑓;𝑥)
over an interval of width 2π/N
and prove that it simplifies to the Fourier series modified by the Lanczos
σ-factors.
Let A(𝑥) be the moving average of the
-th partial sum SN(𝑓;𝑥) centered at 𝑥:
Substitute the standard definition of the Fourier partial sum,
\( \displaystyle \quad S_N (f;x) = \sum_{k=-N+1}^{k=N-1} \ \hat{f}(k) \,e^{\mathbf{j}\,kt/span> into the integral to obtain
Example 5:
We consider the odd function:
\[
f(x) = \mbox{sign}\left( \sin \left( \frac{\pi x}{\ell} \right) \right) , \qquad x \in [-\ell , \ell ] .
\]
We use Mathematica to demonstrate
specific numerical milestones to illustrate exactly how the
σ-factor tames the Gibbs phenomenon for an
partial sum on an interval where ℓ = 1:
The Discontinuity (The Jump): Located at 𝑥 = 0, where the true function abruptly jumps from −1 to +1.
The Classical Peak (Gibbs Overshoot): Occurs at 𝑥 ≈ 1/N = 0.02 because we use N = 50.
Classical Fourier Value: ≈ 1.089 (an 8,95% overshoot above the true ceiling of 1.0).
Lanczos
-Factored Value: ≈ 1.011 (the overshoot is suppressed to just 1.1%).
The Ringing Valley: Occurs slightly further out at 𝑥 ≈ 2/N = 0.04.
Classical Fourier Value: Drops hard to ≈ 0.951 (visible dipping/ringing ripple).
The Core Trade-off: Notice how the blue line (Lanczos) completely deletes the ripples, but it makes the transition slope slightly wider. This explicitly demonstrates the mathematical trade-off between sharpness (frequency resolution) and smoothness (spatial control).
The Amplitude Compression: The classical red spikes shoot wildly past the bounds of [−1,1]. The Lanczos series structurally stays locked within the physical reality of the original dataset.
■
End of Example 5
Example 6:
In medical imaging, preventing ringing is a literal matter of health safety.
An MRI machine does not take a standard picture. It scans the human body in the frequency domain, capturing raw mathematical data known as
k-space data. To turn this raw data into a cross-section image of a brain or knee, the scanner applies an Inverse Fast Fourier Transform (IFFT).
Because scanning takes time, the machine can only capture a finite number of frequencies (
-terms) before the patient moves. At boundaries where tissue changes abruptly—such as the sharp transition between dark cerebrospinal fluid and bright brain matter—the abrupt cutoff in the raw
k-space data triggers the Gibbs phenomenon.
This causes dark and bright ringing bands to ripple across the actual brain tissue in the final image. In clinical practice, these are called truncation artifacts, and they can look exactly like false lesions, small tumors, or internal bleeding, leading to a dangerous misdiagnosis.
Before passing the raw data to the IFFT algorithm, the scanner's computer multiplies the high-frequency
k-space data points by the Lanczos
-factors.
By smoothing the edge of the data collection window, the false ripples inside the brain vanish.
The doctor gets a clean, artifact-free image of the tissue.
To see this in action mathematically, look at a standard 1D discontinuous wave—a Square Wave of length ℓ.
.
The standard analytical Fourier coefficients for a square wave jumping between −1 and +1 are:
\[
a_0 = 0, \quad a_k = 0, \quad b_k = \frac{4}{\pi k} \quad (\mbox{for odd }\ k).
\]
Below is how you would evaluate a point 𝑥
with and without the
σ-factor:
■
B. Kuttner, Note on the Gibbs Phenomenon, Journal of the London Mathematical Society, Volume s1-20, Issue 3, 1 June 1945, Pages 136–139, https://doi.org/10.1112/jlms/s1-20.3.136
A correction has been published: Journal of the London Mathematical Society, Volume s1-20, Issue 4, 1 October 1945, Pages 238, https://doi.org/10.1112/jlms/s1-20.4.238-s
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