      DOUBLE PRECISION function fun(x,iuser)
***** normalized functions *******
      DOUBLE PRECISION x, t, alpha, beta, pi
      integer iuser
c     on input, x in [0,1]
c     t in [-1,1], for convenience in typing
      t = 2*x-1
      pi = 4*DATAN(1.D0)
      alpha = 1000
      beta = 1/pi
      if(iuser.lt.1.or.iuser.gt.22)then
         print *,"bad function code ",iuser
         stop
      end if
      goto (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,  17,18,19,20,21,22),
     + iuser
1       continue
      fun = acosh(1+99*x)/acosh(100.D0)
      return
2       continue
      fun = .5D0+.5D0*asin(-.99D0+1.98D0*x)/asin(.99D0)
      return
3       continue
      fun = .5D0+.5D0*asinh(-100+200*x)/asinh(100.D0)
      return
4       continue
      fun =.5D0+.5D0*DATAN(-100+200*x)/DATAN(100.D0)
      return
5       continue
      fun = .5D0+.5D0*atanh(-.99D0+1.98D0*x)/atanh(.99D0)
      return
6       continue
      fun = (cosh(t)-1)/(cosh(1.D0)-1)
      return
7       continue
      fun = x**1.6D0
      return
8       continue
      fun =(DEXP(t)-DEXP(-1.D0))/(DEXP(1.D0)-DEXP(-1.D0))
      return
9       continue
      fun =(DEXP(t)-DEXP(-1.D0)+max(0.D0,alpha*(t-beta)))/
     $    (DEXP(1.D0)-DEXP(-1.D0)+max(0.D0,alpha*(1.-beta)))
      return
10       continue
      fun = (erf(alpha*(x-beta))+DEXP(x*x))/
     $      (erf(alpha*(1.-beta))+DEXP(1.D0))
      return
11       continue
      fun = (tanh(alpha*t)+DEXP(t*t))/
     $      (tanh(alpha)+DEXP(1.D0))
      return
12       continue
      fun =DEXP(-alpha*x)
      return
13       continue
      fun = max(0.D0,alpha*(t-beta))/(alpha*(1.-beta))
      return
14       continue
      fun = (log(.01D0+99.99D0*x)-log(.01D0))/
     $      (log(.01D0+99.99D0)-log(.01D0))
      return
15       continue
      fun = .5D0+.5D0*DSIN(2*pi*x)
      return
16       continue
      fun = .5D0+.5D0*sinh(t)/sinh(1.D0)
      return
17       continue
      fun =DSQRT(t+1)/DSQRT(2.D0)
      return
18       continue
      fun = .5D0+.5D0*(erf(100*t)/erf(100.D0)-t)
      return
19       continue
      fun = .5D0+.5D0*(tan(-1.5D0+3*x)/tan(1.5D0))
      return
20       continue
      fun = .5D0+.5D0*tanh(alpha*t)
      return
21       continue
      if(x.eq.0)then
      fun = 0
      else
      fun = -exp(1.D0)*x*log(x)
      end if
      return
22       continue
      fun = .5D0+.5D0*erf(alpha*(x-beta))
      return
      end
