The special-functions Reference Manual

This is the special-functions Reference Manual, version 1.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:56:38 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 special-functions

Special functions in Common Lisp

Long Name

Mathematical Special Functions

Author

Steve Nunez <>

Source Control

(GIT https://github.com/Lisp-Stat/special-functions.git)

Bug Tracker

https://github.com/Lisp-Stat/special-functions/issues

License

MS-PL

Long Description

Mathematical Special Functions

Version

1.2.0

Dependencies
  • num-utils (system).
  • float-features (system).
  • let-plus (system).
  • alexandria+ (system).
Source

special-functions.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 special-functions/special-functions.asd

Source

special-functions.asd.

Parent Component

special-functions (system).

ASDF Systems

special-functions.


3.1.2 special-functions/pkgdcl.lisp

Source

special-functions.asd.

Parent Component

special-functions (system).

Packages

special-functions.


3.1.3 special-functions/utils.lisp

Dependency

pkgdcl.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Internals

3.1.4 special-functions/erf.lisp

Dependency

utils.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface
Internals

3.1.5 special-functions/lanczos.lisp

Dependency

erf.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Packages

lanczos.

Public Interface
  • g (special variable).
  • g-1/2 (special variable).
  • lanczos-sum (function).
  • n (special variable).
Internals

3.1.6 special-functions/gamma.lisp

Dependency

lanczos.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface
Internals

3.1.7 special-functions/log-gamma.lisp

Dependency

gamma.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface

log-gamma (function).


3.1.8 special-functions/factorial.lisp

Dependency

log-gamma.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface

factorial (function).

Internals

4 Packages

Packages are listed by definition order.


4.1 lanczos

Source

lanczos.lisp.

Use List

common-lisp.

Public Interface
  • g (special variable).
  • g-1/2 (special variable).
  • lanczos-sum (function).
  • n (special variable).
Internals

4.2 special-functions

Source

pkgdcl.lisp.

Nicknames
  • spfn
  • specfun
Use List
  • alexandria+.
  • common-lisp.
  • let-plus.
  • num-utils.arithmetic.
  • num-utils.polynomial.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: g
Package

lanczos.

Source

lanczos.lisp.

Special Variable: g-1/2
Package

lanczos.

Source

lanczos.lisp.

Special Variable: n
Package

lanczos.

Source

lanczos.lisp.


5.1.2 Ordinary functions

Function: erf (n)

Returns the error function of n

Package

special-functions.

Source

erf.lisp.

Function: erfc (x)

Return the complementary error function erfc(x) = 1-erf(x)

Package

special-functions.

Source

erf.lisp.

Function: factorial (x)

Return the factorial value X! for X <= MAX-FACTORIAL; DOUBLE-FLOAT-POSITIVE-INFINITY if x < 0. X must be an INTEGER.

Package

special-functions.

Source

factorial.lisp.

Function: gamma (x)

Return gamma(x), x <= +MAXGAMD+; NAN/RTE if x is a non-positive integer

Package

special-functions.

Source

gamma.lisp.

Function: incomplete-gamma (a x &key compute-prefix)

Return the normalised incomplete gamma functions P and Q, a>=0, x>=0 P(a,x) = integral(exp(-t)*t^(a-1), t=0..x )/gamma(a)
Q(a,x) = integral(exp(-t)*t^(a-1), t=x..Inf)/gamma(a))
dax = x^a*exp(-x)/gamma(a) (prefix factor)

Returns three values:
P is the first value, Q the second, DAX the third, e.g. (values p q dax)

Package

special-functions.

Source

gamma.lisp.

Function: inverse-erf (x)

Return the inverse function of erf: (erf (inverse-erf x)) = x, -1 < x < 1

Package

special-functions.

Source

erf.lisp.

Function: inverse-erfc (x)

Return the inverse function of erfc: (erfc (inverse-erfc x)) = x, 0 < x < 2

Package

special-functions.

Source

erf.lisp.

Function: lanczos-sum (x &key unscaled)

Return the Lanczos sum for x, exp(g). If UNSCALED is non-nil, return the unscaled result

Package

lanczos.

Source

lanczos.lisp.

Function: log-gamma (n)

Return the logarithm of gamma(x)

Package

special-functions.

Source

log-gamma.lisp.

Function: lower-incomplete-gamma (x a)

Return the normalised lower incomplete gamma function P(a,x), a>=0, x>=0 P(a,x) = integral(exp(-t)*t^(a-1), t=0..x)/gamma(a)

Package

special-functions.

Source

gamma.lisp.

Function: regularised-gamma-prefix (a x)

Return x^a * exp(-x) / gamma(a)
This function accepts either RATIONAL or FLOAT values.

Package

special-functions.

Source

gamma.lisp.

Function: upper-incomplete-gamma (x a)

Return the normalised upper incomplete gamma function Q(a,x), a>=0, x>=0 Q(a,x) = integral(exp(-t)*t^(a-1), t=x..Inf)/gamma(a))

Package

special-functions.

Source

gamma.lisp.


5.2 Internals


5.2.1 Constants

Constant: +square-root-2-pi+
Package

special-functions.

Source

utils.lisp.

Constant: log-maximum-double-value
Package

special-functions.

Source

gamma.lisp.

Constant: log-minimum-double-value
Package

special-functions.

Source

gamma.lisp.

Constant: maxgamd

Maximum argument for gamma

Package

special-functions.

Source

gamma.lisp.


5.2.2 Special variables

Special Variable: factorial-table

Table of factorials for integer values up to 100

Package

special-functions.

Source

factorial.lisp.

Special Variable: lanczos-13-denominator
Package

lanczos.

Source

lanczos.lisp.

Special Variable: lanczos-13-numerator
Package

lanczos.

Source

lanczos.lisp.

Special Variable: lanczos-13-numerator-scaled
Package

lanczos.

Source

lanczos.lisp.


5.2.3 Ordinary functions

Function: decode-float64 (x)

Convert the (unsigned-byte 64) bit representation into a native double-float

Package

special-functions.

Source

utils.lisp.

Function: encode-float64 (x)

Returns the bit representation of the double-float X as an (unsigned-byte 64)

Package

special-functions.

Source

utils.lisp.

Function: erfc-scaled (x)

p/q := exp(x^2)*erfc(x), 1<=x<=128

Package

special-functions.

Source

erf.lisp.

Function: gamma-aux (x)
Package

special-functions.

Source

gamma.lisp.

Function: gamma-inverse-small (x)

Return 1/gamma(x) for |x| < 0.03125

Package

special-functions.

Source

gamma.lisp.

Function: gamma-medium (x)

Return gamma(x), |x| <= 13, x negative integer produces div by 0

Package

special-functions.

Source

gamma.lisp.

Function: gamma-p-derivative (a x)

Partial derivative with respect to x of the incomplete gamma function

Package

special-functions.

Source

gamma.lisp.

Function: inverse-error (p q)

Return value of inverse error function: erf_inv(p) if p <= 0.5, erfc_inv(q) otherwise

Package

special-functions.

Source

erf.lisp.

Function: p-taylor (a x dax)

Temme/Gautschi code for P(a,x), dax = x^a*exp(-x)/gamma(a+1) Returns (values p q)

Package

special-functions.

Source

gamma.lisp.

Function: pq-asymptotic (a x)

Incomplete gamma functions for large A and A near X

Package

special-functions.

Source

gamma.lisp.

Function: q-fraction (a x dax)

Continued fraction for Q(a,x)

Package

special-functions.

Source

gamma.lisp.

Function: q-gamma-half (a x)

Calculates normalised Q when a is a half-integer for a < min(30, x+1)

Package

special-functions.

Source

gamma.lisp.

Function: q-gamma-integer (a x)

Return Q(a,x) when A is an integer, A < min(30,x+1)

Package

special-functions.

Source

gamma.lisp.

Function: q-taylor (a x)

Temme/Gautschi code for Q(a,x) when x < 1

Package

special-functions.

Source

gamma.lisp.

Function: ramanujan (x)

Ramanujan’s original approximation of n!

Package

special-functions.

Source

factorial.lisp.

Function: sam-ramanujan (x)

Modification of Ramanujan’s approximation of n! by Sidney A. Morris

Package

special-functions.

Source

factorial.lisp.

Function: sign-gamma (x)

Return sign(gamma(x)), invalid for 0 or negative integer

Package

special-functions.

Source

gamma.lisp.

Function: sin-pi (x)

Returns (sin (* pi x))

Package

special-functions.

Source

utils.lisp.

Function: stirling (x)

Return gamma(x) for x > 13

Package

special-functions.

Source

gamma.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   D   E   F   G   I   L   P   Q   R   S   U  
Index Entry  Section

D
decode-float64: Private ordinary functions

E
encode-float64: Private ordinary functions
erf: Public ordinary functions
erfc: Public ordinary functions
erfc-scaled: Private ordinary functions

F
factorial: Public ordinary functions
Function, decode-float64: Private ordinary functions
Function, encode-float64: Private ordinary functions
Function, erf: Public ordinary functions
Function, erfc: Public ordinary functions
Function, erfc-scaled: Private ordinary functions
Function, factorial: Public ordinary functions
Function, gamma: Public ordinary functions
Function, gamma-aux: Private ordinary functions
Function, gamma-inverse-small: Private ordinary functions
Function, gamma-medium: Private ordinary functions
Function, gamma-p-derivative: Private ordinary functions
Function, incomplete-gamma: Public ordinary functions
Function, inverse-erf: Public ordinary functions
Function, inverse-erfc: Public ordinary functions
Function, inverse-error: Private ordinary functions
Function, lanczos-sum: Public ordinary functions
Function, log-gamma: Public ordinary functions
Function, lower-incomplete-gamma: Public ordinary functions
Function, p-taylor: Private ordinary functions
Function, pq-asymptotic: Private ordinary functions
Function, q-fraction: Private ordinary functions
Function, q-gamma-half: Private ordinary functions
Function, q-gamma-integer: Private ordinary functions
Function, q-taylor: Private ordinary functions
Function, ramanujan: Private ordinary functions
Function, regularised-gamma-prefix: Public ordinary functions
Function, sam-ramanujan: Private ordinary functions
Function, sign-gamma: Private ordinary functions
Function, sin-pi: Private ordinary functions
Function, stirling: Private ordinary functions
Function, upper-incomplete-gamma: Public ordinary functions

G
gamma: Public ordinary functions
gamma-aux: Private ordinary functions
gamma-inverse-small: Private ordinary functions
gamma-medium: Private ordinary functions
gamma-p-derivative: Private ordinary functions

I
incomplete-gamma: Public ordinary functions
inverse-erf: Public ordinary functions
inverse-erfc: Public ordinary functions
inverse-error: Private ordinary functions

L
lanczos-sum: Public ordinary functions
log-gamma: Public ordinary functions
lower-incomplete-gamma: Public ordinary functions

P
p-taylor: Private ordinary functions
pq-asymptotic: Private ordinary functions

Q
q-fraction: Private ordinary functions
q-gamma-half: Private ordinary functions
q-gamma-integer: Private ordinary functions
q-taylor: Private ordinary functions

R
ramanujan: Private ordinary functions
regularised-gamma-prefix: Public ordinary functions

S
sam-ramanujan: Private ordinary functions
sign-gamma: Private ordinary functions
sin-pi: Private ordinary functions
stirling: Private ordinary functions

U
upper-incomplete-gamma: Public ordinary functions