25 lines
566 B
Fortran
25 lines
566 B
Fortran
SUBROUTINE splint(xa,ya,y2a,n,x,y)
|
|
INTEGER n
|
|
REAL x,y,xa(n),y2a(n),ya(n)
|
|
INTEGER k,khi,klo
|
|
REAL a,b,h
|
|
klo=1
|
|
khi=n
|
|
1 if (khi-klo.gt.1) then
|
|
k=(khi+klo)/2
|
|
if(xa(k).gt.x)then
|
|
khi=k
|
|
else
|
|
klo=k
|
|
endif
|
|
goto 1
|
|
endif
|
|
h=xa(khi)-xa(klo)
|
|
if (h.eq.0.) pause 'bad xa input in splint'
|
|
a=(xa(khi)-x)/h
|
|
b=(x-xa(klo))/h
|
|
y=a*ya(klo)+b*ya(khi)+((a**3-a)*y2a(klo)+(b**3-b)*y2a(khi))*(h**
|
|
*2)/6.
|
|
return
|
|
END
|