      function aid (x)
c july 1980 edition.  w. fullerton, bell labs.
c
c evaluate the derivative of the airy function ai(x).
c
      dimension aifcs(8), aigcs(9)
      external aide, cos, csevl, exp, inits, r1mach, sqrt
c
c series for aif on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   5.22e-18
c                                         log weighted error  17.28
c                               significant figures required  16.01
c                                    decimal places required  17.73
c
      data aifcs(  1) /     0.1052746122 6531408809 e0/
      data aifcs(  2) /     0.0118361362 8152997844 e0/
      data aifcs(  3) /     0.0001232810 4173225664 e0/
      data aifcs(  4) /     0.0000006226 1225638140 e0/
      data aifcs(  5) /     0.0000000018 5298887844 e0/
      data aifcs(  6) /     0.0000000000 0363328873 e0/
      data aifcs(  7) /     0.0000000000 0000504622 e0/
      data aifcs(  8) /     0.0000000000 0000000522 e0/
c
c series for aig on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   3.14e-19
c                                         log weighted error  18.50
c                               significant figures required  17.44
c                                    decimal places required  18.98
c
      data aigcs(  1) /     0.0212338781 5091866685 2e0/
      data aigcs(  2) /     0.0863159303 3521440675 2e0/
      data aigcs(  3) /     0.0017975947 2038323135 8e0/
      data aigcs(  4) /     0.0000142654 9987555069 3e0/
      data aigcs(  5) /     0.0000000594 3799528368 3e0/
      data aigcs(  6) /     0.0000000001 5240336647 9e0/
      data aigcs(  7) /     0.0000000000 0026458766 0e0/
      data aigcs(  8) /     0.0000000000 0000033156 2e0/
      data aigcs(  9) /     0.0000000000 0000000031 4e0/
c
      data naif, naig, x2sml, x3sml / 2*0, 2*0.0 /
c
      if (naif.ne.0) go to 10
      naif = inits (aifcs, 8, 0.1*r1mach(3))
      naig = inits (aigcs, 9, 0.1*r1mach(3))
c
      x3sml = r1mach(3)**0.3334
      x2sml = sqrt(r1mach(3))
c
 10   if (x.ge.(-1.0)) go to 20
      call r9admp (x, xn, phi)
      aid = xn * cos(phi)
      return
c
 20   if (x.gt.1.0) go to 30
      x3 = 0.0
      if (abs(x).gt.x3sml) x3 = x**3
      x2 = 0.0
      if (abs(x).gt.x2sml) x2 = x*x
      aid = (x2*(0.125 + csevl (x3, aifcs, naif)) -
     1  csevl (x3, aigcs, naig)) - 0.25
      return
c
 30   aid = aide(x) * exp(-2.0*x*sqrt(x)/3.0)
      return
c
      end