Best way to find Quadratic Regression Curve in Java

前端 未结 3 1527
春和景丽
春和景丽 2021-01-23 00:20

I\'ve three sets of data such as:

x   y
4   0
6   60
8   0

Does anyone know any (efficient) Java codes that can give me back the values of a, b

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-23 01:14

    The LaGrange interpolation is probably the most 'efficient' (how do you measure that?) solution you are going to find. So I'll suggest a completely general code. You did want code, right? This code can go linear, quadratic, cubic, .... for any number of points.

    I didn't actually try to compile it, so I don't if the source code is up to date. You know how online demos go. Yet the applet from the associated web page is fully functional. The jar file will run standalone. With a resizable window, you really don't need to customize it.

提交回复
热议问题