The SPECIAL-FUNCTIONS Reference Manual

The SPECIAL-FUNCTIONS Reference Manual

This is the SPECIAL-FUNCTIONS Reference Manual, version 1.2.0, generated automatically by Declt version 4.0b2.

Copyright © 2019-2022 Steve Nunez

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled “Copying” is included exactly as in the original.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be translated as well.

Table of Contents


Copying

This program is distributed under the terms of the Microsoft Public License.


1 Systems

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


1.1 special-functions

Special functions in Common Lisp

Long Name

Mathematical Special Functions

Author

Steve Nunez <steve@symbolics.tech>

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

Special functions written in common lisp with accuracy equal to Boost, Python and Cephes.

Version

1.2.0

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

special-functions.asd.

Child Components

2 Files

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


2.1 Lisp


2.1.1 special-functions/special-functions.asd

Source

special-functions.asd.

Parent Component

special-functions (system).

ASDF Systems

special-functions.


2.1.2 special-functions/pkgdcl.lisp

Source

special-functions.asd.

Parent Component

special-functions (system).

Packages

special-functions.


2.1.3 special-functions/utils.lisp

Dependency

pkgdcl.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Internals

2.1.4 special-functions/erf.lisp

Dependency

utils.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface
Internals

2.1.5 special-functions/gamma.lisp

Dependency

erf.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface
Internals

2.1.6 special-functions/lanczos.lisp

Dependency

gamma.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

2.1.7 special-functions/log-gamma.lisp

Dependency

lanczos.lisp (file).

Source

special-functions.asd.

Parent Component

special-functions (system).

Public Interface

log-gamma (function).


2.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

3 Packages

Packages are listed by definition order.


3.1 special-functions

Source

pkgdcl.lisp.

Nicknames
  • specfun
  • spfn
Use List
  • common-lisp.
  • let-plus.
  • num-utils.arithmetic.
  • num-utils.polynomial.
Used By List
  • distributions.
  • special-functions-tests.
Public Interface
Internals

3.2 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 Definitions

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


4.1 Public Interface


4.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.


4.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)

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.


4.2 Internals


4.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.


4.2.2 Special variables

Special Variable: boost-denominator
Package

lanczos.

Source

lanczos.lisp.

Special Variable: boost-numerator
Package

lanczos.

Source

lanczos.lisp.

Special Variable: boost-numerator-scaled
Package

lanczos.

Source

lanczos.lisp.

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.


4.2.3 Ordinary functions

Function: c-to-rat (int frac)
Package

lanczos.

Source

lanczos.lisp.

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: floatify-coefficients (coeff)
Package

lanczos.

Source

lanczos.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: rationalize-coefficients (coeff)
Package

lanczos.

Source

lanczos.lisp.

Function: regularised-gamma-prefix* (a x)

Return x^a * exp(-x) / gamma(a)

Package

special-functions.

Source

gamma.lisp.

Function: regularised-gamma-prefix- (a z)

Return (z^a)(e^-z)/gamma(a), the power term prefix, using Lanczos summation Most of the error occurs in this function

Package

special-functions.

Source

gamma.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:   C   D   E   F   G   I   L   P   Q   R   S   U  
Index Entry  Section

C
c-to-rat: Private ordinary functions

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
floatify-coefficients: Private ordinary functions
Function, c-to-rat: Private 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, floatify-coefficients: Private 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, rationalize-coefficients: Private ordinary functions
Function, regularised-gamma-prefix: Public ordinary functions
Function, regularised-gamma-prefix*: Private ordinary functions
Function, regularised-gamma-prefix-: Private 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
rationalize-coefficients: Private ordinary functions
regularised-gamma-prefix: Public ordinary functions
regularised-gamma-prefix*: Private ordinary functions
regularised-gamma-prefix-: Private 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

Jump to:   C   D   E   F   G   I   L   P   Q   R   S   U  

A.3 Variables

Jump to:   +  
B   C   F   G   L   M   N   S  
Index Entry  Section

+
+square-root-2-pi+: Private constants

B
boost-denominator: Private special variables
boost-numerator: Private special variables
boost-numerator-scaled: Private special variables

C
Constant, +square-root-2-pi+: Private constants
Constant, log-maximum-double-value: Private constants
Constant, log-minimum-double-value: Private constants
Constant, maxgamd: Private constants

F
factorial-table: Private special variables

G
g: Public special variables
g-1/2: Public special variables

L
lanczos-13-denominator: Private special variables
lanczos-13-numerator: Private special variables
lanczos-13-numerator-scaled: Private special variables
log-maximum-double-value: Private constants
log-minimum-double-value: Private constants

M
maxgamd: Private constants

N
n: Public special variables

S
Special Variable, boost-denominator: Private special variables
Special Variable, boost-numerator: Private special variables
Special Variable, boost-numerator-scaled: Private special variables
Special Variable, factorial-table: Private special variables
Special Variable, g: Public special variables
Special Variable, g-1/2: Public special variables
Special Variable, lanczos-13-denominator: Private special variables
Special Variable, lanczos-13-numerator: Private special variables
Special Variable, lanczos-13-numerator-scaled: Private special variables
Special Variable, n: Public special variables

Jump to:   +  
B   C   F   G   L   M   N   S