      program example
c
c     example for interpolation by cubic splines
c     (interpolation of sine, not a knot condition)
c
      implicit double precision (a-h,o-z)
      dimension tau(500),c(4,500)
      data npoint /201/
      data pi /3.14159265358979d0/
      write(*,*) ' enter number of data points'
      read(*,*) n
      write(*,*) ' enter first and xlast point'
      read(*,*)  first,xlast
      dx=(xlast-first)/dble(n-1)
      do 1 i=1,n
1        tau(i)=first+dx*dble(i-1)
      do 2 i=1,n
2        c(1,i)=dsin(5.d0*pi*tau(i))
      ibcbeg=1
      ibcend=1
      c(2,1)=5.d0*pi
      c(2,n)=-5.d0*pi
      call cubspl(tau,c,n,ibcbeg,ibcend)
c
c     generating the file which contains true and interpolated sine
c
      open(1,file='       ',form='formatted')
      h=(xlast-first)/dble(npoint-1)
      do 3 i=2,npoint-1
         point=first+dble(i-1)*h
         call interv(tau,n,point,l,mflag)
         write(1,10) point,dsin(5.d0*pi*point)-ppvalu(tau,c,l,4,point,0)
         write(2,10) point,dsin(5.d0*pi*point),ppvalu(tau,c,l,4,point,0)
20       format(1pe15.5,2(1pe25.10))
10       format(1pe15.5,1pe25.15)
3     continue
      close(1)
      end
