Polynomial regression: Difference between revisions

(→‎{{header|Go}}: add gonum/matrix example)
Line 857:
 
<small>Code thanks to [http://pari.math.u-bordeaux.fr/archives/pari-users-1105/msg00006.html Bill Allombert]</small>
 
Least-squares polynomial fit in its own function:
<lang parigp>lsf(X,Y,n)=my(M=matrix(#X,n,i,j,X[i]^(j-1))); Polrev(matsolve(M~*M,M~*Y~)
lsf([0..10], [1,6,17,34,57,86,121,162,209,262,321], 3)</lang>
 
=={{header|Python}}==