lineThroughOriginFunc function
Least-Squares fitting the points (x,y) to a line through origin y : x -> b*x, returning a function y' for the best fitting line.
Implementation
double Function(double) lineThroughOriginFunc(List<double> x, List<double> y) {
double slope = fitThroughOrigin(x, y);
return (z) => slope * z;
}