mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2025-01-01 06:23:39 +01:00
c977aa998f
Replace amos with slatec
124 lines
3.3 KiB
Fortran
124 lines
3.3 KiB
Fortran
*DECK DXQNU
|
|
SUBROUTINE DXQNU (NU1, NU2, MU1, THETA, X, SX, ID, PQA, IPQA,
|
|
1 IERROR)
|
|
C***BEGIN PROLOGUE DXQNU
|
|
C***SUBSIDIARY
|
|
C***PURPOSE To compute the values of Legendre functions for DXLEGF.
|
|
C Method: backward nu-wise recurrence for Q(MU,NU,X) for
|
|
C fixed mu to obtain Q(MU1,NU1,X), Q(MU1,NU1+1,X), ...,
|
|
C Q(MU1,NU2,X).
|
|
C***LIBRARY SLATEC
|
|
C***CATEGORY C3A2, C9
|
|
C***TYPE DOUBLE PRECISION (XQNU-S, DXQNU-D)
|
|
C***KEYWORDS LEGENDRE FUNCTIONS
|
|
C***AUTHOR Smith, John M., (NBS and George Mason University)
|
|
C***ROUTINES CALLED DXADD, DXADJ, DXPQNU
|
|
C***REVISION HISTORY (YYMMDD)
|
|
C 820728 DATE WRITTEN
|
|
C 890126 Revised to meet SLATEC CML recommendations. (DWL and JMS)
|
|
C 901019 Revisions to prologue. (DWL and WRB)
|
|
C 901106 Corrected order of sections in prologue and added TYPE
|
|
C section. (WRB)
|
|
C 920127 Revised PURPOSE section of prologue. (DWL)
|
|
C***END PROLOGUE DXQNU
|
|
DIMENSION PQA(*),IPQA(*)
|
|
DOUBLE PRECISION DMU,NU,NU1,NU2,PQ,PQA,PQ1,PQ2,SX,X,X1,X2
|
|
DOUBLE PRECISION THETA,PQL1,PQL2
|
|
C***FIRST EXECUTABLE STATEMENT DXQNU
|
|
IERROR=0
|
|
K=0
|
|
PQ2=0.0D0
|
|
IPQ2=0
|
|
PQL2=0.0D0
|
|
IPQL2=0
|
|
IF(MU1.EQ.1) GO TO 290
|
|
MU=0
|
|
C
|
|
C CALL DXPQNU TO OBTAIN Q(0.,NU2,X) AND Q(0.,NU2-1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