D01 Qudrture D01BBF NAG Fortrn Librry Routine Document Note. Before using this routine, plese red the Users Note for your implementtion to check the interprettion of bold itlicised terms nd other implementtion-dependent detils. 1 Purpose D01BBF returns the weights nd bscisse pproprite to Gussin qudrture formul with specified number of bscisse. The formule provided re Guss Legendre, Guss Rtionl, Guss Lguerre nd Guss Hermite. 2 Specifiction SUBROUTINE D01BBF(D01XXX, A, B, ITYPE, N, WEIGHT, ABSCIS, IFAIL) ITYPE, N, IFAIL rel A, B, WEIGHT(N), ABSCIS(N) EXTERNAL D01XXX 3 Description This routine returns the weights nd bscisse for use in the Gussin qudrture of function f(x). The qudrture tkes the form n S = w i f(x i ) i=1 where w i re the weights nd x i re the bscisse (see Dvis nd Rbinowitz [1], Froberg [2], Rlston [3] or Stroud nd Secrest [4]). Weights nd bscisse re vilble for Guss Legendre, Guss Rtionl, Guss Lguerre nd Guss Hermite qudrture, nd for selection of vlues of n (see Section 5). () Guss Legendre Qudrture: b f(x) dx where nd b re finite nd it will be exct for ny function of the form (b) Guss Rtionl qudrture: f(x) dx ( + b>0) or nd will be exct for ny function of the form 2n+1 i=2 f(x) dx ( + b<0) c i (x + b) i = c 2n+1 i (x + b) i (x + b) 2n+1 (c) Guss Lguerre qudrture, djusted weights option: f(x) dx (b >0) or nd will be exct for ny function of the form e bx f(x) dx (b <0) D01BBF.1
D01BBF D01 Qudrture (d) Guss Hermite qudrture, djusted weights option: nd will be exct for ny function of the form + f(x) dx e b(x )2 (b>0) (e) Guss Lguerre qudrture, norml weights option: e bx f(x) dx (b >0) or nd will be exct for ny function of the form e bx f(x) dx (b <0) (f) Guss Hermite qudrture, norml weights option: + nd will be exct for ny function of the form: e b(x )2 f(x) dx Note. Tht the Guss Legendre bscisse, with = 1, b = +1, re the zeros of the Legendre polynomils; the Guss Lguerre bscisse, with =0,b = 1, re the zeros of the Lguerre polynomils; nd the Guss Hermite bscisse, with =0,b = 1, re the zeros of the Hermite polynomils. 4 References [1] Dvis P J nd Rbinowitz P (1975) Methods of Numericl Integrtion Acdemic Press [2] Froberg C E (1970) Introduction to Numericl Anlysis Addison Wesley [3] Rlston A (1965) A First Course in Numericl Anlysis McGrw Hill 87 90 [4] Stroud A H nd Secrest D (1966) Gussin Qudrture Formuls Prentice Hll 5 Prmeters 1: D01XXX SUBROUTINE, supplied by the NAG Fortrn Librry. Externl Procedure The nme of the routine indictes the qudrture formul: D01BAZ, for Guss Legendre weights nd bscisse; D01BAY, for Guss Rtionl weights nd bscisse; D01BAX, for Guss Lguerre weights nd bscisse; D01BAW, for Guss Hermite weights nd bscisse. The nme used must be declred s EXTERNALin the (sub)progrm from which D01BBF is clled. In certin implementtions, to void nme clshes between single nd double precision versions, nmes of uxiliry routines hve been chnged, e.g., D01BAX to BAXD01. Plese refer to the Users Note for your implementtion. D01BBF.2
D01 Qudrture D01BBF 2: A rel Input 3: B rel Input On entry: the quntities nd b s described in the pproprite subsection of Section 3. 4: ITYPE Input On entry: indictes the type of weights for Guss Lguerre or Guss Hermite qudrture (see Section 3): if ITYPE = 1, djusted weights will be returned; if ITYPE = 0, norml weights will be returned. Constrint: ITYPE = 0 or 1. For Guss Legendre or Guss Rtionl qudrture, this prmeter is not used. 5: N Input On entry: the number of weights nd bscisse to be returned, n. Constrint: N = 1,2,3,4,5,6,8,10,12,14,16,20,24,32,48 or 64. 6: WEIGHT(N) rel rry Output On exit: the N weights. For Guss Lguerre nd Guss Hermite qudrture, these will be the djusted weights if ITYPE = 1, nd the norml weights if ITYPE = 0. 7: ABSCIS(N) rel rry Output On exit: the N bscisse. 8: IFAIL Input/Output On entry: IFAILmust be set to 0, 1 or 1. For users not fmilir with this prmeter (described in Chpter P01) the recommended vlue is 0. On exit: IFAIL= 0 unless the routine detects n error (see Section 6). 6 Error Indictors nd Wrnings Errors detected by the routine: IFAIL= 1 The N-point rule is not mong those stored. If the soft fil option is used, the weights nd bscisse returned will be those for the lrgest vlid vlue of N less thn the requested vlue, nd the excess elements of WEIGHT nd ABSCIS (i.e., up to the requested N) will be filled with zeros. IFAIL= 2 The vlue of A nd/or B is invlid. Guss Rtionl: A + B = 0 Guss Lguerre: B = 0 Guss Hermite: B 0 If the soft fil option is used the weights nd bscisse re returned s zero. IFAIL= 3 Lguerre nd Hermite norml weights only: underflow is occurring in evluting one or more of the norml weights. If the soft fil option is used, the underflowing weights re returned s zero. A smller vlue of N must be used; or djusted weights should be used (ITYPE = 1). In the ltter cse, tke cre tht underflow does not occur when evluting the integrnd pproprite for djusted weights. D01BBF.3
D01BBF D01 Qudrture 7 Accurcy The weights nd bscisse re stored for stndrd vlues of A nd B to full mchine ccurcy. 8 Further Comments Timing is negligible. 9 Exmple This exmple progrm returns the bscisse nd (djusted) weights for the six-point Guss Lguerre formul. 9.1 Progrm Text Note. The listing of the exmple progrm presented below uses bold itlicised terms to denote precision-dependent detils. Plese red the Users Note for your implementtion to check the interprettion of these terms. As explined in the Essentil Introduction to this mnul, the results produced my not be identicl for ll implementtions. D01BBF ExmpleProgrm Text Mrk 14 Revised. NAG Copyright 1989... Prmeters.. N PARAMETER (N=6) NOUT PARAMETER (NOUT=6).. Locl Sclrs.. rel A, B IFAIL, ITYPE, J.. Locl Arrys.. rel ABSCIS(N), WEIGHT(N).. Externl Subroutines.. EXTERNAL D01BAX, D01BBF.. Executble Sttements.. D01BBF ExmpleProgrm Results A = 0.0e0 B = 1.0e0 ITYPE = 1 IFAIL = 0 CALL D01BBF(D01BAX,A,B,ITYPE,N,WEIGHT,ABSCIS,IFAIL) WRITE (NOUT,99998) Lguerre formul,, N, points AbscisseWeights WRITE (NOUT,99999) (ABSCIS(J),WEIGHT(J),J=1,N) STOP 99999 FORMAT (1X,2e15.6) 99998 FORMAT (1X,A,I3,A) END 9.2 Progrm Dt None. D01BBF.4
D01 Qudrture D01BBF 9.3 Progrm Results D01BBF ExmpleProgrm Results Lguerre formul, 6 points AbscisseWeights 0.222847E+00 0.118893E+01 0.299274E+01 0.577514E+01 0.983747E+01 0.159829E+02 0.573536E+00 0.136925E+01 0.226068E+01 0.335052E+01 0.488683E+01 0.784902E+01 D01BBF.5 (lst)