Gamma Function

Author

Eric W. Weisstein
August 20, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/SpecialFunctions/GammaFunction.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GammaFunction.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Plots

<<Utilities`Plot`

Real Axis

PlotDiscontinuous[Gamma[z],{z,-5,-4,-3,-2,-1,0,5},
PlotRange->{{-5.02,4},{-5,5}},
VerticalAsymptotes->Range[-5,0],
PlotStyle->Red,
AxesLabel->TraditionalForm/@{x,Gamma[x]}]

ComplexPlot3D[Gamma[z],{z,-5,5},PlotPoints->100,ClipFill->None,Mesh->False]//Timing

ComplexContourPlot[Gamma[z],{z,-5,5}]//Timing

Products

(1/(z exp(ℽ z) (∏_r^∞)((z/r)+1) exp(-(z/r))))==Γ(z)

Weierstrass form

(((z Exp[EulerGamma z]Product[(1+(z/r))Exp[-z/r],{r,∞}]))^(-1))

FullSimplify[%]

(1/z)(∏_n^∞)(((((1/n)+1))^z)/((z/n)+1))==Γ(z)

Euler Limit Form

V6

expr1=Exp[z(Sum[1/k,{k,1,m}]-Log[m])]

Limit[FunctionExpand[expr1],m->∞]

expr2=Product[(1+(z/n))Exp[-z/n],{n,m}]

Limit[expr2,m->∞]

expr=FullSimplify[z FunctionExpand[expr1 expr2]]

Limit[expr,m->∞]

FullSimplify[(1/z)Product[(((1+(1/n)))^z)(((1+(z/n)))^(-1)),{n,∞}]]

Product[(((1+(1/n)))^z)(((1+(z/n)))^(-1)),{n,4}]

Limit[((n!)/(Pochhammer[z,n+1]))(((n+1))^z),n->∞]

Limit[(((n-1)!)/(Pochhammer[z,n]))(n^z),n->∞]

V7

(1/z)Product[(((1+(1/n)))^z)(((1+(z/n)))^(-1)),{n,∞}]

FullSimplify[%]

FullSimplify[(1/z)Product[(((1+(1/n)))^z)(((1+(z/n)))^(-1)),{n,k}],k∈Integers&&k>0]

Limit[(((((1+k))^z) k! Gamma[z])/(Gamma[1+k+z])),k->∞]

Limit[((n!)/(Pochhammer[z,n+1]))(((n+1))^z),n->∞]

Limit[(((n-1)!)/(Pochhammer[z,n]))(n^z),n->∞]

(2^(2 z)) (∏_(m=1)^∞)(1/(Sqrt[π])) Γ((2^(-m)) z+(1/2))==Γ(z+1)

Knar's Formula

V6

k[v_]:=2^(2v) Product[Pi^(-1/2)Gamma[1/2+2^(-m) v],{m,Infinity}]

Plot[k[v],{v,.01,2}]

Plot[Gamma[1+v],{v,.01,2}]

Plot[k[v]-Gamma[1+v],{v,.01,2}]

V7

2^(2v) Product[Pi^(-1/2)Gamma[1/2+2^(-m) v],{m,Infinity}]//InputForm

Subtract@@@Table[{2^(2v) Product[Pi^(-1/2)Gamma[1/2+2^(-m) v],{m,200}],Gamma[v+1]}/.v->RandomComplex[],{100}]//Chop//Union

(∏_(n=0)^∞)(1+(ℽ/(n+x))) (e^(-(y/(n+x))))==(((e^(y (ψ^((0)))(x))) Γ(x))/(Γ(x+ℽ)))

Mellin's Formula

V6

Product[(1+EulerGamma/(n+x))Exp[-y/(n+x)],{n,0,Infinity}]

V7

Product[(1+EulerGamma/(n+x))Exp[-y/(n+x)],{n,0,Infinity}]//InputForm

(∏_(n=1)^2)Γ((n/3))==((2 π)/(Sqrt[3]))

Product[Gamma[n/3],{n,1,2}]//FullSimplify

(∏_(n=1)^3)Γ((n/3))==((2 π)/(Sqrt[3]))

Product[Gamma[n/3],{n,1,3}]//FullSimplify

(∏_(n=1)^4)Γ((n/3))==((2 π Γ((4/3)))/(Sqrt[3]))

Product[Gamma[n/3],{n,1,4}]//FullSimplify

(∏_(n=1)^8)Γ((n/3))==((640 (π^3))/(2187 (Sqrt[3])))

Product[Gamma[n/3],{n,1,8}]//FullSimplify

(∏_(k=1)^∞)(((x^2)/(((k+n))^2))+1)==(((Γ(n+1))^2)/(Γ(n-i x+1) Γ(n+i x+1)))

Product[1+((x^2)/(((n+k))^2)),{k,1,∞}]

(∏_(k=1)^∞)((((((m+n)/(k+m))))^3)+1)(∏_(k=1)^∞)((((((m+n)/(k+n))))^3)+1)==((((Γ(m+1))^3) ((Γ(n+1))^3) (cosh((Sqrt[3]) π (m+n))-cos(π (m-n))))/(2 (π^2) ((m^2)+m n+(n^2)) Γ(2 m+n+1) Γ(m+2 n+1)))

Product[1+(((((m+n)/(k+m))))^3),{k,1,∞}]Product[1+(((((m+n)/(k+n))))^3),{k,1,∞}]//FullSimplify

(∏_(k=1)^∞)(((((n/k)))^3)+1)(∏_(k=1)^∞)(3 ((((n/(2 k+n))))^2)+1)==((((Γ((n/2)))^2) (cosh((Sqrt[3]) π n)-cos(π n)))/(8 (π^2) Γ(n+1)))

Product[1+((((n/k)))^3),{k,1,∞}]Product[1+3((((n/(n+2k))))^2),{k,1,∞}]

FullSimplify[%,n∈Integers&&n>0]

<<Utilities`Simplify`

GammaSimplify[%192]

Sums

z (e^(ℽ z-(∑_(k=2)^∞)(((((-1))^k) ζ(k) (z^k))/k)))==(1/(Γ(z)))

1/Γ(x) (Fransen-Robinson)

V5.2

FullSimplify[z Exp[EulerGamma z-Sum[(-1)^k Zeta[k]z^k/k,{k,2,Infinity}]]]

V6

FullSimplify[z Exp[EulerGamma z-Sum[(-1)^k Zeta[k]z^k/k,{k,2,Infinity}]]]

V7

z Exp[EulerGamma z-Sum[(-1)^k Zeta[k]z^k/k,{k,2,Infinity}]]

FullSimplify[%]

(1/z)(e^((∑_k^∞)(((((-1))^k) (z^k))/k)-ℽ z))==Γ(z)

(1/z)Exp[Sum[((((-1))^k)/k)Piecewise[{{EulerGamma,k==1}},Zeta[k]](z^k),{k,∞}]]

FullSimplify[%]

FullSimplify[%-Gamma[z]]//InputForm

Union[
  Chop[Table[(E^((-EulerGamma)*(1/2 + z + Zeta[0, 1 + z]) + Derivative[1, 0][Zeta][0, 1 + z])*
        Sqrt[2*Pi])/z - Gamma[z] /. z -> RandomComplex[], {20}]]]

(1/z)Exp[-EulerGamma z+Sum[((((-1))^k)/k)Zeta[k](z^k),{k,2,∞}]]//InputForm

Chop[{E^((-EulerGamma)*z + (1/2)*(-EulerGamma + Log[2] + Log[Pi] - 
         2*EulerGamma*Zeta[0, 1 + z] + 2*Derivative[1, 0][Zeta][0, 1 + z]))/z, Gamma[z]} /. 
   z -> -3/2.]

FullSimplify[%%]//InputForm

Chop[{(E^((-EulerGamma)*(1/2 + z + Zeta[0, 1 + z]) + Derivative[1, 0][Zeta][0, 1 + z])*
      Sqrt[2*Pi])/z, Gamma[z]} /. z -> -3/2.]

Chop[{(E^((-EulerGamma)*(1/2 + z + Zeta[0, 1 + z]) + Derivative[1, 0][Zeta][0, 1 + z])*
       Sqrt[2*Pi])/z, Gamma[z]} /. Zeta :> HurwitzZeta /. z -> -3/2.]

(∑_n^∞)(ln((z/n)+1)-(z/n))+ln(z)+ℽ z==-ln(Γ(z))

Log[z]+EulerGamma z+Sum[Log[1+(z/n)]-(z/n),{n,∞}]

-((Γ'(z))/(Γ(z)))==(∑_n^∞)((1/(n ((z/n)+1)))-(1/n))+(1/z)+ℽ==-(ψ^((0)))(z)

(1/z)+EulerGamma+Sum[((1/n)/(1+(z/n)))-(1/n),{n,∞}]

FullSimplify[(1/z)-PolyGamma[0,1+z]]

-Gamma'[z]/Gamma[z]//FullSimplify

FullSimplify[Subtract@@{(1/z)-PolyGamma[0,1+z],-PolyGamma[0,z]}]

-Γ(z) ((∑_n^∞)((1/(n+z))-(1/n))+(1/z)+ℽ)==Γ(z) (ψ^((0)))(z)

-Gamma[z]((1/z)+EulerGamma+Sum[(1/(n+z))-(1/n),{n,∞}])

FullSimplify[%]

FullSimplify[((Gamma[z] (-1+z PolyGamma[0,1+z]))/z)-PolyGamma[0,z]Gamma[z]]

Gamma'[z]

(∑_(n=0)^∞)(8 n+1) (((((Γ(n+(1/4)))/(Γ((1/4)) n!))))^4)==((2^(3/2))/((Sqrt[π]) ((Γ((3/4)))^2)))

Ramanujan's 1st Sum

Formulate

Product[4k-3,{k,n}]/Product[4k,{k,n}]

FullSimplify[%]

FullSimplify[Table[%,{n,0,3}]]

V6

s=FullSimplify[Sum[(8n+1)(((Gamma[(1/4)+n])/(n! Gamma[(1/4)])))^4,{n,0,∞}]]

N[{HypergeometricPFQ[{(1/4),(1/4),(1/4),(1/4)},{1,1,1},1]+(1/32) HypergeometricPFQ[{(5/4),(5/4),(5/4),(5/4)},{2,2,2},1],2^(3/2)/Sqrt[Pi]/Gamma[3/4]^2},25]

N[{HypergeometricPFQ[{(1/4),(1/4),(1/4),(1/4)},{1,1,1},1]+(1/32) HypergeometricPFQ[{(5/4),(5/4),(5/4),(5/4)},{2,2,2},1],2^(3/2)/Sqrt[Pi]/Gamma[3/4]^2},25]

V7

s=FullSimplify[Sum[(8n+1)(((Gamma[(1/4)+n])/(n! Gamma[(1/4)])))^4,{n,0,∞}]]

FullSimplify[%]

TimeConstrained[N[HypergeometricPFQ[{(1/4),(1/4),(1/4),(1/4),(9/8)},{(1/8),1,1,1},1]],60]//Timing

FunctionExpand[%]

FullSimplify[%]

TimeConstrained[N[HypergeometricPFQ[{(1/4),(1/4),(1/4),(1/4)},{1,1,1},1]+(1/32) HypergeometricPFQ[{(5/4),(5/4),(5/4),(5/4)},{2,2,2},1]],60]//Timing

N[%]

2^(3/2)/Sqrt[Pi]/Gamma[3/4]^2

(∑_(k=0)^∞)(((-1))^k) (4 k+1) ((((((2 k-1)!!)/((2 k)!!))))^5)==(2/((Γ((3/4)))^4))

Ramanujan's 2nd Sum

V6

Sum[(-1)^k(4k+1)((2k-1)!!/(2k)!!)^5,{k,0,∞}]

N[{Sum[(-1)^k(4k+1)((2k-1)!!/(2k)!!)^5,{k,0,∞}],2/Gamma[3/4]^4},20]

factorial[n_,k_]:=Product[i k,{i,n/k}]/;GCD[k,n]!=1
factorial[n_,k_]:=Product[n-i k,{i,0,Floor[n/k]}]

Product[i k,{i,n/k}]

FullSimplify[factorial[n,k] ]

factorial[n_,k_]:=With[{r=n/k},k^r r!] /;GCD[k,n]>1
factorial[n_,k_]:=(((-k))^(1+Floor[(n/k)])) Pochhammer[-(n/k),1+Floor[(n/k)]]

FullSimplify[factorial[4k-3,4]^4/factorial[4k,4]^4(8k+1)  /. Floor[-3/4+k]->k-1 /. Floor[k]->k]

f[k]:=(1/256) (1+8 k) ((Gamma[-k])^4) ((Pochhammer[(3/4)-k,k])^4)

Table[f[k],{k,0,5}]

Sum[f[k],{k,0,Infinity}]

Sum[f[k],{k,0,500}]//N

N[2^(3/2)/Sqrt[Pi]/Gamma[3/4]^2]

g[k_]:=(-1)^k(4k+1)((2k-1)!!/(2k)!!)^5

FullSimplify[g[k]]

Sum[g[k],{k,0,Infinity}]

NSum[g[k],{k,0,Infinity}]

2/(Gamma[3/4])^4//N

V7

Sum[(-1)^k(4k+1)((2k-1)!!/(2k)!!)^5,{k,0,∞}]

FullSimplify[%]

N[%]

2/Gamma[3/4]^4//N

Series

Γ(z+1)==((((2 π))^(1/2)) (Sqrt[z])+(((1/6) ((((1/2) π))^(1/2)))/(Sqrt[z]))+(((1/144) ((((1/2) π))^(1/2)))/(z^(3/2)))+((-(139/25920) ((((1/2) π))^(1/2)))/(z^(5/2)))+((-(571/1244160) ((((1/2) π))^(1/2)))/(z^(7/2)))+O(((((1/z)))^(9/2)))) exp((-ln((1/z))-1) z+O(((((1/z)))^5)))

V5

Series[Gamma[z+1],{z,∞,7}]/(Exp[-z]z^(z+1/2)Sqrt[2π])

V7

Series[Gamma[z+1],{z,∞,4}]

ln(Γ(z))==z (-ln((1/z))-1)+((1/2) ln((1/z))+(1/2) ln(2 π))+((1/12)/z)+((-(1/360))/(z^3))+O(((((1/z)))^5))

V5

Series[Log[Gamma[z]],{z,∞,5}]

V7

Series[Log[Gamma[z]],{z,∞,5}]

logΓ(z)==z (-ln((1/z))-1)+(1/2) (ln((1/z))+ln(2 π))+((1/12)/z)+((-(1/360))/(z^3))+((1/1260)/(z^5))+O(((((1/z)))^6))

V6

Series[LogGamma[z],{z,∞,5}]

V7

Series[LogGamma[z],{z,∞,5}]

((Γ((1/2)+J))/(Γ(J)))==(Sqrt[J])+((-(1/8))/(Sqrt[J]))+((1/128)/(J^(3/2)))+((5/1024)/(J^(5/2)))+((-(21/32768))/(J^(7/2)))+((-(399/262144))/(J^(9/2)))+((869/4194304)/(J^(11/2)))+O(((((1/J)))^6))

V7

Series[((Gamma[J+(1/2)])/(Gamma[J])),{J,∞,7}]

Table[Binomial[2n-1/2,-1/2],{n,0,10}]

Numerator[{1,(3/8),(35/128),(231/1024),(6435/32768),(46189/262144),(676039/4194304),(5014575/33554432),(300540195/2147483648)}]/{1,1,1,5,21,399,869,39325,334477}

Special Values

Complementary Values

<<Utilities`Simplify`

FullSimplify[GammaSimplify/@{Gamma[2/3],Gamma[3/4],Gamma[3/5],Gamma[4/5]}]

Γ'(1)==-ℽ

Gamma'[1]

Γ'(n)==Γ(n) (ψ^((0)))(n)

Gamma'[n]//FullSimplify

-(n-1)!((1/n)+EulerGamma-Sum[(1/k),{k,n}])

FullSimplify[%]

FullSimplify[%-Gamma[n] PolyGamma[0,n]]

Γ((1/2))==(Sqrt[π])

Gamma[1/2]

Rational

Gamma[2/3]//FunctionExpand

Identities

Γ(z) Γ(-z)==-((π csc(π z))/z)

FunctionExpand[Gamma[z]Gamma[-z]]

Γ(z) Γ(1-z)==π csc(π z)

FunctionExpand[Gamma[z]Gamma[1-z]]

((|(i x)!|)^2)==π x csch(π x)

FullSimplify[FunctionExpand[Abs[(I x)!]^2],x∈Reals]

Γ(n-i x+1) Γ(n+i x+1)

FullSimplify[FunctionExpand[Abs[(n+I x)!]^2],x∈Reals&&n∈Integers&&n>0]

((Γ'(1))/(Γ(1)))-((Γ'((1/2)))/(Γ((1/2))))==2 ln(2)

FullSimplify[Gamma'[1]/Gamma[1]-Gamma'[1/2]/Gamma[1/2]]

Continued Fraction

{((3^2)/((3^2)-1)),((3^2)/((3^2)-1+(((5^2)-1)/(5^2)))),((3^2)/((3^2)-1+(((5^2)-1)/((5^2)+((7^2)/((7^2)-1)))))),((3^2)/((3^2)-1+(((5^2)-1)/((5^2)+((7^2)/((7^2)-1+(((9^2)-1)/(9^2))))))))}

Table[ContinuedFractionK[If[Mod[n,2]==1,(2n+1)^2,(2n+1)^2-1],If[Mod[n,2]==0,(2n+1)^2,(2n+1)^2-1],{n,k}],{k,4}]

N[ContinuedFractionK[If[Mod[n,2]==1,(2n+1)^2,(2n+1)^2-1],If[Mod[n,2]==0,(2n+1)^2,(2n+1)^2-1],{n,1100}],20]

((3^2)/((3^2)-1+(((5^2)-1)/((5^2)+((7^2)/((7^2)-1+(((9^2)-1)/(9^2))))))))//N

N[((Gamma[1/4])^4)/(16(π^2)),20]

Magnus and Obinghettinger are wrong...

N[ContinuedFractionK[If[Mod[n,2]==1,(2n+1)^2,(2n+1)^2-1],If[Mod[n,2]==1,(2n+1)^2,(2n+1)^2-1],{n,1100}],20]

1/%

N[ContinuedFractionK[If[Mod[n,2]==0,(2n+1)^2,(2n+1)^2-1],If[Mod[n,2]==0,(2n+1)^2,(2n+1)^2-1],{n,1100}],20]

1/%

N[ContinuedFractionK[If[Mod[n,2]==0,(2n+1)^2,(2n+1)^2-1],If[Mod[n,2]==1,(2n+1)^2,(2n+1)^2-1],{n,1100}],20]

1/%

1/Γ(x) (Fransen-Robinson)

FullSimplify[z Exp[EulerGamma z-Sum[(-1)^k Zeta[k]z^k/k,{k,2,Infinity}]]]

FullSimplify[Series[1/Gamma[z],{z,0,5}]]

FullSimplify[Series[1/Gamma[z],{z,0,4}]]

a[n_]:=Coefficient[FullSimplify[Normal[Series[1/Gamma[z],{z,0,n}]]],z,n]

Table[a[n],{n,3}]

%//N

b[n_]:=n a[n]-a[2]a[n-1]+Sum[(-1)^k Zeta[k]a[n-k],{k,2,n}]

Simplify[Table[a[n]-b[n],{n,6}]]

Show[GraphicsArray[{
			Plot[Gamma[x],{x,0,5},DisplayFunction->Identity],
		Plot[1/Gamma[x],{x,0,10},DisplayFunction->Identity]
		}],DisplayFunction->$DisplayFunction]

Integrate[1/Gamma[x],{x,0,Infinity}]

NIntegrate[1/Gamma[x],{x,0,Infinity}]

Minimum

D[Gamma[x],x]

FindRoot[PolyGamma[0,x]==0,{x,1.46},WorkingPrecision->30]

FindMinimum[Gamma[x],{x,1},AccuracyGoal->Infinity,PrecisionGoal->200,WorkingPrecision->250]

f[p_,w_,d_]:=Take[RealDigits[FindMinimum[Gamma[x],{x,1},AccuracyGoal->Infinity,PrecisionGoal->p,WorkingPrecision->w][[-1,-1,-1]]][[1]],d]

f[200,250,100]-f[250,300,100]

NMinimize

NMinimize[{Gamma[x],0<x<4},x]

Minimize

Minimize[{Gamma[x],x>0},x]

Minimize[{Gamma[x],0<x<4},x]

Minimize[{Gamma[x],1/100<x<4},x]

Reduce

Reduce[Gamma'[x]==0&&x>0,x,Reals]

Refine[Gamma'[x]>0,x>4]

V7

Reduce[Gamma'[x]==0&&0<x<4,x]

Reduce[Gamma'[x]==0&&1/10<x<4,x]

Poles

Table[Residue[Gamma[z],{z,n}],{n,0,-5,-1}]

Table[Series[Gamma[z],{z,n,2}],{n,0,-5,-1}]//ColumnForm

Magnus and Oberhettinger

(∏_(k=1)^n)Γ((k/3))

FunctionExpand[Product[Gamma[k/3],{k,n}]]

FullSimplify[Table[Product[Gamma[n/3],{n,k}],{k,10}]]

FunctionExpand[%]//.Gamma[n_]:>(n-1)Gamma[n-1]/;n>1

Integrals

Ramanujan's Integral

Integrate[Cos[2z t]Sech[Pi t],{t,0,Infinity}]

Integrate[Cosh[2z t]Sech[Pi t],{t,0,Infinity}]

Quadratic Iteration for Γ(1/4)

x[0]:=(Sqrt[2])
y[1]:=(2^(1/4))
x[n_]:=(1/2)(((x[n-1])^(1/2))+((x[n-1])^(-1/2)))
y[n_]:=((y[n-1]((x[n-1])^(1/2))+((x[n-1])^(-1/2)))/(y[n-1]+1))

N[Table[2(((1+Sqrt[2]))^(3/4))((Product[((x[n])^(-1))(((((1+x[n])/(1+y[n]))))^3),{n,k}])^(1/4)),{k,5}]-Gamma[1/4],100]//N

N[Gamma[1/4],20]