public double interpolate(double xIter) {
	int np = this.xArray.length;           // number of points        double d[] = new double[np];        // Newton form coefficients
        double x[] = xArray;//new double[np];        // x-coordinates of nodes
        double d[] = yArray;
        double y;
        double t;
        double oldy=0;
        double oldt=0;

        int npp = np*precision ;          // number of points used for drawing
	
      
     
        
     
        if (np>1){  
          double a[] = new double[np];
          double t1;
          double t2;
          double h[] = new double[np];
          for (int i=1; i<=np-1; i++){
            h[i] = x[i] - x[i-1];
          }
          if (np>2){
            double sub[] = new double[np-1];
            double diag[] = new double[np-1];
            double sup[] = new double[np-1];
            
            for (int i=1; i<=np-2; i++){
              diag[i] = (h[i] + h[i+1])/3;
              sup[i] = h[i+1]/6;
              sub[i] = h[i]/6;
              a[i] = (d[i+1]-d[i])/h[i+1]-(d[i]-d[i-1])/h[i];
            }
            solveTridiag(sub,diag,sup,a,np-2);
          }
          // note that a[0]=a[np-1]=0
          // draw
          oldt=x[0];
          oldy=d[0];
          for (int i=1; i<=np-1; i++) {   // loop over intervals between nodes
            for (int j=1; j<=precision; j++){
              t1 = (h[i]*j)/precision;
              t2 = h[i] - t1;
              y = ((-a[i-1]/6*(t2+h[i])*t1+d[i-1])*t2 +
                   (-a[i]/6*(t1+h[i])*t2+d[i])*t1)/h[i];
              t=x[i-1]+t1;
              if (xIter==t||Math.abs(xIter-t)<0.01)
                  return y;
              oldt=t;
              oldy=y;
            }
          }
          
        }
        return 1000;
      }