Skip to content

Commit 372120a

Browse files
authored
Merge pull request #50 from Samuel3008/patch-1
Fix up README.md
2 parents 8e349fd + 7bd2d20 commit 372120a

File tree

1 file changed

+45
-43
lines changed

1 file changed

+45
-43
lines changed

README.md

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,95 +19,95 @@ julia> using Bessels
1919
julia> x = 12.3; nu = 1.3
2020

2121
julia> besselj(nu, x)
22-
-0.2267581644816903
22+
-0.2267581644816917
2323
```
2424

2525
# Supported functions
2626

27-
### Bessel Functions of the first kind
27+
### Bessel functions of the first kind
2828

29-
$$ J_{\nu} = \sum_{m=0}^{\infty} \frac{(-1)^m}{m!\Gamma(m+\nu+1)}(\frac{x}{2})^{2m+\nu} $$
29+
$$ J_{\nu}(x) = \sum_{m=0}^{\infty} \frac{(-1)^m}{m!\Gamma(m+\nu+1)}(\frac{x}{2})^{2m+\nu} $$
3030

3131
Bessel functions of the first kind, denoted as $J_{\nu}(x)$, can be called with `besselj(nu, x)` where `nu` is the order of the Bessel function with argument `x`. Routines are also available for orders `0` and `1` which can be called with `besselj0(x)` and `besselj1(x)`.
3232

3333
```julia
34-
julia> v, x = 1.4, 12.3
34+
julia> ν, x = 1.4, 12.3
3535

36-
# generic call for any order v
37-
julia> besselj(v, x)
38-
-0.22796228516266664
36+
# generic call for any order ν
37+
julia> besselj(ν, x)
38+
-0.22796228516266345
3939

40-
# v = 0
40+
# ν = 0
4141
julia> besselj0(x)
4242
0.11079795030758544
4343

44-
# v = 1
44+
# ν = 1
4545
julia> besselj1(x)
4646
-0.1942588480405914
4747
```
4848

49-
### Bessel Functions of the second kind
49+
### Bessel functions of the second kind
5050

51-
$$ Y_{\nu} = \frac{J_{\nu} \cos(\nu \pi) - J_{-\nu}}{\sin(\nu \pi)} $$
51+
$$ Y_{\nu}(x) = \frac{J_{\nu}(x) \cos(\nu \pi) - J_{-\nu}(x)}{\sin(\nu \pi)} $$
5252

5353
Bessel functions of the second kind, denoted as $Y_{\nu}(x)$, can be called with `bessely(nu, x)`. Routines are also available for orders `0` and `1` which can be called with `bessely0(x)` and `bessely1(x)`.
5454

5555
```julia
56-
julia> v, x = 1.4, 12.3
56+
julia> ν, x = 1.4, 12.3
5757

58-
# generic call for any order v
59-
julia> bessely(v, x)
58+
# generic call for any order ν
59+
julia> bessely(ν, x)
6060
0.00911009829832235
6161

62-
# v = 0
62+
# ν = 0
6363
julia> bessely0(x)
6464
-0.19859309463502633
6565

66-
# v = 1
66+
# ν = 1
6767
julia> bessely1(x)
68-
-0.11894840329926633
68+
-0.11894840329926631
6969
```
7070

7171
### Modified Bessel functions of the first kind
7272

73-
$$ I_{\nu} = \sum_{m=0}^{\infty} \frac{1}{m!\Gamma(m+\nu+1)}(\frac{x}{2})^{2m+\nu} $$
73+
$$ I_{\nu}(x) = \sum_{m=0}^{\infty} \frac{1}{m!\Gamma(m+\nu+1)}(\frac{x}{2})^{2m+\nu} $$
7474

75-
Modified Bessel functions of the first kind, denoted as $I_{\nu}(x)$, can be called with `besseli(nu, x)` where `nu` is the order of the Bessel function with argument `x`. Routines are also available for orders `0` and `1` which can be called with `besseli0(x)` and `besseli1`. Exponentially scaled versions of these functions $I_{\nu}(x) * e^{-x}$ are also provided which can be called with `besseli0x(nu, x)`, `besseli1x(nu, x)`, and `besselix(nu, x)`.
75+
Modified Bessel functions of the first kind, denoted as $I_{\nu}(x)$, can be called with `besseli(nu, x)` where `nu` is the order of the Bessel function with argument `x`. Routines are also available for orders `0` and `1` which can be called with `besseli0(x)` and `besseli1(x)`. Exponentially scaled versions of these functions $I_{\nu}(x) \cdot e^{-x}$ are also provided which can be called with `besseli0x(x)`, `besseli1x(x)`, and `besselix(nu, x)`.
7676

7777
```julia
78-
julia> v, x = 1.4, 12.3
78+
julia> ν, x = 1.4, 12.3
7979

8080
# generic call for any order v
81-
julia> besseli(v, x)
82-
23781.28963619158
81+
julia> besseli(ν, x)
82+
23242.698263113296
8383

8484
# exponentially scaled version
85-
julia> besselix(v, x)
86-
0.10824635342651369
85+
julia> besselix(ν, x)
86+
0.10579482312624018
8787

88-
# v = 0
88+
# ν = 0
8989
julia> besseli0(x)
9090
25257.48759692308
9191
julia> besseli0x(x)
9292
0.11496562932068803
9393

94-
# v = 1
94+
# ν = 1
9595
julia> besseli1(x)
9696
24207.933018435186
9797
julia> besseli1x(x)
9898
0.11018832507935208
9999
```
100100

101-
### Modified Bessel Functions of the second kind
101+
### Modified Bessel functions of the second kind
102102

103-
$$ K_{\nu} = \frac{\pi}{2} \frac{I_{-\nu} - I_{\nu}}{\sin(\nu \pi)} $$
103+
$$ K_{\nu}(x) = \frac{\pi}{2} \frac{I_{-\nu}(x) - I_{\nu}(x)}{\sin(\nu \pi)} $$
104104

105-
Modified Bessel functions of the second kind, denoted as $K_{\nu}(x)$, can be called with `besselk(nu, x)`. Routines are available for orders `0` and `1` which can be called with `besselk0(x)` and `besselk1`. Exponentially scaled versions of these functions $K_{\nu}(x) * e^{x}$ are also provided which can be called with `besselk0x(nu, x)`, `besselk1x(nu, x)`, and `besselkx(nu, x)`.
105+
Modified Bessel functions of the second kind, denoted as $K_{\nu}(x)$, can be called with `besselk(nu, x)`. Routines are available for orders `0` and `1` which can be called with `besselk0(x)` and `besselk1(x)`. Exponentially scaled versions of these functions $K_{\nu}(x) \cdot e^{x}$ are also provided which can be called with `besselk0x(x)`, `besselk1x(x)`, and `besselkx(nu, x)`.
106106

107107
```julia
108-
julia> v, x = 1.4, 12.3
108+
julia> ν, x = 1.4, 12.3
109109

110-
julia> besselk(v, x)
110+
julia> besselk(ν, x)
111111
1.739055243080153e-6
112112

113113
julia> besselk0(x)
@@ -122,23 +122,25 @@ julia> besselk1(x)
122122
Support is provided for negative arguments and orders only if the return value is real. A domain error will be thrown if the return value is complex. See https://github.com/heltonmc/Bessels.jl/issues/30 for more details.
123123

124124
```julia
125-
julia> (v,x) = 13.0, -1.0
126-
julia> besseli(v,x)
127-
-1.9956316782072008e-14
125+
julia> ν, x = 13.0, -1.0
126+
julia> besseli(ν, x)
127+
-1.9956316782072005e-14
128128

129-
julia> (v, x) = -14.0, -9.9
130-
julia> besseli(v,x)
129+
julia> ν, x = -14.0, -9.9
130+
julia> besseli(ν, x)
131131
0.2892290867115618
132132

133-
julia> (v,x) = 12.6, -3.0
134-
julia> besseli(v,x)
133+
julia> ν, x = 12.6, -3.0
134+
julia> besseli(ν, x)
135135
ERROR: DomainError with -3.0:
136136
Complex result returned for real arguments. Complex arguments are currently not supported
137137
Stacktrace:
138-
[1] besseli(nu::Float64, x::Float64)
139-
@ Bessels ~/Documents/code/repos/Bessels.jl/src/besseli.jl:176
140-
[2] top-level scope
141-
@ REPL[9]:1
138+
[1] _besseli(nu::Float64, x::Float64)
139+
@ Bessels ~/.julia/packages/Bessels/OBoYU/src/besseli.jl:181
140+
[2] besseli(nu::Float64, x::Float64)
141+
@ Bessels ~/.julia/packages/Bessels/OBoYU/src/besseli.jl:167
142+
[3] top-level scope
143+
@ REPL[62]:1
142144
```
143145
#### Gamma
144146
We also provide an unexported gamma function for real arguments that can be called with `Bessels.gamma(x)`.
@@ -174,7 +176,7 @@ In general the largest relative errors are observed near the zeros of Bessel fun
174176

175177
# Benchmarks
176178

177-
We give brief performance comparisons to the implementations provided by [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl). In general, special functions are computed with separate algorithms in different domains leading to computational time being dependent on argument. For these comparisons we show the relative speed increase for computing random values between `0` and `100` for `x` and order `nu`. In some ranges, performance may be significantly better while others more similar.
179+
We give brief performance comparisons to the implementations provided by [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl). In general, special functions are computed with separate algorithms in different domains leading to computational time being dependent on argument. For these comparisons we show the relative speed increase for computing random values between `0` and `100` for `x` and order `nu`. In some ranges, performance may be significantly better while others will be more similar.
178180

179181
| function | `Float64`
180182
| ------------- | ------------- |

0 commit comments

Comments
 (0)