The notes I am using are great and so I will link to them here. It starts off with a primer on numerical methods, one of the things he asks you to do is create a program which will compute the least squares solution to an overdetermined system, then apply that program to create a least squares fit to a set of data. This was the method Gauss used to create tables of ephermrides for asteroids, but it presents and interesting set of computational problems,
1) how does one represent a matrix in memory
2) how does one solve a system of linear equations in a finite number of steps
3) how does one then use that solution as a polynomial to evaluate a coefficent of determination.
This has occupied my time on and off for the past couple of weeks. It suffices to say I learned a lot about representing mathematical objects in a computer. Polynomials are really quite facinating actually. For example it is possible to compute a polynomial at any unknown value in Ω(n) time where n is the degree of the polynomial.
Another interesting question is how does one test a linear least squares code once its been written. The answers are found in my github repository. Here I will only present my results:
The test data and fit
Polynomial model:
Degree: 1
Coefficients:
a_1: 7.939715
a_0: 1438.362123
r: 0.997310
r2: 0.994628