Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polynomial that interpolate the function f at points using java

I have the values

x = 0   =>   y = 0
x = 1   =>   y = 1
x = 3   =>   y = 27
x = 4   =>   y = 64

I want to create a polynomial function using JAVA to create the function x^3. The program should create the function and display it, and if i give any values it should calculate the interpolated values. I have created a function which just produced the values using Aitken but it doesnt produce the function and it is really hard to understand how to do the function. Because i dont know how to put the X value as X in the java program.

like image 871
need_the_buzz Avatar asked Dec 08 '25 12:12

need_the_buzz


1 Answers

I have the same problem with you, and finally got the solution. Just look at Apache commons math API. You can use both Lagrange's or Newton's method to compute the coefficient of each polynomial degree.

You can download the .jar file of the API here, and the documentations here.

like image 64
Dufuz Avatar answered Dec 11 '25 01:12

Dufuz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!