C  * * * * * * * * * * * * * * * * * * * * * * * * * * *                
C     SUBROUTINE FOR PROBABILITY DENSITY DISTRIBUTION                   
C  * * * * * * * * * * * * * * * * * * * * * * * * * * *                
C                                                                       
C                                   CODED BY Y.OHSAKI                   
C                                                                       
      SUBROUTINE PROD(N,X,ND,RAMP,PROP,AV,SD)                           
C                                                                       
      DIMENSION X(ND),RAMP(21),PROP(21)                                 
      DIMENSION BOUND(21)                                               
C                                                                       
C     INTIALIZATION                                                     
C                                                                       
      DO 110 I=1,21                                                     
      RAMP(I)=1.-REAL(I-1)/10.                                          
      BOUND(I)=RAMP(I)-0.05                                             
      PROP(I)=0.                                                        
  110 CONTINUE                                                          
      XMAX=0.                                                           
      DO 120 M=1,N                                                      
      XMAX=AMAX1(XMAX,ABS(X(M)))                                        
  120 CONTINUE                                                          
      DO 130 M=1,N                                                      
      X(M)=X(M)/XMAX                                                    
  130 CONTINUE                                                          
      AV=0.                                                             
      SD=0.                                                             
C                                                                       
C     PROBABILITY DENSITY                                               
C                                                                       
      DO 150 M=1,N                                                      
      AV=AV+X(M)                                                        
      SD=SD+X(M)**2                                                     
      DO 140 I=1,21                                                     
      IF(X(M).LT.BOUND(I)) GO TO 140                                    
      PROP(I)=PROP(I)+1.                                                
      GO TO 150                                                         
  140 CONTINUE                                                          
  150 CONTINUE                                                          
      DO 160 I=1,21                                                     
      PROP(I)=PROP(I)/REAL(N)*100.                                      
  160 CONTINUE                                                          
      AV=AV/REAL(N)                                                     
      SD=SQRT(SD/REAL(N)-AV**2)                                         
      RETURN                                                            
      END                                                               
