API reference
The docstrings of all exported functions, grouped by family. The same text is available in the Julia REPL by typing ? followed by the function name. Functions gives the mathematical background and examples.
Coulomb
FewSpecialFunctions.η — Function
η(a::Number, k::Number)
η(ϵ::Number)Coulomb (Sommerfeld) parameter, the second argument of the Coulomb wave functions such as F.
η(a, k)returns1/(a*k), wherekis the wave number andais the Bohr radius of the two-body system.a > 0describes a repulsive anda < 0an attractive interaction.η(ϵ)returns1/sqrt(ϵ), whereϵ = (a*k)^2is the energy in units of the corresponding Rydberg energy. A negative realϵthrows aDomainError; passcomplex(ϵ)for bound-state energies.
Zero arguments throw an ArgumentError.
FewSpecialFunctions.C — Function
C(ℓ::Number, η::Number)Coulomb normalization constant (Gamow factor)
C_ℓ(η) = 2^ℓ * exp(-π*η/2) * sqrt(Γ(ℓ+1+iη) * Γ(ℓ+1-iη)) / Γ(2ℓ+2),which fixes the behavior F(ℓ, η, ρ) ≈ C(ℓ, η) * ρ^(ℓ+1) as ρ → 0. ℓ is the angular momentum and η the Coulomb parameter (see η). Real arguments return a real value; complex arguments return a complex value.
For complex parameters, the square root of the gamma product is defined by exp((loggamma(ℓ + 1 + im * η) + loggamma(ℓ + 1 - im * η)) / 2). This selects a local analytic branch using the principal log-gamma branches, away from their cuts and poles, and agrees with the positive normalization for real ℓ ≥ 0 and real η. The full normalization is evaluated in logarithmic form to avoid overflow or underflow of its individual factors.
FewSpecialFunctions.θ — Function
θ(ℓ::Number, η::Number, ρ::Number)Phase of the Coulomb wave functions at large ρ,
θ_ℓ(η, ρ) = ρ - ℓ*π/2 - η*log(2ρ) + σ_ℓ(η),where σ_ℓ(η) = imag(loggamma(ℓ + 1 + im*η)) is the Coulomb phase shift. As ρ → ∞ with real arguments, F ≈ sin(θ), G ≈ cos(θ), and H⁺ ≈ exp(im*θ), H⁻ ≈ exp(-im*θ). See DLMF 33.2.9.
FewSpecialFunctions.F — Function
F(ℓ::Number, η::Number, ρ::Number)Regular Coulomb wave function
F_ℓ(η, ρ) = C_ℓ(η) * ρ^(ℓ+1) * exp(-iρ) * ₁F₁(ℓ+1-iη; 2ℓ+2; 2iρ),the solution of the Coulomb wave equation u'' + (1 - 2η/ρ - ℓ(ℓ+1)/ρ²) u = 0 that vanishes at ρ = 0 for ℓ ≥ 0 (DLMF 33.2.3).
Arguments
ℓ: angular momentum. Non-integer and complex values are accepted.η: Coulomb parameter (seeη); positive for a repulsive and negative for an attractive interaction.ρ: dimensionless radiusk*r.
Three real arguments return a real value. If any argument is complex, the result is complex. The normalization is C and the confluent hypergeometric function is evaluated by HypergeometricFunctions.jl, which determines the accuracy.
References:
FewSpecialFunctions.G — Function
G(ℓ::Number, η::Number, ρ::Number)Irregular Coulomb wave function
G_ℓ(η, ρ) = (H⁺_ℓ(η, ρ) + H⁻_ℓ(η, ρ)) / 2,the solution of the Coulomb wave equation that is linearly independent of F, with Wronskian F'G - FG' = 1 and G ≈ cos(θ) as ρ → ∞ (see θ). It is singular at ρ = 0.
The arguments have the same meaning as in F. Three real arguments return a real value; otherwise the result is complex.
References:
FewSpecialFunctions.H⁺ — Function
H⁺(ℓ::Number, η::Number, ρ::Number)Outgoing Coulomb wave function
H⁺_ℓ(η, ρ) = D⁺_ℓ(η) * ρ^(ℓ+1) * exp(iρ) * U(ℓ+1+iη, 2ℓ+2, -2iρ),where U is Tricomi's confluent hypergeometric function and D⁺ is the factor D⁺. The result is complex. For real arguments H⁺ = G + im*F, and H⁺ ≈ exp(im*θ) as ρ → ∞ with the phase θ. The arguments have the same meaning as in F; ρ must be nonzero.
References:
FewSpecialFunctions.H⁻ — Function
H⁻(ℓ::Number, η::Number, ρ::Number)Incoming Coulomb wave function
H⁻_ℓ(η, ρ) = D⁻_ℓ(η) * ρ^(ℓ+1) * exp(-iρ) * U(ℓ+1-iη, 2ℓ+2, 2iρ),where U is Tricomi's confluent hypergeometric function and D⁻ is the factor D⁻. The result is complex. For real arguments H⁻ = G - im*F, and H⁻ ≈ exp(-im*θ) as ρ → ∞ with the phase θ. The arguments have the same meaning as in F; ρ must be nonzero.
References:
FewSpecialFunctions.F_imag — Function
F_imag(ℓ::Number, η::Number, ρ::Number)Regular Coulomb wave function computed from the outgoing and incoming solutions, (H⁺(ℓ, η, ρ) - H⁻(ℓ, η, ρ)) / (2im).
For real arguments this is the imaginary part of H⁺ and agrees with F up to rounding, but the result is returned as a complex number and, unlike F, the evaluation requires ρ ≠ 0.
FewSpecialFunctions.D⁺ — Function
D⁺(ℓ::Number, η::Number)Normalization factor of the outgoing Coulomb wave function H⁺,
D⁺_ℓ(η) = (-2i)^(2ℓ+1) * Γ(ℓ+1+iη) / (C_ℓ(η) * Γ(2ℓ+2)),with C_ℓ(η) given by C. The result is complex.
FewSpecialFunctions.D⁻ — Function
D⁻(ℓ::Number, η::Number)Normalization factor of the incoming Coulomb wave function H⁻,
D⁻_ℓ(η) = (2i)^(2ℓ+1) * Γ(ℓ+1-iη) / (C_ℓ(η) * Γ(2ℓ+2)),with C_ℓ(η) given by C. The result is complex; for real ℓ and η it is the complex conjugate of D⁺.
FewSpecialFunctions.Φ — Function
Φ(ℓ::Number, η::Number, ρ::Number)Modified regular Coulomb function
Φ_ℓ(η, ρ) = (2ηρ)^(ℓ+1) * exp(iρ) * M_regularized(ℓ+1+iη, 2ℓ+2, -2iρ),which equals F(ℓ, η, ρ) up to the ρ-independent factor (2η)^(ℓ+1) / (C(ℓ, η) * Γ(2ℓ+2)). See M_regularized and the implementation paper. The arguments have the same meaning as in F. The result is complex.
FewSpecialFunctions.M_regularized — Function
M_regularized(α::Number, β::Number, γ::Number)Regularized confluent hypergeometric function ₁F₁(α; β; γ) / Γ(β), with parameters α and β and argument γ.
The value is computed as the quotient of the two factors, so it is not finite at the poles of Γ(β), β = 0, -1, -2, …, where the mathematical function has a finite limit.
FewSpecialFunctions.w — Function
w(ℓ::Integer, η::Number)
w(ℓ::Number, η::Number)Product
w_ℓ(η) = ∏ⱼ (1 + j²/η²),taken over j = 0, 1, …, ℓ for an integer ℓ and over j = 1/2, 3/2, …, ℓ for a half-integer ℓ. It appears in the connection formulas of the implementation paper (see Ψ).
An integer order must be passed as an Integer: w(1, η) is accepted, while w(1.0, η) and any other non-half-integer value throw an ArgumentError.
FewSpecialFunctions.w_plus — Function
w_plus(ℓ::Number, η::Number)Gamma-function ratio
w⁺_ℓ(η) = Γ(ℓ+1+iη) / ((iη)^(2ℓ+1) * Γ(-ℓ+iη))used in the connection formulas of the implementation paper. The result is complex; η must be nonzero.
FewSpecialFunctions.w_minus — Function
w_minus(ℓ::Number, η::Number)Gamma-function ratio
w⁻_ℓ(η) = Γ(ℓ+1-iη) / ((-iη)^(2ℓ+1) * Γ(-ℓ-iη)),the counterpart of w_plus with i → -i. The result is complex; η must be nonzero.
FewSpecialFunctions.h_plus — Function
h_plus(ℓ::Number, η::Number)Digamma combination
h⁺_ℓ(η) = (ψ(ℓ+1+iη) + ψ(-ℓ+iη)) / 2 - log(iη),where ψ is the digamma function and log is the principal branch. It is used in the connection formulas of the implementation paper. The result is complex; η must be nonzero.
FewSpecialFunctions.h_minus — Function
h_minus(ℓ::Number, η::Number)Digamma combination
h⁻_ℓ(η) = (ψ(ℓ+1-iη) + ψ(-ℓ-iη)) / 2 - log(-iη),the counterpart of h_plus with i → -i. The result is complex; η must be nonzero.
FewSpecialFunctions.g — Function
g(ℓ::Number, η::Number)Real part of the digamma combination
g_ℓ(η) = real((ψ(ℓ+1+iη) + ψ(ℓ+1-iη)) / 2) - log(|η|),where ψ is the digamma function. It is used in the connection formulas of the implementation paper. η must be nonzero.
FewSpecialFunctions.Φ_dot — Function
Φ_dot(ℓ::Number, η::Number, ρ::Number; h=nothing)Derivative ∂Φ_ℓ(η, ρ)/∂ℓ of Φ with respect to the angular momentum, approximated by the central difference (Φ(ℓ + h, η, ρ) - Φ(ℓ - h, η, ρ)) / (2h).
h is the step size; it defaults to cbrt(eps(T)), where T is the floating-point type of ℓ. With that step the truncation and rounding errors are both of order eps(T)^(2/3) relative to the scale of Φ (about 4e-11 for Float64), so the result has fewer correct digits than Φ itself.
FewSpecialFunctions.F_dot — Function
F_dot(ℓ::Number, η::Number, ρ::Number; h=nothing)Derivative ∂F_ℓ(η, ρ)/∂ℓ of F with respect to the angular momentum, approximated by the central difference (F(ℓ + h, η, ρ) - F(ℓ - h, η, ρ)) / (2h).
h is the step size; it defaults to cbrt(eps(T)), where T is the floating-point type of ℓ. The accuracy is that of Φ_dot.
FewSpecialFunctions.Ψ — Function
Ψ(ℓ::Number, η::Number, ρ::Number; h=nothing)Combination of angular-momentum derivatives of Φ,
Ψ_ℓ(η, ρ) = (w_ℓ(η) * ∂Φ_ℓ/∂ℓ + ∂Φ_{-ℓ-1}/∂ℓ) / 2,with w_ℓ(η) given by w and both derivatives computed by Φ_dot. See the implementation paper for its role in the connection formulas.
ℓ must be an Integer or a half-integer, as required by w. h is the finite-difference step passed to Φ_dot, whose accuracy limits apply.
FewSpecialFunctions.I — Function
I(ℓ::Number, η::Number, ρ::Number; h=nothing)Rescaled form of Ψ,
I_ℓ(η, ρ) = C_ℓ(η) * Γ(2ℓ+2) / (2η)^(ℓ+1) * Ψ_ℓ(η, ρ),which applies to Ψ the inverse of the factor that relates Φ to F. C_ℓ(η) is C.
ℓ must be an Integer or a half-integer, and η must be nonzero. h is the finite-difference step passed to Φ_dot, whose accuracy limits apply. This function shares its name with LinearAlgebra.I; qualify it as FewSpecialFunctions.I when both packages are loaded.
Whittaker
FewSpecialFunctions.WhittakerM — Function
WhittakerM(κ::Number, μ::Number, z::Number)Compute the Whittaker function Mκμ(z) = exp(-z/2) * z^(μ+1/2) * ₁F₁(μ-κ+1/2, 1+2μ, z) on the principal branch.
Inputs must be finite and z ≠ 0; negative real arguments require an explicit complex input. Negative integer 2μ is a parameter pole. Invalid inputs raise DomainError. Real inputs with z > 0 return real values; complex inputs return complex values. Float32, Float64 and BigFloat are supported, with mixed inputs promoted. Use broadcasting for arrays.
Evaluation uses a precision-guarded Kummer series. Extra precision controls cancellation and intermediate overflow, at a cost in speed for large inputs. See DLMF 13.14 and Thompson & Barnett (1986), doi:10.1016/0021-9991(86)90046-X.
FewSpecialFunctions.WhittakerW — Function
WhittakerW(κ::Number, μ::Number, z::Number)Compute Wκμ(z) = exp(-z/2) * z^(μ+1/2) * U(μ-κ+1/2, 1+2μ, z), where U here is Tricomi's confluent hypergeometric function.
The domain, principal-branch convention and type behavior match WhittakerM, but W also accepts negative integer 2μ. Uses an asymptotic expansion when it reaches working precision, otherwise a guarded connection formula, including limits at integer 2μ. These are series methods described by Thompson & Barnett (1986); this is not a port of their full COULCC algorithm.
FewSpecialFunctions.dWhittakerM — Function
dWhittakerM(κ::Number, μ::Number, z::Number)Compute the argument derivative of WhittakerM using the analytic derivative of its Kummer representation. The domain and type behavior match WhittakerM.
FewSpecialFunctions.dWhittakerW — Function
dWhittakerW(κ::Number, μ::Number, z::Number)Compute the argument derivative of WhittakerW using its asymptotic expansion or the analytic derivative of its Tricomi representation. The domain and type behavior match WhittakerW.
Parabolic cylinder
FewSpecialFunctions.U — Function
U(a::T, x::T) where {T <: AbstractFloat}Compute the real parabolic cylinder function U(a,x). Supports Float32, Float64, and BigFloat. Uses a precision-guarded convergent series when the order and argument do not permit an accurate asymptotic expansion.
Reference: DLMF, Chapter 12.
FewSpecialFunctions.V — Function
V(a::T, x::T) where {T <: AbstractFloat}Compute the real parabolic cylinder function V(a,x) using a convergent series with extra working precision. Supports Float32, Float64, and BigFloat.
FewSpecialFunctions.W — Function
W(a::T, x::T) where {T <: AbstractFloat}Compute the real parabolic cylinder function W(a,x). Supports Float32, Float64, and BigFloat. Uses a precision-guarded convergent series or an asymptotic expansion whose decreasing terms reach the requested precision.
Reference: DLMF 12.14.
FewSpecialFunctions.dU — Function
dU(a::T, x::T) where {T <: AbstractFloat}Compute ∂U(a,x)/∂x from the same expansion as U. Supports Float32, Float64, and BigFloat.
FewSpecialFunctions.dV — Function
dV(a::T, x::T) where {T <: AbstractFloat}Compute ∂V(a,x)/∂x from the same convergent series as V. Supports Float32, Float64, and BigFloat.
FewSpecialFunctions.dW — Function
dW(a::T, x::T) where {T <: AbstractFloat}Compute ∂W(a,x)/∂x from the same expansion as W. Supports Float32, Float64, and BigFloat.
FewSpecialFunctions.ParabolicCylinderD — Function
ParabolicCylinderD(ν::Real, x::Real)Compute Dν(x) = U(-ν-1/2, x) for finite real order and argument. Supports Float32, Float64 and BigFloat, with mixed inputs promoted. See DLMF 12.2.5.
FewSpecialFunctions.dParabolicCylinderD — Function
dParabolicCylinderD(ν::Real, x::Real)Compute the argument derivative dDν(x)/dx = dU(-ν-1/2, x). The domain and type behavior match ParabolicCylinderD.
FewSpecialFunctions.U_scaled — Function
U_scaled(a::Real, x::Real)Compute F(a,x) * U(a,x) for finite real a and x ≥ 0, evaluating the scaling before rounding to the output type. Here F = exp(L), with L = a*log(x/2 + sqrt(x²/4+a)) + x*sqrt(x²/4+a)/2 - a/2 in the nonoscillatory region, L = a*(log(abs(a))-1)/2 in the oscillatory region, and L = x²/4 when a = 0.
Supports Float32, Float64 and BigFloat. Invalid arguments raise DomainError. The series fallback uses extra precision and can be expensive for large orders. This scaling is from Gil, Segura & Temme (2006), equations (7), (11)–(13): paper. It removes growth/decay in both order and argument; it is not simply multiplication by exp(x²/4).
FewSpecialFunctions.V_scaled — Function
V_scaled(a::Real, x::Real)Compute V(a,x) / F(a,x) for finite real a and x ≥ 0, with the scaling factor defined in U_scaled. Scaling is applied before rounding, so values can remain finite when V overflows. Supports Float32, Float64 and BigFloat; invalid arguments raise DomainError.
FewSpecialFunctions.ParabolicCylinderD_scaled — Function
ParabolicCylinderD_scaled(ν::Real, x::Real)Compute U_scaled(-ν-1/2, x) for finite real ν and x ≥ 0. Uses the order-dependent scaling of U_scaled, and supports Float32, Float64 and BigFloat. Invalid arguments raise DomainError.
Debye
FewSpecialFunctions.debye_function — Function
debye_function(n::T, β::T, x::T; tol=1e-35, max_terms=2000) where {T <: AbstractFloat}Compute n/x^n * ∫₀ˣ t^n/(exp(t)-1)^β dt for finite n > 0, 0 < β < n+1, and x ≥ 0. At x = 0, returns the limiting value: 0 for β < 1, 1 for β = 1, and Inf for β > 1. Returns 0 at x = Inf. Supports any AbstractFloat type (e.g., Float32, Float64, BigFloat). Array broadcasting is supported: any one argument may be an AbstractArray.
Throws ArgumentError for invalid parameters, tolerances, or work limits. Throws ErrorException if quadrature cannot meet the requested tolerance within the work limit.
tol: positive finite relative quadrature tolerance (default1e-35), floored at8eps(T)max_terms: positive integer limit on quadrature subintervals (default2000)
References:
Fermi–Dirac
FewSpecialFunctions.FermiDiracIntegral — Function
FermiDiracIntegral(j::Real, x::Real)Approximate the unnormalized complete Fermi–Dirac integral
\[\mathcal{F}_j(x) = \int_0^\infty \frac{t^j}{\exp(t-x)+1}\,\mathrm{d}t\]
of order j ≥ -1/2 at real x. No factor 1/Γ(j+1) is included; see FermiDiracIntegralNorm for the normalized form. Orders j < -1/2 throw an ErrorException.
The arguments are promoted to a common floating-point type T, which is also the return type. The method then depends on the order:
Order j | Method | Measured relative error (Float64) |
|---|---|---|
0 | closed form log(1 + exp(x)) | 1.5e-14 for x ≥ -5; see below |
-1/2, 1/2, 3/2, 5/2 | rational approximations of Antia [5]: in exp(x) for x < 2, in 1/x² for x ≥ 2 | 2.8e-12, 5.4e-13, 5.1e-13, 2.5e-13 |
any other j > -1/2 | closed-form expression of Aymerich-Humet et al. [4] | 5.8e-3 to 1.2e-2 at the tested orders 1/4, 1, 2, 3, 9/2; 2.9e-2 at order 10 |
Each figure is the maximum over a grid of 190 points in -30 ≤ x ≤ 60, relative to quadrature of the integral in 512-bit arithmetic. They are measurements at the listed orders, not bounds; docs/accuracy_checks.jl reproduces them. The order is matched by exact comparison after conversion to T, so 1/2 selects the rational approximation and 0.5 + 1e-12 does not.
The return type does not change the method. The coefficients of [5] are double-precision constants and the expression of [4] is an approximation, so a BigFloat result has the same error as the Float64 one, and a Float32 result is limited by single precision. Two limits of the j = 0 form: for x ≪ 0 the sum 1 + exp(x) rounds, so the relative error grows as x decreases (about 1e-3 at x = -30 in Float64) although the absolute error stays below eps(T), and for x large enough that exp(x) overflows (x > 709 in Float64) the result is Inf.
Examples
julia> FermiDiracIntegral(3 / 2, 1.0) ≈ 2.6616826247307124
true
julia> FermiDiracIntegral(0, 0.0) ≈ log(2)
true
julia> FermiDiracIntegral(0.5f0, 1.0f0) isa Float32
trueReferences
- D. Bednarczyk and J. Bednarczyk, Phys. Lett. A 64, 409 (1978)
- J. S. Blakemore, Solid-State Electron. 25, 1067 (1982)
- X. Aymerich-Humet, F. Serra-Mestres, and J. Millan, Solid-State Electron. 24, 981 (1981)
- X. Aymerich-Humet, F. Serra-Mestres, and J. Millan, J. Appl. Phys. 54, 2850 (1983)
- H. M. Antia, Astrophys. J. Suppl. Ser. 84, 101 (1993)
See also Kim and Lundstrom, Notes on Fermi-Dirac Integrals and DLMF 25.12(iii).
FewSpecialFunctions.FermiDiracIntegralNorm — Function
FermiDiracIntegralNorm(j::Real, x::Real)Approximate the normalized complete Fermi–Dirac integral
\[F_j(x) = \frac{1}{\Gamma(j+1)}\int_0^\infty \frac{t^j}{\exp(t-x)+1}\,\mathrm{d}t\]
of order j ≥ -1/2 at real x, computed as FermiDiracIntegral(j, x) / gamma(j + 1). With this normalization F_j(x) → exp(x) as x → -∞ and dF_j/dx = F_{j-1}.
The order restriction, the choice of method for each order, and the relative error are those of FermiDiracIntegral. In particular, only j ∈ (-1/2, 1/2, 3/2, 5/2) and j = 0 are computed to better than the relative error of 6e-3 to 3e-2 measured for the other tested orders.
Examples
julia> FermiDiracIntegralNorm(1 / 2, 1.0) ≈ FermiDiracIntegral(1 / 2, 1.0) / (sqrt(π) / 2)
true
julia> FermiDiracIntegralNorm(0, 0.0) ≈ log(2)
trueBose–Einstein
FewSpecialFunctions.BoseEinsteinIntegral — Function
BoseEinsteinIntegral(k, η)Compute the unnormalized Bose–Einstein integral
\[\int_0^\infty \frac{t^k}{\exp(t-\eta)-1}\,dt = \Gamma(k+1) B_k(\eta).\]
Accepts integer and half-integer orders k > -1 and real η ≤ 0. At η = 0, returns gamma(k+1)*zeta(k+1) for k > 0, and Inf for k = -1/2 or k = 0. Returns zero at η = -Inf. Invalid inputs throw DomainError. Supports Float32, Float64, BigFloat, dot broadcasting, and ForwardDiff differentiation with respect to η.
The naming follows FermiDiracIntegral. For normalized values and continuation to negative orders, use BoseEinsteinIntegralNorm.
FewSpecialFunctions.BoseEinsteinIntegralNorm — Function
BoseEinsteinIntegralNorm(k, η)Compute the normalized Bose–Einstein integral
\[B_k(\eta) = \frac{1}{\Gamma(k+1)}\int_0^\infty \frac{t^k}{\exp(t-\eta)-1}\,dt = \operatorname{Li}_{k+1}(e^\eta).\]
Accepts integer and half-integer orders k ≥ -9/2 and real η ≤ 0. For k ≤ -1, the polylogarithm defines the continuation by differentiation; the displayed integral itself requires k > -1. At η = 0, returns zeta(k+1) for k > 0 and Inf otherwise. Returns zero at η = -Inf. Invalid orders, positive η, and NaN inputs throw DomainError.
Uses Fukushima's minimax rational approximations for half-integer orders -9/2:1:39/2 and integer orders 1:19, elementary formulas for nonpositive integers, and a convergent series for higher orders. Float32 and Float64 use the double precision coefficients; BigFloat uses convergent series at the working precision. The ForwardDiff extension supports differentiation with respect to η, but not the discrete order k.
Examples
julia> round(BoseEinsteinIntegralNorm(0.5, -1.0); digits=12)
0.4284407346Reference
T. Fukushima (2020 preprint), Analytical computation of Bose–Einstein integral of half integer orders, −9/2, −7/2, ⋯, and 39/2, and integer orders, 1, 2, ⋯, and 19, by minimax rational function approximations, Eqs. (11)–(24), Tables A.3–A.48, doi:10.13140/RG.2.2.21720.65283.
See also BoseEinsteinIntegral, FermiDiracIntegralNorm.
Marcum Q
FewSpecialFunctions.MarcumQ — Function
MarcumQ(μ::Real, a::Real, b::Real)Compute the generalized Marcum Q-function Q_μ(a, b) of order μ with non-centrality parameter a ≥ 0 and threshold b ≥ 0. Returns a value in [0, 1].
Requires μ ≥ 0.5, a ≥ 0, and b ≥ 0; throws ArgumentError otherwise. Supports any Real input type; arguments are promoted to a common floating-point type. Array broadcasting is supported: any one argument may be an AbstractArray.
Reference: [1] https://arxiv.org/pdf/1311.0681v1
FewSpecialFunctions.dQdb — Function
dQdb(M, a, b)Derivative ∂Q_M(a, b)/∂b of the Marcum Q-function MarcumQ,
∂Q_M(a, b)/∂b = -b^M / a^(M-1) * exp(-(a² + b²)/2) * I_{M-1}(a*b),where I is the modified Bessel function of the first kind.
Requires a real order M ≥ 1, integer or non-integer, and a ≠ 0; other values throw an AssertionError. This domain is narrower than that of MarcumQ, which accepts M ≥ 0.5 and a ≥ 0. dQdb(a, b) uses M = 1, and any one argument may be an AbstractArray.
Voigt
FewSpecialFunctions.voigt — Function
voigt(x::Real, y::Real)Evaluate the real Voigt function
\[K(x, y) = \frac{y}{\pi} \int_{-\infty}^{\infty} \frac{e^{-t^2}}{(x - t)^2 + y^2} \, \mathrm{d}t, \qquad y \ge 0.\]
For y == 0, K(x, 0) = exp(-x^2). The implementation follows the Fourier-expansion method of Abrarov, Quine, and Jagpal.
Fresnel
FewSpecialFunctions.fresnel — Function
fresnel(z::Number)Compute the Fresnel cosine and sine integrals and their combination:
S(z) = ∫₀ᶻ sin(π / 2 * t²) dt
C(z) = ∫₀ᶻ cos(π / 2 * t²) dtReturns (C, S, C + im * S). For complex inputs, C and S are the analytic complex Fresnel integrals. For ComplexF16, ComplexF32, and ComplexF64, the third value is evaluated independently to avoid cancellation. Other complex float types retain the series/asymptotic implementation, whose combination can lose precision when C and S nearly cancel.
FewSpecialFunctions.FresnelC — Function
FresnelC(z::Number)Compute the Fresnel cosine integral C(z).
FewSpecialFunctions.FresnelS — Function
FresnelS(z::Number)Compute the Fresnel sine integral S(z).
FewSpecialFunctions.FresnelE — Function
FresnelE(z::Number)Compute the Fresnel integral combination C(z) + im * S(z).
Dawson
FewSpecialFunctions.dawson — Function
dawson(x::Real)Compute the Dawson integral
\[D(x) = e^{-x^2}\int_0^x e^{t^2}\,\mathrm{d}t = \frac{\sqrt{\pi}}{2}\,e^{-x^2}\operatorname{erfi}(x)\]
for real x. D is odd, D(0) = 0, and D(x) ≈ 1/(2x) for large |x|; dawson(±Inf) returns ±0 and NaN propagates.
Float32, Float64, and BigFloat arguments return the same type; integers and other reals are converted with float. Complex arguments are not supported.
The argument range is split into four regions: a continued fraction for |x| ≤ sqrt(eps(T)), a power series up to max(8, sqrt(2log(1/eps(T)))), a second continued fraction beyond that, and the leading term 1/(2x) for |x| ≥ 1/sqrt(eps(T)). The series and continued fractions iterate until successive values agree to a relative 4eps(T), so the accuracy follows the precision of T; an ErrorException is thrown if that is not reached within 10 000 terms.
Examples
julia> dawson(0.0)
0.0
julia> dawson(1.0) ≈ 0.5380795069127684
true
julia> dawson(-0.5) == -dawson(0.5)
true
julia> dawson(1.0e10) ≈ 1 / 2.0e10
trueReference
M. R. Zaghloul, Numerical Algorithms 95, 1291–1308 (2023), doi:10.1007/s11075-023-01608-8.
Clausen
FewSpecialFunctions.Clausen — Function
Clausen(n::Int, θ::Real; N::Int=10, m::Int=20)Compute the Clausen function Cl_n(θ) of order n at angle θ. Supports any Real input type for θ.
n must be in 1..6; N must be 10 or 20 (throws ArgumentError otherwise).
Note on singularity: Clausen(1, θ) = -log|2sin(θ/2)| has a logarithmic singularity at θ = 0, 2π, 4π, …, where it returns Inf.
N: number of Gauss-Legendre quadrature nodes used in the Euler-Maclaurin tail sum; 10 gives double precision, 20 gives extended precision.m: number of terms in the direct summation before switching to the tail formula.
References:
FewSpecialFunctions.Ci_complex — Function
Ci_complex(z::Complex{T}) where {T <: AbstractFloat}Complex cosine integral function used in Clausen function calculations. Supports any AbstractFloat type.
FewSpecialFunctions.f_n — Function
f_n(n::Int, k::Int, θ::Real)Compute the Clausen series summand fₙ(k, θ): sin(kθ)/kⁿ for even n, cos(kθ)/kⁿ for odd n. Supports any Real input type for θ.
FewSpecialFunctions.F_clausen — Function
F_clausen(n::Int, z::Complex{T}, θ::T) where {T <: AbstractFloat}Dispatch to the correct primitive function Fₙ(z, θ) for n = 1..6. Supports any AbstractFloat type.
Index
FewSpecialFunctions.BoseEinsteinIntegralFewSpecialFunctions.BoseEinsteinIntegralNormFewSpecialFunctions.CFewSpecialFunctions.Ci_complexFewSpecialFunctions.ClausenFewSpecialFunctions.D⁺FewSpecialFunctions.D⁻FewSpecialFunctions.FFewSpecialFunctions.F_clausenFewSpecialFunctions.F_dotFewSpecialFunctions.F_imagFewSpecialFunctions.FermiDiracIntegralFewSpecialFunctions.FermiDiracIntegralNormFewSpecialFunctions.FresnelCFewSpecialFunctions.FresnelEFewSpecialFunctions.FresnelSFewSpecialFunctions.GFewSpecialFunctions.H⁺FewSpecialFunctions.H⁻FewSpecialFunctions.IFewSpecialFunctions.M_regularizedFewSpecialFunctions.MarcumQFewSpecialFunctions.ParabolicCylinderDFewSpecialFunctions.ParabolicCylinderD_scaledFewSpecialFunctions.UFewSpecialFunctions.U_scaledFewSpecialFunctions.VFewSpecialFunctions.V_scaledFewSpecialFunctions.WFewSpecialFunctions.WhittakerMFewSpecialFunctions.WhittakerWFewSpecialFunctions.dParabolicCylinderDFewSpecialFunctions.dQdbFewSpecialFunctions.dUFewSpecialFunctions.dVFewSpecialFunctions.dWFewSpecialFunctions.dWhittakerMFewSpecialFunctions.dWhittakerWFewSpecialFunctions.dawsonFewSpecialFunctions.debye_functionFewSpecialFunctions.f_nFewSpecialFunctions.fresnelFewSpecialFunctions.gFewSpecialFunctions.h_minusFewSpecialFunctions.h_plusFewSpecialFunctions.voigtFewSpecialFunctions.wFewSpecialFunctions.w_minusFewSpecialFunctions.w_plusFewSpecialFunctions.ΦFewSpecialFunctions.Φ_dotFewSpecialFunctions.ΨFewSpecialFunctions.ηFewSpecialFunctions.θ