Nächste: , Vorige:   [Inhalt][Index]

72 stirling


Vorige: , Nach oben: stirling   [Inhalt][Index]

72.1 Functions and Variables for stirling

Function: stirling (z, n)
Function: stirling (z, n, pred)

Replace gamma(x) with the O(1/x^(2n-1)) Stirling formula. When n isn’t a nonnegative integer, signal an error. With the optional third argument pred, the Stirling formula is applied only when pred is true.

To use this function write first load("stirling").

Reference: Abramowitz & Stegun, "Handbook of mathematical functions", 6.1.40.

Examples:

(%i1) load ("stirling")$

(%i2) stirling(gamma(%alpha+x)/gamma(x),1);
       1/2 - x             x + %alpha - 1/2
(%o2) x        (x + %alpha)
                                   1           1
                            --------------- - ---- - %alpha
                            12 (x + %alpha)   12 x
                          %e
(%i3) taylor(%,x,inf,1);
                    %alpha       2    %alpha
          %alpha   x       %alpha  - x       %alpha
(%o3)/T/ x       + -------------------------------- + . . .
                                 2 x
(%i4) map('factor,%);
                                       %alpha - 1
         %alpha   (%alpha - 1) %alpha x
(%o4)   x       + -------------------------------
                                  2

The function stirling knows the difference between the variable ’gamma’ and the function gamma:

(%i5) stirling(gamma + gamma(x),0);
                                    x - 1/2   - x
(%o5)    gamma + sqrt(2) sqrt(%pi) x        %e
(%i6) stirling(gamma(y) + gamma(x),0);
                         y - 1/2   - y
(%o6) sqrt(2) sqrt(%pi) y        %e
                                              x - 1/2   - x
                         + sqrt(2) sqrt(%pi) x        %e

To apply the Stirling formula only to terms that involve the variable k, use an optional third argument; for example

(%i7) makegamma(pochhammer(a,k)/pochhammer(b,k));
                      gamma(b) gamma(k + a)
(%o7)                 ---------------------
                      gamma(a) gamma(k + b)

(%i8) stirling(%,1, lambda([s], not(freeof(k,s))));
        b - a                 k + a - 1/2        - k - b + 1/2
      %e      gamma(b) (k + a)            (k + b)
(%o8) --------------------------------------------------------
                              gamma(a)

The terms gamma(a) and gamma(b) are free of k, so the Stirling formula was not applied to these two terms.


Nächste: , Vorige:   [Inhalt][Index]