-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more docstrings, and generate document by Documenter.jl (#87)
* add docstrings and doctest for gausslegendre * fix jldoctest * fix jldoctest for gausslegendre * add docstring and jldoctest for gausshermite * add docstring and jldoctest for gausslaguerre * fix typos and form of README.md * add docstring and jldoctest for gausschebyshev * add docstring and jldoctest for gaussjacobi * add docstring and jldoctest for gaussradau * add docstring and jldoctest for gausslobatto * first commit for Documenter.jl * update gitignore for Documenter.jl * fix wording in docstring * update .travis.yml for Documenter * update authors in make.jl * update wording in index.md * update benchmark results * add pages for besselroots and benchmark * add badges for Documenter.jl * update docstring for besselroots * update travis badge (fix #82) * fix typos * update wording for clarity * update symbols to use unicode
- Loading branch information
Showing
21 changed files
with
872 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
.DS_Store | ||
/Manifest.toml | ||
/dev/ | ||
/docs/build/ | ||
/docs/site/ | ||
/docs/Manifest.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Documenter | ||
using FastGaussQuadrature | ||
|
||
makedocs(; | ||
modules = [FastGaussQuadrature], | ||
format = Documenter.HTML( | ||
canonical = "https://JuliaApproximation.github.io/FastGaussQuadrature.jl/stable/", | ||
assets = ["assets/favicon.ico"], | ||
), | ||
pages = [ | ||
"Home" => "index.md", | ||
"Gaussian Quadrature" => "gaussquadrature.md", | ||
"Benchmark" => "benchmark.md", | ||
"Roots of Bessel function" => "besselroots.md", | ||
"References" => "reference.md", | ||
], | ||
repo = "https://github.com/JuliaApproximation/FastGaussQuadrature.jl/blob/{commit}{path}#L{line}", | ||
sitename = "FastGaussQuadrature.jl", | ||
authors = "Alex Townsend, Sheehan Olver, Peter Opsomer, and contributors.", | ||
assets = String[], | ||
) | ||
|
||
deploydocs(; repo = "github.com/JuliaApproximation/FastGaussQuadrature.jl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Benchmark | ||
|
||
Here we compute `100000` nodes and weights of the Gauss rules. | ||
Try a million or ten million. | ||
|
||
```julia | ||
julia> @time gausschebyshev( 100000 ); | ||
0.001788 seconds (4 allocations: 1.526 MiB) | ||
|
||
julia> @time gausslegendre( 100000 ); | ||
0.002976 seconds (10 allocations: 2.289 MiB) | ||
|
||
julia> @time gaussjacobi( 100000, .9, -.1 ); | ||
0.894373 seconds (3.59 k allocations: 1.255 GiB, 36.38% gc time) | ||
|
||
julia> @time gaussradau( 100000 ); | ||
0.684122 seconds (3.59 k allocations: 1.256 GiB, 21.71% gc time) | ||
|
||
julia> @time gausslobatto( 100000 ); | ||
0.748166 seconds (3.57 k allocations: 1.256 GiB, 27.78% gc time) | ||
|
||
julia> @time gausslaguerre( 100000 ); | ||
0.156867 seconds (7 allocations: 2.292 MiB) | ||
|
||
julia> @time gausshermite( 100000 ); | ||
0.175055 seconds (386 allocations: 67.916 MiB, 9.18% gc time) | ||
``` | ||
|
||
The paper [[1]](http://epubs.siam.org/doi/abs/10.1137/140954969) computed a billion Gauss-Legendre nodes. | ||
So here we will do a billion + 1. | ||
```julia | ||
julia> @time gausslegendre( 1000000001 ); | ||
24.441304 seconds (10 allocations: 22.352 GiB, 2.08% gc time) | ||
``` | ||
(The nodes near the endpoints coalesce in 16-digits of precision.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Roots of Bessel function | ||
|
||
Since [SpecialFunctions.jl](https://github.com/JuliaMath/SpecialFunctions.jl) doesn't have a method to calculate roots of [Bessel function](https://en.wikipedia.org/wiki/Bessel_function), we implemented `besselroots`. | ||
|
||
```@docs | ||
besselroots(ν::Real, n::Integer) | ||
``` | ||
|
||
This method `besselroots` is used to calculate `gaussjacobi` and `gausslaguerre`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Gaussian Quadrature | ||
|
||
|
||
## Gauss-Legendre quadrature | ||
|
||
```@docs | ||
gausslegendre(n::Integer) | ||
``` | ||
|
||
|
||
## Gauss-Hermite quadrature | ||
|
||
```@docs | ||
gausshermite(n::Integer) | ||
``` | ||
|
||
|
||
## Gauss-Laguerre quadrature | ||
|
||
```@docs | ||
gausslaguerre(n::Integer) | ||
``` | ||
|
||
```@docs | ||
gausslaguerre(n::Integer, α::Real) | ||
``` | ||
|
||
|
||
## Gauss-Chebyshev quadrature | ||
|
||
```@docs | ||
gausschebyshev(n::Integer, kind::Integer) | ||
``` | ||
|
||
|
||
## Gauss-Jacobi quadrature | ||
|
||
```@docs | ||
gaussjacobi(n::Integer, α::Real, β::Real) | ||
``` | ||
|
||
|
||
## Gauss-Radau quadrature | ||
|
||
```@docs | ||
gaussradau(n::Integer) | ||
``` | ||
|
||
|
||
## Gauss-Lobatto quadrature | ||
|
||
```@docs | ||
gausslobatto(n::Integer) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# FastGaussQuadrature.jl | ||
|
||
## Abstract | ||
|
||
FastGaussQuadrature.jl is a Julia package to compute `n`-point Gauss quadrature nodes and weights to 16-digit accuracy and in `O(n)` time. | ||
So far the package includes `gausschebyshev()`, `gausslegendre()`, `gaussjacobi()`, `gaussradau()`, `gausslobatto()`, `gausslaguerre()`, and `gausshermite()`. | ||
This package is heavily influenced by [Chebfun](http://www.chebfun.org). | ||
|
||
An introduction to Gauss quadrature can be found [here](http://en.wikipedia.org/wiki/Gaussian_quadrature). | ||
For a quirky account on the history of computing Gauss-Legendre quadrature, see [[6]](http://pi.math.cornell.edu/~ajt/papers/QuadratureEssay.pdf). | ||
|
||
## Our Aims | ||
|
||
* The fastest Julia code for Gauss quadrature nodes and weights (without tabulation). | ||
* Change the perception that Gauss quadrature rules are expensive to compute. | ||
|
||
## First example | ||
To check an integral | ||
```math | ||
\int_{-1}^{1} x^4 dx = \frac{2}{5} | ||
``` | ||
by numerically, try following code. | ||
```julia | ||
julia> using FastGaussQuadrature, LinearAlgebra | ||
|
||
julia> x, w = gausslegendre(3); | ||
|
||
julia> f(x) = x^4; | ||
|
||
julia> I = dot(w, f.(x)); | ||
|
||
julia> I ≈ 2/5 | ||
true | ||
``` |
Oops, something went wrong.
bd8857c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
bd8857c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/27769
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: