From 1802c2e55254840541d01cd73b1ba28993007f98 Mon Sep 17 00:00:00 2001 From: Alexander Seiler Date: Sat, 8 Apr 2023 04:35:05 +0200 Subject: [PATCH] Correct some typos Signed-off-by: Alexander Seiler --- docs/src/contribute.md | 2 +- docs/src/index.md | 4 ++-- docs/src/install.md | 2 +- docs/src/roadmap.md | 6 +++--- src/asymptotics.jl | 12 ++++++------ src/besseli.jl | 2 +- src/besselk.jl | 4 ++-- src/bessely.jl | 6 +++--- test/hankel_test.jl | 2 +- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/src/contribute.md b/docs/src/contribute.md index bfd595f..e4cca27 100644 --- a/docs/src/contribute.md +++ b/docs/src/contribute.md @@ -11,7 +11,7 @@ In general, Bessels.jl aims to provide highly accurate implementations. We do no 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. -**2. Improving exisiting function** +**2. Improving existing function** 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. diff --git a/docs/src/index.md b/docs/src/index.md index 2bf7df8..7d0aa79 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -4,11 +4,11 @@ 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. -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. +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 available 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. ## Scope -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. +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 Digital 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. 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. diff --git a/docs/src/install.md b/docs/src/install.md index 31e53cd..f6582e9 100644 --- a/docs/src/install.md +++ b/docs/src/install.md @@ -4,7 +4,7 @@ Bessels requires Julia v1.6 or later but it is recommended to use the latest sta ### Installation -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/). +Install Julia by [downloading](https://julialang.org/downloads/) the latest version from the official site and follow the [platform specific installations](https://julialang.org/downloads/platform/). You can add Bessels using Julia's package manager by typing `] add Bessels` in the Julia prompt. diff --git a/docs/src/roadmap.md b/docs/src/roadmap.md index a6f517e..c56666e 100644 --- a/docs/src/roadmap.md +++ b/docs/src/roadmap.md @@ -12,12 +12,12 @@ A nice list of Bessel and related functions is provided by [mpmath](https://mpma ### Develop higher precision routines -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. +Current development has focused on single and double precision 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. ### Derivatives through automatic differentiation 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. -### Accuracy and Peformance improvements +### Accuracy and Performance improvements -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. \ No newline at end of file +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 incorporated 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. \ No newline at end of file diff --git a/src/asymptotics.jl b/src/asymptotics.jl index 46795bd..2f3570c 100644 --- a/src/asymptotics.jl +++ b/src/asymptotics.jl @@ -60,9 +60,9 @@ end # 20 terms gives ~2e-16 relative error when x > 2*nu # 15 terms gives ~5e-18 relative error when x > 3*nu # 10 terms gives ~3e-18 relative error when x > 5*nu -# 5 terms give ~5e-15 relative erros when x > 20*nu -# 3 terms give ~5e-15 relative erros when x > 50*nu -# 2 terms give ~5e-15 relative erros when x > 500*nu +# 5 terms give ~5e-15 relative errors when x > 20*nu +# 3 terms give ~5e-15 relative errors when x > 50*nu +# 2 terms give ~5e-15 relative errors when x > 500*nu # Float32 # can only use for x > 15.0 @@ -70,8 +70,8 @@ end # 20 terms gives ~8e-8 relative error when x > 1.3*nu # 15 terms gives ~8e-8 relative error when x > 1.4*nu # 10 terms gives ~3e-8 relative error when x > 1.8*nu -# 5 terms give ~8e-8 relative erros when x > 4*nu -# 3 terms give ~2e-8 relative erros when x > 8*nu +# 5 terms give ~8e-8 relative errors when x > 4*nu +# 3 terms give ~2e-8 relative errors when x > 8*nu # Float128 # can only use for x > 40.0 @@ -80,7 +80,7 @@ end # 15 terms gives ~6e-34 relative error when x > 8.5*nu # 10 terms gives ~3e-34 relative error when x > 30*nu -# can fit a rational function to trend (numer of terms on y axis; x/nu on x axis) +# can fit a rational function to trend (number of terms on y axis; x/nu on x axis) # to get the number of terms needed for desired precision as function of x/nu # terms = a / (x/nu) + b / (x/nu)^2 + c # diff --git a/src/besseli.jl b/src/besseli.jl index 04bb477..68522b1 100644 --- a/src/besseli.jl +++ b/src/besseli.jl @@ -655,7 +655,7 @@ end # using K0 and K1 as starting values then forward recurrence up till nu # then using the wronskian to getting I_{nu} # in general this method is slow and depends on starting values of K0 and K1 -# which is not very flexible for arbitary orders +# which is not very flexible for arbitrary orders function _besseli_continued_fractions(nu, x::T) where T S = promote_type(T, Float64) diff --git a/src/besselk.jl b/src/besselk.jl index acd6b5a..7939286 100644 --- a/src/besselk.jl +++ b/src/besselk.jl @@ -40,7 +40,7 @@ # # K_{nu+1} = (2*nu/x)*K_{nu} + K_{nu-1} # -# When nu is large, a large amount of recurrence is necesary. +# When nu is large, a large amount of recurrence is necessary. # We consider uniform asymptotic expansion for large orders to more efficiently # compute besselk(nu, x) when nu is larger than 100 (Let's double check this cutoff) # The boundary should be carefully determined for accuracy and machine roundoff. @@ -312,7 +312,7 @@ besselk_underflow_check(nu, x::T) where T = nu < T(1.45)*(x - 780) + 45*Base.Mat """ besselk_positive_args(x::T) where T <: Union{Float32, Float64} -Modified Bessel function of the second kind of order nu, ``K_{nu}(x)`` valid for postive arguments and orders. +Modified Bessel function of the second kind of order nu, ``K_{nu}(x)`` valid for positive arguments and orders. """ function besselk_positive_args(nu, x::T) where T <: Union{Float32, Float64} iszero(x) && return T(Inf) diff --git a/src/bessely.jl b/src/bessely.jl index fd50753..9b3b7d8 100644 --- a/src/bessely.jl +++ b/src/bessely.jl @@ -8,7 +8,7 @@ # where r1 and r2 are zeros of J0 # and P3 and Q8 are a 3 and 8 degree polynomial respectively # Polynomial coefficients are from [1] which is based on [2]. -# For tiny arugments the power series expansion is used. +# For tiny arguments the power series expansion is used. # # Branch 2: 5.0 < x < 25.0 # bessely0 = sqrt(2/(pi*x))*(sin(x - pi/4)*R7(x) - cos(x - pi/4)*R8(x)) @@ -429,7 +429,7 @@ end Computes ``Y_{nu}(x)`` using the power series when nu is not an integer. In general, this is most accurate for small arguments and when nu > x. -Outpus both (Y_{nu}(x), J_{nu}(x)). +Outputs both (Y_{nu}(x), J_{nu}(x)). """ function bessely_power_series(v, x::T) where T MaxIter = 3000 @@ -550,7 +550,7 @@ const bessely_cheb_weights = ( #= ### don't quite have this right (issue with signs) -# probably not needed because we should use debye exapnsion for large nu +# probably not needed because we should use debye expansion for large nu function log_bessely_power_series(v, x::T) where T MaxIter = 2000 out = zero(T) diff --git a/test/hankel_test.jl b/test/hankel_test.jl index 9ccd0a5..16cefba 100644 --- a/test/hankel_test.jl +++ b/test/hankel_test.jl @@ -1,6 +1,6 @@ # most of the tests are contained in bessely_test and besselj_test which test the besseljy function # which is called by hankelh1 and besselh -# here we will test just a few cases of the overal hankel function +# here we will test just a few cases of the overall hankel function # focusing on negative arguments and reflection v, x = 1.5, 1.3