The degree of the polynomial should be # of points - 1 for example. if there are 2 points, it should be a line.
I know that I can solve this using a matrix
eg. if there are 4 points:
the polynomial will be y = ax^3 + bx^2 + cx + d , and the matrix will be
| y0 | | x0^3 x0^2 x0 1 | | a | | y1 | = | x1^3 x1^2 x1 1 | x | b | | y2 | | x2^3 x2^2 x2 1 | | c | | y3 | | x3^3 x3^2 x3 1 | | d |
and I can solve for a, b, c, d. Is there a library that can perform this operation, and the inputs are points {x0, y0} to {xn, xn}?
source share