// Tool · Fourier Series Calculator
Fourier Series Calculator: Find a₀, aₙ, bₙ and Watch the Partial Sums Converge
Define one period piece by piece, or pick a ready-made waveform, and get , , in closed form (for example ) with a harmonic table, RMS, THD, and a graph of against the partial sum with a slider for the number of terms.
Calculator
How to use it
- Pick a ready-made waveform, or type piece by piece. For example piece 1:
1from0topi; piece 2:-1frompito2*pi. - Enter the period , equal to the total length of the pieces.
piis accepted, e.g.2*pi. - Choose the number of harmonics and calculate. Then drag the slider under the graph to see the partial sum approach .
The coefficient formulas
A periodic function with period and fundamental angular frequency has the Fourier series
Here is the mean value itself. Some textbooks write instead, which makes their twice the value shown on this page.
Symmetry saves work
| Symmetry | Condition | Consequence |
|---|---|---|
| Even | : cosine terms only | |
| Odd | : sine terms only | |
| Half-wave | odd harmonics only |
The calculator detects symmetry from the computed coefficients and reports it, a quick way to check a hand calculation.
Example: the square wave
The square wave for and for is odd and has half-wave symmetry, so only for odd survives.
The THD of a square wave is 48.34 %, which is what the calculator reports. The overshoot near each jump, about 9 % of the jump, is the Gibbs phenomenon; it does not disappear as harmonics are added.
Learn the theory
Frequently asked questions
Is a₀ here the same as in my textbook?
Here a₀ is the mean value (1/T)∫f(t)dt. A textbook that starts the series with a₀/2 has an a₀ twice as large. The sum of the series is the same either way.
How does it produce closed forms such as 4/π?
Coefficients are computed by high-accuracy numerical integration and then compared with simple fractions times π, 1/π, 1/π² and common roots. A closed form is shown only when it matches to nine decimal places; otherwise a decimal is shown.
What is THD?
Total harmonic distortion: the RMS of all harmonics from the second upward divided by the RMS of the fundamental. It measures how far a waveform is from a sine.
Can I use u(t) inside a piece?
Yes, but splitting the period at each discontinuity is more accurate, because numerical integration works best when the function is smooth inside each piece.