#include "cubic.h"
#include <stdio.h>

void main()
{
  int NumPoints = 5, NumInter = 9, Error,i;
  TNvector XData, YData, XInter, Coef0, Coef1, Coef2, Coef3, YInter;

  XData = calloc(ArraySize,sizeof(double));
  YData = calloc(ArraySize,sizeof(double));
  XInter = calloc(ArrayIntSize,sizeof(double));
  XData[1]=0.0;   YData[1]=1.0;
  XData[2]=1.0;   YData[2]=1.0;
  XData[3]=2.0;   YData[3]=5.0;
  XData[4]=3.0;   YData[4]=1.0;
  XData[5]=4.0;   YData[5]=1.0;
  XInter[1]=0.0;
  XInter[2]=0.5;
  XInter[3]=1.0;
  XInter[4]=1.5;
  XInter[5]=2.0;
  XInter[6]=2.5;
  XInter[7]=3.0;
  XInter[8]=3.5;
  XInter[9]=4.0;
  CubicSplineFree(NumPoints, XData, YData, NumInter, XInter, &Coef0, &Coef1, &Coef2, &Coef3, &YInter, &Error);
  printf("\n");
  for (i=1; i <= 9; i++) printf("\n%f ",YInter[i]);
  free(Coef0);free(Coef1);free(Coef2);free(Coef3);free(XData);free(YData);
  free(XInter);free(YInter);
}
