.qa Cern__library .flags substitute .flags escape The CERN library is broken up into 3 libraries. .i5;^*sys_$userlib:KERNLIB .i5;sys_$userlib:GENLIB .i5;sys_$userlib:PACKLIB\* .br;More documentation will be added. .c;Library revision: 26-Oct-1985 .c;Document revision: $$DATE .qb libraries The 3 libraries are compiled from the PAM files: .list 1 .le;KERNLIB .list 0 .le;KERNVAX 2.14 .le;KERNFOR 4.11 .le;KERNNUM 2.00 .els 0 .le;PACKLIB .list 0 .le;EPIO 1.5 .le;FFREAD 2.01 .le;HBOOK 3.38 .le;HPLOT 4.12 .le;KAPACK 2.01 .le;MGD3 3.02 .le;ZBOOK 2.13 .le;ZCEDEX 2.52 .els 0 .le;GENLIB .list 0 .le;GEN 1.16 .le;MINUIT 1.04 .els 0 .els 1 .qb Author This document was condensed from the CERN library short writeup, and selected long writeups. .s This help file was written by: .s.c;Arthur Rabeau .c;Bonner Lab .c;Rice University .c;Houston, Texas .c;August 1985 .s The HBOOK section was written by: .s.c;John Clement .no flags subst .no flags escape .req 'IN:HBOOK' .qb Functions .qc AMAXMU .br;X = AMAXMU(A,Ind2,Iwords,Ind1) .x Subroutine>AMAXMU .list 0 .le;A = Real array of size IND2*IND1 same as A(IND1,IND2) .le;Ind2 = Number of subsets .le;Iwords = Number of elements/subset to look at .le;Ind1 = Total number of elemnts/subset .els 0 .p;This looks for the largest absolute value in a scattered real vector. .c;Example X=AMAXMU(A,4,1,2) .x Subroutine>AMAXMU .br;Library: KERNLIB - E103 .p;Sets X to the argest absolute value of A(1),(3),(5) .br;Note: AMAXMU(A,1,N,0) is faster than AMAXMU(A,N,1,1) .qc ARSIMP .br;CALL ARSIMP(N,DEL,A,R) .x Subroutine>ARSIMP .s INPUT: .i5;N - Size of ARRAY A must be odd .i5;A - REAL ARRAY of dimension N .br;OUTPUT; .i5;R - Integral over A .p;ARSIMP approximates an integral of f(x) from a to b using Simpson's rule. The function f(x) must be given at N= 2n+1 points equally separated by a distance DEL= (b-a)/2n. The array A should contain the N values of f(x), with A(n)= F(a+(n-1)*DEL). The approximation of the integral is returned in R. .s .br;Library: GENLIB - D100 .qc Bessel__func .x Bessel functions .br; Y=BESJ0(X) Y=BESJ1(X) Y=BESY0(X) Y=BESY1(X) .x Subroutine>BESJ0 .x Subroutine>BESJ1 .x Subroutine>BESY0 .x Subroutine>BESY1 .s .p;These function subprograms calculate the Bessel functions J(x) and Y(x) of order 0 or 1 (according to which is subprogram is used) for real arguments x, where x>0 for either Y(x). .s .br;Library: KERNLIB - C312 .s .br;Y=BESI0(X) Y=BESI1(X) Y=BESK0(X) Y=BESK1(X) .x Subroutine>BESI0 .x Subroutine>BESI1 .x Subroutine>BESK0 .x Subroutine>BESK1 .br;Y=EBESI0(X) Y=EBESI1(X) Y=EBESK0(X) Y=EBESK1(X) .x Subroutine>EBESI0 .x Subroutine>EBESI1 .x Subroutine>EBESK0 .x Subroutine>EBESK1 .s .p;These function subprograms calculate the modified Bessel functions I(x) and K(x) for real arguments x (x>0 for K(x)). The functions EBESIn(X) return Y=exp(-|X|)In(X); the functions EBESKn(X) return Y=exp(X)Kn(X). .s .br;Library: KERNLIB - C313 .s .br;B=BSIR3(X,NU) B=EBSIR(X,NU) B=BSKR3(X,NU) B=EBSKR3(X,NU) .x Subroutine>BSIR3 .x Subroutine>EBSIR .x Subroutine>BSKR3 .x Subroutine>EBSKR3 .s .p;BSIKR3 computes the modified Bessel functions I(x) and K(x) of order nu/3 with nu= -2, -1, 1, 2 and real x>0 (x^&>\&0 for I with nu=1 or 2). Note that K is even with respect to nu. .br;BSIR3 yields I(x); .br;EBSIR3 yields exp(-x) I(x); .br;BSKR3 yields K(x); .br;EBSKR3 yields exp(x) K(x). .s .br;Library: GENLIB - C340 .s .br;CALL BESIN(X,A,NNN,D,I) .x Subroutine>BESIN .s INPUT: .i5;A - Real in range [0,1) .i5;X - Real argument .i5;NNN - Integer so that A+NNN specifies order .br;OUTPUT: .i5;I - Real array of dimension NNN+1 .p;BESIN evaluates to D significant digits the modified Bessel functions I[a+n] (x) for fixed a and x, for n=0,...NNN. The results are stored in the array I. It is assumed that x>0 and NNN lies on the range [-100,100]. .s .br;Library: GENLIB - C327 .s .br;CALL DBESIN(X,A,NNN,D,I) .x Subroutine>DBESIN .s .br;Integer D .br;Double precision X,A,I .p;This is a double precision version of BESIN. .s .br;Library: GENLIB - C329 .s .br;CALL BESJN(X,A,NNN,D,I) .x Subroutine>BESJN .s INPUT: .i5;A - Real in range [0,1) .i5;X - Real argument .i5;NNN - Integer so that A+NNN specifies order .br;OUTPUT: .i5;I - Real array of dimension NNN+1 .p;BESJN evaluates to D significant digits the Bessel functions J(x) for fixed a and x, for n=0,...NNN. The results are stored in the array I. It is assumed that x>0 and NNN lies on the range [-100,100]. .s .br;Library: GENLIB - C328 .s .br;CALL DBESJN(X,A,NNN,D,I) .x Subroutine>DBESJN .s .br;Integer D .br;Double precision X,A,I .p;This is a double precision version of BESJN. .s .br;Library: GENLIB - C330 .s .br;CALL BESCJ(V,A,NMAX,D,U) .x Subroutine>BESCJ .s INPUT: .I5;Complex V,U .br;Integer D .br;Real A .p;This is a complex version BESJN .p;BESCJ evaluates to D significant digits the Bessel functions J[a+n](v) for fixed real A, complex v for n=0,1,...,nmax. The results are stored in the complex array U. It is assumed that 0^&<\&a<1, 0^&<\&nmax^&<\&100, and that v is not on the negative real axis. .s .br;Library: GENLIB - C331 .s .br;CALL DBESCJ(X,Y,A,NMAX,D,U,V) .x Subroutine>DBESCJ .s INPUT: .I5;Double precision X, Y, A .I5;Integer D .I5;OUTPUT: .I5;Double precision arrays U, V .p;DBESCJ evaluates to D significant digits the Bessel functions J[a+n](z)= Un+iVn for fixed double precision A, complex z= x+iy, for n=0,1,...,nmax. The real parts of the results are stored in the double precision array U, the imaginary parts in the double precision array V. It is assumed that 0^&<\&a<1, 0^&<\&nmax^&<\&100, and that z is not on the negative real axis. .s .br;Library: GENLIB - C332 .s .br;CALL BESSEL(B,X,C) .x Subroutine>BESSEL .s .br;Real array B of length 4 .br;Real C has value either +1.0 or -1.0 .p;If C=+1.0, returns the zeroeth and first order J and Y Bessel functions for X in B(1) through B(4). .p;If C=-1.0, returns the Modified Bessel functions I and K in the array B. .s .br;Library: GENLIB - C302 .s .br;CALL COMBES(X,Y,ALPHA,BETA,N,BJRE,BJIM,YRE,YIM,NY) .x Subroutine>COMBES .br;CALL CBESJY(X,Y,ALPHA,BETA,N,BJRE,BJIM,YRE,YIM,NY) .x Subroutine>CBESJY .s .br;Real ALPHA,BETA,X,Y .br;Real arrays BJRE, BJIM of dim ^&>\& max of |Z|+25 and |N|+15 .br;Real arrays YRE, YIM of dimension ^&>\& max of |N|+1 and 3 .p;Computes the Bessel functions of complex order (ALPHA+ BETA+N) yielding J(X+Y) and Y(X+iY). The real parts of J and Y are stored in BJRE and YRE; the imaginary parts are stored in BJIM and YIM. .s .br;Library: GENLIB - C303 .qc Coulomb__wave__func .x Subroutine>COUL1 .x Coulomb wave functions .br;CALL COUL1(ETA,RO,LMAX,N,F) .x Subroutine>COUL1 .s .br;Real array F of dimension 101 .p;This subroutine calculates solutions for regular Coulomb wave functions to a desired number of significant digits N. (See documentation.) .s .br;Library: GENLIB - C316 .s .br;CALL COUL2(F,FD,G,GD,SIG,RHO,ETA,LMAX) .x Subroutine>COUL2 .x Subroutine>COUL2 .s .br;Arrays F,FD,G,GD,SIG of dimension 101 .br;For 5^&<\&RHO^&<\&30, 0.1^&<\&ETA^&<\&30, and LMAX^&<\&100, COUL2 calculates the two independent solutions F and G of the differential Coulomb wave equation; their derivatives with respect to rho, F'(eta,rho) and a phase function sigma[L](eta). .s .br;Library: GENLIB - C326 .qc CHEBQU .br;C= CHEBQU(A,B,EPSIN,EPSOUT,JOP,F) .x Subroutine>CHEBQU .s .br;Double precision function subprogram F of one variable; must appear in EXTERNAL statement in calling program .p;CHEBQU computes an approximation to the integral from A to B of a function F(x) in double precision using the modified Clenshaw-Curtis algorithm, but written as an ordinary quadrature formula. The routine is faster and also much more stable with respect to accumulation of round-off error than GPINDP, when a very high precision is wanted. It also provides the experienced user with a possibility to print intermediate calculations. .p;EPSIN specifies the relative accuracy required; EPSOUT is the accuracy obtained. A and B specify the endpoints of integration, and JOP controls the printing of intermediate results: 0 for no printing, 1 for printing. .s .br;Library: GENLIB - D115 .qc CAUCHY .br;C=CAUCHY(F,A,B,S,EPS) .x Subroutine>CAUCHY .s .br;Function subprogram F with one argument which must be declared in an EXTERNAL statement in calling program .p;In any arithmetic expression, CAUCHY(F,A,B,S,EPS) has the value of the specified principle value integral, where F is the single-variable function being evaluated, A and B are real variables or expressions specifying the end points of the integration interval, S is a real variable or expression specifying the abcissa of the regularity, and EPS is a real variable or expression specifying the accuracy. .s .br;Library: GENLIB - D104 .qc DIVDIF .br;Y = DIVDIF(F,A,N,X,M) .x Subroutine>DIVDIF .p;Interpolates a table of arguments and function values using a polynomial. .list 0 .le;F(N) = Array which is to be interpolated. If X=A(J) then Y=F(J). .le;A(N) = Array of table argumenta .le;N = Size of arrays F and A .le;X = Real argument to interpolate .le;M = degree of polynomial to use in interpolation .els 0 .br;Library: KERNLIB - E105 .qc DAWSON .x Dawson intergral .br;D=DAWSON(X) .x Subroutine>DAWSON .s .p;DAWSON calculates the Dawson integral for arbitrary real x. .s .br;Library: GENLIB - C339 .qc Digamma__func. .x Digamma function .x Logarithm .br;PSI= ADIGAM(X) .x Subroutine>ADIGAM .s .br;Real X may not be zero or a negative integer .p;Calculates the digamma function d[log(Gamma(x))]/dx for arbitrary real x except for the above restriction. .s .br;Library: GENLIB - C317 .s .br;C= CDIGAM(Z) .x Subroutine>CDIGAM .s .br;Complex CDIGAM, Z .p;Computes the digamma (psi) function for a complex number Z which is not a negative integer. .br;derivitive LOG(GAMMA(Z))/dZ .s .br;Library: GENLIB - C307 .qc DILOG .br;D= DILOG(X) .x Subroutine>DILOG .s .p;Calculates the dilogarithm function d(x) for any real x. .br;- Integral[0,X] (LOG(ABS(1-e))/e) de .s .br;Library: GENLIB - C304 .qc ELFUN .br;CALL ELFUN(X,AM,SN,CN,DN) .x Elliptic functions .x Jacobian elliptic functions .x Subroutine>ELFUN .s .br;Real AM is the parameter m= k**2 .p;ELFUN computes the three Jacobian elliptic functions sn(x,m), cn(x,m) and dn(x,k). x is the argument and m=k**2 where 0 ^&<\&m^&<\& 1, the parameter, where k is the modulus which determines the quarter-period K(k) of these periodic functions. (cf. program ELLICK) .s .br;Library: GENLIB - C318 .qc EXPINT .br;Y= EXPINT(X) .x Exponential integral .x Integral>Exponential .x Subroutine>EXPINT .s .p;Function subprogram EXPINT calculates the exponential integral E[1] (x) for real arguments x. For x<0, the real part of the principal value of the integral is taken. .s .br;Library: KERNLIB - C318 .s .br;CALL CELFUN(Z,AM,SN,CN,DN) .x Subroutine>CELFUN .s .br;Complex Z, SN, CN, DN .p;CELFUN computes the three Jacobian elliptic functions sn(z,m), cn(z,m) and dn(z,m) where z=x+iy is the complex argument and m=k**2 the parameter (0^&<\&m^&<\&1), where k is the modulus which determines the real and imaginary quarter- periods K(k) and K'=K(k'). .s .br;Library: GENLIB - C320 .qc FERDIR .br;F= FERDIR(X,P) .x Fermi-Dirac function .x Subroutine>FERDIR .s .p;FERDIR calculates the Fermi-Dirac function F[p] (x) for p= -1/2, 1/2, 3/2 and arbitrary real x. .s .br;Library: GENLIB - C338 .qc FINIT .br;Y = FINIT(NARG,X,NA,A,F) .x Interpolation>3 dimenstional .x Subroutine>FINIT .p;This performs multidimensional interpolation .list 0 .le;NARG = Number of coordinates n .le;X(NARG) = Array containing coordinates of point at which the interpolation is performed. .le;NA(NARG) = Array containing dimensions of array F .le;A(I) = Array whose dimension = sum of NA(J),J=1,NARG .br;A(1-NA(1)) contain the values a11 a12 of the first variable X1 in strictly increasing order. These define the values of X1 at the gridpoints of function F. .br;A(NA(1)+1--NA(1)+NA(2)) contains values at grid points for X2 and so on. .le;F(n1...nnarg) = Multidimensional array to interpolate .els 0 .br;Library: KERNLIB - E100 .qc RGAUSS .br;Y= RGAUSS(F, A, B, N [,X2,X3,X4,X5,X6]) .x Subroutine>RGAUSS .s .br;Function subprogram F of type real and of the form .br; FUNCTION F(X1,X2,X3,X4,X5,X6) .br;in which X1 is the variable of integration and X2 to X6 are defined below. F must be declared EXTERNAL in the program that calls RGAUSS. .p;Function subprogram RGAUSS integrates a function F of up to six variables by allowing the integrands to call RGAUSS in turn. The arguments are defined as follows: .p;A and B are the lower and upper limits of integration with respect to X1. .p;N is a positive integer specifying the number of subintervals of [A,B] equal length over each of which the Gaussian quadrature formula is to be applied. .p;X2-X6 are parameters through which information of any kind (e.g. variables, names of FUNCTION subprograms, etc.) may be transmitted from the program which calls RGAUSS to the FUNCTION F. Their use is optional. However, the actual parameters X2, X3,... specified in the call of RGAUSS and the formal parameters X2, X3,... of F must agree in number, order and type. .s .br;Library: GENLIB - D112 .qc CGAUSS .br;C= CGAUSS(F,A,B,EPS) .x Subroutine>CGAUSS .s .br;Complex function subprogram F with one argument, declared in EXTERNAL statement in the calling program. Both CGAUSS and the name F must be declared in the calling program to be COMPLEX. .br;Complex variables or expressions A and B .p;CGAUSS evaluates the complex integral of F(z) dz to a specified accuracy along the directed line segment AB. The complex function F must be single- valued on this segment. The accuracy is specified by the REAL variable or expression EPS. This routine is similar in usage to the single-precision version GAUSS. .s .br;Library: GENLIB - D113 .qc GPINSP .br;Y= GPINSP(A,B,EPSIN,EPSOUT,F,IOP) .x Subroutine>GPINSP .s .br;Function subprogram F of one variable; must appear in EXTERNAL statement of calling program .p;GPINSP computes an approximation to the integral of F(x) from A to B of a user-supplied function F. The routine also computes what is believed to be a rather safe estimate for the relative error. The integration methods are rather slow and the main usage should be to check other, faster methods of integration. .p;EPSIN is the relative accuracy required; EPSOUT is the relative accuracy obtained; IOP is an option parameter specifying the method to be used: .br;i) For integrands with a strongly exponential behavior, use IOP=1. .br;ii) For integrands with singularities near the integration interval endpoints (but outside the interval) or integrands with singular derivatives in the integration interval, use IOP=2. .br;iii) For integrands which are continuous and have continuous derivatives up to a certain order, use IOP=1 or IOP=3. .s .br;Library: GENLIB - D110 .qc GQUAD .br;G= GQUAD(F,A,B,N) .x Subroutine>GQUAD .br;CALL GSET(A,B,N,X,W) .x Subroutine>GSET .s .br;Function subprogram F with one argument which must be declared in an EXTERNAL statement in calling program .br;Real arrays X and W of dimension N (GSET only) .p;Function subprogram GQUAD computes the approximate value of the integral from A to B of the function F(t) using the N-point Gauss-Legendre quadrature formula corresponding to the interval [A,B]. .p;Subroutine GSET stores, for subsequent use, the abscissae x[i] and the weights w[i] of the N-point Gauss-Legendre quadrature formula corresponding to the interval [A,B]. These values are stored in the arrays X and W. .p;The following values of N may be used: 2 through 16, 20, 24, 32, 40, 48, 64, 80, 96. GQUAD and GSET are independent subprograms: it is not necessary to call GSET in order to use GQUAD, or vice-versa. .s .br;Library: KERNLIB - D106 .qc Legendre__func .br;CALL LEGFN(V,Z,P,Q,NC,NF) .x Subroutine>LEGFN .x Legendre polynomial .s .br;Complex V, Z .p;LEGFN calculates the Legendre functions of the first and second kind, Pv(z) and Qv(z), for all complex values of v and z. NC returns zero if an accuracy of 10**-6 is achieved, nonzero otherwise. NF must be preset if z is a real number less than one (see write-up). .s .br;Library: GENLIB - C311 .qc LOGAM .x Gamma function .x Logarithm>Gamma function .br;A= ALOGAM(X) .x Subroutine>ALOGAM .s .p;Function subprogram ALOGAM computes the logarithm of the gamma function for real arguments x>0. .s .br;Library: KERNLIB - C341 .s .br;C=CLOGAM(Z) .x Subroutine>CLOGAM .s .br;Complex C, CLOGAM, Z .p;CLOGAM calculates the logarithm of the gamma function of z for arbitrary complex z <> -n (n=0,1,2,...). The imaginary part is calculated in such a way that it is continuous for |arg z|Sine .x Integral>Cosine .x Subroutine>SININT .x Subroutine>COSINT .s .p;Function subprograms SININT and COSINT calculate the integrals Si(x) and Ci(x) for real arguments x, x <> 0 for COSINT. (See documentation for integral form.) .s .br;Library: KERNLIB - C336 .qc TRIINT .br;D= TRIINT(F,NSUBDV,NPOINT,EPS,X1,Y1,X2,Y2,X3,Y3) .x Subroutine>TRIINT .s .br;Function subprogram F with two arguments which must be declared in an EXTERNAL statement in calling program .br;Integer NSUBDV= 0 or 1 .br;Integer NPOINT= 7, 25, or 64 .p;TRIINT calculates the double integral of F(x,y)__dx__dy over an arbitary (finite) triangle in the x-y plane whose vertices are the points (X1,Y1), (X2,Y2), (X3,Y3). .p;If NSUBDV=0, no subdivision of the given triangle is performed; if NSUBDV=1, the triangle is subdivided. (See write-up.) .p;NPOINT specifies the integration formula used: 7, 25 or 64-point. The default is 7. .p;EPS is a variable or expression specifying the accuracy. For reasonably-behaved functions EPS is approximately |w-w'|/(1+|w'|) where w is the exact value and w' is the value computed by TRIINT. .s .br;Library: GENLIB - D105 .qc STRHO .br;S= STRH0(X) S=STRH1(X) .x Struve function .x Subroutine>STRH0 .x Subroutine>STRH1 .s .p;The STRH0 package computes the Struve function H0(x) and H1(x) for arbitrary real x. .s .br;Library: GENLIB - C342 .qc WHIT .x Whittacker function .br;W= WHIT(AK,AM,Z) .x Subroutine>WHIT .s .br;Complex AK, AM, Z .br;WHIT computes the values of the Whittacker function M[k,m] (z) for complex argument z and complex parameters k (=AK) and M (=AM). .s .br;Library: GENLIB - C325 .qc ELIN1 .br;F= ELIN1(X,AM) .x Elliptic integral .x Integral>Elliptic .x Subroutine>ELIN1 .s .p;ELIN1 computes the incomplete elliptic integral of the first kind, f(x,k), where AM is the real parameter m=k**2. .s .br;Library: GENLIB - C319 .qc ERF .br;A= ERF(X) A= ERFC(X) A= FREQ(X) .x Error function .x Normal function .x Frequency function .x Subroutine>ERF .x Subroutine>ERFC .x Subroutine>FREQ .s .p;These function subprograms compute error and normal frequency functions for a given X (see documentation). .s .br;Library: KERNLIB - C300 .s .br;C=CWERF(Z) .x Subroutine>CWERF .s .br;Complex C,CWERF,Z .p;CWERF calculates the complex error function w(z) for arbitrary complex z. (See documentation for exact form.) .s .br;Library: GENLIB - C335 .qc GAUSIN .br;G= GAUSIN(P) .x Gaussian probability function .x Subroutine>GAUSIN .s .p;For a given Gausssian probability P, GAUSIN(P) has the value of the corresponding deviate X. .s .br;Library: GENLIB - C301 .qc GAMMA .br;Y= GAMMA(X) .x Gamma function .x Subroutine>GAMMA .s .p;Calculates the gamma function for real X, where X is not zero or a negative integer. .s .br;Library: KERNLIB - C305 .s .br;G= DGAMMA(X) .x Subroutine>DGAMMA .s .br;Double precision X, DGAMMA .p;DGAMMA computes the value of the gamma function for any real argument x in DOUBLE PRECISION mode. Near a pole the accuracy of the gamma function may deteriorate to less than 24 digits. .s .br;Library: GENLIB - C322 .s .br;G= CGAMMA(Z) .x Subroutine>CGAMMA .br;G= ZFACT(Z) .x Subroutine>ZFACT .s .br;Complex CGAMMA, ZFACT, Z, G .p;CGAMMA returns the complex value of the gamma function of Z; ZFACT returns the complex value of the factorial of Z. Z may not be a negative integer. .s .br;Library: GENLIB - C306 .qc GPLOG .br;G= GPLOG(N,P,X) .x Polylogarithm function .x Subroutine>GPLOG .s .p;GPLOG calculates the real part of the generalized polylogarithm function, Re S[np] (x), for arbitrary real x and integers n, p satisfying 1^&<\&n^&<\&4, 1^&<\&p^&<\&4 and n+p^&<\&5. .s .br;Library: GENLIB - C323 .s .br;G= GPLOG(N,P,X) .x Subroutine>GPLOG .p;CGPLOG calculates the complex-valued generalized polylogarithm function, S[np] (x), for arbitrary real x and integers n, p satisfying 1^&<\&n^&<\&4, 1^&<\&p^&<\&4 and n+p^&<\&5. For x^&<\&1, S[np] (x) is a real function and the imaginary part is zero. .s .br;Library: GENLIB - C324 .qc ELLICK .br;Y= ELLICK(X) .x Elliptic integral .x Integral>Elliptic .x Subroutine>ELLICK .br;Y= ELLICE(X) .x Subroutine>ELLICE .s .p;ELLICK returns the elliptic integral K(x) for |x| < 1; .br;Integral[0,Pi/2] dPhi/SQRT(1-k**2 * SIN(Phi)**2 ) .p;ELLICE returns the elliptic integral E(x) for |x| < 1. .br;Integral[0,Pi/2] SQRT(1-k**2 * SIN(Phi)**2 ) dPhi .s .br;Library: KERNLIB - C308 .qc CRAGAM .br;G= CRAGAM(Z,A,B) .x Gamma function>Ratio .x Subroutine>CRAGAM .s .br;Complex Z,A,B .p;CRAGAM returns the ratio Gamma(Z+A) / Gamma(Z+B). .s .br;Library: GENLIB - C310 .qc IDENZB .br;I= IDENZB(A,B) .x Subroutine>IDENZB .s .br;Logical I, IDENZB .p;Returns .TRUE. if A is identical to B .s .br;Library: GENLIB - A401 .qc PROXIM .br;P= PROXIM(BETA,ALPHA) .x Subroutine>PROXIM .s .p;Returns equivalent angle to BETA within range (ALPHA-pi,ALPHA+pi) .s .br;Library: KERNLIB - B102 .qc POLY .br;P= POLY(X,M,A) .x Power series .x Subroutine>POLY .s .p;Summation of power series [A(i)* X**i] where the index i runs from 1 to M .s .br;Library: GENLIB - C100 .qb Subroutines .qc POWEZE .br;CALL POWEZE(X,A,N) .x Subroutine>POWEZE .s .br;Real array A of dimension > N .p;POWEZE stores the successive powers of X, starting at zero, in successive elements of A, i.e. A(j)=X**(j-1) for j=1,...,N+1. A(1) will always equal 1. .s .br;Library: KERNLIB - B400 .qc DDVETA .x Cubic equations>Roots .br;CALL DDVETA(A,X,MTYPE) .x Subroutine>DDVETA .s .br;Double precision A array of dimension 4 .br;Double precision X array of dimension 3 .p;Returns the roots of cubic equation .i10;A(1)X**3 + A(2)X**2 + A(3)X + A(4) = 0 .br;in the array X. MTYPE indicates the solution type: .p; MTYPE = -1 <-- three real roots .p; MTYPE = 0 <-- three real roots, at least two equal .p; MTYPE = 1 <-- one real root in X(1), two complex conjugate .p;roots with real part in X(2) and imaginary part in X(3) .s .br;Library: GENLIB - C201 .qc NZEROS .br;CALL NZEROS(NZ,Z,R,FCN) .x Subroutine>NZEROS .s .br;Integer NZ .br;Complex Z .br;Complex function FCN subprogram must be delared .br; in EXTERNAL statement by the calling program .p;Given FCN(Z,I) defining a function f(z) at z=Z (I is set by NZEROS), this routine will return the number of zeros (NZ) in a circle of given radius R about given point Z. .s .br;Library: GENLIB - C203 .qc MAXIZE .br;INDEX = MAXIZE(Iarray,N) .x Subroutine>MAXIZE .p This returns the index of the first maximum element of the integer array. .br;Library: GENLIB - E102 .qc MINIZE .br;INDEX = MINIZE(Iarray,N) .x Subroutine>MINIZE .p This returns the index of the first minimum element of the integer array. .br;Library: GENLIB - E102 .qc MAXFZE .br;INDEX = MAXFZE(Iarray,N) .x Subroutine>MAXFZE .p This returns the index of the first maximum element of the floating array. .br;Library: GENLIB - E102 .qc MINFZE .br;INDEX = MINFZE(Iarray,N) .x Subroutine>MINFZE .p This returns the index of the first minimum element of the floating array. .br;Library: GENLIB - E102 .qc MULLER .br;CALL MULLER(A,N,ROOT) .x Subroutine>MULLER .s .br;Real A array of size (N+1) .br;Complex ROOT array of size (N+1) .p;Given a polynomial of degree N with coefficients A(1,2,..N+1), i.e., A(1)z**N + A(2)z**(N-1) +...+ A(N)z + A(N+1), returns the roots (real and complex) in array ROOT. .s .;*********************************** .br;Library: KERNLIB .qc RZERO .br;CALL RZERO(A,B,X,R,EPS,MAXF,F) .x Subroutine>RZERO .s .br;Real A, B, X, R, EPS, MAXF .br;Real Function F subprogram, declared EXTERNAL by calling program .p;Given a function F(X,I), returns in X an approximation of a zero of F on the given interval (A,B), referring to F at most a given number of MAXF times. Attempts to hit a given accuracy EPS; returns |R| > |X-root| (see writeup). .s .br;Library: KERNLIB .qc POLY2 .br;CALL POLY2(A,N,ROOT,H,MAXFUN,MODE) .x Subroutine>POLY2 .s .br;Integer N, MAXFUN, MODE .br;Real Array H of dimension ^&>\& N .br;Complex Array A of dimension ^&>\& N+1, ROOT of dimension ^&>\& N .p;Given the coefficients A(1,2,..N+1) of a complex polynomial of given degree N, returns in ROOT the zeros of the polynomial; H(I) returns the radius about ROOT(I) which contains the true Ith root. .p;If MODE = 0 on input, ROOT is empty on input. If MODE <> 0, ROOT(I) should contain starting approximations for the Ith roots. MAXFUN is the given maximum number of iterations. .s .br;Library: GENLIB .qc FRECS .br;CALL FRECS(X,U,V) .x Subroutine>FRECS .br;CALL FRICS(X,U,V) .x Subroutine>FRICS .s .p;FRECS returns U= C(X), V= S(X), where C and S are the Fresnel integrals of X. FRICS calculates similar integrals (explained in documentation). .s .br;Library: GENLIB .qc LOCATn .br;L = LOCATI(A,N,T) .x Subroutine>LOCATI .br;L = LOCATF(A,N,T) .x Subroutine>LOCATF .p;Binary search for a specified value. LOCATI uses integer arguments, LOCATF floating args. .list 0 .le;A(N) = Integer or real array of non-decreasing numbers. .le;N = Number of elements in A .le;T = Integer or real search value .le;L = 0 if T < A(1) .br; = k if T = A(k) .br; = -k if A(k) < T < A(k+1) .br; = -N if A(N) < T .els 0 .br;Library: KERNLIB - E106 .qc GAUSS1 .br;CALL GAUSS1(F,A,B,LAMBDA,RESULT,EPS) .x Subroutine>GAUSS1 .s .br;Function subprogram F with one argument which must be declared in an EXTERNAL statement in calling program .p;GAUSS1 evaluates the integral of F(x) from A to B using a 16-point Gaussian integration formula on each of a specified set of sub-intervals, giving an indication of the error. .p;LAMBDA is an integer variable or expression specifying the number of subintervals. The result is returned in RESULT and an accuracy indication is returned in EPS (see writeup). .s .br;Library: GENLIB .qc GAUSS .br;CALL GAUSS(F,A,B,EPS) .x Subroutine>GAUSS .s .br;Function subprogram F with one argument which must be declared in an EXTERNAL statement in calling program in the calling program .p;Function subprogram GAUSS computes, to an attempted specified accuracy, the value of the integral of F(x) from A to B. The user-supplied parameter EPS specifies a bound on the relative error of the integral I for |I|>1, and a bound on the absolute error in the case |I|<1. (See documentation.) .s .br;Library: KERNLIB - D103 .s .br;D= DGAUSS(F,A,B,EPS) .x Subroutine>DGAUSS .s .br;Double Precision function subprogram F with a single double precision argument; F must appear in an EXTERNAL statement in the calling program .br;Double Precision variables A, B and EPS .p;DGAUSS evaluates the integral of F(x) dx from A to B in double precision to a specified accuracy. It is identical in form and operation to GAUSS, but it is very slow and should be used only in exceptional circumstances. .s .br;Library: GENLIB - D109 .qc TRAPER .br;CALL TRAPER(X,Y,E,N,A,B,RE,SD) .x Subroutine>TRAPER .s .br;Real arrays X, Y, E of length ^&>\&N .p;Let a function f(x) be given by its values at certain discrete points x[v] (v=1,2,..,n). Let the function values y[v] be accompanied by an estimated standard deviation e[v] (square root of the variance). TRAPER then approximates the integral RE of f(x) from A to B, approximately the sum of the values w[u]*y[u], by a linear combination of the y[v] using the trapezoidal rule. It calculates the standard deviation SD of RE by SD= (sum w[u]**2 e[u]**2)**.5. The function values f(A) and f(B) are calculated by linear interpolation. .p;The arrays X, Y, and E should contain the values of x[v], y[v], and e[v] respectively; N is the number of function values supplied to the program, and A and B are the endpoints of integration. .p;Note: If no e[v] are given, the array E should be filled with zeros. .s .br;Library: GENLIB .qc GPINDP .s2 .p;GPINDP computes an approximation to the integral from A to B of a function F(x) in double precision. F(x) is calculated from a FUNCTION subprogram supplied by the user. The user may choose between three different methods of integration. The calculation is performed in such a way that at any step during the calculation lower and upper bounds for the true value of the integral are computed. The integration methods, though extremely safe, are rather slow and the main usage should be to check the accuracy of other, faster methods of integration. A simplified single-precision version of GPINDP is available (GPINSP). The long write-up should be consulted for use of this subprogram. .s .br;Library: GENLIB .qc RIWIAD .br;CALL RIWIAD(EXAMPLE) .x Subroutine>RIWIAD .s .br;Real function EXAMPLE(Q) of a parameter which is a real array Q(NDIM), for example defined by: .br; FUNCTION EXAMPLE(Q) .br; DIMENSION Q(NDIM) .br; ...function statements... .br; END .p;RIWIAD is an adaptive multidimensional integration subroutine. It permits numerical integration of a large class of functions, in particular those that are irregular at the border of the integration region. The integration is always performed over the unit hypercube. .p;To use RIWIAD, the COMMON block PARAMS must be set by the user: .br; COMMON/PARAMS/ACC,NDIM,NSUB,ITER .p;See writeup for details and usage. .s .br;Library: GENLIB .qc DIVON4 .s2 .br;Double precision function DFUN(ND,X) of ND varibles .br;Double precision array X .p;The subroutine package DIVON4 is designed for integration of scalar functions of several variables, expecially functions not smooth enough to be integrated reliably using Gaussian quadrature. It can also be used effectively to generate random points in a multidimensional space, with point density given by any bounded function. The heart of the package is an algorithm for recursive multi-dimensional partitioning of the space into subregions of approimately constant function value. For usage details, see the writeup. .s .br;Library:GENLIB .qc BULSTO .s2 .p;Subroutine BULSTO integrates the set of equations .p; dY[r]/dx = F[r](X,Y1,...,Yn) r=1,2...n .x Subroutine>F[r] .br;by a method due to Bulirsch and Stoer. See long writeup for usage. .s .br;Library: GENLIB .qc MERSON .br;CALL MERSON(X,XEND,Y,N,ACC,H,HMIN,JTEST,OK,DIFF) .x Subroutine>MERSON .s .br;Real array Y of length N .br;Logical OK = .TRUE. on entering MERSON .br;Subroutine DIFF(X,Y,F) must have chosen name appear in EXTERNAL statement in the calling program .p;Subroutine MERSON performs step by step integration of a system of simultaneous first order differential equations .p; dY[r]/dX = F[r](X,Y1,...,Yn) r=1,2...n .br;with automatic local error control. See writeup for usage. .s .br;Library: GENLIB .qc RKSTP .br;CALL RKSTP(N,H,X,Y,SUB,W) .x Subroutine>RKSTP .br;CALL DRKSTP(N,H,X,Y,SUB,W) .x Subroutine>DRKSTP .s .br;Real array Y of dimension N .br;Real array W of dimension 3N .br;Subroutine SUB(X,Y,F), declared EXTERNAL is the calling program .p;Either of these two subroutines advances the solution of the system of several simultaneous first-order differential equations, i.e. .br; dy[i]/dx= F[i](x,y1,...,yn), i=1,2...n .br;by a single step of length h in the independent variable X. RKSTP is the single-precision version, while DRKSTP is the double-precision version. For DRKSTP,H,X,Y,W and F must be of type DOUBLE PRECISION. See the writeup for details and usage. .s .br;Library: KERNLIB .qc EPDE1 .br;CALL EDPE1 .p;EPDE1 solves an elliptic partial differential equation of general form (Poisson's equation being a special case) over a two-dimensional region using a finite difference method. The region may be of any shape and on its boundary either the dependent variable or a relation involving its derivative may be specified. See long writeup for usage. .s .br;Library: GENLIB .qc ELPHANY .br;CALL ELPHANY(F,NX,NY,DX,DY,C,IBX,BWEST,BEAST,JBY,BSOUTH,BNORTH) .s .br;Real two-dimensional array F of dimension (NX,NY) .br;Real array C of dimension 3 .br;Real arrays BWEST and BEAST of dimension NY .br;Real arrays BSOUTH and BNORTH of dimension NX .p;ELPHANY uses fast Fourier transform techniques for the solution, over a rectangular domain, of an elliptic, parabolic, or hyperbolic partial differential equation (see writeup for form and usage). .s .br;Library: GENLIB .qc NUMID1 .s .p;Subroutine NUMID1 computes the numerical value of the derivative of the function y=f(x) at x= x[1]. See long writeup for details and usage. .s .br;Library: GENLIB .qc MINSQ .br;CALL MINSQ(M,N,F,X,E,IPRINT,NFUN,NW,W,COV,XSTEP) .x Subroutine>MINSQ .s .br;Real array F of dimension M .br;Real arrays X and E of dimension N .br;Integer NW must be set ^&>\& N+M(N+1)+3N(N+1)/2 .br;Real array W of dimension NW .br;COV= 0 or 1 .p;MINSQ finds the minimum of a sum of squares of functions f[k](x1,x2...xn). See the writeup for details and usage. .s .br;Library: GENLIB .qc MINVAR .br;CALL MINVAR(X,Y,R,EPS,STEP,MAXF,A,B,F) .x Subroutine>MINVAR .s .br;Real F is the name of a user-supplied FUNCTION subprogram declared EXTERNAL in the calling program. .p;Subroutine MINVAR computes, to an attempted specified accuracy, the abscissa of a local minimum of a real-valued function f(x) lying in a given interval [A,B], together with the value of the function at the minimum. See the writeup for details and usage. .s .br;Library: KERNLIB .qc FRED1 .s .p;FRED1 uses an N-point Gaussian quadrature formula to obtain an approximation to the solution y of the Fredholm type integral equation over the range [A,B]. The program also evaluates numerically integrals of H(t)y(t) from A to B, where H is an arbitrary function and y is given above. See the writeups for details and usage. .s .br;Library: GENLIB .qc POOL-D .s .p;The 'POOL' of Physics Algorithms and Programs is a collection of coded material for physicists and programmers working on problems in the area of data analysis. The access method for programs in the POOL is described in chapter 1 of the Program Library manual. .qb Approximations__and__Fitting .qc FUMILI .s .p;FUMILI fits the chi-squared and likelihood functions. See writeups for details and usage. .s .br;Library: GENLIB .qc LINSQ .br;CALL LINSQ(K,N,M,A,X,Y,W,DA,H,COV,QPRINT,QMIN) .x Subroutine>LINSQ .s .br;Real array A of dimension K .br;Real array X of dimension M x N .br;Real arrays Y and W of dimension N .br;Real array DA of length K .br;Double precision array H of dimension K x K+1 .br;Real COV and QPRINT must be either 0. or 1. .p;LINSQ fits data Y(i) by a function F(x1,x2,...,x[m]). Various information is provided. See writeup for details and usage. .s .br;Library: GENLIB .qc MINUIT .s .p;The MINUIT package performs minimization and analysis of the shape of a multiparameter function. It is intended to be used on Chisquare or likelihood functions for fitting data and finding parameter errors and correlations. The more important options are: .s .br;1. Variable metric (Fletcher) minimization .br;2. Monte Carlo minimization .br;3. Simplex (Nelder and Mead) minimization .br;4. Parabolic error analysis .br;5. MINOS (non-linear) error analysis .br;6. Contour plotting .br;7. Fixing and restoring parameters .br;8. Global minimization .p;The long writeup must be consulted for usage. .s .br;Library: GENLIB .qc Fourier__transforms .x Fourier transforms .br;CALL RFT(M,X,IX,Y,IY,MODE) .x Subroutine>RFT .br;CALL RCA(M,X,IX,Y,IY) .x Subroutine>RCA .br;CALL RPA(M,X,IX,Y,IY) .x Subroutine>RPA .br;CALL RPS(M,X,IX,Y,IY) .x Subroutine>RPS .br;CALL RSA(M,X,IX,Y,IY) .x Subroutine>RSA .s .br;Real arrays X and Y of dimension N .p;The subroutines in this group compute fast Fourier transforms and their inverses for real functions. See writeup for details and usage. .s.i5;FFTRC .s .p;This is a set of routines which perform fast Fourier transforms for a variety of cases including both real and complex coefficients. See the long writeup for details and usage. .s .br;Library: GENLIB .s .br;CALL CFT(A,B,NTOT,N,NSPAN,ISN) .x Subroutine>CFT .s .br;Real arrays A and B of dimension N .p;CFT evaluates discrete Fourier transforms using fast Fourier technique. One-, two- and three-dimensional transforms can be performed. See writeup for details and usage. .s .br;Library: GENLIB .s .br;EQUIVALENCE (C,Y) .br;CALL RFFT(C,M) .x Subroutine>RFFT .s .br;Complex array C of length not less than (n/2)+1 .br;Real array Y of length not less than n. .p;Subroutine RFFT computes either: (1) the finite Fourier transform of a real periodic sequence, or (2) the corresponding inverse transform. The period n must be a power of 2. See writeup for details and usage. .s .br;Library: KERNLIB .s .br; CALL CFFT(A,M) .x Subroutine>CFFT .s .br;Complex array A of length not less than n .p;Subroutine CFFT computes the finite Fourier transform of a complex periodic sequence, whose period n must be a power of 2. Either the forward transform or the unscaled inverse transform may be computed. See the writeup for details and usage. .s .br;Library: KERNLIB .qc POLINT .br;CALL POLINT(F,A,N,X,R) .x Interpolation .x Subroutine>POLINT .s .br;Real arrays F and A of length N .p;Subroutine POLINT interpolates in a table of arguments a[j] and function values f[j]=f(a[j]), using an interpolating polynomial of specified degree N-1 which passes through N successive tabular points. The table arguments a[j] need not be equidistant. See writeup for details and usage. .s .br;Library: KERNLIB .qc TRICOF This computes the coefficient ak, bk in the trigonomertic expansion: .i5;f(x) = a0/2 + a1*COS(x)+ ... an*COS(n*x) .i10;b1*SIN(x)+ ... bm*SIN(m*x) .br;from given equidistant function values in the normalized interval -pi<=x<=pi. .s.i5;CALL TRICOFF(F,NF,A,NA,B,IOP) .s;INPUT: .list 0 .le;F(1:NF) - Array containing function values .le;NF - Size of array F .le;NA - Size of array A - 1TRISUM .s;INPUT: .list 0 .le;A(1:NA) - A(i+1)=ai .le;NA - Size of array A .le;B(1:NB) - B(i)=bi .le;NB - Size of array B .le;IOP - Options .i5;1 - general case .i5;2 - even case - f(x)=f(-x) .i5;3 - odd case - f(x)=-f(x) .els 0 .br;Library: GENLIB .qc LSQ .x Polynomial>Fitting .x Fitting>Polynomial Fits a polynomial to n equally weighted data points (Xi,Yi). For m=2 LLSQ is faster and easier than LSQ. .i5;CALL LSQ(N,X,Y,M,A) .x Subroutine>LSQ .i5;CALL LLSQ(N,X,Y,A1,A2,IFAIL) .x Subroutine>LLSQ .br;INPUT: .list 0 .le;N - Number of data points .le;X(1:N) - Real data .le;Y(1:N) - Real data coordinate y=f(x) .le;M - The number of coefficients to fit .els 1 .br;OUTPUT: .list 0 .le;M - Indicates error condition .i5;0 if M<1 or M20 .le;A(1:M) - Coefficients of polynomial .le;A1,A2 - Coefficients of Y=A1+A2*x .le;IFAIL - Error indicator .i5;-2 if N<2 .i5;-1 if the matrix is singular .i5;#0 if OK .els 0 .br;Library: GENLIB .qc SPLIN3 Third order spline approximation .i5;Consult the long write up .;********************************************E220 .qb system__information .qc Date__time .x Date .x Time .x Subroutine>DATIM .i5;CALL DATIME(ID,IT) .x Subroutine>DATIME .br;Returns decimal date and time: .i5;ID=(Yearr-1900)*1000+Month*100+Dat .i5;IT=Hour*100+Min s .i5;CALL DATIMH(ND,NT) .x Subroutine>DATIMH .X Subroutine>DATIMH .br;Returns hollerith date and time: .i5;ND='DA/MO/YR' .i5;NT='HR:MN:SC' .br;Library: KERNLIB .qc CPU__time .x CPU time .x Time, CPU .i5;CALL TIMEX(T) .x Subroutine>TIMEX .X Subroutine>TIMEX .s T=Execution time in seconds .s.i5;CALL TIMEL(T) .x Subroutine>TIMEL .X Subroutine>TIMEL .s T=Execution time remaining in seconds .s.i5;CALL TIMED(T) .x Subroutine>TIMED .X Subroutine>TIMED .s T=Execution time since last call to TIMED .br;Library: KERNLIB .qc NOARG Number of arguments in a fortran CALL. .i5;CALL NOARG(I) .x Subroutine>NOARG br;This supplies the number of arguments in a Fortran call. This will not work if character variables are passed. .br;Library: KERNLIB .qc INTRAC .X Subroutine>INTRAC Logical function which identifies interactive (not batch) jobs. .i5;LOGICAL INTRAC .i5;IF(INTRAC(dummy)) THEN .i10;_.......... .br;It is true if the job is interactive. .br;Library: KERNLIB