double interpolate(int numberofpairs, double x[], double y[], double bigx, int k) { int i=0,j=0,width=0; int upperbound=0,lowerbound = 0; double fx=0; for (i=0;ibigx) { lowerbound=i-1; upperbound=i; break; } } width = (k/2) - 1; upperbound+=width; lowerbound-=width; if (lowerbound < 0) { upperbound = (abs(lowerbound)+upperbound); lowerbound = 0; } else { if(upperbound > numberofpairs) { lowerbound=lowerbound-(abs(upperbound-numberofpairs)); upperbound=numberofpairs; } } fx = summation(x,y,numberofpairs,bigx,upperbound,lowerbound); //printf("fx is %lf\n", fx); return fx; }