daid.f 3.39 KB
double precision function daid (x)
c july 1980 edition.  w. fullerton, bell labs.
c
c evaluate the derivative of the airy function ai(x).
c
      double precision x, aifcs(13), aigcs(13), x3sml, x2sml, xn,
     1  phi, x3, x2, d1mach, daide,  dcsevl
c
c series for aif    on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   2.20e-34
c                                         log weighted error  33.66
c                               significant figures required  32.39
c                                    decimal places required  34.21
c
      data aif cs(  1) /  0.1052746122 6531408808 8970057325 134114d0/
      data aif cs(  2) /  0.0118361362 8152997844 2889292583 980840d0/
      data aif cs(  3) /  0.0001232810 4173225664 3051689242 469164d0/
      data aif cs(  4) /  0.0000006226 1225638139 9016825658 693579d0/
      data aif cs(  5) /  0.0000000018 5298887844 1452950548 140821d0/
      data aif cs(  6) /  0.0000000000 0363328872 5904357915 995625d0/
      data aif cs(  7) /  0.0000000000 0000504621 7040440664 768330d0/
      data aif cs(  8) /  0.0000000000 0000000522 3816555471 480985d0/
      data aif cs(  9) /  0.0000000000 0000000000 4185745090 748989d0/
      data aif cs( 10) /  0.0000000000 0000000000 0002672887 324883d0/
      data aif cs( 11) /  0.0000000000 0000000000 0000001392 128006d0/
      data aif cs( 12) /  0.0000000000 0000000000 0000000000 602653d0/
      data aif cs( 13) /  0.0000000000 0000000000 0000000000 000220d0/
c
c series for aig    on the interval -1.00000e+00 to  1.00000e+00
c                                        with weighted error   2.76e-32
c                                         log weighted error  31.56
c                               significant figures required  30.50
c                                    decimal places required  32.12
c
      data aig cs(  1) /  0.0212338781 5091866685 2312227684 8937d0/
      data aig cs(  2) /  0.0863159303 3521440675 2494280946 1604d0/
      data aig cs(  3) /  0.0017975947 2038323135 7803396322 5230d0/
      data aig cs(  4) /  0.0000142654 9987555069 3252662068 7495d0/
      data aig cs(  5) /  0.0000000594 3799528368 3201048878 7064d0/
      data aig cs(  6) /  0.0000000001 5240336647 9447894521 4786d0/
      data aig cs(  7) /  0.0000000000 0026458766 0349043530 5100d0/
      data aig cs(  8) /  0.0000000000 0000033156 2429681502 0591d0/
      data aig cs(  9) /  0.0000000000 0000000031 3978975759 4792d0/
      data aig cs( 10) /  0.0000000000 0000000000 0232576737 9040d0/
      data aig cs( 11) /  0.0000000000 0000000000 0000138438 4231d0/
      data aig cs( 12) /  0.0000000000 0000000000 0000000067 6629d0/
      data aig cs( 13) /  0.0000000000 0000000000 0000000000 0276d0/
c
      data naif, naig, x2sml, x3sml / 2*0, 2*0.0d0 /
c
      if (naif.ne.0) go to 10
      eta = 0.1*sngl(d1mach(3))
      naif = initds (aifcs, 13, eta)
      naig = initds (aigcs, 13, eta)
c
      x3sml = d1mach(3)**0.3334d0
      x2sml = dsqrt (d1mach(3))
c
 10   if (x.ge.(-1.d0)) go to 20
      call d9admp (x, xn, phi)
      daid = xn * dcos(phi)
      return
c
 20   if (x.gt.1.0d0) go to 30
      x3 = 0.0d0
      if (dabs(x).gt.x3sml) x3 = x**3
      x2 = 0.0d0
      if (dabs(x).gt.x2sml) x2 = x*x
      daid = (x2*(0.125d0 + dcsevl (x3, aifcs, naif)) -
     1  dcsevl (x3, aigcs, naig)) - 0.25d0
      return
c
 30   daid = daide(x) * dexp(-2.0d0*x*dsqrt(x)/3.0d0)
      return
c
      end