/usr/share/doc/libghc-math-functions-doc/html/Numeric-SpecFunctions.html is in libghc-math-functions-doc 0.1.1.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Numeric.SpecFunctions</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Numeric-SpecFunctions.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Numeric-SpecFunctions.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">math-functions-0.1.1.0: Special functions and Chebyshev polynomials</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>bos@serpentine.com</td></tr><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Numeric.SpecFunctions</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Gamma function
</a></li><li><a href="#g:2">Beta function
</a></li><li><a href="#g:3">Logarithm
</a></li><li><a href="#g:4">Factorial
</a></li><li><a href="#g:5">Combinatorics
</a></li><li><a href="#g:6">References
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Special functions and factorials.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:logGamma">logGamma</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:logGammaL">logGammaL</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:incompleteGamma">incompleteGamma</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:invIncompleteGamma">invIncompleteGamma</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:logBeta">logBeta</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:incompleteBeta">incompleteBeta</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:incompleteBeta_">incompleteBeta_</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:invIncompleteBeta">invIncompleteBeta</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:log1p">log1p</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:log2">log2</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:factorial">factorial</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:logFactorial">logFactorial</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:stirlingError">stirlingError</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li><li class="src short"><a href="#v:choose">choose</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></li></ul></div><div id="interface"><h1 id="g:1">Gamma function
</h1><div class="top"><p class="src"><a name="v:logGamma" class="def">logGamma</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#logGamma" class="link">Source</a></p><div class="doc"><p>Compute the logarithm of the gamma function Γ(<em>x</em>). Uses
Algorithm AS 245 by Macleod.
</p><p>Gives an accuracy of 10–12 significant decimal digits, except
for small regions around <em>x</em> = 1 and <em>x</em> = 2, where the function
goes to zero. For greater accuracy, use <code><a href="Numeric-SpecFunctions.html#v:logGammaL">logGammaL</a></code>.
</p><p>Returns ∞ if the input is outside of the range (0 < <em>x</em>
≤ 1e305).
</p></div></div><div class="top"><p class="src"><a name="v:logGammaL" class="def">logGammaL</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#logGammaL" class="link">Source</a></p><div class="doc"><p>Compute the logarithm of the gamma function, Γ(<em>x</em>). Uses a
Lanczos approximation.
</p><p>This function is slower than <code><a href="Numeric-SpecFunctions.html#v:logGamma">logGamma</a></code>, but gives 14 or more
significant decimal digits of accuracy, except around <em>x</em> = 1 and
<em>x</em> = 2, where the function goes to zero.
</p><p>Returns ∞ if the input is outside of the range (0 < <em>x</em>
≤ 1e305).
</p></div></div><div class="top"><p class="src"><a name="v:incompleteGamma" class="def">incompleteGamma</a><a href="src/Numeric-SpecFunctions.html#incompleteGamma" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>s</em>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>x</em>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute the normalized lower incomplete gamma function
γ(<em>s</em>,<em>x</em>). Normalization means that
γ(<em>s</em>,∞)=1. Uses Algorithm AS 239 by Shea.
</p></div></div><div class="top"><p class="src"><a name="v:invIncompleteGamma" class="def">invIncompleteGamma</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#invIncompleteGamma" class="link">Source</a></p><div class="doc"><p>Inverse incomplete gamma function. It's approximately inverse of
<code><a href="Numeric-SpecFunctions.html#v:incompleteGamma">incompleteGamma</a></code> for the same <em>s</em>. So following equality
approximately holds:
</p><pre> invIncompleteGamma s . incompleteGamma s = id
</pre><p>For <code>invIncompleteGamma s p</code> <em>s</em> must be positive and <em>p</em> must be
in [0,1] range.
</p></div></div><h1 id="g:2">Beta function
</h1><div class="top"><p class="src"><a name="v:logBeta" class="def">logBeta</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#logBeta" class="link">Source</a></p><div class="doc"><p>Compute the natural logarithm of the beta function.
</p></div></div><div class="top"><p class="src"><a name="v:incompleteBeta" class="def">incompleteBeta</a><a href="src/Numeric-SpecFunctions.html#incompleteBeta" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>p</em> > 0
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>q</em> > 0
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>x</em>, must lie in [0,1] range
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Regularized incomplete beta function. Uses algorithm AS63 by
Majumder abd Bhattachrjee.
</p></div></div><div class="top"><p class="src"><a name="v:incompleteBeta_" class="def">incompleteBeta_</a><a href="src/Numeric-SpecFunctions.html#incompleteBeta_" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p>logarithm of beta function
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>p</em> > 0
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>q</em> > 0
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>x</em>, must lie in [0,1] range
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Regularized incomplete beta function. Same as <code><a href="Numeric-SpecFunctions.html#v:incompleteBeta">incompleteBeta</a></code>
but also takes logarithm of beta function as parameter.
</p></div></div><div class="top"><p class="src"><a name="v:invIncompleteBeta" class="def">invIncompleteBeta</a><a href="src/Numeric-SpecFunctions.html#invIncompleteBeta" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>p</em>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>q</em>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc"><p><em>a</em>
</p></td></tr><tr><td class="src">-> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Compute inverse of regularized incomplete beta function. Uses
initial approximation from AS109 and Halley method to solve equation.
</p></div></div><h1 id="g:3">Logarithm
</h1><div class="top"><p class="src"><a name="v:log1p" class="def">log1p</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#log1p" class="link">Source</a></p><div class="doc"><p>Compute the natural logarithm of 1 + <code>x</code>. This is accurate even
for values of <code>x</code> near zero, where use of <code>log(1+x)</code> would lose
precision.
</p></div></div><div class="top"><p class="src"><a name="v:log2" class="def">log2</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a><a href="src/Numeric-SpecFunctions.html#log2" class="link">Source</a></p><div class="doc"><p><em>O(log n)</em> Compute the logarithm in base 2 of the given value.
</p></div></div><h1 id="g:4">Factorial
</h1><div class="top"><p class="src"><a name="v:factorial" class="def">factorial</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#factorial" class="link">Source</a></p><div class="doc"><p>Compute the factorial function <em>n</em>!. Returns ∞ if the
input is above 170 (above which the result cannot be represented by
a 64-bit <code><a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a></code>).
</p></div></div><div class="top"><p class="src"><a name="v:logFactorial" class="def">logFactorial</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#logFactorial" class="link">Source</a></p><div class="doc"><p>Compute the natural logarithm of the factorial function. Gives
16 decimal digits of precision.
</p></div></div><div class="top"><p class="src"><a name="v:stirlingError" class="def">stirlingError</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#stirlingError" class="link">Source</a></p><div class="doc"><p>Calculate the error term of the Stirling approximation. This is
only defined for non-negative values.
</p><pre> stirlingError @n@ = @log(n!) - log(sqrt(2*pi*n)*(n/e)^n)
</pre></div></div><h1 id="g:5">Combinatorics
</h1><div class="top"><p class="src"><a name="v:choose" class="def">choose</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Data-Int.html#t:Int">Int</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.6.0.1/Prelude.html#t:Double">Double</a><a href="src/Numeric-SpecFunctions.html#choose" class="link">Source</a></p><div class="doc"><p>Compute the binomial coefficient <em>n</em> <code>`<code><a href="Numeric-SpecFunctions.html#v:choose">choose</a></code>`</code> <em>k</em>. For
values of <em>k</em> > 30, this uses an approximation for performance
reasons. The approximation is accurate to 12 decimal places in the
worst case
</p><p>Example:
</p><pre> 7 `choose` 3 == 35
</pre></div></div><h1 id="g:6">References
</h1><div class="doc"><ul><li> Lanczos, C. (1964) A precision approximation of the gamma
function. <em>SIAM Journal on Numerical Analysis B</em>
1:86–96. <a href="http://www.jstor.org/stable/2949767">http://www.jstor.org/stable/2949767</a>
</li><li> Loader, C. (2000) Fast and Accurate Computation of Binomial
Probabilities. <a href="http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf">http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf</a>
</li><li> Macleod, A.J. (1989) Algorithm AS 245: A robust and reliable
algorithm for the logarithm of the gamma function.
<em>Journal of the Royal Statistical Society, Series C (Applied Statistics)</em>
38(2):397–402. <a href="http://www.jstor.org/stable/2348078">http://www.jstor.org/stable/2348078</a>
</li><li> Shea, B. (1988) Algorithm AS 239: Chi-squared and incomplete
gamma integral. <em>Applied Statistics</em>
37(3):466–473. <a href="http://www.jstor.org/stable/2347328">http://www.jstor.org/stable/2347328</a>
</li><li> Majumder, K.L., Bhattacharjee, G.P. (1973) Algorithm AS 63: The
Incomplete Beta Integral. /Journal of the Royal Statistical
Society. Series C (Applied Statistics)/ Vol. 22, No. 3 (1973),
pp. 409-411. <a href="http://www.jstor.org/pss/2346797">http://www.jstor.org/pss/2346797</a>
</li><li> Majumder, K.L., Bhattacharjee, G.P. (1973) Algorithm AS 64:
Inverse of the Incomplete Beta Function Ratio. /Journal of the
Royal Statistical Society. Series C (Applied Statistics)/
Vol. 22, No. 3 (1973), pp. 411-414
<a href="http://www.jstor.org/pss/2346798">http://www.jstor.org/pss/2346798</a>
</li><li> Cran, G.W., Martin, K.J., Thomas, G.E. (1977) Remark AS R19
and Algorithm AS 109: A Remark on Algorithms: AS 63: The
Incomplete Beta Integral AS 64: Inverse of the Incomplete Beta
Function Ratio. /Journal of the Royal Statistical Society. Series
C (Applied Statistics)/ Vol. 26, No. 1 (1977), pp. 111-114
<a href="http://www.jstor.org/pss/2346887">http://www.jstor.org/pss/2346887</a>
</li></ul></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.13.2</p></div></body></html>
|