1 from __future__
import print_function
3 def printhankelrow(lMax
, x
, file=sys
.stdout
):
4 print(lMax
, N(x
), end
=' ', file=file);
5 for l
in range(lMax
+1):
6 print(N(spherical_hankel1(l
,x
)), end
= ' ', file=file)
10 def printbesselJrow(lMax
, x
, file=sys
.stdout
):
11 print(lMax
, N(x
), end
=' ', file=file);
12 for l
in range(lMax
+1):
13 print(N(spherical_bessel_J(l
,x
)), end
= ' ', file=file)
17 def printbesselYrow(lMax
, x
, file=sys
.stdout
):
18 print(lMax
, N(x
), end
=' ', file=file);
19 for l
in range(lMax
+1):
20 print(N(spherical_bessel_Y(l
,x
)), end
= ' ', file=file)
26 def printbesselDJrow(lMax
, x
, file=sys
.stdout
):
27 print(lMax
, N(x
), end
=' ', file=file);
28 for l
in range(lMax
+1):
29 print(N(-spherical_bessel_J(l
+1,x
)
30 + l
/x
*spherical_bessel_J(l
,x
)), end
= ' ', file=file)
34 def printbesselDYrow(lMax
, x
, file=sys
.stdout
):
35 print(lMax
, N(x
), end
=' ', file=file);
36 for l
in range(lMax
+1):
37 print(N(-spherical_bessel_Y(l
+1,x
)
38 + l
/x
*spherical_bessel_Y(l
,x
)), end
= ' ', file=file)
43 return factorial(n
+k
)/2**k
/factorial(k
)/factorial(n
-k
)
46 f
= open('besselDJcases', 'w')
47 for o
in IntegerRange(1,100):
48 printbesselDJrow(lMax
, o
, file=f
)
49 printbesselDJrow(lMax
, 1/o
, file=f
)
50 printbesselDJrow(lMax
, o
/sqrt(3), file=f
)
51 f
= open('besselDYcases', 'w')
52 for o
in IntegerRange(1,100):
53 printbesselDYrow(lMax
, o
, file=f
)
54 printbesselDYrow(lMax
, 1/o
, file=f
)
55 printbesselDYrow(lMax
, o
/sqrt(3), file=f
)
56 f
= open('besselJcases', 'w')
57 for o
in IntegerRange(1,100):
58 printbesselJrow(lMax
, o
, file=f
)
59 printbesselJrow(lMax
, 1/o
, file=f
)
60 printbesselJrow(lMax
, o
/sqrt(3), file=f
)
61 f
= open('besselYcases', 'w')
62 for o
in IntegerRange(1,100):
63 printbesselYrow(lMax
, o
, file=f
)
64 printbesselYrow(lMax
, 1/o
, file=f
)
65 printbesselYrow(lMax
, o
/sqrt(3), file=f
)
74 return math
.exp(math
.lgamma(n
+k
+1) - k
* M_LN2
- math
.lgamma(k
+1) - math
.lgamma(n
-k
+1))
79 return 2 * abs(a
- b
)/(abs(a
)+abs(b
))