      SUBROUTINE SMOOTH(Y,MU,X)
************************************************************************
*                                                                      *
*     neural network smoothing function                                *
*                                                                      *
************************************************************************
*
      REAL*8 X,Y,MU,TMP
*
      TMP=X/MU
      IF(TMP.GT.30) THEN
        Y=X
        ELSE IF(TMP.LT.-30) THEN
          Y=0.0
        ELSE
          Y=X+MU*LOG(1.0+EXP(-TMP))
      ENDIF
*
      RETURN
      END
*
*
      SUBROUTINE SMOOTHM(Y,MU,X)
************************************************************************
*                                                                      *
*     derivative w.r.t. epsilon                                        *
*                                                                      *
************************************************************************
*
      REAL*8 X,Y,MU,TMP
*
      TMP=X/MU
      IF(TMP.GT.30) THEN
        Y=0.0
        ELSE IF(TMP.LT.-30) THEN
          Y=0.0
        ELSE
          Y=LOG(1.0+EXP(TMP))-TMP+TMP/(1.0+EXP(TMP))
      ENDIF
*
      RETURN
      END
*
*
      SUBROUTINE SMOOTHX(Y,MU,X)
************************************************************************
*                                                                      *
*     derivative w.r.t. x                                              *
*                                                                      *
************************************************************************
*
      REAL*8 X,Y,MU,TMP
*
      TMP=X/MU
      IF(TMP.GT.30) THEN
        Y=1.0
        ELSE IF(TMP.LT.-30) THEN
          Y=0.0
        ELSE
          Y=1.0-1.0/(1.0+EXP(TMP))
      ENDIF
*
      RETURN
      END
*
*
