diff --git a/README.md b/README.md index a2ccd28..498b1d9 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ [![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) [![JET QA](https://img.shields.io/badge/JET.jl-%E2%9C%88%EF%B8%8F-%23aa4444)](https://github.com/aviatesk/JET.jl) -This package provides functions to compute the zeros of the J and Y functions, -and the zeros of their derivatives, where J and Y are Bessel functions of the first and second kind, respectively. - -For all functions described below, the order `nu::Real` is a finite number and `n::Integer` is a positive integer. -When `nu isa AbstractFloat`, the returned value has the same type as `nu`. When `nu isa Integer`, the usual -promotion rules apply, so that for most builtin integer types the output type will be `Float64`. However, -when `nu isa BigInt` the output type will be `BigFloat`. - -When the output type is `Float64`, the exported functions (`besselj_zero`, -`bessely_zero`, `besselj_deriv_zero`, and `bessely_deriv_zero`) will use lookup tables to rapidly -return function zeros if the order `nu` is one of the first few values of `0, 1, ...` and the enumerator -`n` is one of the first values of `1, 2, 3, ...`. See the individual function docstrings for the actual +This package provides functions to compute the zeros of the J and Y functions, and the zeros of +their derivatives, where J and Y are Bessel functions of the first and second kind, respectively. + +For all functions described below, the order `nu::Real` is a finite number and `n::Integer` is a +positive integer. When `nu isa AbstractFloat`, the returned value has the same type as `nu`. When +`nu isa Integer`, the usual promotion rules apply, so that for most builtin integer types the output +type will be `Float64`. However, when `nu isa BigInt` the output type will be `BigFloat`. + +When the output type is `Float64`, the exported functions (`besselj_zero`, `bessely_zero`, +`besselj_deriv_zero`, and `bessely_deriv_zero`) will use lookup tables to rapidly return function +zeros if the order `nu` is one of the first few values of `0, 1, ...` and the enumerator `n` is one +of the first values of `1, 2, 3, ...`. See the individual function docstrings for the actual extents of the lookup tables. ### Exported Functions @@ -28,7 +28,7 @@ extents of the lookup tables. besselj_zero(nu, n) ``` -Return the `n`th zero of the Bessel J function of order `nu`. +Return the `n`th zero of the Bessel J function of order `nu`. #### bessely_zero(nu, n) @@ -44,8 +44,7 @@ Return the `n`th zero of the Bessel Y function of order `nu`. besselj_deriv_zero(nu, n) ``` -Return the `n`th nonvanishing zero of the derivative of the Bessel J -function of order `nu`. +Return the `n`th nonvanishing zero of the derivative of the Bessel J function of order `nu`. #### bessely_deriv_zero(nu, n) @@ -81,8 +80,7 @@ Asymptotic formula for the `n`th zero for the Bessel Y function of order `nu`. FunctionZeros.besselj_deriv_zero_asymptotic(nu, n) ``` -Asymptotic formula for the `n`th nonvanishing zero of the derivative of the -Bessel J function of order `nu`. +Asymptotic formula for the `n`th nonvanishing zero of the derivative of the Bessel J function of order `nu`. #### FunctionZeros.bessely_deriv_zero_asymptotic(nu, n) @@ -92,5 +90,3 @@ FunctionZeros.bessely_deriv_zero_asymptotic(nu, n) ``` Asymptotic formula for the `n`th zero of the derivative of the Bessel Y function of order `nu`. - - diff --git a/src/FunctionZeros.jl b/src/FunctionZeros.jl index e5b6af1..4112e84 100644 --- a/src/FunctionZeros.jl +++ b/src/FunctionZeros.jl @@ -2,7 +2,7 @@ """ FunctionZeros This module provides functions to compute the zeros of the J and Y functions, -and the zeros of their derivatives, where J and Y are Bessel functions of the first and second kind, respectively. +and the zeros of their derivatives, where J and Y are Bessel functions of the first and second kind, respectively. """ module FunctionZeros import SpecialFunctions @@ -15,7 +15,7 @@ const nupre_max = 1 const npre_max = 500 # Strings used in multiple function docstrings: -const speeddocstr = """For greater speed, table lookup is used for `Float64` outputs when +const speeddocstr = """For greater speed, table lookup is used for `Float64` outputs when `nu ∈ 0:$nupre_max` and `n ∈ 1:$(npre_max)`.""" const argstr = """## Arguments - `nu::Real`: The order of the Bessel function. @@ -84,7 +84,7 @@ end _besselj_zero(nu, n) `n`th zero of the Bessel J function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr """ @@ -101,7 +101,7 @@ const jzero_pre = [_besselj_zero(nu, n) for nu in 0:nupre_max, n in 1:npre_max] besselj_zero(nu, n) Return the `n`th zero of the Bessel J function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr $speeddocstr @@ -146,7 +146,7 @@ const yzero_pre = [_bessely_zero(nu, n) for nu in 0:nupre_max, n in 1:npre_max] bessely_zero(nu, n) Return the `n`th zero of the Bessel Y function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr $speeddocstr @@ -185,7 +185,7 @@ bessely_deriv_zero_asymptotic(nu, n) = bessel_deriv_zero_asymptotic(nu, n, 2) """ bessel_deriv_zero_asymptotic(nu, n, kind=1) -Asymptotic formula for the `n`th zero of the the derivative of Bessel J (Y) function +Asymptotic formula for the `n`th zero of the the derivative of Bessel J (Y) function of order `nu`. `kind == 1 (2)` for Bessel function of the first (second) kind, J (Y). """ function bessel_deriv_zero_asymptotic(nu_in::Real, n::Integer, kind=1) @@ -218,11 +218,11 @@ end _besselj_deriv_zero(nu, n) Return the `n`th nonvanishing zero of the derivative of Bessel J function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr """ -function _besselj_deriv_zero(nu::Real, n::Integer) +function _besselj_deriv_zero(nu::Real, n::Integer) # Ref: https://dlmf.nist.gov/10.6.E1 iszero(nu) && (n += 1) # Skip the zero occuring at zero return Roots.find_zero(bessel_deriv_zero_asymptotic(nu, n, 1)) do x @@ -237,7 +237,7 @@ const jderivzero_pre = [_besselj_deriv_zero(nu, n) for nu in 0:nupre_max, n in 1 besselj_deriv_zero(nu, n) Return the `n`th nonvanishing zero of the derivative of the Bessel J function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr $speeddocstr @@ -276,7 +276,7 @@ const yderivzero_pre = [_bessely_deriv_zero(nu, n) for nu in 0:nupre_max, n in 1 bessely_deriv_zero(nu, n) Return the `n`th zero of the derivative of the Bessel Y function of order `nu`, -for `n` = `1,2,...`. +for `n` = `1,2,...`. $argstr $speeddocstr