matrix - Java library for estimating a polynomial based on a set of points -


the polynomial's degree should # of points - 1 e.g. if there 2 points given should line.

i know can solve using matrix

e.g. if there 4 points:
polynomial y = ax^3 + bx^2 + cx + d , matrix be

| y0 |         | x0^3    x0^2    x0    1 |     | | | 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 can solve a,b,c,d. there library can operation inputs being points {x0,y0} {xn,xn}?

look jama http://math.nist.gov/javanumerics/jama/ in particular qrdecomposition class of it.

i writing similar , found princeton's cis program helpful.

http://introcs.cs.princeton.edu/java/97data/multiplelinearregression.java.html

the thing jama not return x intercept have no d in equation.

you in excel using data analysis tool , click on regression return statistics on dataset , equation best fits data.


Comments