ccccccccccccccccccccccccc     Program 4.5     cccccccccccccccccccccccccc
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c                                                                      c
c Please Note:                                                         c
c                                                                      c
c (1) This computer program is part of the book, "An Introduction to   c
c     Computational Physics," written by Tao Pang and published and    c
c     copyrighted by Cambridge University Press in 1997.               c
c                                                                      c
c (2) No warranties, express or implied, are made for this program.    c
c                                                                      c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
      SUBROUTINE TDPL(A,B,N,X,P)
C
C Subroutine to generate determinant polynomial P_N(X).
C
      DIMENSION P(1:N),A(1:N),B(1:N)
      P0  = 1.0
      IF (N.LT.1) STOP 'The dimension is less than 1.'
      P(1) = A(1)-X
      IF(N.LT.2) RETURN
      P(2) = (A(2)-X)*P(1)-B(1)*B(1)*P0
      IF(N.LT.3) RETURN
      DO    100 I = 2, N-1
        P(I+1) = (A(I+1)-X)*P(I)-B(I)*B(I)*P(I-1)
  100 CONTINUE
      RETURN
      END
