Fourier Series Calculator

When a periodic waveform needs to be broken into its fundamental frequencies, manually evaluating the Euler–Fourier integrals for the coefficients a₀, aₙ, and bₙ is tedious and prone to sign errors. A Fourier series calculator automates this decomposition, returning the amplitude of each cosine and sine harmonic for any integrable periodic function you provide.

Students use it to verify homework on square waves and sawtooth signals. Engineers rely on it to preview total harmonic distortion in switching power supplies or audio amplifiers before simulating a circuit. In every case, the goal is the same: replace a complex repeating pattern with an infinite sum of simple trigonometric terms that are easier to analyze and filter.

Waveform Configuration

The calculator above accepts either a custom piecewise definition or a selection of common waveforms. You set the fundamental period 2L and the number of harmonics N. The tool then evaluates the definite integrals for each coefficient, formats the resulting series, and overlays the partial-sum graph on the original function so you can inspect convergence behavior directly.

What Formulas Power a Fourier Series Calculator?

For a real-valued function f(x) with period 2L, the expansion takes the form:

f(x) = a₀/2 + Σ_{n=1}^{∞} [aₙ cos(nπx/L) + bₙ sin(nπx/L)]

The coefficients are found through integration over one full period:

  • a₀ = (1/L) ∫_{-L}^{L} f(x) dx
  • aₙ = (1/L) ∫_{-L}^{L} f(x) cos(nπx/L) dx
  • bₙ = (1/L) ∫_{-L}^{L} f(x) sin(nπx/L) dx

When the period equals 2π, these simplify to the textbook versions with L = π:

  • a₀ = (1/π) ∫_{-π}^{π} f(x) dx
  • aₙ = (1/π) ∫_{-π}^{π} f(x) cos(nx) dx
  • bₙ = (1/π) ∫_{-π}^{π} f(x) sin(nx) dx

Symmetry shortcuts save time. If f(x) is even, every bₙ is zero, producing a cosine series. If f(x) is odd, a₀ and aₙ vanish, leaving a sine series. The calculator detects these symmetries automatically and skips the associated integrals.

Can a Fourier Series Calculator Handle Piecewise Functions?

Yes. Most real signals are not single expressions. You can define the waveform segment by segment, specifying breakpoints and separate formulas for each interval. The calculator integrates each piece individually and accumulates the contributions into a single set of coefficients.

This is essential for rectified sine waves, pulse-width-modulated trains, and mechanical vibration profiles where the load changes abruptly. As long as the function satisfies the Dirichlet conditions–finite jumps and a finite number of maxima and minima in one period–the series converges.

Step-by-Step Example: Square Wave Expansion

Consider the odd square wave

f(x) = -1, −π < x < 0 f(x) = 1, 0 < x < π

with period 2π. Because the function is odd, symmetry tells us immediately that a₀ = 0 and aₙ = 0 for all n ≥ 1.

For bₙ:

bₙ = (1/π) ∫{-π}^{π} f(x) sin(nx) dx = (1/π) [ ∫{-π}^{0} (-1) sin(nx) dx + ∫_{0}^{π} (1) sin(nx) dx ] = (2/(nπ)) [1 − (−1)ⁿ]

Thus bₙ = 4/(nπ) when n is odd, and bₙ = 0 when n is even. The resulting Fourier series is:

f(x) = (4/π) [ sin(x) + (1/3)sin(3x) + (1/5)sin(5x) + (1/7)sin(7x) + … ]

Entering this waveform into the calculator confirms these coefficients in seconds and plots the partial sum. You can watch the ringing near the jumps–Gibbs phenomenon–diminish in width but not in height as more terms are added.

Practical Applications of Fourier Series in 2026

Fourier analysis remains a backbone of modern engineering education and design. In electronics, it predicts the harmonic content of clock signals and switch-mode power supplies. In structural engineering, it decomposes vibration modes of bridges and rotating machinery. In signal processing, it underlies filter design and audio compression algorithms.

Modern online calculators have bridged the gap between theory and practice. Instead of stopping at symbolic coefficients, they visualize how adding the 3rd, 5th, and 7th harmonics gradually reconstructs a square wave, giving concrete meaning to the abstract infinite sums taught in differential equations courses.

How to Get Accurate Results Every Time

  • Check symmetry before you start. Identifying even or odd parity cuts the number of integrals in half and eliminates common sign mistakes.
  • Define periods explicitly. A waveform running from 0 to T requires different integral limits than one centered at zero; the calculator needs the exact interval length 2L.
  • Use 5–20 harmonics for smooth shapes. Discontinuous waveforms need more terms to resolve steep edges, though Gibbs overshoot will remain visible near jumps.
  • Validate a₀ separately. The constant term a₀ divided by 2 should equal the average value of the function over one period; this sanity check catches input errors instantly.

Frequently Asked Questions

What is the difference between a Fourier series and a Fourier transform?
A Fourier series represents a strictly periodic function as an infinite sum of discrete sine and cosine waves with harmonically related frequencies. A Fourier transform extends this concept to non-periodic functions by integrating over a continuous spectrum of frequencies rather than discrete integer multiples.
Can a Fourier series calculator handle non-periodic functions?
Strictly speaking, no. Fourier series require periodicity. However, you can often extend a non-periodic segment periodically or restrict analysis to a single period. For truly aperiodic signals that decay at infinity, a Fourier transform calculator is the more appropriate mathematical tool.
How many terms are needed for an accurate graph?
For smooth periodic functions, 5 to 10 harmonics usually capture the general shape with acceptable accuracy. Near a jump discontinuity, however, overshoot known as the Gibbs phenomenon persists even with hundreds of terms, although the region of error shrinks and the area under the spike diminishes.
Why are Fourier coefficients labeled a₀, aₙ, and bₙ?
The notation originates from the foundational work of Leonhard Euler and Joseph Fourier. The subscript zero denotes the average or DC offset of the waveform, while n indexes the harmonic order. Cosine amplitudes take the letter a and sine amplitudes take the letter b by long-standing mathematical convention.
What functions cannot be represented by a Fourier series?
Dirichlet conditions require that a function have a finite number of extrema and jump discontinuities within one period, and it must be absolutely integrable. Pathological cases with infinite discontinuities or unbounded variation across a finite interval cannot be reliably expanded into a convergent Fourier series.
Does the calculator work for complex exponential form?
Yes. The trigonometric coefficients aₙ and bₙ map directly to complex exponential coefficients cₙ through the identities c₀ = a₀/2 and cₙ = (aₙ − ibₙ)/2 for n greater than zero. Advanced calculators often display both the real trigonometric form and the compact complex exponential representation.
  1. Scientific Calculator with Fraction - Free Online Tool
  2. Absolute Value Calculator
  3. Double Calculator
  4. Vertex Form Calculator
  5. Cylinder Calculator
  6. Composite Function Calculator – f(g(x)) Solver