lineThroughOrigin function
Least-Squares fitting the points (x,y) to a line through origin y : x -> b*x, returning its best fitting parameter b, where the intercept is zero and b the slope.
Implementation
double lineThroughOrigin(List<double> x, List<double> y) =>
fitThroughOrigin(x, y);