source: PSPA/parmelaPSPA/trunk/spl1d2.f @ 404

Last change on this file since 404 was 12, checked in by lemeur, 12 years ago

parmela pspa initial

File size: 1.4 KB
Line 
1      subroutine spl1d2(n,x,f,w,ij,y,tab)
2c     where n= number of points in the interpolation
3c           x= origin of table of the independent variable
4c           f= origin of table of the dependent variable
5c           w= origin of table of second derivatives as calculated by
6c              spl1d1
7c          ij= spacing in the tables f and w
8c           y= the point at which interpolation is desired
9c         tab= an array of dimension 3 which contains the function
10c              value, first derivative, and second derivative at y
11c--------------------------------------------------------------------------
12c
13      dimension x(n),f(n),w(n),tab(3)
14c--------------------------------------------------------------------------
15c*
16c
17c     locate y in the x table
18      call interv (x,n-1,y,i)
19   30 mi=(i-1)*ij+1
20      k1=mi+ij
21      flk=x(i+1)-x(i)
22c
23c     calculate f(y)
24c
25      a=(w(mi)*(x(i+1)-y)**3+w(k1)*(y-x(i))**3)/(6.*flk)
26      b=(f(k1)/flk-w(k1)*flk/6.)*(y-x(i))
27      c=(f(mi)/flk-flk*w(mi)/6.)*(x(i+1)-y)
28      tab(1)=a+b+c
29c
30c     calculate the first derivative at y
31c
32      a=(w(k1)*(y-x(i))**2-w(mi)*(x(i+1)-y)**2)/(2.*flk)
33      b=(f(k1)-f(mi))/flk
34      c=flk*(w(mi)-w(k1))/6.
35      tab(2)=a+b+c
36c
37c     calculate the second derivative at y
38c
39      tab(3)=(w(mi)*(x(i+1)-y)+w(k1)*(y-x(i)))/flk
40      return
41      end
42c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Note: See TracBrowser for help on using the repository browser.