This applet will give you some insight into approximating functions with either Legendre polynomials or a Fourier series.
A couple of notes:
All available functions here are odd functions. Hence, only the sine functions are necessary to find the Fourier coefficients.
When using the Fourier series (i.e. sine functions) to approximate the underlying function, you will need to minimize the area between your Fourier series and the underlying function. I've provided a calculation of area to help you determine the appropriate coefficients.
If you have questions regarding installation of this applet, go here. If you find any bugs with this and/or have suggestions, the support forum is here.