I used MathNet matrix calculations to calculate the coefficients for a 2nd degree polynomial.
Matrix<double> A = CreateMatrix.DenseOfColumnArrays(xPointsSquared, yPoints, ones);
Matrix<double> Y = CreateMatrix.DenseOfColumnArrays(yPoints);
Matrix<double> C = A.TransposeThisAndMultiply(A).Cholesky().Solve(A.TransposeThisAndMultiply(Y));
However, the coefficients created by this does not give the accurate curve. It creates a line that nowhere runs along the scatterplot of the data points.
I suspect this is because of the functions using double as opposed to decimal. Can anyone please help me get around this?