~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to share/specfunctions/gamma.mac

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/* This batch contains a function which returns an asymptotic expansion of
3
 
        the GAMMA function truncated to N terms, in the variable Z.
4
 
        Just say ASYMPGAMMA(Z,N); 
5
 
   It also contains a function which computes the asymptotic expansion of
6
 
        GAMMA(z+a)/GAMMA(z+b). */
7
 
 
8
 
REMARRAY(%GAMA1,%GAMA)$
9
 
%GAMA1[1]:1$
10
 
%GAMA1[N]:=%GAMA1[N-1]/(N+1)-(1/2)*SUM(%GAMA1[R]*%GAMA1[-R+N+1],R,2,N-1)$
11
 
        /*The above array contains the a[n] as defined in Copson.*/
12
 
%GAMA[0]:1$
13
 
%GAMA[K]:=LAMBDA([FACTLIM],(2*K+1)*2^(1-K)*(2*K-1)!*%GAMA1[2*K+1]/(K-1)!)(-1)$
14
 
 
15
 
ASYMPGAMMA(Z,N):=(Z/%E)^Z*SQRT(2*%PI/Z)*
16
 
SUM(apply('EV,[%GAMA[K]])*Z^(-K),K,0,N)$
17
 
 
18
 
/* The following program computes the asymptotic expansion for
19
 
        GAMMA(z-a)/GAMMA(z-b).  Just call GAMMAR(z,a,b). */
20
 
 
21
 
GAMMAR(ZVAR,AVAR,BVAR,N):=BLOCK([A,B,W,T1,T2,T3,T4,T5,T6,T7,T8,T9,answer],
22
 
T1:     TAYLOR((1/W+A-1/2)*LOG(W*A+1),W,0,N),
23
 
T2:     TAYLOR(T1-subst(a=b,T1),W,0,N)+B-A,
24
 
T3:     TAYLOR(%E^T2,W,0,N),
25
 
T4:     SUM(%GAMA[K]*(A+1/W)^(-K),K,0,N),
26
 
T5:     TAYLOR(LOG(T4),W,0,N),
27
 
T7:     TAYLOR(T5-subst(a=b,T5),W,0,N),
28
 
T8:     TAYLOR(%E^T7,W,0,N),
29
 
T9:     T3*T8,
30
 
ANSWER: ZVAR^(AVAR-BVAR)*
31
 
subst([A=AVAR,B=BVAR,W=1/ZVAR],RATDISREP(T9)))$