dbesy1.f 2.81 KB
double precision function dbesy1 (x)
c july 1977 edition.  w. fullerton, c3, los alamos scientific lab.
      double precision x, by1cs(20), ampl, theta, twodpi, xmin, xsml,
     1  y, d1mach, dcsevl, dbesj1, dexp, dlog, dsin, dsqrt
      external d1mach, dbesj1, dcsevl, initds
c
c series for by1        on the interval  0.          to  1.60000e+01
c                                        with weighted error   8.65e-33
c                                         log weighted error  32.06
c                               significant figures required  32.17
c                                    decimal places required  32.71
c
      data by1 cs(  1) / +.3208047100 6119086293 2352018628 015 d-1    /
      data by1 cs(  2) / +.1262707897 4335004495 3431725999 727 d+1    /
      data by1 cs(  3) / +.6499961899 9231750009 7490637314 144 d-2    /
      data by1 cs(  4) / -.8936164528 8605041165 3144160009 712 d-1    /
      data by1 cs(  5) / +.1325088122 1757095451 2375510370 043 d-1    /
      data by1 cs(  6) / -.8979059119 6483523775 3039508298 105 d-3    /
      data by1 cs(  7) / +.3647361487 9583067824 2287368165 349 d-4    /
      data by1 cs(  8) / -.1001374381 6660005554 9075523845 295 d-5    /
      data by1 cs(  9) / +.1994539657 3901739703 1159372421 243 d-7    /
      data by1 cs( 10) / -.3023065601 8033816728 4799332520 743 d-9    /
      data by1 cs( 11) / +.3609878156 9478119611 6252914242 474 d-11   /
      data by1 cs( 12) / -.3487488297 2875824241 4552947409 066 d-13   /
      data by1 cs( 13) / +.2783878971 5591766581 3507698517 333 d-15   /
      data by1 cs( 14) / -.1867870968 6194876876 6825352533 333 d-17   /
      data by1 cs( 15) / +.1068531533 9116825975 7070336000 000 d-19   /
      data by1 cs( 16) / -.5274721956 6844822894 3872000000 000 d-22   /
      data by1 cs( 17) / +.2270199403 1556641437 0133333333 333 d-24   /
      data by1 cs( 18) / -.8595390353 9452310869 3333333333 333 d-27   /
      data by1 cs( 19) / +.2885404379 8337945600 0000000000 000 d-29   /
      data by1 cs( 20) / -.8647541138 9371733333 3333333333 333 d-32   /
c
      data twodpi / 0.6366197723 6758134307 5535053490 057 d0 /
      data nty1, xmin, xsml / 0, 2*0.d0 /
c
      if (nty1.ne.0) go to 10
      nty1 = initds (by1cs, 20, 0.1*sngl(d1mach(3)))
c
      xmin = 1.571d0 * dexp (dmax1(dlog(d1mach(1)), -dlog(d1mach(2))) +
     1  0.01d0)
      xsml = dsqrt (4.0d0*d1mach(3))
c
 10   if (x.le.0.d0) call seteru (29hdbesy1  x is zero or negative, 29,
     1  1, 2)
      if (x.gt.4.0d0) go to 20
c
      if (x.lt.xmin) call seteru (31hdbesy1  x so small y1 overflows,
     1  31, 3, 2)
      y = 0.d0
      if (x.gt.xsml) y = x*x
      dbesy1 = twodpi * dlog(0.5d0*x)*dbesj1(x) + (0.5d0 +
     1  dcsevl (.125d0*y-1.d0, by1cs, nty1))/x
      return
c
 20   call d9b1mp (x, ampl, theta)
      dbesy1 = ampl * dsin(theta)
      return
c
      end