subroutine splint(xa,ya,y2a,n,x,y) c author: c. seftor c date: 3 feb 1991 c purpose: given the arrays xa and ya of length n, which tabulate a c function (with the xa's in order), and given the array y2a, c which is the output from the subroutine spline, and given a value c of x, this routine returns a cubic-spline interpolated value y. c (algorithm taken from numerical recipes (fortran) by press et. al.) c implicit integer*4(i-n), real*8(a-h,o-z) real*8 xa(n), ya(n), y2a(n), x, y real*8 a, b integer*4 n klo = 1 khi = n 10 continue if (khi-klo .gt. 1) then k = (khi+klo)/2 if (xa(k) .gt. x) then khi = k else klo = k endif goto 10 endif h = xa(khi) - xa(klo) if (h .eq. 0.) then write (23,*)' bad xa input' stop endif a = (xa(khi)-x)/h b = (x-xa(klo))/h y = a*ya(klo) + b*ya(khi) + 1 ((a**3-a)*y2a(klo) + (b**3-b)*y2a(khi)) * (h**2)/6. return end