package Polynomial;

import Polynomial.View.MainWindow;
import Polynomial.View.PolynomialView;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;

import javafx.scene.image.Image;

import javafx.scene.layout.Pane;

import javafx.stage.Stage;
import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.analysis.interpolation.SplineInterpolator;
import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;
import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
import org.apache.commons.math.analysis.solvers.NewtonSolver;

import java.lang.reflect.Array;
import java.util.Arrays;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception{

        Parent root = new MainWindow();
        primaryStage.setTitle("Polynomial Evaluator");
        primaryStage.getIcons().add(new Image("file:img/icon.jpg"));
        primaryStage.setScene(new Scene(root, 1280,720 ));
        double x[] = { -1.0, 0.0, 1.0,2.0 };
        double y[] = { 1.0, 1.0, 3.0,1.0};
        PolynomialFunctionLagrangeForm polynomialFunctionLagrangeForm  = new PolynomialFunctionLagrangeForm(x,y);
        System.out.println("coefficients:");
        for (int i = polynomialFunctionLagrangeForm.getCoefficients().length - 1; i >=0 ; i--) {
            System.out.println(polynomialFunctionLagrangeForm.getCoefficients()[i]);
        }
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}

@@ -735,16 +735,74 @@
 .Array;%0A
+import java.math.BigDecimal;%0Aimport java.math.BigInteger;%0A
 import j
@@ -1184,27 +1184,12 @@
 = %7B 
--1.0, 0.0, 1.0,2.0 
+2,-2
 %7D;%0A 
@@ -1214,25 +1214,12 @@
 = %7B 
-1.0, 1.0, 3.0,1.0
+8,-4
 %7D;%0A 
@@ -1343,208 +1343,606 @@
     
-System.out.println(%22coefficients:%22);%0A        for (int i = polynomialFunctionLagrangeForm.getCoefficients().length - 1; i %3E=0 ; i--) %7B%0A            System.out.println(polynomialFunctionLagrangeForm.getC
+int coefficients_size = polynomialFunctionLagrangeForm.getCoefficients().length ;%0A        double%5B%5D coefficients_Double = polynomialFunctionLagrangeForm.getCoefficients();%0A        BigInteger %5B%5D coefficients = new BigInteger %5Bcoefficients_size%5D;%0A        System.out.println(%22coefficients:%22);%0A        for (int i =coefficients_size-1; i %3E=0 ; i--) %7B%0A            System.out.println(coefficients_Double%5Bi%5D);%0A%0A        %7D%0A      // lop for  cast  double to Big integer%0A        for (int i = 0 ; i%3C coefficients_size;i++) %7B%0A            long c = (long) coefficients_Double%5Bcoefficients_size - i-1%5D;%0A            c
 oeff
@@ -1952,25 +1952,159 @@
 ents
-()
 %5Bi%5D
-);%0A        %7D
+ = BigInteger.valueOf(c);%0A        %7D%0A%0A       Polynomial polynomial = new Polynomial(coefficients);%0A        System.out.println(polynomial.toString());
 %0A   

use to string in generate equation