FewSpecialFunctions.jl

FewSpecialFunctions.jl provides additional special functions and alternative numerical implementations of some functions that exist elsewhere.

FunctionsTypical use
Coulomb wave functionsscattering and bound states of charged particles
Whittaker functionsconfluent hypergeometric problems, Coulomb problems at complex energy
Parabolic cylinder functionsharmonic-oscillator and turning-point problems
Fermi-Dirac integrals and Bose–Einstein integralscarrier and particle statistics in solid-state and statistical physics
Debye functionslattice heat capacity
Marcum Q-functiondetection probabilities in radar and communications
Voigt functionspectral line shapes
Fresnel integrals and the Dawson integraldiffraction, error-function-type integrals
Clausen functionspolylogarithms on the unit circle

Installation

The package requires Julia 1.10 or later. In a Julia session, run

import Pkg; Pkg.add("FewSpecialFunctions")

Equivalently, press ] at the julia> prompt to enter the package mode (the prompt changes to pkg>), type add FewSpecialFunctions, and press backspace to return to the julia> prompt.

First steps

Load the package and evaluate a few functions at scalar arguments:

julia> using FewSpecialFunctions

julia> round(FresnelC(1.0); digits = 10)
0.7798934004

julia> round(dawson(1.0); digits = 10)
0.5380795069

julia> WhittakerW(0, 0.5, 2) ≈ exp(-1)
true

Functions act on scalars. Use Julia's dot syntax to apply them to arrays:

julia> round.(FresnelS.([0.0, 0.5, 1.0]); digits = 6)
3-element Vector{Float64}:
 0.0
 0.064732
 0.438259

In the REPL, type ? followed by a function name, for example ?dawson, to read its documentation. The same text is collected in the API reference.

Plotting an Euler spiral

The plots in this manual use Plots.jl and LaTeXStrings.jl, which are not installed with FewSpecialFunctions.jl. Install them once with

import Pkg; Pkg.add(["Plots", "LaTeXStrings"])

The Euler spiral is the curve $(C(x), S(x))$ traced by the two Fresnel integrals:

using FewSpecialFunctions, Plots, LaTeXStrings

x = range(-25, 25, length = 5000)
plot(
    FresnelC.(x), FresnelS.(x);
    xlabel = L"C(x)", ylabel = L"S(x)", title = "Euler spiral",
    label = nothing, framestyle = :box, aspect_ratio = :equal,
)
Example block output

Where to go next

Contributing, license, and citation

Bug reports and pull requests are welcome at the GitHub repository. CONTRIBUTING.md describes how to run the tests, build this manual, format the code, and report a bug.

The package is distributed under the MIT license. If you use it in published work, please cite it using the metadata in CITATION.cff; GitHub's "Cite this repository" button converts that file to BibTeX or APA format. The methods implemented for each family are listed in the Bibliography.