AI authored to showcase ironpad capabilities.
Any periodic function can be decomposed into a sum of sine and cosine harmonics — this is the Fourier series:
f(x) = \frac{a_0}{2} + \sum_{n=1}^{N} \left[ a_n \cos(nx) + b_n \sin(nx) \right]
For purely odd functions (only sine terms), three classic waveforms emerge from their Fourier coefficients:
| Waveform | Series |
|---|---|
| Square | \displaystyle\frac{4}{\pi}\sum_{n=1,3,5,\ldots}^{N}\frac{\sin(nx)}{n} |
| Sawtooth | \displaystyle\frac{2}{\pi}\sum_{n=1}^{N}\frac{(-1)^{n+1}\sin(nx)}{n} |
| Triangle | \displaystyle\frac{8}{\pi^2}\sum_{n=1,3,5,\ldots}^{N}\frac{(-1)^{(n-1)/2}\sin(nx)}{n^2} |
As you increase the number of harmonics the approximation sharpens — watch the Gibbs phenomenon overshoot appear at the sharp corners of the square and sawtooth waves!