Previous Up Next

20.2.8  Polynomial regression

The polynomial_regression command finds a more general polynomial y=a0xn+⋯+an which best fits a set of data points.

Example

polynomial_regression([[1,1],[2,2],[3,10],[4,20]],3)

or:

polynomial_regression([1,2,3,4],[1,2,10,20],3)
     



5
6
,
17
2
,−
56
3
,12


          

so the best fit polynomial will be y=(−5/6)x3+(17/2)x2 − (56/3)x+12.

The polynomial_regression_plot command draws the best fit polynomial.

Example

polynomial_regression_plot([1,2,3,4],[1,2,10,20],3)

Previous Up Next