Skip to content

Commit f0676fa

Browse files
authored
Update README.md
1 parent 26460a8 commit f0676fa

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,80 @@ Implementations of Bessel's functions `besselj0`, `besselj1`, `bessely0`, `besse
44
Most implementations are ported to Julia from the [Cephes](https://www.netlib.org/cephes/) math library originally written by Stephen L. Moshier in the C programming language
55
which are (partly) used in [SciPy](https://docs.scipy.org/doc/scipy/reference/special.html#faster-versions-of-common-bessel-functions) and [GCC libquadmath](https://gcc.gnu.org/onlinedocs/libquadmath/).
66

7+
# Quick start
8+
9+
Only implemented for real arguments so far.
10+
11+
```julia
12+
using Bessels
13+
14+
# Bessel function of the first kind of order 0
15+
julia> besselj0(1.0)
16+
0.7651976865579665
17+
julia> besselj0(1.0f0)
18+
0.7651977f0
19+
20+
# Bessel function of the first kind of order 1
21+
julia> besselj1(1.0)
22+
0.44005058574493355
23+
julia> besselj1(1.0f0)
24+
0.4400506f0
25+
26+
# Bessel function of the second kind of order 0
27+
julia> bessely0(1.0)
28+
0.08825696421567697
29+
julia> bessely0(1.0f0)
30+
0.08825697f0
31+
32+
# Bessel function of the second kind of order 1
33+
julia> bessely1(1.0)
34+
-0.7812128213002888
35+
julia> bessely1(1.0f0)
36+
-0.7812128f0
37+
38+
# Modified Bessel function of the first kind of order 0
39+
julia> besseli0(1.0)
40+
1.2660658777520082
41+
julia> besseli0(1.0f0)
42+
1.266066f0
43+
44+
# Scaled modified Bessel function of the first kind of order 0
45+
julia> besseli0x(1.0)
46+
0.46575960759364043
47+
julia> besseli0x(1.0f0)
48+
0.46575963f0
49+
50+
# Scaled modified Bessel function of the first kind of order 1
51+
julia> besseli1x(1.0)
52+
0.2079104153497085
53+
julia> besseli1x(1.0f0)
54+
0.20791042f0
55+
56+
# Modified Bessel function of the second kind of order 0
57+
julia> besselk0(1.0)
58+
0.42102443824070823
59+
julia> besselk0(1.0f0)
60+
0.42102447f0
61+
62+
# Scaled modified Bessel function of the second kind of order 0
63+
julia> besselk0x(1.0)
64+
1.1444630798068947
65+
julia> besselk0x(1.0f0)
66+
1.1444632f0
67+
68+
# Modified Bessel function of the second kind of order 1
69+
julia> besselk1(1.0)
70+
0.6019072301972346
71+
julia> besselk1(1.0f0)
72+
0.6019073f0
73+
74+
# Scaled modified Bessel function of the second kind of order 1
75+
julia> besselk1x(1.0)
76+
1.636153486263258
77+
julia> besselk1x(1.0f0)
78+
1.6361537f0
79+
```
80+
781
# Benchmarks
882

983
Comparing the relative speed (`SpecialFunctions.jl / Bessels.jl`) for a vector of values between 0 and 100.

0 commit comments

Comments
 (0)