mathematica examples relevant to gamma and beta...

4
Mathematica examples relevant to Gamma and Beta functions Gamma function: Gamma[x] Check that the defining integral indeed gives Gamma function In[789]:= Integrate@x^ Hp - 1L Exp@- xD, 8x, 0, Infinity<, Assumptions Ø Re@pD > 0D Out[789]= Gamma@pD Check recursion relation (following quantity should equal 1) In[795]:= check@p_D = Gamma@pD p ê Gamma@p + 1D; In[797]:= Plot@check@pD, 8p, 0, 10<, PlotStyle Ø 8Red, Thick<D Out[797]= 2 4 6 8 10 0.0 0.5 1.5 2.0 Gamma[p] is indeed (p-1)! for integer p: In[778]:= 8Gamma@7D,6 !< Out[778]= 8720, 720< Plot shows the poles in the Gamma function on the real axis. In[779]:= Plot@Gamma@xD, 8x, - 3, 3<, PlotStyle Ø ThickD Out[779]= -3 -2 -1 1 2 3 -10 -5 5 10 Here’s a 3D plot of the absolute value of the Gamma function in the complex plane. Note that you can

Upload: hoangque

Post on 01-Nov-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Mathematica examples relevant to Gamma and Beta functionscourses.washington.edu/ph227814/228/W14/notes/Gamma.nb.pdf · Mathematica examples relevant to Gamma and Beta functions Gamma

Mathematica examples relevant to Gamma and Beta functions

Gamma function: Gamma[x]

Check that the defining integral indeed gives Gamma function

In[789]:= Integrate@x^Hp - 1L Exp@-xD, 8x, 0, Infinity<, Assumptions Ø Re@pD > 0D

Out[789]= Gamma@pD

Check recursion relation (following quantity should equal 1)

In[795]:= check@p_D = Gamma@pD p ê Gamma@p + 1D;

In[797]:= Plot@check@pD, 8p, 0, 10<, PlotStyle Ø 8Red, Thick<D

Out[797]=2 4 6 8 10

0.0

0.5

1.5

2.0

Gamma[p] is indeed (p-1)! for integer p:

In[778]:= 8Gamma@7D, 6!<

Out[778]= 8720, 720<

Plot shows the poles in the Gamma function on the real axis.

In[779]:= Plot@Gamma@xD, 8x, -3, 3<, PlotStyle Ø ThickD

Out[779]= -3 -2 -1 1 2 3

-10

-5

5

10

Here’s a 3D plot of the absolute value of the Gamma function in the complex plane. Note that you can rotate the view around.Note the poles at x=0, -1, -2, -3,...

Page 2: Mathematica examples relevant to Gamma and Beta functionscourses.washington.edu/ph227814/228/W14/notes/Gamma.nb.pdf · Mathematica examples relevant to Gamma and Beta functions Gamma

Here’s a 3D plot of the absolute value of the Gamma function in the complex plane. Note that you can rotate the view around.Note the poles at x=0, -1, -2, -3,...

In[780]:= Plot3D@Abs@Gamma@x + I yDD, 8x, -3, 3<,8y, -3, 3<, PlotRange Ø 8-1, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[780]=

This is the argument---a rather complicated plot!

In[781]:= Plot3D@Arg@Gamma@x + I yDD, 8x, -3, 3<, 8y, -3, 3<, AxesLabel Ø 8"Re", "Im"<D

Out[781]=

Here follows the real and imaginary parts---a more complicated structure emerges around the poles.

2 Gamma.nb

Page 3: Mathematica examples relevant to Gamma and Beta functionscourses.washington.edu/ph227814/228/W14/notes/Gamma.nb.pdf · Mathematica examples relevant to Gamma and Beta functions Gamma

In[782]:= Plot3D@Re@Gamma@x + I yDD, 8x, -3, 3<, 8y, -3, 3<,PlotRange Ø 8-10, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[782]=

In[783]:= Plot3D@Im@Gamma@x + I yDD, 8x, -3, 3<, 8y, -3, 3<,PlotRange Ø 8-10, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[783]=

For comparison a single pole

In[784]:= Plot3D@Abs@1 ê Hx + I yLD, 8x, -3, 3<, 8y, -3, 3<,PlotRange Ø 8-1, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[784]=

Here’s the real part , which is x/(x^2+y^2)

Gamma.nb 3

Page 4: Mathematica examples relevant to Gamma and Beta functionscourses.washington.edu/ph227814/228/W14/notes/Gamma.nb.pdf · Mathematica examples relevant to Gamma and Beta functions Gamma

In[785]:= Plot3D@Re@1 ê Hx + I yLD, 8x, -3, 3<, 8y, -3, 3<,PlotRange Ø 8-10, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[785]=

...and the imaginary part which is -y/(x^2+y^2)

In[786]:= Plot3D@Im@1 ê Hx + I yLD, 8x, -3, 3<, 8y, -3, 3<,PlotRange Ø 8-10, 10<, AxesLabel Ø 8"Re", "Im"<D

Out[786]=

Beta function: Beta[x,y]

The following integral defines Beta[x,y] for Re[p,q]>0Mathematica jumps directly to the expression for Beta in terms of Gamma functions

In[798]:= Integrate@x^Hp - 1L H1 - xL^Hq - 1L, 8x, 0, 1<D

Out[798]= ConditionalExpressionBGamma@pD Gamma@qD

Gamma@p + qD, Re@qD > 0 && Re@pD > 0F

Checking relation between Gamma and Beta functions

In[787]:= [email protected], .6D, [email protected] [email protected] ê [email protected] + .6D<

Out[787]= 82.7745, 2.7745<

11.7 #2

In[799]:= Integrate@Sqrt@Sin@xD^3 Cos@xDD, 8x, 0, Pi ê 2<D

Out[799]=p

4 2

4 Gamma.nb