1 | subroutine spl1d2(n,x,f,w,ij,y,tab) |
---|
2 | c where n= number of points in the interpolation |
---|
3 | c x= origin of table of the independent variable |
---|
4 | c f= origin of table of the dependent variable |
---|
5 | c w= origin of table of second derivatives as calculated by |
---|
6 | c spl1d1 |
---|
7 | c ij= spacing in the tables f and w |
---|
8 | c y= the point at which interpolation is desired |
---|
9 | c tab= an array of dimension 3 which contains the function |
---|
10 | c value, first derivative, and second derivative at y |
---|
11 | c-------------------------------------------------------------------------- |
---|
12 | c |
---|
13 | dimension x(n),f(n),w(n),tab(3) |
---|
14 | c-------------------------------------------------------------------------- |
---|
15 | c* |
---|
16 | c |
---|
17 | c 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) |
---|
22 | c |
---|
23 | c calculate f(y) |
---|
24 | c |
---|
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 |
---|
29 | c |
---|
30 | c calculate the first derivative at y |
---|
31 | c |
---|
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 |
---|
36 | c |
---|
37 | c calculate the second derivative at y |
---|
38 | c |
---|
39 | tab(3)=(w(mi)*(x(i+1)-y)+w(k1)*(y-x(i)))/flk |
---|
40 | return |
---|
41 | end |
---|
42 | c+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|