Naive algorithm questions: Fourier Series I'm having both conceptual and practical problems here. In a big picture sense, I get that a Fourier series is just an estimate of a function on some interval. That function is estimated by summing up a bunch of waves, that together with weight values, contribute to the picture of what the function looks like.  
My goal is to code an algorithm that naively does this, but I want to really understand this stuff first. 
So first of all, I have worked out that for the complex form of the Fourier series. $M$ is the number of waves we are summing, and $c_m$ is the weight of that wave on the sum. My derivation for the $c_m$ formula is outlined here. 
$$f(x_n) = \sum_{m = 0}^{M - 1} c_m \exp(\frac{im\pi x_n}{L})$$
$$c_m = \frac{1}{N}\sum_{n=0}^{N-1}f(x_n) \exp(\frac{-im \pi x_n}{L})$$
Question 1: If calculating each $c_m$ requires that we know the exact function value $f(x_n)$ for each $n$, and then the Fourier Series just gives us back those an estimate of the same values, but nothing new, what is the point? My algorithm is just going to give me a bad estimate of what I already know.
I think I am very, very confused here and all of the resources that I have found talk about this stuff at a level above what I can comprehend.   
Question 2: This one I already asked elsewhere, and never got answered, so I'll ask again here. Why are my formulas above different than what I've seen online and in my professor's notes? That factor of $\frac{1}{N}$ is not present in any form I can find. Secondly, in my professor's class notes, he makes the statement that:
$$f(x_n) = \sum_{m = 0}^{N-1} c_m \exp(\frac{im\pi x_n}{L})$$
Where the difference between his and mine is the upper limit of the sum. I don't understand why, and no explanation is given, we would not sum over the number of waves, instead of $N-1$ evaluation points (He has defined $N = \frac{2L}{\Delta x}$ for the interval $[-L, L]$). 
 A: You are almost right:
"a bunch of waves" will interpolate (in the least squares sense) the function $f(x_n)$.   
If you have some knowledge of interpolating data, through polynomials or other functions, you might be able to clear up your mind
about Fourier series meaning and use.
a) If I already know the  $n$ points $(x_1,y_1), \cdots,( x_n, y_n)$  what's the scope to interpolate them ?
the answer is that there are obviously many reasons:
 - to estimate what values can be expected in other $x_k$ in between or in continuation (sampling statistics);
 - to encode the sequence into a formal series, which in the case of a  Fourier series, will help to understand how the
composed signal will behave when fed to a physical linear system (linear combination of derivations, integrations) or to extract
the long/ medium / short term behaviour;
 - etc., etc.
b) From the polynomial interpolation you know that to exactly interpolate $n$ points you need in general a polynomial of degree $n-1$,
i.e. with $n$ coefficients to determine. This unless the points do not actually lie on a lower degree polynomial curve (eg. a line).
If you use a lower degree polynomial, then you are going to do a regression, and for instance do a least squares interpolation.
If you use a higher degree, the highest coefficients will come out to be null.
Concerning the Fourier series, the concept is analogue, apart from the fact that for each point you need one complex or one couple of real coefficients.
Re. to Trigonometric Interpolation.
This explains the difference between your $M-1$ vs. $N-1$.
