Fourier Series Calculator
Test cases replayed : 4 of 4 match · Methodology · No outside source listed
Pick a periodic wave, its amplitude A and period T, and the highest harmonic N. The calculator gives the Fourier coefficients, evaluates the partial sum at time t and compares it with the wave itself.
Result
Partial sum S_N(t)
Wave value f(t)
- Error f(t) − S_N(t)
- Fundamental angular frequency ω = 2π/T (rad per time unit)
- Coefficient b₁
- Coefficient b₂
- Coefficient b₃
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Waveform: choose Square wave, Sawtooth wave or Triangle wave.
- Amplitude A: enter 0 or more.
- Period T (same time unit as t): enter 1e-06 or more.
- Highest harmonic N (1 to 15): enter a number from 1 to 15.
- Evaluate at t: enter a number.
- Read the result: Partial sum S_N(t); the panel also shows Wave value f(t), Error f(t) − S_N(t), Fundamental angular frequency ω = 2π/T (rad per time unit), Coefficient b₁, Coefficient b₂ and Coefficient b₃.
How this calculator works
A periodic function of period T that meets the Dirichlet conditions, as these three waves do, is represented by its Fourier series a₀/2 + Σ [aₙ cos(nωt) + bₙ sin(nωt)] with ω = 2π/T, aₙ = (2/T)∫ f(t) cos(nωt) dt and bₙ = (2/T)∫ f(t) sin(nωt) dt over one period (Euler–Fourier formulas). The three waves here are odd functions, so a₀ and every aₙ are 0.
Square wave (A on the first half period, −A on the second): bₙ = 4A/(nπ) for odd n, 0 for even n. Sawtooth (rising from −A to A, f(t) = 2At/T on −T/2 < t < T/2): bₙ = 2A(−1)ⁿ⁺¹/(nπ). Triangle (peak A at t = T/4): bₙ = 8A(−1)^((n−1)/2)/(n²π²) for odd n, 0 for even n.
The partial sum S_N adds the terms n = 1 to N. At a jump the series converges to the midpoint of the jump (0 here), and near a jump the partial sums overshoot, by about 9% of the jump for large N (the Gibbs phenomenon); the overshoot does not disappear as N grows.
Worked example
| Waveform | Square wave |
|---|---|
| Amplitude A | 1 |
| Period T (same time unit as t) | 2 |
| Highest harmonic N (1 to 15) | 5 |
| Evaluate at t | 0.5 |
| Partial sum S_N(t) | 1.1035 |
|---|---|
| Wave value f(t) | 1 |
| Error f(t) − S_N(t) | -0.1035 |
| Fundamental angular frequency ω = 2π/T (rad per time unit) | 3.1416 |
| Coefficient b₁ | 1.2732 |
| Coefficient b₂ | 0 |
| Coefficient b₃ | 0.4244 |
Frequently asked questions
Why are there no cosine terms?
The three waves are odd (f(−t) = −f(t)), and the cosine coefficients of an odd function integrate to zero over a period.
Why does the square wave converge slowly?
Its coefficients shrink like 1/n because the wave jumps; the triangle wave is continuous, its coefficients shrink like 1/n², so a few harmonics already match it closely.
Can I enter my own function?
Not here: the calculator covers the three standard waves. For another function, compute aₙ and bₙ with the integrals above.