besk0.f
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function besk0 (x)
c april 1977 version. w. fullerton, c3, los alamos scientific lab.
dimension bk0cs(11)
external besi0, besk0e, csevl, inits, r1mach
c
c series for bk0 on the interval 0. to 4.00000d+00
c with weighted error 3.57e-19
c log weighted error 18.45
c significant figures required 17.99
c decimal places required 18.97
c
data bk0 cs( 1) / -.0353273932 3390276872e0 /
data bk0 cs( 2) / .3442898999 246284869e0 /
data bk0 cs( 3) / .0359799365 1536150163e0 /
data bk0 cs( 4) / .0012646154 1144692592e0 /
data bk0 cs( 5) / .0000228621 2103119451e0 /
data bk0 cs( 6) / .0000002534 7910790261e0 /
data bk0 cs( 7) / .0000000019 0451637722e0 /
data bk0 cs( 8) / .0000000000 1034969525e0 /
data bk0 cs( 9) / .0000000000 0004259816e0 /
data bk0 cs(10) / .0000000000 0000013744e0 /
data bk0 cs(11) / .0000000000 0000000035e0 /
c
data ntk0, xsml, xmax / 0, 0., 0. /
c
if (ntk0.ne.0) go to 10
ntk0 = inits (bk0cs, 11, 0.1*r1mach(3))
xsml = sqrt (4.0*r1mach(3))
xmax = -alog(r1mach(1))
xmax = xmax - 0.5*xmax*alog(xmax)/(xmax+0.5) - 0.01
c
10 if (x.le.0.) call seteru (29hbesk0 x is zero or negative, 29,
1 2, 2)
if (x.gt.2.) go to 20
c
y = 0.
if (x.gt.xsml) y = x*x
besk0 = -alog(0.5*x)*besi0(x) - .25 + csevl (.5*y-1., bk0cs, ntk0)
return
c
20 besk0 = 0.
if (x.gt.xmax) call seteru (30hbesk0 x so big k0 underflows, 30,
1 1, 0)
if (x.gt.xmax) return
c
besk0 = exp(-x) * besk0e(x)
c
return
end