Skip to content

Commit 22c25c3

Browse files
authored
Add a documentation page (#69)
* init docs page * fill more details * add contributing details * add Documenter dependency * fix compat * fix compat * add more doc strings * fix escape * fix escape * add hankel docs * add airy and spherical docs * fix parse and add doc badge * fix parse
1 parent 4c4b013 commit 22c25c3

19 files changed

+725
-36
lines changed

.github/workflows/documentation.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master # update to match your development branch (master, main, dev, trunk, ...)
7+
tags: '*'
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
permissions:
13+
contents: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: julia-actions/setup-julia@v1
18+
with:
19+
version: '1.6'
20+
- name: Install dependencies
21+
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
22+
- name: Build and deploy
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token
25+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
26+
run: julia --project=docs/ docs/make.jl

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Bessels.jl
22
[![Build Status](https://github.com/heltonmc/Bessels.jl/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/heltonmc/Bessels.jl/actions/workflows/CI.yml?query=branch%3Amaster)
3+
[![Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliamath.github.io/Bessels.jl/stable)
34
[![Coverage](https://codecov.io/gh/heltonmc/Bessels.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/heltonmc/Bessels.jl)
45

56
[![version](https://juliahub.com/docs/Bessels/version.svg)](https://juliahub.com/ui/Packages/Bessels/29L49)

docs/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[deps]
2+
Bessels = "0e736298-9ec6-45e8-9647-e4fc86a2fe38"
3+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
4+
5+
[compat]
6+
Documenter = "~0.24"

docs/make.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
push!(LOAD_PATH,"../src/")
2+
using Documenter, Bessels
3+
4+
makedocs(
5+
sitename = "Bessels.jl",
6+
modules = [Bessels],
7+
pages=[
8+
"Home" => "index.md",
9+
"Getting started" => "install.md",
10+
"Roadmap" => "roadmap.md",
11+
"Contributing" => "contribute.md",
12+
"API" => "API.md",
13+
"Function list" => "functions.md",
14+
]
15+
)
16+
17+
deploydocs(
18+
repo="github.com/JuliaMath/Bessels.jl.git",
19+
)

docs/src/API.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Bessel functions
2+
3+
```@docs
4+
besselj
5+
Bessels.besselj!
6+
besselj0
7+
besselj1
8+
bessely
9+
Bessels.bessely!
10+
bessely0
11+
bessely1
12+
Bessels.besseljy
13+
```
14+
15+
## Modified Bessel functions
16+
17+
```@docs
18+
besseli
19+
Bessels.besseli!
20+
besseli0
21+
besseli0x
22+
besseli1
23+
besseli1x
24+
besselix
25+
besselk
26+
Bessels.besselk!
27+
besselk0
28+
besselk0x
29+
besselk1
30+
besselk1x
31+
besselkx
32+
```
33+
34+
## Hankel functions
35+
```@docs
36+
besselh
37+
hankelh1
38+
hankelh2
39+
```
40+
41+
## Spherical Bessel functions
42+
```@docs
43+
sphericalbesselj
44+
sphericalbessely
45+
Bessels.sphericalbesseli
46+
Bessels.sphericalbesselk
47+
```
48+
49+
# Airy functions
50+
```@docs
51+
airyai
52+
airyaiprime
53+
airybi
54+
airybiprime
55+
```
56+
57+
# Gamma functions
58+
```@docs
59+
Bessels.gamma
60+
```

docs/src/contribute.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## Contributors Guide
2+
3+
Contributions of any kind are very welcome! Bessels.jl is a community-driven project and is under the JuliaMath organization.
4+
If you are interested in getting involved with the development of Bessels.jl please feel free to open an issue. In general, contributions will likely fall under four main categories:
5+
6+
**1. Implementing a new function**
7+
8+
Any Bessel type or related function is welcome for inclusion in this library. Please read the scope section for more details but in general any function listed [here](https://mpmath.org/doc/current/functions/bessel.html) would be a good addition. Opening an issue would be a great start to further discuss a particular function or implementation details. If you already have an existing function ready to go please open a pull request. Porting functions from MIT compatible implementation is also acceptable.
9+
10+
In general, Bessels.jl aims to provide highly accurate implementations. We do not have a set error tolerance we are willing to accept as it will depend on the function. For example, the `gamma` function is a very important and widely used function so it is necessary to provide maximal errors less than 2 Units in the last place (ULP). For other functions, such as the Bessel function, which oscillate around zero it is much more difficult to provide such tight error tolerances. Therefore, relative tolerances better than `1e-14` would be a good target with a slightly less tolerance around the zeros. Single variable functions should be able to provide better tolerances than multi-variable functions.
11+
12+
Even if the function isn't quite to those error tolerances, please open a pull request to discuss further. It might be good for a single precision implementation or there might be opportunities to improve the errors of the existing implementation. Though, there are fairly strict criteria that the function should be non-allocating and type stable.
13+
14+
**2. Improving exisiting function**
15+
16+
Improving the accuracy or speed of any implementation would be a great contribution. There are plenty of opportunities so please open an issue if you are interested and we can point you to a good function to work with. Accuracy improvements are always welcome whereas any speed improvements would also need to maintain the current level of accuracy. Ideally, implementations could trend to more accurate and faster but there will always be some tradeoff.
17+
18+
**3. Filing bug reports, writing tests, feature requests, improve documentation**
19+
20+
Testing the accuracy and performance of each function is also welcome. In the future, we hope to have an automated way to print out the error and performance of each function so any help with this would be appreciated. Additionally, contributing better tests and writing documentation is very helpful. Filing feature requests are also very helpful.
21+
22+
**4. Other miscellaneous contributions**
23+
24+
Please also share any papers or discussions on implementation details!
25+
26+
#### Pull Requests
27+
28+
Contributions should be made via pull requests on GitHub. This can be done by forking Bessels.jl and making commits on your own fork. After you have made all necessary changes please submit a pull request against the main branch. We will then review and provide any feedback on the changes. Once you a submit a PR, the automated tests will run through CI. Therefore, please also include tests if you are implementing a new function and review the results of the CI run. We typically keep all tests passing on the main branch, so any CI failures are most likely related to the PR. By submitting a pull request, you are agreeing for contributed code to be under the MIT license.
29+
30+
**Code Style:** There is not an explicit code style that we use. Please try to keep it as consistent as possible with existing code.

docs/src/functions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```@index
2+
Pages = ["API.md"]
3+
```

docs/src/index.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Bessels.jl
2+
3+
## Introduction
4+
5+
Bessels.jl is a collection of mathematical algorithms to compute special functions written entirely in the Julia programming language. It is focused on providing high quality implementations of mathematical functions that are accurate and highly performant. Since it contains only Julia code and has no external dependencies, it is a lightweight package that can be used in any high performance application while taking advatnage of the dynamism of the Julia language.
6+
7+
Bessels.jl contains numerous definitions of special functions important in many fields of mathematical physics. Available functions include Bessel, Modified Bessel, Spherical Bessel, Airy, Hankel, and Gamma functions. A full list of availabe functions can be found in the API section of this documentation. Initial development has focused on providing implementations for real arguments, however, some functions (e.g., Airy) also accept complex numbers as input.
8+
9+
## Scope
10+
11+
Bessels.jl started simply as a package to compute just the Bessel function of the first kind and zero order, but it has quickly grown to include several Bessel type functions. As mentioned earlier, Bessels.jl contains algorithms for computing Bessel, Modified Bessel, Spherical Bessel, Airy, and Hankel functions. These functions are contained in Chapters 9 and 10 of the [NIST Digitial Library of Mathematical Functions](https://dlmf.nist.gov/). However, there exists other types of related functions such as the Struve and Weber type functions contained in Chapters 11 and 12. In general, these are special cases of the confuent hypergeometric functions $_0F_1, _1F_1$, and $_1F_2$. Additionally, several other special functions such as the gamma functions are also needed to compute these types of functions.
12+
13+
Therefore, Bessels.jl seeks to be home to any Bessel or related functions (see the section provided by [mpmath](https://mpmath.org/doc/current/functions/bessel.html)) which are typically contained in Chapters 9-12 of the NIST Digital library or to any other related function required to compute Bessel type functions.
14+
15+
### Advantages
16+
17+
- Typically 2-12x faster than other available [implementations](https://github.com/JuliaMath/SpecialFunctions.jl)
18+
- Written entirely in Julia
19+
20+
### Limitations
21+
22+
- Does not yet support automatic differentiation
23+
- Limited support for complex arguments
24+
- No support for higher precision (above `Float64`)
25+
26+
## Packages using Bessels.jl
27+
28+
- [Meshes.jl](https://github.com/JuliaGeometry/Meshes.jl)
29+
- [GeoStats.jl](https://github.com/JuliaEarth/GeoStats.jl)
30+
- [BesselK.jl](https://github.com/cgeoga/BesselK.jl)
31+
- [SparseIR.jl](https://github.com/SpM-lab/SparseIR.jl)
32+
- [Variography.jl](https://github.com/JuliaEarth/Variography.jl)
33+
- [LightPropagation.jl](https://github.com/heltonmc/LightPropagation.jl)
34+
35+
If you are using Bessels.jl, please feel free to add yours to the list!
36+
37+
## Related Math libraries
38+
39+
**Julia packages**
40+
- [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl)
41+
- [HypergeometricFunctions.jl](https://github.com/JuliaMath/HypergeometricFunctions.jl)
42+
- [ClassicalOrthogonalPolynomials.jl](https://github.com/JuliaApproximation/ClassicalOrthogonalPolynomials.jl)
43+
- [LegendrePolynomials.jl](https://github.com/jishnub/LegendrePolynomials.jl)
44+
- [BesselK.jl](https://github.com/cgeoga/BesselK.jl)
45+
- [AssociatedLegendrePolynomials.jl](https://github.com/jmert/AssociatedLegendrePolynomials.jl)
46+
- [HarmonicOrthogonalPolynomials.jl](https://github.com/JuliaApproximation/HarmonicOrthogonalPolynomials.jl)
47+
- [SphericalHarmonics.jl](https://github.com/jishnub/SphericalHarmonics.jl)
48+
- [ArbNumerics.jl](https://github.com/JeffreySarnoff/ArbNumerics.jl)
49+
- [Elliptic.jl](https://github.com/nolta/Elliptic.jl)
50+
- [EllipticFunctions.jl](https://github.com/stla/EllipticFunctions.jl)
51+
- [ClausenFunctions.jl](https://github.com/Expander/ClausenFunctions.jl)
52+
- [Polylogarithms.jl](https://github.com/mroughan/Polylogarithms.jl)
53+
- [PolyLog.jl](https://github.com/Expander/PolyLog.jl)
54+
- [LambertW.jl](https://github.com/jlapeyre/LambertW.jl)
55+
- [Struve.jl](https://github.com/gwater/Struve.jl)
56+
- [Quadmath.jl](https://github.com/JuliaMath/Quadmath.jl)
57+
58+
**Other**
59+
- [SciPy](https://github.com/scipy/scipy)
60+
- [mpmath](https://github.com/mpmath/mpmath)
61+
- [Arb](https://github.com/fredrik-johansson/arb)
62+
- [Boost](https://github.com/boostorg/boost)
63+
- [GSL](https://www.gnu.org/software/gsl/)
64+
- [Cephes](https://netlib.org/cephes/)
65+
- [fortran-bessels](https://github.com/perazz/fortran-bessels)
66+
67+
This is by no means exhaustive so please add yours or any others that should be listed.

docs/src/install.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
### Installation requirements
2+
3+
Bessels requires Julia v1.6 or later but it is recommended to use the latest stable release. Bessels uses CI tools provided by GitHub Actions to run tests on Julia versions 1.6, current stable release, and nightly builds on Linux operating systems using `ubuntu-latest`. Though, Bessels is written entirely in Julia and therefore should work on any of the [supported platforms](https://julialang.org/downloads/#supported_platforms) such as MacOS and Windows.
4+
5+
### Installation
6+
7+
Install Julia by [downloading](https://julialang.org/downloads/) the latest version from the offical site and follow the [platform specific installations](https://julialang.org/downloads/platform/).
8+
9+
You can add Bessels using Julia's package manager by typing `] add Bessels` in the Julia prompt.
10+
11+
```julia
12+
julia> ] # ']' should be pressed
13+
14+
(@v1.8) pkg> add Bessels
15+
```
16+
17+
The package manager can also be used verify the installation by running the bundled tests, check the installed version, or update to the latest release.
18+
19+
```julia
20+
julia> ]
21+
22+
# run tests
23+
(@v1.8) pkg> test Bessels
24+
25+
# check version
26+
(@v1.8) pkg> status Bessels
27+
Status `~/.julia/environments/v1.8/Project.toml`
28+
[0e736298] Bessels v0.2.7
29+
30+
# update to latest release
31+
(@v1.8) pkg> update Bessels
32+
```
33+
34+
### Running
35+
36+
At this point you are ready to start using Bessels.jl!
37+
38+
```julia
39+
julia> using Bessels
40+
41+
julia> besselj0(1.2)
42+
0.6711327442643626
43+
44+
julia> besselj(1.8, 10.1)
45+
0.2374319718222891
46+
```

docs/src/roadmap.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Bessels.jl Roadmap
2+
3+
The major development goals can be summarized by the following groups.
4+
5+
### Support for complex arguments
6+
7+
The current development and immediate goals of this project is to provide support for complex variables in all the existing functions. Currently, the Airy functions `airyai`, `airyaiprime`, `airybi`, and `airybiprime` are the only supported functions using complex variables. This will be implemented in a step approach focusing on single argument functions with fixed order (e.g. $\nu=0, 1$) then expanded to the general case of arbitrary order. Therefore, current focus is on developing complex routines for `besselj0(z)`, `besselj1(z)`, `bessely0(z)`, `bessely1(z)`, `besselk0(z)`, `besselk1(z)`, `besseli0(z)`, and `besseli1(z)`.
8+
9+
### Adding additional special functions
10+
11+
A nice list of Bessel and related functions is provided by [mpmath](https://mpmath.org/doc/current/functions/bessel.html). Any function listed there would be a good candidate for inclusion in this package. Functions on the current scope are the Kelvin, Struve, and Scorer type functions. If other functions (or the ones listed) are desired, please open an issue!
12+
13+
### Develop higher precision routines
14+
15+
Current development has focused on single and double precison routine (`Float32` and `Float64`). We intend to also provide support for higher precision types such as double-double (`Double64`) and/or quadruple (`Float128`) precision in the future.
16+
17+
### Derivatives through automatic differentiation
18+
19+
Typically, the derivatives of certain special functions with respect to argument can be obtained through definitions. However, derivative with respect to the order usually does not have a simple expression. Automatic differentiation could be a powerful tool to quickly compute higher order derivatives using native Julia code. This is not an immediate goal but would be a welcome contribution.
20+
21+
### Accuracy and Peformance improvements
22+
23+
Speed improvements are beneficial in most cases as these low level functions are typically called many times. Performance gains can come from using better algorithms or through better support for parallelization (e.g., vectorization, SIMD). In general, any speed improvements will only be incoporated that maintain the current relative accuracy. Accuracy improvements may come at the cost of a slightly longer runtime. These type of improvements will come on a more ad-hoc basis.

0 commit comments

Comments
 (0)