MATHEMATICS • TRIGONOMETRY
Fourier Series
Add sinusoidal harmonics to approximate square, triangle, and sawtooth waves and inspect where truncation error remains.
Build a waveform from harmonics
Increase the number of terms and compare the smooth partial sum with the ideal target waveform across one full period.
LEARN WITH THE SIMULATION
Understand Fourier Series by experimenting.
A Fourier series reconstructs a periodic waveform from sinusoidal harmonics. This laboratory keeps three ideas visible at once: the target waveform, the finite harmonic sum and two different error measures. The probe reports local signed error at one phase, while the global RMS error summarizes mismatch across a full cycle. Comparing square, triangle and sawtooth waves shows how coefficient decay and discontinuities control how quickly a truncated series becomes accurate.
BUILD THE IDEA
What you should understand first
- Build square, triangle and sawtooth waveforms from their harmonic content.
- Distinguish local probe error from a cycle-wide RMS error metric.
- Relate the number of retained terms to the highest harmonic included in each waveform family.
- Explain why smoothness and discontinuities change convergence speed and why Gibbs overshoot persists near jumps.
TRY IT YOURSELF
Why can the global RMS error improve while the approximation near a square-wave jump still shows visible overshoot?
- Select Square wave with only a few terms and note both RMS error and probe error in a smooth region.
- Increase the term count until the RMS target is reached.
- Move the probe toward a discontinuity and compare the local error with the global RMS value.
- Switch to Triangle wave using the same number of terms and compare how quickly the RMS error falls.
Adding harmonics improves the approximation over most of the interval, so the RMS error decreases, but a discontinuity concentrates oscillatory overshoot into a narrowing neighborhood. A smoother waveform such as the triangle wave has faster-decaying coefficients and therefore converges more efficiently in this finite-term comparison.
WHY IT WORKS 01
Different waveforms hide different harmonic-decay laws
The square-wave series uses odd harmonics with amplitudes proportional to 1/n, while the triangle-wave amplitudes fall roughly as 1/n² with alternating sign. Faster coefficient decay means high-frequency terms matter less, so a triangle wave reaches a small global error with fewer terms. The sawtooth also has a 1/n-type decay and therefore retains stronger high-frequency content.
WHY IT WORKS 02
RMS error and pointwise error answer different questions
The probe compares the truncated sum with the target at one selected phase, producing a signed local error. RMS error instead squares the mismatch over many phases, averages it and takes a square root. A narrow region of strong overshoot can therefore coexist with a relatively small RMS value, which is why both readouts are needed to reason about approximation quality.
WHY IT WORKS 03
Gibbs behavior is about convergence near a jump
Near a discontinuity, partial Fourier sums overshoot and ring even as more harmonics are added. The oscillations become spatially narrower, but the peak overshoot approaches a nonzero fraction of the jump rather than vanishing. The simulator does not prove the full theorem, but moving the probe toward a jump while increasing terms makes the distinction between global convergence and local overshoot directly observable.
DO NOT MIX THESE UP
Common misconception
A finite Fourier sum never becomes literally discontinuous because it is still a smooth sum of sinusoids. Gibbs overshoot does not disappear simply by adding terms; it becomes confined closer to the jump. A low RMS error is also not evidence that every phase has small error, because a localized region can remain visually poor while contributing only a limited amount to the global average.
PRACTICE CHALLENGE
Can you meet a global RMS target with the fewest terms and still identify where the largest local mismatch survives?
- Choose an RMS target in the premium controls.
- Increase terms only until the global target is first reached.
- Move the probe through smooth regions and then toward a discontinuity to compare local error.
- Repeat with another waveform and explain why the required term count changes.
Reveal the reasoning
The minimum term count depends on the waveform because its Fourier coefficients decay at different rates. Meeting an RMS target does not guarantee uniformly small pointwise error. For discontinuous targets, the strongest visible mismatch remains concentrated near jumps even while the global RMS measure continues to improve.
MODEL BOUNDARIES
What this simulation assumes
Every simulation simplifies reality or a mathematical system. These are the assumptions and limits to keep in mind while interpreting the results.
Model assumptions
- The selected waveform is periodic and normalized to a fundamental angular period of 2π.
- The approximation uses the implemented analytical sine-series coefficients for the selected waveform.
- Numerical error metrics are evaluated on a finite set of uniformly spaced phase samples.
Model limitations
- A finite Fourier sum cannot reproduce an exact discontinuity and exhibits Gibbs overshoot near jumps.
- The simulator covers only the implemented normalized square, triangle, and sawtooth waveforms rather than arbitrary user-defined signals.
CONNECT IT
Where this matters
- Signal synthesis and audio
- Spectral analysis and harmonic distortion
- Communications and vibration analysis
- Understanding bandwidth limits in approximating nonsinusoidal signals
WORDS THAT MATTER
Key vocabulary
- Harmonic
- Sinusoidal component whose frequency is an integer multiple of a fundamental frequency.
- Fourier series
- Infinite trigonometric series that represents a periodic function under suitable conditions.
- RMS error
- Root-mean-square mismatch across many phase samples, used here as a global approximation metric.
- Pointwise error
- Difference between approximation and target at one selected phase.
- Gibbs phenomenon
- Persistent oscillatory overshoot near a discontinuity in truncated Fourier approximations.
NEXT STEP