Skip to content

Commit 4377c7a

Browse files
update docs + remove abuses of word cardinal
1 parent fab1241 commit 4377c7a

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed

docs/src/functions_list.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,9 @@ ellipe
151151
eta
152152
zeta
153153
```
154+
155+
## Special Trigonometric Functions
156+
```@docs
157+
sincu
158+
sinhcu
159+
```

docs/src/functions_overview.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,11 @@ Here the *Special Functions* are listed according to the structure of [NIST Digi
118118
|:-------- |:----------- |
119119
| [`eta(x)`](@ref SpecialFunctions.eta) | [Dirichlet eta function](https://en.wikipedia.org/wiki/Dirichlet_eta_function) at `x` |
120120
| [`zeta(x)`](@ref SpecialFunctions.zeta) | [Riemann zeta function](https://en.wikipedia.org/wiki/Riemann_zeta_function) at `x` |
121+
122+
## Special Trigonometric Functions
123+
124+
| Function | Description |
125+
|:-------- |:----------- |
126+
| [`sincu(x)`](@ref SpecialFunctions.sincu) | [Unnormalized sine cardinal function](https://en.wikipedia.org/wiki/Sinc_function) at `x` |
127+
| [`sinhcu(x)`](@ref SpecialFunctions.sinhcu) | [Unnormalized hyperbolic sinc function](https://mathworld.wolfram.com/SinhcFunction.html) at `x` |
128+

src/SpecialFunctions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ include("gamma.jl")
107107
include("gamma_inc.jl")
108108
include("betanc.jl")
109109
include("beta_inc.jl")
110-
include("trigcardinal.jl")
110+
include("trig.jl")
111111

112112
if !isdefined(Base, :get_extension)
113113
include("../ext/SpecialFunctionsChainRulesCoreExt.jl")
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ isinf_real(x::Number) = isinf(real(x)) && isfinite(imag(x))
88
isinf_imag(x::Real) = false
99
isinf_imag(x::Number) = isfinite(real(x)) && isinf(imag(x))
1010

11-
# sincu copied exactly from Boost library
11+
# sincu copied from Boost library and correct limit behavior added
1212
# https://www.boost.org/doc/libs/1_87_1/boost/math/special_functions/sinc.hpp
13+
"""
14+
sincu(x)
15+
16+
Compute the unnormalized sinc function ``\\operatorname{sincu}(x) = \\sin(x) / (x)``
17+
with accuracy near the origin.
18+
"""
1319
sincu(x) = _sinc(float(x))
1420
function _sinc(x::Union{T,Complex{T}}) where {T}
1521
if isinf_real(x)
1622
return zero(x)
1723
end
18-
24+
1925
nrm = fastabs(x)
2026
if nrm >= 3.3*sqrt(sqrt(eps(T)))
2127
return sin(x)/x
@@ -25,8 +31,15 @@ function _sinc(x::Union{T,Complex{T}}) where {T}
2531
end
2632
end
2733

28-
# sinhcu copied exactly from Boost library
34+
# sinhcu copied from Boost library and correct limit behavior added
2935
# https://www.boost.org/doc/libs/1_87_1/boost/math/special_functions/sinhc.hpp
36+
37+
"""
38+
sinhcu(x)
39+
40+
Compute the unnormalized sinhc function ``\\operatorname{sinhcu}(x) = \\sinh(x) / (x)``
41+
with accuracy accuracy near the origin.
42+
"""
3043
sinhcu(x) = _sinhcu(float(x))
3144
function _sinhcu(x::Union{T,Complex{T}}) where {T}
3245
taylor_0_bound = eps(T)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ tests = [
3434
"sincosint",
3535
"other_tests",
3636
"chainrules",
37-
"trigcardinal"
37+
"trig"
3838
]
3939

4040
const testdir = dirname(@__FILE__)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@testset "Cardinal trigonometric" begin
1+
@testset "Special trigonometric functions" begin
22
@testset "sincu (unnormalized sinc)" begin
33
a = 1.0
44
@test sincu(a) sin(a)/a

0 commit comments

Comments
 (0)