Skip to content

Commit 809e51b

Browse files
committed
update docs
1 parent 51cb088 commit 809e51b

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

src/besselj.jl

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,26 @@
33
#
44
# Calculation of besselj0 is done in three branches using polynomial approximations
55
#
6-
# Branch 1: x <= 5.0
7-
# besselj0 = (x^2 - r1^2)*(x^2 - r2^2)*P3(x^2) / Q8(x^2)
8-
# where r1 and r2 are zeros of J0
9-
# and P3 and Q8 are a 3 and 8 degree polynomial respectively
10-
# Polynomial coefficients are from [1] which is based on [2]
11-
# For tiny arugments the power series expansion is used.
6+
# Branch 1: x <= pi/2
7+
# besselj0 is calculated using a 9 term, even minimax polynomial
128
#
13-
# Branch 2: 5.0 < x < 25.0
14-
# besselj0 = sqrt(2/(pi*x))*(cos(x - pi/4)*R7(x) - sin(x - pi/4)*R8(x))
15-
# Hankel's asymptotic expansion is used
16-
# where R7 and R8 are rational functions (Pn(x)/Qn(x)) of degree 7 and 8 respectively
17-
# See section 4 of [3] for more details and [1] for coefficients of polynomials
9+
# Branch 1: pi/2 < x < 26.0
10+
# besselj0 is calculated by one of 16 different degree 13 minimax polynomials
11+
# Each polynomial is an expansion around either a root or extrema of the besselj0.
12+
# This ensures accuracy near the roots. Method taken from [2]
1813
#
19-
# Branch 3: x >= 25.0
14+
# Branch 2: x >= 26.0
2015
# besselj0 = sqrt(2/(pi*x))*beta(x)*(cos(x - pi/4 - alpha(x))
21-
# See modified expansions given in [3]. Exact coefficients are used
16+
# See modified expansions given in [2]. Exact coefficients are used
2217
#
2318
# Calculation of besselj1 is done in a similar way as besselj0.
24-
# See [3] for details on similarities.
19+
# See [2] for details on similarities.
2520
#
2621
# [1] https://github.com/deepmind/torch-cephes
27-
# [2] Cephes Math Library Release 2.8: June, 2000 by Stephen L. Moshier
28-
# [3] Harrison, John. "Fast and accurate Bessel function computation."
22+
# [2] Harrison, John. "Fast and accurate Bessel function computation."
2923
# 2009 19th IEEE Symposium on Computer Arithmetic. IEEE, 2009.
3024
#
3125

32-
#poly = Float64.(Tuple(ratfn_minimax(x->r(x,pts[i]), ((pts[i][1]-pts[i-1][1])/2, (pts[i][1]-pts[i+1][1])/2), 13, 0)[1]))
33-
3426
const PTS = (( 2.404825557695773 , -1.176691651530894e-16),
3527
( 3.8317059702075125, -1.5269184090088067e-16),
3628
( 5.520078110286311 , 8.088597146146722e-17),

0 commit comments

Comments
 (0)