cephes.cl

2021-10-21

No Description

Upstream URL

github.com/Lisp-Stat/cephes.cl

Author

Steven Nunez <steve@symbolics.tech>

License

ms-pl
README
Provided Systems

Cephes Mathematical Library

A common lisp CFFI wrapper for the SciPy version of Cephes special functions.

For many years Cephes was considered the gold standard in cross-platform mathematical libraries, superior to the libm distributions of the time (early 1990's). Since then C99 and later ANSI C specifications have closed the gap, but there are still certain special and statistical functions available in Cephes that are not in the standard C libraries.

The SciPy version differs from standard Cephes in that it has some additional functions, improvements in accuracy, and is better documented. Only double-float versions are provided.

Installation

The ASDF file will automatically build the shared library as part of the load operation. If you need to build on a system other than MS Windows or UNIX, you will need to modify the make file to account for the linker command to create a shared library.

As delivered, the Makefile is set-up to work on MS Windows or UNIX, and you can build it manually like so:

cd scipy-cephes && make

If you build this on another platform, please drop a note into a Cephes repository issue with the build instructions so we can update the Makefile and system definition.

The init.lisp file, where CFFI loads the library, should work out of the box if libmd on the path somewhere, regardless of platform. If in doubt, place a copy in the same directory as this README.

Documentation

If you know your way around special functions, the table below should suffice to get started. For a more complete description, see the doc strings in cephes.lisp. Finally, the C source code itself, referenced in cephes.lisp, is thorough and complete from a mathematical perspective.

You can also use the scipy.special online documentation.

The API

There is no overlap between the wrapped Cephes functions and the Common Lisp numerical tower. All functions are in the cephes package.

Exported functions are:

functiondescription
airyAiry function
bdtrBinomial distribution
bdtrcComplement of binomial distribution
bdtriInverse binomial distribution
besselpolyWeighted integral of the Bessel function of the first kind
betaBeta function
lbetaNatural log of beta
btdtrincomplete beta integral
cbrtcube root
chdtrChi-square distribution
chdtrcComplemented Chi-square distribution
chdtriInverse of complemented Chi-square distribution
dawsnDawson's Integral
ellikIncomplete elliptic integral of the first kind
ellieIncomplete elliptic integral of the second kind
ellpkComplete elliptic integral of the first kind
ellpeComplete elliptic integral of the second kind
jacobian-ellipticjacobian Elliptic Functions
exp2Base 2 exponential function
exp10Base 10 exponential function (Common antilogarithm)
expnExponential integral
fdtrF distribution
fdtrcComplemented F distribution
fdtriInverse of F distribution
fresnlFresnel integral
gammaGamma function
log-gammaNatural logarithm of Gamma function
gdtrGamma distribution function
gdtrcComplemented Gamma distribution function
gdtriInverse Gamma distribution function (?) - not documented in src
hyp2f1Gauss hypergeometric function
hypergConfluent hypergeometric function
i0Modified Bessel function of order zero
i0eModified Bessel function of order zero, exponentially scaled
i1Modified Bessel function of order one
i1eModified Bessel function of order one, exponentially scaled
igamRegularized lower incomplete gamma function
igamcRegularized upper incomplete gamma function
igamiInverse of the lower incomplete gamma function
igamciInverse of the upper incomplete gamma function
incbetIncomplete beta integral
incbiInverse of incomplete beta integral
ivModified Bessel function of noninteger order
j0Bessel function of order zero
y0Bessel function of the second kind, order zero
j1Bessel function of order one
y1Bessel function of second kind of order one
jvBessel function of noninteger order
k0Modified Bessel function, third kind, order zero
k0eModified Bessel function, third kind, order zero, exponentially scaled
k1Modified Bessel function of the third kind of order one
k1eModified Bessel function of the third kind of order one, exponentially scaled
knModified Bessel function, third kind, integer order
nbdtrNegative binomial distribution
nbdtrcComplemented negative binomial distribution
nbdtriInverse complemented negative binomial distribution
ndtrNormal distribution function
log-ndtrLog of the normal distribution function
erfError function
erfcComplementary error function
erfinvInverse of the error function
erfcinvInverse of the complementary error function
ndtriInverse of Normal distribution function
pdtrPoisson distribution
pdtrcComplemented poisson distribution
pdtriInverse Poisson distribution
pochPochhammer symbol (a)_m = gamma(a + m) / gamma(a)
psiPsi (digamma) function
rgammaReciprocal Gamma function
shichiHyperbolic sine and cosine integrals
siciSine and cosine integrals
sindgCircular sine of angle in degrees
cosdgCircular cosine of angle in degrees
sinpiCompute sin(pi * x)
cospiCompute cos(pi * x)
spenceDilogarithm
stdtrStudent's t distribution
stdtriFunctional inverse of Student's t distribution
yvBessel function of noninteger order
tandgCircular tangent of angle in degrees
cotdgCircular cotangent of argument in degrees
log1plog(1 + x)
log1pmxlog(1 + x) - x
expm1exp(x) - 1
cosm1cos(x) - 1
lgam1plgam(x + 1)
ynBessel function of second kind of integer order
zetaRiemann zeta function of two arguments
zetacRiemann zeta function
owens-tOwen's T-Function

Contributing

When contributing to this repository, please first discuss major changes to the existing code you wish to make via a github issue. Minor changes and major additions are welcome. Please write good commit messages.

License

CEPHES.CL is available under the Microsoft Public License.

Dependencies (1)

  • cffi

Dependents (0)

    • GitHub
    • Quicklisp