Author(s): C. Letertre | Library: KERNLIB |
Submitter: B. Schorr | Submitted: 17.05.1971 |
Language: Fortran | Revised: 27.11.1984 |
Function subprogram FINT uses repeated linear interpolation to evaluate a function ) of n variables which has been tabulated at the nodes of an n-dimensional rectangular grid. It is not necessary that the table arguments corresponding to any coordinate be equally spaced.
Structure:
FUNCTION subprogram
User Entry Names: FINT
Files Refernced: Printer
External References: KERMTR, ABEND
Usage:
In any arithmetic expression,
FINT(N,X,NA,A,F)
Method:
Repeated linear interpolation with respect to variables within the grid cell which contains the given point X. For n=2, with replaced by (x,y) for clarity, the procedure is equivalent to the following:
Let be the tabulated values of x.
Let be the tabulated values of y.
Let i and j be the subscripts for which
.
Then compute:
Restrictions:
Error handling:
E104.1: or . FINT is set equal to zero, and a message is printed unless subroutine KERSET (N001) has been called.
Examples:
Given a function of two variables g(x,y) defined by a FUNCTION subprogram G, to construct a table of values of for , and to interpolate in this table to set GINT equal to an approximate value of g(1.7,2.9). The program is written in a form which allows generalization to functions of more than two variables.
PARAMETER (NA1=10,NA2=15) DIMENSION X(2),NA(2),A(NA1+NA2),F(NA1,NA2) DATA NA/NA1,NA2/ C STORE ARGUMENT ARRAY K1=0 K2=K1+NA1 DO 1 J = 1,MAX(NA1,NA2) IF (J .LE. NA1) A(J+K1)=SQRT(FLOAT(J)) IF (J .LE. NA2) A(J+K2)=LOG(FLOAT(J)) 1 CONTINUE C STORE FUNCTION ARRAY DO 3 J1 = 1,NA1 DO 2 J2 = 1,NA2 F(J1,J2)=G(A(J1+K1),A(J2+K2)) 2 CONTINUE 3 CONTINUE C INTERPOLATE IN TABLE X(1)=1.7 X(2)=2.9 GINT=FINT(2,X,NA,A,F) ...