      INCLUDE 'stdhdr.for'
      REAL xv(0: maxr), yv(0: maxr), coef(0: maxr, 0: maxc)
      INTEGER n, i
      REAL r, YActual, Errr

      n = 10
      DO i = 0, 10   !!one cycle of a cosine sampled at 10 intervals
        xv(i) = pi * REAL(i) / 5.0       !x value
        yv(i) = 3 * COS(xv(i))           !y value
      END DO
      !!! calculate spline equation coefficients
      CALL CubicSplines(xv, yv, n, coef)

      PRINT *, 'Spline equation coefficients'
      DO i = 0, n - 1
        PRINT 10, i, coef(i, 0), coef(i, 1), coef(i, 2), coef(i, 3)
10      FORMAT (I2, 4(F10.2))
      END DO
      PRINT *, 'Press any key to continue'
      READ (*,*)
      PRINT *, 'Y-actual     Y-estimate   Error in estimate'
      PRINT *
      DO i = 0, 20
        r = REAL(i) * pi / 250.0
        YActual = 3.0 * COS(r)
        CALL CalcSpline(xv, coef, n, r, yest)
        Errr = YActual - yest
        PRINT 20,  YActual, yest, Errr
20      FORMAT (3(F10.5, 5X))
      END DO

      END