ó
¡¼™\c           @  s\   d  d l  m Z m Z d  d l m Z m Z d  d l m Z m Z d e f d „  ƒ  YZ	 d S(   iÿÿÿÿ(   t   print_functiont   division(   t   Functiont   ArgumentIndexError(   t   gammat   digammat   betac           B  sM   e  Z d  Z d Z e Z d „  Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z RS(   s1	  
    The beta integral is called the Eulerian integral of the first kind by
    Legendre:

    .. math::
        \mathrm{B}(x,y) := \int^{1}_{0} t^{x-1} (1-t)^{y-1} \mathrm{d}t.

    Beta function or Euler's first integral is closely associated with gamma function.
    The Beta function often used in probability theory and mathematical statistics.
    It satisfies properties like:

    .. math::
        \mathrm{B}(a,1) = \frac{1}{a} \\
        \mathrm{B}(a,b) = \mathrm{B}(b,a)  \\
        \mathrm{B}(a,b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}

    Therefore for integral values of a and b:

    .. math::
        \mathrm{B} = \frac{(a-1)! (b-1)!}{(a+b-1)!}

    Examples
    ========

    >>> from sympy import I, pi
    >>> from sympy.abc import x,y

    The Beta function obeys the mirror symmetry:

    >>> from sympy import beta
    >>> from sympy import conjugate
    >>> conjugate(beta(x,y))
    beta(conjugate(x), conjugate(y))

    Differentiation with respect to both x and y is supported:

    >>> from sympy import beta
    >>> from sympy import diff
    >>> diff(beta(x,y), x)
    (polygamma(0, x) - polygamma(0, x + y))*beta(x, y)

    >>> from sympy import beta
    >>> from sympy import diff
    >>> diff(beta(x,y), y)
    (polygamma(0, y) - polygamma(0, x + y))*beta(x, y)

    We can numerically evaluate the gamma function to arbitrary precision
    on the whole complex plane:

    >>> from sympy import beta
    >>> beta(pi,pi).evalf(40)
    0.02671848900111377452242355235388489324562

    >>> beta(1+I,1+I).evalf(20)
    -0.2112723729365330143 - 0.7655283165378005676*I

    See Also
    ========

    sympy.functions.special.gamma_functions.gamma: Gamma function.
    sympy.functions.special.gamma_functions.uppergamma: Upper incomplete gamma function.
    sympy.functions.special.gamma_functions.lowergamma: Lower incomplete gamma function.
    sympy.functions.special.gamma_functions.polygamma: Polygamma function.
    sympy.functions.special.gamma_functions.loggamma: Log Gamma function.
    sympy.functions.special.gamma_functions.digamma: Digamma function.
    sympy.functions.special.gamma_functions.trigamma: Trigamma function.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Beta_function
    .. [2] http://mathworld.wolfram.com/BetaFunction.html
    .. [3] http://dlmf.nist.gov/5.12
    i   c         C  s„   |  j  \ } } | d k r@ t | | ƒ t | ƒ t | | ƒ S| d k rq t | | ƒ t | ƒ t | | ƒ St |  | ƒ ‚ d  S(   Ni   i   (   t   argsR   R   R   (   t   selft   argindext   xt   y(    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   fdiffX   s    %%c         C  s   d  S(   N(    (   t   clsR
   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   evalc   s    c         K  s1   |  j  \ } } t | ƒ t | ƒ t | | ƒ S(   N(   R   R   (   R   t   hintsR
   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   _eval_expand_funcg   s    c         C  s   |  j  d j o |  j  d j S(   Ni    i   (   R   t   is_real(   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   _eval_is_realk   s    c         C  s*   |  j  |  j d j ƒ  |  j d j ƒ  ƒ S(   Ni    i   (   t   funcR   t	   conjugate(   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   _eval_conjugaten   s    (   t   __name__t
   __module__t   __doc__t   nargst   Truet
   unbranchedR   t   classmethodR   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyR   
   s   J			N(
   t
   __future__R    R   t   sympy.core.functionR   R   t'   sympy.functions.special.gamma_functionsR   R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/special/beta_functions.pyt   <module>   s   