ó
¡¼™\c           @  sè  d  d l  m Z m Z d  d l m Z d  d l m Z m Z m Z m	 Z	 m
 Z
 m Z m Z d  d l m Z m Z d  d l m Z d  d l m Z d  d l m Z d  d l m Z m Z m Z m Z d  d	 l m Z d  d
 l m Z m Z d  d l m  Z  m! Z! d  d l" m# Z# d  d l$ m% Z% d  d l& m' Z( d e f d „  ƒ  YZ) d e) f d „  ƒ  YZ* d e) f d „  ƒ  YZ+ d e) f d „  ƒ  YZ, d e) f d „  ƒ  YZ- d e) f d „  ƒ  YZ. d e) f d „  ƒ  YZ/ d „  Z0 d e) f d „  ƒ  YZ1 d  „  Z2 d! „  Z3 d" e1 f d# „  ƒ  YZ4 d$ e1 f d% „  ƒ  YZ5 d& e1 f d' „  ƒ  YZ6 d( e6 f d) „  ƒ  YZ7 d* e6 f d+ „  ƒ  YZ8 d, d- d. „ Z9 d/ e f d0 „  ƒ  YZ: d1 e: f d2 „  ƒ  YZ; d3 e: f d4 „  ƒ  YZ< d5 e: f d6 „  ƒ  YZ= d7 e: f d8 „  ƒ  YZ> d9 S(:   iÿÿÿÿ(   t   print_functiont   division(   t   wraps(   t   St   pit   It   Rationalt   Wildt   cacheitt   sympify(   t   Functiont   ArgumentIndexError(   t   Pow(   t   range(   t	   factorial(   t   sint   cost   csct   cot(   t   Abs(   t   sqrtt   root(   t   ret   im(   t   gamma(   t   hyper(   t   spherical_bessel_fnt
   BesselBasec           B  sb   e  Z d  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d d „ Z d „  Z	 d „  Z
 d „  Z RS(	   sî  
    Abstract base class for bessel-type functions.

    This class is meant to reduce code duplication.
    All Bessel type functions can 1) be differentiated, and the derivatives
    expressed in terms of similar functions and 2) be rewritten in terms
    of other bessel-type functions.

    Here "bessel-type functions" are assumed to have one complex parameter.

    To use this base class, define class attributes ``_a`` and ``_b`` such that
    ``2*F_n' = -_a*F_{n+1} + b*F_{n-1}``.
    c         C  s   |  j  d S(   s(    The order of the bessel-type function. i    (   t   args(   t   self(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   order.   s    c         C  s   |  j  d S(   s+    The argument of the bessel-type function. i   (   R   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   argument3   s    c         C  s   d  S(   N(    (   t   clst   nut   z(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   eval8   s    i   c         C  sh   | d k r t  |  | ƒ ‚ n  |  j d |  j |  j d |  j ƒ |  j d |  j |  j d |  j ƒ S(   Ni   i   (   R   t   _bt	   __class__R   R   t   _a(   R   t   argindex(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   fdiff<   s    $c         C  sD   |  j  } | j o | j t k r@ |  j |  j j ƒ  | j ƒ  ƒ Sd  S(   N(   R   t   is_realt   is_negativet   FalseR%   R   t	   conjugate(   R   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_conjugateB   s    	c         K  sî   |  j  |  j |  j } } } | j rê | d j r‡ |  j |  j | | d | ƒ j ƒ  d |  j | d | | d | ƒ j ƒ  | S| d j rê d |  j | d | | d | ƒ j ƒ  | |  j |  j | | d | ƒ j ƒ  Sn  |  S(   Ni   i   (	   R   R   R%   R)   t   is_positiveR&   R$   t   _eval_expand_funcR*   (   R   t   hintsR!   R"   t   f(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   G   s    	%/-)c         C  s   d d l  m } | |  ƒ S(   Niÿÿÿÿ(   t
   besselsimp(   t   sympy.simplify.simplifyR2   (   R   t   ratiot   measuret   rationalt   inverseR2   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_simplifyR   s    (   t   __name__t
   __module__t   __doc__t   propertyR   R   t   classmethodR#   R(   R-   R/   R8   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR      s   		t   besseljc           B  s\   e  Z d  Z e j Z e j Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(   s  
    Bessel function of the first kind.

    The Bessel `J` function of order `\nu` is defined to be the function
    satisfying Bessel's differential equation

    .. math ::
        z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
        + z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 - \nu^2) w = 0,

    with Laurent expansion

    .. math ::
        J_\nu(z) = z^\nu \left(\frac{1}{\Gamma(\nu + 1) 2^\nu} + O(z^2) \right),

    if :math:`\nu` is not a negative integer. If :math:`\nu=-n \in \mathbb{Z}_{<0}`
    *is* a negative integer, then the definition is

    .. math ::
        J_{-n}(z) = (-1)^n J_n(z).

    Examples
    ========

    Create a Bessel function object:

    >>> from sympy import besselj, jn
    >>> from sympy.abc import z, n
    >>> b = besselj(n, z)

    Differentiate it:

    >>> b.diff(z)
    besselj(n - 1, z)/2 - besselj(n + 1, z)/2

    Rewrite in terms of spherical Bessel functions:

    >>> b.rewrite(jn)
    sqrt(2)*sqrt(z)*jn(n - 1/2, z)/sqrt(pi)

    Access the parameter and argument:

    >>> b.order
    n
    >>> b.argument
    z

    See Also
    ========

    bessely, besseli, besselk

    References
    ==========

    .. [1] Abramowitz, Milton; Stegun, Irene A., eds. (1965), "Chapter 9",
           Handbook of Mathematical Functions with Formulas, Graphs, and
           Mathematical Tables
    .. [2] Luke, Y. L. (1969), The Special Functions and Their
           Approximations, Volume 1
    .. [3] https://en.wikipedia.org/wiki/Bessel_function
    .. [4] http://functions.wolfram.com/Bessel-TypeFunctions/BesselJ/
    c         C  sä  | j  r | j  r t j S| j r1 | j  t k s@ t | ƒ j rG t j St | ƒ j rl | j t	 k	 rl t j
 S| j r t j Sn  | t j k s | t j k r¤ t j S| j ƒ  rÐ | | | | t | | ƒ S| j r/| j ƒ  rt d ƒ | t | | ƒ S| j t ƒ } | r/t | t | | ƒ Sn  d d l m } m } | j rv| | ƒ } | | k r»t | | ƒ SnE | j ƒ  \ } } | d k r»| d | t | t ƒ t | | ƒ S| | ƒ } | | k ràt | | ƒ Sd  S(   Niÿÿÿÿ(   t
   unpolarifyt   expi    i   (   t   is_zeroR   t   Onet
   is_integerR+   R   R.   t   ZeroR*   t   Truet   ComplexInfinityt   is_imaginaryt   NaNt   Infinityt   NegativeInfinityt   could_extract_minus_signR>   t   extract_multiplicativelyR   t   besselit   sympyR?   R@   t   extract_branch_factorR   (   R    R!   R"   t   newzR?   R@   t   nt   nnu(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   ›   s<    		'	
 		'c         K  sD   d d l  m } m } | t t | d ƒ t | | t ƒ | ƒ S(   Niÿÿÿÿ(   t
   polar_liftR@   i   (   RN   RS   R@   R   R   RM   (   R   R!   R"   t   kwargsRS   R@   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_besseliÀ   s    c         K  sJ   | j  t k rF t t | ƒ t | | ƒ t t | ƒ t | | ƒ Sd  S(   N(   RC   R+   R   R   t   besselyR   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_besselyÄ   s    c         K  s)   t  d | t ƒ t | t j |  j ƒ S(   Ni   (   R   R   t   jnR   t   HalfR   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_jnÈ   s    c         C  s)   |  j  \ } } | j r% | j r% t Sd  S(   N(   R   RC   R)   RE   (   R   R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_is_realË   s    c         C  s9   d d  l  j } | j |  j d j ƒ  |  j d j ƒ  ƒ S(   Niÿÿÿÿi    i   (   t   sage.allt   allt   bessel_JR   t   _sage_(   R   t   sage(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR_   Ð   s    (   R9   R:   R;   R   RB   R&   R$   R=   R#   RU   RW   RZ   R[   R_   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR>   W   s   ?		%				RV   c           B  s\   e  Z d  Z e j Z e j Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(   sJ  
    Bessel function of the second kind.

    The Bessel `Y` function of order `\nu` is defined as

    .. math ::
        Y_\nu(z) = \lim_{\mu \to \nu} \frac{J_\mu(z) \cos(\pi \mu)
                                            - J_{-\mu}(z)}{\sin(\pi \mu)},

    where :math:`J_\mu(z)` is the Bessel function of the first kind.

    It is a solution to Bessel's equation, and linearly independent from
    :math:`J_\nu`.

    Examples
    ========

    >>> from sympy import bessely, yn
    >>> from sympy.abc import z, n
    >>> b = bessely(n, z)
    >>> b.diff(z)
    bessely(n - 1, z)/2 - bessely(n + 1, z)/2
    >>> b.rewrite(yn)
    sqrt(2)*sqrt(z)*yn(n - 1/2, z)/sqrt(pi)

    See Also
    ========

    besselj, besseli, besselk

    References
    ==========

    .. [1] http://functions.wolfram.com/Bessel-TypeFunctions/BesselY/

    c         C  s¬   | j  rN | j  r t j St | ƒ j  t k r5 t j St | ƒ j  rN t j Sn  | t j k sl | t j k rs t j S| j	 r¨ | j
 ƒ  r¨ t d ƒ | t | | ƒ Sn  d  S(   Niÿÿÿÿ(   RA   R   RJ   R   R+   RF   RH   RI   RD   RC   RK   RV   (   R    R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   þ   s    		
	c         K  sJ   | j  t k rF t t | ƒ t t | ƒ t | | ƒ t | | ƒ Sd  S(   N(   RC   R+   R   R   R   R>   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_besselj  s    c         K  s)   |  j  |  j Œ  } | r% | j t ƒ Sd  S(   N(   Ra   R   t   rewriteRM   (   R   R!   R"   RT   t   aj(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU     s    c         K  s)   t  d | t ƒ t | t j |  j ƒ S(   Ni   (   R   R   t   ynR   RY   R   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_yn  s    c         C  s)   |  j  \ } } | j r% | j r% t Sd  S(   N(   R   RC   R.   RE   (   R   R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR[     s    c         C  s9   d d  l  j } | j |  j d j ƒ  |  j d j ƒ  ƒ S(   Niÿÿÿÿi    i   (   R\   R]   t   bessel_YR   R_   (   R   R`   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR_     s    (   R9   R:   R;   R   RB   R&   R$   R=   R#   Ra   RU   Re   R[   R_   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRV   Õ   s   $						RM   c           B  s]   e  Z d  Z e j Z e j Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(   sé  
    Modified Bessel function of the first kind.

    The Bessel I function is a solution to the modified Bessel equation

    .. math ::
        z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
        + z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 + \nu^2)^2 w = 0.

    It can be defined as

    .. math ::
        I_\nu(z) = i^{-\nu} J_\nu(iz),

    where :math:`J_\nu(z)` is the Bessel function of the first kind.

    Examples
    ========

    >>> from sympy import besseli
    >>> from sympy.abc import z, n
    >>> besseli(n, z).diff(z)
    besseli(n - 1, z)/2 + besseli(n + 1, z)/2

    See Also
    ========

    besselj, bessely, besselk

    References
    ==========

    .. [1] http://functions.wolfram.com/Bessel-TypeFunctions/BesselI/

    c         C  sï  | j  r | j  r t j S| j r1 | j  t k s@ t | ƒ j rG t j St | ƒ j rl | j t	 k	 rl t j
 S| j r t j Sn  | j r¼ t | ƒ t j k s² t | ƒ t j k r¼ t j Sn  | j ƒ  rè | | | | t | | ƒ S| j r:| j ƒ  rt | | ƒ S| j t ƒ } | r:t | t | | ƒ Sn  d d l m } m } | j r| | ƒ } | | k rÆt | | ƒ SnE | j ƒ  \ } } | d k rÆ| d | t | t ƒ t | | ƒ S| | ƒ } | | k rët | | ƒ Sd  S(   Niÿÿÿÿ(   R?   R@   i    i   (   RA   R   RB   RC   R+   R   R.   RD   R*   RE   RF   RG   RH   R   RI   RJ   RK   RM   RL   R   R>   RN   R?   R@   RO   R   (   R    R!   R"   RP   R?   R@   RQ   RR   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   L  s>    		'	
	*
 		'c         K  sD   d d l  m } m } | t t | d ƒ t | | t ƒ | ƒ S(   Niÿÿÿÿ(   RS   R@   i   (   RN   RS   R@   R   R   R>   (   R   R!   R"   RT   RS   R@   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   r  s    c         K  s)   |  j  |  j Œ  } | r% | j t ƒ Sd  S(   N(   Ra   R   Rb   RV   (   R   R!   R"   RT   Rc   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRW   v  s    c         K  s   |  j  |  j Œ  j t ƒ S(   N(   Ra   R   Rb   RX   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRZ   {  s    c         C  s)   |  j  \ } } | j r% | j r% t Sd  S(   N(   R   RC   R)   RE   (   R   R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR[   ~  s    c         C  s9   d d  l  j } | j |  j d j ƒ  |  j d j ƒ  ƒ S(   Niÿÿÿÿi    i   (   R\   R]   t   bessel_IR   R_   (   R   R`   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR_   ƒ  s    (   R9   R:   R;   R   RB   R&   R$   R=   R#   Ra   RW   RZ   R[   R_   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRM   $  s   #
	&				t   besselkc           B  sf   e  Z d  Z e j Z e j Z e d „  ƒ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z RS(   sþ  
    Modified Bessel function of the second kind.

    The Bessel K function of order :math:`\nu` is defined as

    .. math ::
        K_\nu(z) = \lim_{\mu \to \nu} \frac{\pi}{2}
                   \frac{I_{-\mu}(z) -I_\mu(z)}{\sin(\pi \mu)},

    where :math:`I_\mu(z)` is the modified Bessel function of the first kind.

    It is a solution of the modified Bessel equation, and linearly independent
    from :math:`Y_\nu`.

    Examples
    ========

    >>> from sympy import besselk
    >>> from sympy.abc import z, n
    >>> besselk(n, z).diff(z)
    -besselk(n - 1, z)/2 - besselk(n + 1, z)/2

    See Also
    ========

    besselj, besseli, bessely

    References
    ==========

    .. [1] http://functions.wolfram.com/Bessel-TypeFunctions/BesselK/

    c         C  sµ   | j  rN | j  r t j St | ƒ j  t k r5 t j St | ƒ j  rN t j Sn  | j r‹ t | ƒ t j k s t | ƒ t j	 k r‹ t j
 Sn  | j r± | j ƒ  r± t | | ƒ Sn  d  S(   N(   RA   R   RI   R   R+   RF   RH   RG   R   RJ   RD   RC   RK   Rh   (   R    R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   ®  s    		
	*
	c         K  sD   | j  t k r@ t t t | ƒ t | | ƒ t | | ƒ d Sd  S(   Ni   (   RC   R+   R   R   RM   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU   ¿  s    c         K  s)   |  j  |  j Œ  } | r% | j t ƒ Sd  S(   N(   RU   R   Rb   R>   (   R   R!   R"   RT   t   ai(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   Ã  s    c         K  s)   |  j  |  j Œ  } | r% | j t ƒ Sd  S(   N(   Ra   R   Rb   RV   (   R   R!   R"   RT   Rc   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRW   È  s    c         K  s)   |  j  |  j Œ  } | r% | j t ƒ Sd  S(   N(   RW   R   Rb   Rd   (   R   R!   R"   RT   t   ay(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRe   Í  s    c         C  s)   |  j  \ } } | j r% | j r% t Sd  S(   N(   R   RC   R.   RE   (   R   R!   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR[   Ò  s    c         C  s9   d d  l  j } | j |  j d j ƒ  |  j d j ƒ  ƒ S(   Niÿÿÿÿi    i   (   R\   R]   t   bessel_KR   R_   (   R   R`   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR_   ×  s    (   R9   R:   R;   R   RB   R&   R$   R=   R#   RU   Ra   RW   Re   R[   R_   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRh   ˆ  s   !	
					t   hankel1c           B  s)   e  Z d  Z e j Z e j Z d „  Z RS(   sŽ  
    Hankel function of the first kind.

    This function is defined as

    .. math ::
        H_\nu^{(1)} = J_\nu(z) + iY_\nu(z),

    where :math:`J_\nu(z)` is the Bessel function of the first kind, and
    :math:`Y_\nu(z)` is the Bessel function of the second kind.

    It is a solution to Bessel's equation.

    Examples
    ========

    >>> from sympy import hankel1
    >>> from sympy.abc import z, n
    >>> hankel1(n, z).diff(z)
    hankel1(n - 1, z)/2 - hankel1(n + 1, z)/2

    See Also
    ========

    hankel2, besselj, bessely

    References
    ==========

    .. [1] http://functions.wolfram.com/Bessel-TypeFunctions/HankelH1/

    c         C  sA   |  j  } | j o | j t k r= t |  j j ƒ  | j ƒ  ƒ Sd  S(   N(   R   R)   R*   R+   t   hankel2R   R,   (   R   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR-     s    	(   R9   R:   R;   R   RB   R&   R$   R-   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRl   Ü  s    		Rm   c           B  s)   e  Z d  Z e j Z e j Z d „  Z RS(   sÆ  
    Hankel function of the second kind.

    This function is defined as

    .. math ::
        H_\nu^{(2)} = J_\nu(z) - iY_\nu(z),

    where :math:`J_\nu(z)` is the Bessel function of the first kind, and
    :math:`Y_\nu(z)` is the Bessel function of the second kind.

    It is a solution to Bessel's equation, and linearly independent from
    :math:`H_\nu^{(1)}`.

    Examples
    ========

    >>> from sympy import hankel2
    >>> from sympy.abc import z, n
    >>> hankel2(n, z).diff(z)
    hankel2(n - 1, z)/2 - hankel2(n + 1, z)/2

    See Also
    ========

    hankel1, besselj, bessely

    References
    ==========

    .. [1] http://functions.wolfram.com/Bessel-TypeFunctions/HankelH2/

    c         C  sA   |  j  } | j o | j t k r= t |  j j ƒ  | j ƒ  ƒ Sd  S(   N(   R   R)   R*   R+   Rl   R   R,   (   R   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR-   -  s    	(   R9   R:   R;   R   RB   R&   R$   R-   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRm     s   !		c           s   t  ˆ  ƒ ‡  f d †  ƒ } | S(   Nc           s   | j  r ˆ  |  | | ƒ Sd  S(   N(   RC   (   R   R!   R"   (   t   fn(    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   g4  s    	(   R   (   Rn   Ro   (    (   Rn   s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   assume_integer_order3  s    t   SphericalBesselBasec           B  s>   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d d „ Z RS(   s%  
    Base class for spherical Bessel functions.

    These are thin wrappers around ordinary Bessel functions,
    since spherical Bessel functions differ from the ordinary
    ones just by a slight change in order.

    To use this class, define the ``_rewrite`` and ``_expand`` methods.
    c         K  s   t  d ƒ ‚ d S(   s@    Expand self into a polynomial. Nu is guaranteed to be Integer. t	   expansionN(   t   NotImplementedError(   R   R0   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _expandF  s    c         C  s   t  d ƒ ‚ d S(   s5    Rewrite self in terms of ordinary Bessel functions. t	   rewritingN(   Rs   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _rewriteJ  s    c         K  s   |  j  j r |  j |   S|  S(   N(   R   t
   is_IntegerRt   (   R   R0   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   N  s    c         C  s#   |  j  j r |  j ƒ  j | ƒ Sd  S(   N(   R   Rw   Rv   t   _eval_evalf(   R   t   prec(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRx   S  s    i   c         C  sN   | d k r t  |  | ƒ ‚ n  |  j |  j d |  j ƒ |  |  j d |  j S(   Ni   i   (   R   R%   R   R   (   R   R'   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR(   W  s    (   R9   R:   R;   Rt   Rv   R/   Rx   R(   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRq   ;  s   					c         C  s?   t  |  | ƒ t | ƒ d |  d t  |  d | ƒ t | ƒ S(   Niÿÿÿÿi   (   Rn   R   R   (   RQ   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _jn^  s    c         C  s?   d |  d t  |  d | ƒ t | ƒ t  |  | ƒ t | ƒ S(   Niÿÿÿÿi   (   Rn   R   R   (   RQ   R"   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _ynb  s    RX   c           B  s;   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   sý  
    Spherical Bessel function of the first kind.

    This function is a solution to the spherical Bessel equation

    .. math ::
        z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
          + 2z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 - \nu(\nu + 1)) w = 0.

    It can be defined as

    .. math ::
        j_\nu(z) = \sqrt{\frac{\pi}{2z}} J_{\nu + \frac{1}{2}}(z),

    where :math:`J_\nu(z)` is the Bessel function of the first kind.

    The spherical Bessel functions of integral order are
    calculated using the formula:

    .. math:: j_n(z) = f_n(z) \sin{z} + (-1)^{n+1} f_{-n-1}(z) \cos{z},

    where the coefficients :math:`f_n(z)` are available as
    :func:`polys.orthopolys.spherical_bessel_fn`.

    Examples
    ========

    >>> from sympy import Symbol, jn, sin, cos, expand_func, besselj, bessely
    >>> from sympy import simplify
    >>> z = Symbol("z")
    >>> nu = Symbol("nu", integer=True)
    >>> print(expand_func(jn(0, z)))
    sin(z)/z
    >>> expand_func(jn(1, z)) == sin(z)/z**2 - cos(z)/z
    True
    >>> expand_func(jn(3, z))
    (-6/z**2 + 15/z**4)*sin(z) + (1/z - 15/z**3)*cos(z)
    >>> jn(nu, z).rewrite(besselj)
    sqrt(2)*sqrt(pi)*sqrt(1/z)*besselj(nu + 1/2, z)/2
    >>> jn(nu, z).rewrite(bessely)
    (-1)**nu*sqrt(2)*sqrt(pi)*sqrt(1/z)*bessely(-nu - 1/2, z)/2
    >>> jn(2, 5.2+0.3j).evalf(20)
    0.099419756723640344491 - 0.054525080242173562897*I

    See Also
    ========

    besselj, bessely, besselk, yn

    References
    ==========

    .. [1] http://dlmf.nist.gov/10.47

    c         C  s   |  j  |  j |  j ƒ S(   N(   Ra   R   R   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRv      s    c         K  s&   t  t d | ƒ t | t j | ƒ S(   Ni   (   R   R   R>   R   RY   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   £  s    c         K  s/   d | t  t d | ƒ t | t j | ƒ S(   Niÿÿÿÿi   (   R   R   RV   R   RY   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRW   ¦  s    c         K  s   d | t  | d | ƒ S(   Niÿÿÿÿi   (   Rd   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRe   ©  s    c         K  s   t  |  j |  j ƒ S(   N(   Rz   R   R   (   R   R0   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRt   ¬  s    (   R9   R:   R;   Rv   Ra   RW   Re   Rt   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRX   g  s   7				Rd   c           B  sG   e  Z d  Z d „  Z e d „  ƒ Z e d „  ƒ Z d „  Z d „  Z RS(   s›  
    Spherical Bessel function of the second kind.

    This function is another solution to the spherical Bessel equation, and
    linearly independent from :math:`j_n`. It can be defined as

    .. math ::
        y_\nu(z) = \sqrt{\frac{\pi}{2z}} Y_{\nu + \frac{1}{2}}(z),

    where :math:`Y_\nu(z)` is the Bessel function of the second kind.

    For integral orders :math:`n`, :math:`y_n` is calculated using the formula:

    .. math:: y_n(z) = (-1)^{n+1} j_{-n-1}(z)

    Examples
    ========

    >>> from sympy import Symbol, yn, sin, cos, expand_func, besselj, bessely
    >>> z = Symbol("z")
    >>> nu = Symbol("nu", integer=True)
    >>> print(expand_func(yn(0, z)))
    -cos(z)/z
    >>> expand_func(yn(1, z)) == -cos(z)/z**2-sin(z)/z
    True
    >>> yn(nu, z).rewrite(besselj)
    (-1)**(nu + 1)*sqrt(2)*sqrt(pi)*sqrt(1/z)*besselj(-nu - 1/2, z)/2
    >>> yn(nu, z).rewrite(bessely)
    sqrt(2)*sqrt(pi)*sqrt(1/z)*bessely(nu + 1/2, z)/2
    >>> yn(2, 5.2+0.3j).evalf(20)
    0.18525034196069722536 + 0.014895573969924817587*I

    See Also
    ========

    besselj, bessely, besselk, jn

    References
    ==========

    .. [1] http://dlmf.nist.gov/10.47

    c         C  s   |  j  |  j |  j ƒ S(   N(   RW   R   R   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRv   Ý  s    c         K  s3   d | d t  t d | ƒ t | t j | ƒ S(   Niÿÿÿÿi   i   (   R   R   R>   R   RY   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   à  s    c         K  s&   t  t d | ƒ t | t j | ƒ S(   Ni   (   R   R   RV   R   RY   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRW   ä  s    c         K  s   d | d t  | d | ƒ S(   Niÿÿÿÿi   (   RX   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRZ   è  s    c         K  s   t  |  j |  j ƒ S(   N(   R{   R   R   (   R   R0   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRt   ë  s    (	   R9   R:   R;   Rv   Rp   Ra   RW   RZ   Rt   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRd   °  s   +		t   SphericalHankelBasec           B  sS   e  Z d  „  Z e d „  ƒ Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C  s   |  j  |  j |  j ƒ S(   N(   Ra   R   R   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRv   ñ  s    c         K  sX   |  j  } t t d | ƒ t | t j | ƒ | t d | d t | t j | ƒ S(   Ni   iÿÿÿÿi   (   t   _hankel_kind_signR   R   R>   R   RY   R   (   R   R!   R"   RT   t   hks(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   ô  s    	$c         K  sT   |  j  } t t d | ƒ d | t | t j | ƒ | t t | t j | ƒ S(   Ni   iÿÿÿÿ(   R}   R   R   RV   R   RY   R   (   R   R!   R"   RT   R~   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRW   ý  s    	-c         K  s4   |  j  } t | | ƒ j t ƒ | t t | | ƒ S(   N(   R}   RX   Rb   Rd   R   (   R   R!   R"   RT   R~   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRe     s    	c         K  s4   |  j  } t | | ƒ | t t | | ƒ j t ƒ S(   N(   R}   RX   R   Rd   Rb   (   R   R!   R"   RT   R~   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRZ   
  s    	c         K  sZ   |  j  j r |  j |   S|  j  } |  j } |  j } t | | ƒ | t t | | ƒ Sd  S(   N(   R   Rw   Rt   R   R}   RX   R   Rd   (   R   R0   R!   R"   R~   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/     s    			c         K  sC   |  j  } |  j } |  j } t | | ƒ | t t | | ƒ j ƒ  S(   N(   R   R   R}   Rz   R   R{   t   expand(   R   R0   RQ   R"   R~   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRt     s    			
(
   R9   R:   Rv   Rp   Ra   RW   Re   RZ   R/   Rt   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR|   ï  s   							t   hn1c           B  s&   e  Z d  Z e j Z e d „  ƒ Z RS(   sŠ  
    Spherical Hankel function of the first kind.

    This function is defined as

    .. math:: h_\nu^(1)(z) = j_\nu(z) + i y_\nu(z),

    where :math:`j_\nu(z)` and :math:`y_\nu(z)` are the spherical
    Bessel function of the first and second kinds.

    For integral orders :math:`n`, :math:`h_n^(1)` is calculated using the formula:

    .. math:: h_n^(1)(z) = j_{n}(z) + i (-1)^{n+1} j_{-n-1}(z)

    Examples
    ========

    >>> from sympy import Symbol, hn1, hankel1, expand_func, yn, jn
    >>> z = Symbol("z")
    >>> nu = Symbol("nu", integer=True)
    >>> print(expand_func(hn1(nu, z)))
    jn(nu, z) + I*yn(nu, z)
    >>> print(expand_func(hn1(0, z)))
    sin(z)/z - I*cos(z)/z
    >>> print(expand_func(hn1(1, z)))
    -I*sin(z)/z - cos(z)/z + sin(z)/z**2 - I*cos(z)/z**2
    >>> hn1(nu, z).rewrite(jn)
    (-1)**(nu + 1)*I*jn(-nu - 1, z) + jn(nu, z)
    >>> hn1(nu, z).rewrite(yn)
    (-1)**nu*yn(-nu - 1, z) + I*yn(nu, z)
    >>> hn1(nu, z).rewrite(hankel1)
    sqrt(2)*sqrt(pi)*sqrt(1/z)*hankel1(nu, z)/2

    See Also
    ========

    hn2, jn, yn, hankel1, hankel2

    References
    ==========

    .. [1] http://dlmf.nist.gov/10.47

    c         K  s   t  t d | ƒ t | | ƒ S(   Ni   (   R   R   Rl   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_hankel1W  s    (   R9   R:   R;   R   RB   R}   Rp   R   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR€   '  s   ,	t   hn2c           B  s'   e  Z d  Z e j Z e d „  ƒ Z RS(   sˆ  
    Spherical Hankel function of the second kind.

    This function is defined as

    .. math:: h_\nu^(2)(z) = j_\nu(z) - i y_\nu(z),

    where :math:`j_\nu(z)` and :math:`y_\nu(z)` are the spherical
    Bessel function of the first and second kinds.

    For integral orders :math:`n`, :math:`h_n^(2)` is calculated using the formula:

    .. math:: h_n^(2)(z) = j_{n} - i (-1)^{n+1} j_{-n-1}(z)

    Examples
    ========

    >>> from sympy import Symbol, hn2, hankel2, expand_func, jn, yn
    >>> z = Symbol("z")
    >>> nu = Symbol("nu", integer=True)
    >>> print(expand_func(hn2(nu, z)))
    jn(nu, z) - I*yn(nu, z)
    >>> print(expand_func(hn2(0, z)))
    sin(z)/z + I*cos(z)/z
    >>> print(expand_func(hn2(1, z)))
    I*sin(z)/z - cos(z)/z + sin(z)/z**2 + I*cos(z)/z**2
    >>> hn2(nu, z).rewrite(hankel2)
    sqrt(2)*sqrt(pi)*sqrt(1/z)*hankel2(nu, z)/2
    >>> hn2(nu, z).rewrite(jn)
    -(-1)**(nu + 1)*I*jn(-nu - 1, z) + jn(nu, z)
    >>> hn2(nu, z).rewrite(yn)
    (-1)**nu*yn(-nu - 1, z) - I*yn(nu, z)

    See Also
    ========

    hn1, jn, yn, hankel1, hankel2

    References
    ==========

    .. [1] http://dlmf.nist.gov/10.47

    c         K  s   t  t d | ƒ t | | ƒ S(   Ni   (   R   R   Rm   (   R   R!   R"   RT   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_hankel2Œ  s    (   R9   R:   R;   R   RB   R}   Rp   Rƒ   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR‚   \  s   ,
RN   i   c           s¤  d d l  m } ˆ  d k rª d d l m } d d l m } d d l m } | | ƒ } g  t d | d ƒ D]: }	 | j	 | t
 ˆ d ƒ j | ƒ t |	 ƒ ƒ | ƒ ^ ql Sˆ  d	 k r%d d
 l m ‰ y& d d l m ‰ ‡ ‡ f d †  }
 Wq1t k
 r!d d l m ‰ ‡ ‡ f d †  }
 q1Xn t d ƒ ‚ ‡  ‡ f d †  } ˆ | } | |
 | ƒ } | g } x8 t | d ƒ D]& } | |
 | | ƒ } | j | ƒ qvW| S(   s¶  
    Zeros of the spherical Bessel function of the first kind.

    This returns an array of zeros of jn up to the k-th zero.

    * method = "sympy": uses :func:`mpmath.besseljzero`
    * method = "scipy": uses the
      `SciPy's sph_jn <http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.jn_zeros.html>`_
      and
      `newton <http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.newton.html>`_
      to find all
      roots, which is faster than computing the zeros using a general
      numerical solver, but it requires SciPy and only works with low
      precision floating point numbers.  [The function used with
      method="sympy" is a recent addition to mpmath, before that a general
      solver was used.]

    Examples
    ========

    >>> from sympy import jn_zeros
    >>> jn_zeros(2, 4, dps=5)
    [5.7635, 9.095, 12.323, 15.515]

    See Also
    ========

    jn, yn, besselj, besselk, bessely
    iÿÿÿÿ(   R   RN   (   t   besseljzero(   t   dps_to_prec(   t   Expri   g      à?t   scipy(   t   newton(   t   spherical_jnc           s   ˆ ˆ  |  ƒ S(   N(    (   t   x(   RQ   R‰   (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   <lambda>½  t    (   t   sph_jnc           s   ˆ ˆ  |  ƒ d d S(   Ni    iÿÿÿÿ(    (   RŠ   (   RQ   R   (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR‹   À  RŒ   s   Unknown method.c           s.   ˆ  d k r ˆ |  | ƒ } n t  d ƒ ‚ | S(   NR‡   s   Unknown method.(   Rs   (   R1   RŠ   R   (   t   methodRˆ   (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   solverÄ  s    (   t   mathR   t   mpmathR„   t   mpmath.libmp.libmpfR…   RN   R†   R   t   _from_mpmathR   t
   _to_mpmatht   intt   scipy.optimizeRˆ   t   scipy.specialR‰   t   ImportErrorR   Rs   t   append(   RQ   t   kRŽ   t   dpsR   R„   R…   R†   Ry   t   lR1   R   R   t   rootst   i(    (   RŽ   RQ   Rˆ   R   R‰   s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   jn_zeros‘  s2    O
	t   AiryBasec           B  sD   e  Z d  Z d „  Z d „  Z e d „ Z e d „ Z e d „ Z RS(   sf   
    Abstract base class for Airy functions.

    This class is meant to reduce code duplication.
    c         C  s   |  j  |  j d j ƒ  ƒ S(   Ni    (   t   funcR   R,   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR-   Þ  s    c         C  s   |  j  d j S(   Ni    (   R   R)   (   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR[   á  s    c         K  sš   |  j  d j rI | r9 t | d <|  j | |  t j f S|  t j f Sn  | rw |  j  d j | |  j ƒ  \ } } n |  j  d j ƒ  \ } } | | f S(   Ni    t   complex(   R   R)   R+   R   R   RD   t   as_real_imag(   R   t   deepR0   R   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _as_real_imagä  s    
(c         K  sÅ   |  j  d | |  \ } } | d | d } t j |  j | | t | ƒ ƒ |  j | | t | ƒ ƒ } | d | t | ƒ |  j | | t | ƒ ƒ |  j | | t | ƒ ƒ } | | f S(   NR¤   i   (   R¥   R   RY   R¡   R   (   R   R¤   R0   RŠ   t   yt   sqR   R   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR£   ñ  s
    ?Nc         K  s*   |  j  d | |  \ } } | | t j S(   NR¤   (   R£   R   t   ImaginaryUnit(   R   R¤   R0   t   re_partt   im_part(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_expand_complexø  s    (	   R9   R:   R;   R-   R[   RE   R¥   R£   R«   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR    ×  s   		t   airyaic           B  sn   e  Z d  Z d Z e Z e d „  ƒ Z d d „ Z e	 e
 d „  ƒ ƒ Z d „  Z d „  Z d „  Z d „  Z RS(	   s_  
    The Airy function `\operatorname{Ai}` of the first kind.

    The Airy function `\operatorname{Ai}(z)` is defined to be the function
    satisfying Airy's differential equation

    .. math::
        \frac{\mathrm{d}^2 w(z)}{\mathrm{d}z^2} - z w(z) = 0.

    Equivalently, for real `z`

    .. math::
        \operatorname{Ai}(z) := \frac{1}{\pi}
        \int_0^\infty \cos\left(\frac{t^3}{3} + z t\right) \mathrm{d}t.

    Examples
    ========

    Create an Airy function object:

    >>> from sympy import airyai
    >>> from sympy.abc import z

    >>> airyai(z)
    airyai(z)

    Several special values are known:

    >>> airyai(0)
    3**(1/3)/(3*gamma(2/3))
    >>> from sympy import oo
    >>> airyai(oo)
    0
    >>> airyai(-oo)
    0

    The Airy function obeys the mirror symmetry:

    >>> from sympy import conjugate
    >>> conjugate(airyai(z))
    airyai(conjugate(z))

    Differentiation with respect to z is supported:

    >>> from sympy import diff
    >>> diff(airyai(z), z)
    airyaiprime(z)
    >>> diff(airyai(z), z, 2)
    z*airyai(z)

    Series expansion is also supported:

    >>> from sympy import series
    >>> series(airyai(z), z, 0, 3)
    3**(5/6)*gamma(1/3)/(6*pi) - 3**(1/6)*z*gamma(2/3)/(2*pi) + O(z**3)

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

    >>> airyai(-2).evalf(50)
    0.22740742820168557599192443603787379946077222541710

    Rewrite Ai(z) in terms of hypergeometric functions:

    >>> from sympy import hyper
    >>> airyai(z).rewrite(hyper)
    -3**(2/3)*z*hyper((), (4/3,), z**3/9)/(3*gamma(1/3)) + 3**(1/3)*hyper((), (2/3,), z**3/9)/(3*gamma(2/3))

    See Also
    ========

    airybi: Airy function of the second kind.
    airyaiprime: Derivative of the Airy function of the first kind.
    airybiprime: Derivative of the Airy function of the second kind.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Airy_function
    .. [2] http://dlmf.nist.gov/9
    .. [3] http://www.encyclopediaofmath.org/index.php/Airy_functions
    .. [4] http://mathworld.wolfram.com/AiryFunctions.html
    i   c         C  sŒ   | j  rˆ | t j k r t j S| t j k r5 t j S| t j k rK t j S| t j k rˆ t j d t d d ƒ t t d d ƒ ƒ Sn  d  S(   Ni   i   (	   t	   is_NumberR   RH   RI   RD   RJ   RB   R   R   (   R    t   arg(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   U  s    	c         C  s0   | d k r t  |  j d ƒ St |  | ƒ ‚ d  S(   Ni   i    (   t   airyaiprimeR   R   (   R   R'   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR(   a  s    c         G  sŽ  |  d k  r t  j St | ƒ } t | ƒ d k r| d } d t  d ƒ d | |  d t  d ƒ d | |  d t t d |  d t  d ƒ d ƒ t |  ƒ t |  d t  d ƒ d ƒ t t d |  d t  d ƒ d ƒ t |  d ƒ t |  d t  d ƒ d ƒ | St  j d t  d ƒ d t t |  t  j t  d ƒ ƒ t d t |  t  j t  d ƒ ƒ t |  ƒ t	 d d ƒ | |  Sd  S(   Ni    i   iÿÿÿÿi   i   i   (
   R   RD   R	   t   lenR   R   R   R   RB   R   (   RQ   RŠ   t   previous_termst   p(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   taylor_termg  s    
Õc         K  s|   t  d d ƒ } t  d d ƒ } t | t  d d ƒ ƒ } t | ƒ j rx | t | ƒ t | | | ƒ t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R*   R   R>   (   R   R"   RT   t   ott   ttt   a(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   v  s
    c         K  sÀ   t  d d ƒ } t  d d ƒ } t | t  d d ƒ ƒ } t | ƒ j rv | t | ƒ t | | | ƒ t | | | ƒ S| t | | ƒ t | | | ƒ | t | | ƒ t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R.   R   RM   (   R   R"   RT   R´   Rµ   R¶   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU   }  s    1c         K  s¨   t  j d t  d ƒ d t t  d ƒ d ƒ } | t d d ƒ t t  d ƒ d ƒ } | t g  t  d ƒ d g | d d ƒ | t g  t  d ƒ d g | d d ƒ S(   Ni   i   i   i	   i   (   R   RB   R   R   R   (   R   R"   RT   t   pf1t   pf2(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   _eval_rewrite_as_hyper†  s    /'c         K  sm  |  j  d } | j } t | ƒ d k ri| j ƒ  } t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} | j | | | | | ƒ }	 |	 d  k	 ri|	 | } d | j rf|	 | } |	 | } |	 | } | | | | | | | | | }
 | | | | | | } t j	 |
 t j
 t | ƒ |
 t j
 t d ƒ t | ƒ Sqin  d  S(	   Ni    i   t   ct   excludet   dt   mRQ   i   (   R   t   free_symbolsR°   t   popR   t   matcht   NoneRC   R   RY   RB   R¬   R   t   airybi(   R   R0   R®   t   symbsR"   Rº   R¼   R½   RQ   t   Mt   pft   newarg(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   ‹  s$    	



&(   R9   R:   R;   t   nargsRE   t
   unbranchedR=   R#   R(   t   staticmethodR   R³   Ra   RU   R¹   R/   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR¬   ý  s   S				RÂ   c           B  sn   e  Z d  Z d Z e Z e d „  ƒ Z d d „ Z e	 e
 d „  ƒ ƒ Z d „  Z d „  Z d „  Z d „  Z RS(	   s³  
    The Airy function `\operatorname{Bi}` of the second kind.

    The Airy function `\operatorname{Bi}(z)` is defined to be the function
    satisfying Airy's differential equation

    .. math::
        \frac{\mathrm{d}^2 w(z)}{\mathrm{d}z^2} - z w(z) = 0.

    Equivalently, for real `z`

    .. math::
        \operatorname{Bi}(z) := \frac{1}{\pi}
                 \int_0^\infty
                   \exp\left(-\frac{t^3}{3} + z t\right)
                   + \sin\left(\frac{t^3}{3} + z t\right) \mathrm{d}t.

    Examples
    ========

    Create an Airy function object:

    >>> from sympy import airybi
    >>> from sympy.abc import z

    >>> airybi(z)
    airybi(z)

    Several special values are known:

    >>> airybi(0)
    3**(5/6)/(3*gamma(2/3))
    >>> from sympy import oo
    >>> airybi(oo)
    oo
    >>> airybi(-oo)
    0

    The Airy function obeys the mirror symmetry:

    >>> from sympy import conjugate
    >>> conjugate(airybi(z))
    airybi(conjugate(z))

    Differentiation with respect to z is supported:

    >>> from sympy import diff
    >>> diff(airybi(z), z)
    airybiprime(z)
    >>> diff(airybi(z), z, 2)
    z*airybi(z)

    Series expansion is also supported:

    >>> from sympy import series
    >>> series(airybi(z), z, 0, 3)
    3**(1/3)*gamma(1/3)/(2*pi) + 3**(2/3)*z*gamma(2/3)/(2*pi) + O(z**3)

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

    >>> airybi(-2).evalf(50)
    -0.41230258795639848808323405461146104203453483447240

    Rewrite Bi(z) in terms of hypergeometric functions:

    >>> from sympy import hyper
    >>> airybi(z).rewrite(hyper)
    3**(1/6)*z*hyper((), (4/3,), z**3/9)/gamma(1/3) + 3**(5/6)*hyper((), (2/3,), z**3/9)/(3*gamma(2/3))

    See Also
    ========

    airyai: Airy function of the first kind.
    airyaiprime: Derivative of the Airy function of the first kind.
    airybiprime: Derivative of the Airy function of the second kind.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Airy_function
    .. [2] http://dlmf.nist.gov/9
    .. [3] http://www.encyclopediaofmath.org/index.php/Airy_functions
    .. [4] http://mathworld.wolfram.com/AiryFunctions.html
    i   c         C  sŒ   | j  rˆ | t j k r t j S| t j k r5 t j S| t j k rK t j S| t j k rˆ t j d t d d ƒ t t d d ƒ ƒ Sn  d  S(   Ni   i   i   i   (	   R­   R   RH   RI   RJ   RD   RB   R   R   (   R    R®   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   ý  s    	c         C  s0   | d k r t  |  j d ƒ St |  | ƒ ‚ d  S(   Ni   i    (   t   airybiprimeR   R   (   R   R'   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR(   	  s    c         G  sd  |  d k  r t  j St | ƒ } t | ƒ d k rå | d } d t  d ƒ d | t t d t |  t  j t  d ƒ ƒ ƒ t |  t  j t  d ƒ ƒ |  t  j t t	 d t |  t  j
 t  d ƒ ƒ ƒ t |  d t  d ƒ ƒ | St  j t d d ƒ t t |  t  j t  d ƒ ƒ t t d t |  t  j t  d ƒ ƒ ƒ t |  ƒ t d d ƒ | |  Sd  S(   Ni    i   iÿÿÿÿi   i   i   (   R   RD   R	   R°   R   R   R   RB   R   R   RY   R   R   (   RQ   RŠ   R±   R²   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR³     s    
ªc         K  s|   t  d d ƒ } t  d d ƒ } t | t  d d ƒ ƒ } t | ƒ j rx t | d ƒ t | | | ƒ t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R*   R   R>   (   R   R"   RT   R´   Rµ   R¶   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa     s
    c         K  sØ   t  d d ƒ } t  d d ƒ } t | t  d d ƒ ƒ } t | ƒ j r| t | ƒ t d ƒ t | | | ƒ t | | | ƒ St | | ƒ } t | | ƒ } t | ƒ | t | | | ƒ | | t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R.   R   RM   (   R   R"   RT   R´   Rµ   R¶   t   bRº   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU   %  s    7c         K  s£   t  j t d d ƒ t t  d ƒ d ƒ } | t d d ƒ t t  d ƒ d ƒ } | t g  t  d ƒ d g | d d ƒ | t g  t  d ƒ d g | d d ƒ S(   Ni   i   i   i   i	   i   (   R   RB   R   R   R   (   R   R"   RT   R·   R¸   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR¹   0  s    *'c         K  sm  |  j  d } | j } t | ƒ d k ri| j ƒ  } t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} | j | | | | | ƒ }	 |	 d  k	 ri|	 | } d | j rf|	 | } |	 | } |	 | } | | | | | | | | | }
 | | | | | | } t j	 t
 d ƒ t j |
 t | ƒ t j |
 t | ƒ Sqin  d  S(	   Ni    i   Rº   R»   R¼   R½   RQ   i   (   R   R¾   R°   R¿   R   RÀ   RÁ   RC   R   RY   R   RB   R¬   RÂ   (   R   R0   R®   RÃ   R"   Rº   R¼   R½   RQ   RÄ   RÅ   RÆ   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   5  s$    	



&(   R9   R:   R;   RÇ   RE   RÈ   R=   R#   R(   RÉ   R   R³   Ra   RU   R¹   R/   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRÂ   £  s   U			R¯   c           B  sb   e  Z d  Z d Z e Z e d „  ƒ Z d d „ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(	   sè  
    The derivative `\operatorname{Ai}^\prime` of the Airy function of the first kind.

    The Airy function `\operatorname{Ai}^\prime(z)` is defined to be the function

    .. math::
        \operatorname{Ai}^\prime(z) := \frac{\mathrm{d} \operatorname{Ai}(z)}{\mathrm{d} z}.

    Examples
    ========

    Create an Airy function object:

    >>> from sympy import airyaiprime
    >>> from sympy.abc import z

    >>> airyaiprime(z)
    airyaiprime(z)

    Several special values are known:

    >>> airyaiprime(0)
    -3**(2/3)/(3*gamma(1/3))
    >>> from sympy import oo
    >>> airyaiprime(oo)
    0

    The Airy function obeys the mirror symmetry:

    >>> from sympy import conjugate
    >>> conjugate(airyaiprime(z))
    airyaiprime(conjugate(z))

    Differentiation with respect to z is supported:

    >>> from sympy import diff
    >>> diff(airyaiprime(z), z)
    z*airyai(z)
    >>> diff(airyaiprime(z), z, 2)
    z*airyaiprime(z) + airyai(z)

    Series expansion is also supported:

    >>> from sympy import series
    >>> series(airyaiprime(z), z, 0, 3)
    -3**(2/3)/(3*gamma(1/3)) + 3**(1/3)*z**2/(6*gamma(2/3)) + O(z**3)

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

    >>> airyaiprime(-2).evalf(50)
    0.61825902074169104140626429133247528291577794512415

    Rewrite Ai'(z) in terms of hypergeometric functions:

    >>> from sympy import hyper
    >>> airyaiprime(z).rewrite(hyper)
    3**(1/3)*z**2*hyper((), (5/3,), z**3/9)/(6*gamma(2/3)) - 3**(2/3)*hyper((), (1/3,), z**3/9)/(3*gamma(1/3))

    See Also
    ========

    airyai: Airy function of the first kind.
    airybi: Airy function of the second kind.
    airybiprime: Derivative of the Airy function of the second kind.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Airy_function
    .. [2] http://dlmf.nist.gov/9
    .. [3] http://www.encyclopediaofmath.org/index.php/Airy_functions
    .. [4] http://mathworld.wolfram.com/AiryFunctions.html
    i   c         C  sw   | j  rs | t j k r t j S| t j k r5 t j S| t j k rs t j d t d d ƒ t t d d ƒ ƒ Sn  d  S(   Ni   i   (   R­   R   RH   RI   RD   RB   R   R   (   R    R®   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   œ  s    	c         C  s;   | d k r( |  j  d t |  j  d ƒ St |  | ƒ ‚ d  S(   Ni   i    (   R   R¬   R   (   R   R'   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR(   ¦  s    c         C  st   d d l  m } m } d d l m } |  j d j | ƒ } | | ƒ  | j | d d ƒ} Wd  QX| j | | ƒ S(   Niÿÿÿÿ(   t   mpt   workprec(   R†   i    t
   derivativei   (	   R‘   RÌ   RÍ   RN   R†   R   R”   R¬   R“   (   R   Ry   RÌ   RÍ   R†   R"   t   res(    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRx   ¬  s    c         K  sf   t  d d ƒ } t | t  d d ƒ ƒ } t | ƒ j rb | d t | | | ƒ t | | | ƒ Sd  S(   Ni   i   (   R   R   R   R*   R>   (   R   R"   RT   Rµ   R¶   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   ´  s    c         K  sÞ   t  d d ƒ } t  d d ƒ } | t | t  d d ƒ ƒ } t | ƒ j rl | d t | | ƒ t | | ƒ St | t  d d ƒ ƒ } t | | ƒ } t | | ƒ } | | d | t | | | ƒ | t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R.   RM   (   R   R"   RT   R´   Rµ   R¶   RË   Rº   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU   º  s    #c         K  s­   | d d d t  d ƒ d t t  d ƒ d ƒ } d t d d ƒ t t  d ƒ d ƒ } | t g  t  d ƒ d g | d d ƒ | t g  t  d ƒ d g | d d ƒ S(   Ni   i   i   i   i	   (   R   R   R   R   (   R   R"   RT   R·   R¸   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR¹   Æ  s    4'c         K  sm  |  j  d } | j } t | ƒ d k ri| j ƒ  } t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} | j | | | | | ƒ }	 |	 d  k	 ri|	 | } d | j rf|	 | } |	 | } |	 | } | | | | | | | | | }
 | | | | | | } t j	 |
 t j
 t | ƒ |
 t j
 t d ƒ t | ƒ Sqin  d  S(	   Ni    i   Rº   R»   R¼   R½   RQ   i   (   R   R¾   R°   R¿   R   RÀ   RÁ   RC   R   RY   RB   R¯   R   RÊ   (   R   R0   R®   RÃ   R"   Rº   R¼   R½   RQ   RÄ   RÅ   RÆ   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   Ë  s$    	



&(   R9   R:   R;   RÇ   RE   RÈ   R=   R#   R(   Rx   Ra   RU   R¹   R/   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR¯   M  s   J
				RÊ   c           B  sb   e  Z d  Z d Z e Z e d „  ƒ Z d d „ Z d „  Z	 d „  Z
 d „  Z d „  Z d „  Z RS(	   sù  
    The derivative `\operatorname{Bi}^\prime` of the Airy function of the first kind.

    The Airy function `\operatorname{Bi}^\prime(z)` is defined to be the function

    .. math::
        \operatorname{Bi}^\prime(z) := \frac{\mathrm{d} \operatorname{Bi}(z)}{\mathrm{d} z}.

    Examples
    ========

    Create an Airy function object:

    >>> from sympy import airybiprime
    >>> from sympy.abc import z

    >>> airybiprime(z)
    airybiprime(z)

    Several special values are known:

    >>> airybiprime(0)
    3**(1/6)/gamma(1/3)
    >>> from sympy import oo
    >>> airybiprime(oo)
    oo
    >>> airybiprime(-oo)
    0

    The Airy function obeys the mirror symmetry:

    >>> from sympy import conjugate
    >>> conjugate(airybiprime(z))
    airybiprime(conjugate(z))

    Differentiation with respect to z is supported:

    >>> from sympy import diff
    >>> diff(airybiprime(z), z)
    z*airybi(z)
    >>> diff(airybiprime(z), z, 2)
    z*airybiprime(z) + airybi(z)

    Series expansion is also supported:

    >>> from sympy import series
    >>> series(airybiprime(z), z, 0, 3)
    3**(1/6)/gamma(1/3) + 3**(5/6)*z**2/(6*gamma(2/3)) + O(z**3)

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

    >>> airybiprime(-2).evalf(50)
    0.27879516692116952268509756941098324140300059345163

    Rewrite Bi'(z) in terms of hypergeometric functions:

    >>> from sympy import hyper
    >>> airybiprime(z).rewrite(hyper)
    3**(5/6)*z**2*hyper((), (5/3,), z**3/9)/(6*gamma(2/3)) + 3**(1/6)*hyper((), (1/3,), z**3/9)/gamma(1/3)

    See Also
    ========

    airyai: Airy function of the first kind.
    airybi: Airy function of the second kind.
    airyaiprime: Derivative of the Airy function of the first kind.

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Airy_function
    .. [2] http://dlmf.nist.gov/9
    .. [3] http://www.encyclopediaofmath.org/index.php/Airy_functions
    .. [4] http://mathworld.wolfram.com/AiryFunctions.html
    i   c         C  s…   | j  r | t j k r t j S| t j k r5 t j S| t j k rK t j S| t j k r d t d d ƒ t t d d ƒ ƒ Sn  d  S(   Ni   i   i   (   R­   R   RH   RI   RJ   RD   R   R   (   R    R®   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR#   6  s    	c         C  s;   | d k r( |  j  d t |  j  d ƒ St |  | ƒ ‚ d  S(   Ni   i    (   R   RÂ   R   (   R   R'   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR(   B  s    c         C  st   d d l  m } m } d d l m } |  j d j | ƒ } | | ƒ  | j | d d ƒ} Wd  QX| j | | ƒ S(   Niÿÿÿÿ(   RÌ   RÍ   (   R†   i    RÎ   i   (	   R‘   RÌ   RÍ   RN   R†   R   R”   RÂ   R“   (   R   Ry   RÌ   RÍ   R†   R"   RÏ   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRx   H  s    c         K  si   t  d d ƒ } | t | t  d d ƒ ƒ } t | ƒ j re | t d ƒ t | | ƒ t | | ƒ Sd  S(   Ni   i   (   R   R   R   R*   R   R>   (   R   R"   RT   Rµ   R¶   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRa   P  s    c         K  sê   t  d d ƒ } t  d d ƒ } | t | t  d d ƒ ƒ } t | ƒ j rr | t d ƒ t | | ƒ t | | ƒ St | t  d d ƒ ƒ } t | | ƒ } t | | ƒ } t | ƒ | t | | | ƒ | d | t | | | ƒ Sd  S(   Ni   i   i   (   R   R   R   R.   R   RM   (   R   R"   RT   R´   Rµ   R¶   RË   Rº   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRU   V  s    )c         K  s¤   | d d t  d d ƒ t t d ƒ d ƒ } t  d d ƒ t t d ƒ d ƒ } | t g  t d ƒ d g | d d ƒ | t g  t d ƒ d g | d d ƒ S(   Ni   i   i   i   i   i	   (   R   R   R   R   (   R   R"   RT   R·   R¸   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR¹   b  s    /#c         K  sm  |  j  d } | j } t | ƒ d k ri| j ƒ  } t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} t d d | g ƒ} | j | | | | | ƒ }	 |	 d  k	 ri|	 | } d | j rf|	 | } |	 | } |	 | } | | | | | | | | | }
 | | | | | | } t j	 t
 d ƒ |
 t j t | ƒ |
 t j t | ƒ Sqin  d  S(	   Ni    i   Rº   R»   R¼   R½   RQ   i   (   R   R¾   R°   R¿   R   RÀ   RÁ   RC   R   RY   R   RB   R¯   RÊ   (   R   R0   R®   RÃ   R"   Rº   R¼   R½   RQ   RÄ   RÅ   RÆ   (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyR/   g  s$    	



&(   R9   R:   R;   RÇ   RE   RÈ   R=   R#   R(   Rx   Ra   RU   R¹   R/   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyRÊ   å  s   L				N(?   t
   __future__R    R   t	   functoolsR   RN   R   R   R   R   R   R   R	   t   sympy.core.functionR
   R   t   sympy.core.powerR   t   sympy.core.compatibilityR   t(   sympy.functions.combinatorial.factorialsR   t(   sympy.functions.elementary.trigonometricR   R   R   R   t$   sympy.functions.elementary.complexesR   t(   sympy.functions.elementary.miscellaneousR   R   R   R   t'   sympy.functions.special.gamma_functionsR   t   sympy.functions.special.hyperR   t   sympy.polys.orthopolysR   Rn   R   R>   RV   RM   Rh   Rl   Rm   Rp   Rq   Rz   R{   RX   Rd   R|   R€   R‚   RŸ   R    R¬   RÂ   R¯   RÊ   (    (    (    s=   lib/python2.7/site-packages/sympy/functions/special/bessel.pyt   <module>   sF   4"8~OdT+,	#		I?855F&¦ª˜