      SUBROUTINE ORTHOV (MO, NA, AU, AR, NF, FF, DF, SF)
C     ******************************************************************
C     FORTRAN SUBROUTINE FOR ORTHONORMAL POLYNOMIAL EVALUATION
C     ******************************************************************
C     MO = MODE OF OPERATION
C     NA = NUMBER OF COORDINATES
C     AU = ARGUMENT OF FUNCTIONS
C     AR = RECURRENCE COEFFICIENTS                (2*M-2 ARRAY)
C     NF = NUMBER OF FUNCTIONS                    (M)
C     FF = ORTHONORMAL FUNCTIONS                  (M-ARRAY)
C     DF = FIRST DERIVATIVES                      (M-ARRAY)
C     SF = SECOND DERIVATIVES                     (M-ARRAY)
C
C     CALL ORTHOV (0, NA, AU, AR, NF, FF)         FOR FUNCTIONS
C     CALL ORTHOV (1, NA, AU, AR, NF, FF, DF)     FOR FIRST DERIVATIVES
C     CALL ORTHOV (2, NA, AU, AR, NF, FF, DF, SF) FOR SECOND DERIVATIVES
C
      DIMENSION AR(2), FF(2), DF(2), SF(2)
  001 SN=NA
      RN=SQRT(SN)
      FF(1)=1.0/RN
      IF(NF.LE.1)GO TO 003
      FF(2)=(AU-AR(2))*FF(1)/AR(1)
      IF(NF.EQ.2)GO TO 003
      L=2
      DO 002 K=3,NF
      L=L+2
      FF(K)=((AU-AR(L))*FF(K-1)-AR(L-3)*FF(K-2))/AR(L-1)
  002 CONTINUE
  003 IF(MO.LE.0)RETURN
      DF(1)=0.0
      IF(NF.LE.1)GO TO 005
      DF(2)=FF(1)/AR(1)
      IF(NF.EQ.2)GO TO 005
      L=2
      DO 004 K=3,NF
      L=L+2
      DF(K)=(FF(K-1)+(AU-AR(L))*DF(K-1)-AR(L-3)*DF(K-2))/AR(L-1)
  004 CONTINUE
  005 IF(MO.EQ.1)RETURN
      SF(1)=0.0
      IF(NF.LE.1)GO TO 007
      SF(2)=0.0
      IF(NF.EQ.2)GO TO 007
      L=2
      DO 006 K=3,NF
      L=L+2
      SF(K)=(2.0*DF(K-1)+(AU-AR(L))*SF(K-1)-AR(L-3)*SF(K-2))/AR(L-1)
  006 CONTINUE
  007 RETURN
      END
