Skip to content
AllCalcHub

Fourier Series Calculator

Find the Fourier series of a function, including piecewise ones, full range or half range, with the coefficient formulas, Parseval's identity and a partial-sum graph.

About the Fourier Series Calculator

A periodic function can be written as a sum of sines and cosines: f(x) = a₀/2 + Σ(aₙ cos(nπx/L) + bₙ sin(nπx/L)). Euler's formulas give the coefficients as integrals over one period. An odd function has only sine terms and an even one only cosine terms; a half-range series extends a function on (0, L) as odd (sine series) or even (cosine series).

The calculator integrates for n = 1 to 24 and recognises the coefficients as the closed forms textbooks give, such as bₙ = 2(−1)ⁿ⁺¹/n for f(x) = x on (−π, π). A formula is shown only when it matches every integral. Parseval's identity, (1/L)∫f² = a₀²/2 + Σ(aₙ² + bₙ²), is checked too.

The formula

a₀ = (1/L)∫f dx; aₙ = (1/L)∫f cos(nπx/L) dx; bₙ = (1/L)∫f sin(nπx/L) dx

Half range (0, L)
use 2/L and integrate over (0, L)
Gibbs phenomenon
an overshoot of about 9% of the jump near a discontinuity

Worked example

f(x) = x on (−π, π)

  1. a₀ = aₙ = 0 (odd function)
  2. bₙ = 2(−1)ⁿ⁺¹/n
  3. x = 2(sin x − sin 2x/2 + sin 3x/3 − …)

Questions people ask

How do I enter a piecewise function?

One piece per line: formula, from, to. For example −1, −pi, 0 on one line and 1, 0, pi on the next.

Why does the series miss the value at a jump?

At a discontinuity the series converges to the average of the left and right limits.