@@ -32,23 +32,20 @@ _airyai(z::ComplexF16) = ComplexF16(_airyai(ComplexF32(z)))
32
32
33
33
function _airyai (z:: ComplexOrReal{T} ) where T <: Union{Float32, Float64}
34
34
if ~ isfinite (z)
35
- isnan (z) && return z
36
- if abs (angle (z)) < 2 π/ 3
35
+ if abs (angle (z)) < 2 * T (π)/ 3
37
36
return exp (- z)
38
37
else
39
38
return 1 / z
40
39
end
41
40
end
42
41
x, y = real (z), imag (z)
43
- zabs = abs (z)
44
-
45
42
airy_large_argument_cutoff (z) && return airyai_large_argument (z)
46
43
airyai_power_series_cutoff (x, y) && return airyai_power_series (z)
47
44
48
45
if x > zero (T)
49
46
# use relation to besselk (http://dlmf.nist.gov/9.6.E1)
50
47
zz = 2 * z * sqrt (z) / 3
51
- return sqrt (z / 3 ) * besselk_continued_fraction_shift (one (T)/ 3 , zz) / π
48
+ return sqrt (z / 3 ) * besselk_continued_fraction_shift (one (T)/ 3 , zz) / T (π)
52
49
else
53
50
# z is close to the negative real axis
54
51
# for imag(z) == 0 use reflection to compute in terms of bessel functions of first kind (http://dlmf.nist.gov/9.6.E5)
@@ -77,23 +74,20 @@ _airyaiprime(z::ComplexF16) = ComplexF16(_airyaiprime(ComplexF32(z)))
77
74
78
75
function _airyaiprime (z:: ComplexOrReal{T} ) where T <: Union{Float32, Float64}
79
76
if ~ isfinite (z)
80
- isnan (z) && return z
81
- if abs (angle (z)) < 2 π/ 3
77
+ if abs (angle (z)) < 2 * T (π)/ 3
82
78
return - exp (- z)
83
79
else
84
80
return 1 / z
85
81
end
86
82
end
87
83
x, y = real (z), imag (z)
88
- zabs = abs (z)
89
-
90
84
airy_large_argument_cutoff (z) && return airyaiprime_large_argument (z)
91
85
airyai_power_series_cutoff (x, y) && return airyaiprime_power_series (z)
92
86
93
87
if x > zero (T)
94
88
# use relation to besselk (http://dlmf.nist.gov/9.6.E2)
95
89
zz = 2 * z * sqrt (z) / 3
96
- return - z * besselk_continued_fraction_shift (T (2 )/ 3 , zz) / (π * sqrt (T (3 )))
90
+ return - z * besselk_continued_fraction_shift (T (2 )/ 3 , zz) / (T (π) * sqrt (T (3 )))
97
91
else
98
92
# z is close to the negative real axis
99
93
# for imag(z) == 0 use reflection to compute in terms of bessel functions of first kind (http://dlmf.nist.gov/9.6.E5)
@@ -122,18 +116,14 @@ _airybi(z::ComplexF16) = ComplexF16(_airybi(ComplexF32(z)))
122
116
123
117
function _airybi (z:: ComplexOrReal{T} ) where T <: Union{Float32, Float64}
124
118
if ~ isfinite (z)
125
- isnan (z) && return z
126
119
if abs (angle (z)) < 2 π/ 3
127
120
return exp (z)
128
121
else
129
122
return 1 / z
130
123
end
131
124
end
132
125
x, y = real (z), imag (z)
133
- zabs = abs (z)
134
-
135
126
airy_large_argument_cutoff (z) && return airybi_large_argument (z)
136
-
137
127
airybi_power_series_cutoff (x, y) && return airybi_power_series (z)
138
128
139
129
if x > zero (T)
@@ -171,18 +161,14 @@ _airybiprime(z::ComplexF16) = ComplexF16(_airybiprime(ComplexF32(z)))
171
161
172
162
function _airybiprime (z:: ComplexOrReal{T} ) where T <: Union{Float32, Float64}
173
163
if ~ isfinite (z)
174
- isnan (z) && return z
175
- if abs (angle (z)) < 2 π/ 3
164
+ if abs (angle (z)) < 2 * T (π)/ 3
176
165
return exp (z)
177
166
else
178
167
return - 1 / z
179
168
end
180
169
end
181
170
x, y = real (z), imag (z)
182
- zabs = abs (z)
183
-
184
171
airy_large_argument_cutoff (z) && return airybiprime_large_argument (z)
185
-
186
172
airybi_power_series_cutoff (x, y) && return airybiprime_power_series (z)
187
173
188
174
if x > zero (T)
0 commit comments