/*   ATK IV - Numerical Programming (2006)   */
/*  Excercise 3.3 - Polynomial Interpolation */

#include<stdio.h>
#include<math.h>
#define NRANSI /*This definition is required by nr.h, see more in NR online book. */
#include<nr.h>


int main(void){

  float y, dy;
  float xa[] = {0,1,2,3,4};
  float ya[] = {0,1,3,6,8};
  float x = 2.5;
  int n=4;

  polint(xa,ya,n,x,&y,&dy);

  printf("%f\n",y);

  return 0;
}