
\c           @  sp  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
 d  d l m Z m Z m Z d  d l m Z d  d l m Z d  d	 l m Z d  d
 l m Z d  d l m Z d  d l m Z m Z d  d l m Z d  d l m Z 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 S(   i(   t   print_functiont   division(   t   sympify(   t   Add(   t   cacheit(   t   range(   t   Functiont   ArgumentIndexErrort   _coeff_isneg(   t	   fuzzy_not(   t   Mul(   t   Integer(   t   Pow(   t   S(   t   Wildt   Dummy(   t	   factorial(   t   multiplicityt   perfect_powert   ExpBasec           B  sq   e  Z e Z d  d  Z d   Z e d    Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z RS(   i   c         C  s   t  S(   s=   
        Returns the inverse function of ``exp(x)``.
        (   t   log(   t   selft   argindex(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   inverse!   s    c         C  s]   |  j  } | j } | r3 | j r3 t |  } n  | rP t j |  j |  f S|  t j f S(   s7  
        Returns this with a positive exponent as a 2-tuple (a fraction).

        Examples
        ========

        >>> from sympy.functions import exp
        >>> from sympy.abc import x
        >>> exp(-x).as_numer_denom()
        (1, exp(x))
        >>> exp(x).as_numer_denom()
        (exp(x), 1)
        (   t   expt   is_negativeR   R   t   Onet   func(   R   R   t   neg_exp(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   as_numer_denom'   s    		c         C  s   |  j  d S(   s7   
        Returns the exponent of the function.
        i    (   t   args(   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   ?   s    c         C  s   |  j  d  t |  j   f S(   s7   
        Returns the 2-tuple (base, exponent).
        i   (   R   R
   R   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   as_base_expF   s    c         C  s   |  j  |  j d j    S(   Ni    (   R   R   t	   conjugate(   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_conjugateL   s    c         C  sD   |  j  d } | j r3 | j r# t S| j r3 t Sn  | j r@ t Sd  S(   Ni    (   R   t   is_infiniteR   t   Truet   is_positivet   Falset	   is_finite(   R   t   arg(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_finiteO   s    				c         C  sj   |  j  |  j   } | j  |  j  k r_ | j t j k r: t S| j j rf t | j j  rf t	 Sn | j Sd  S(   N(
   R   R   R   R   t   ZeroR#   t   is_rationalR	   t   is_zeroR%   (   R   t   s(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_rationalY   s    c         C  s   |  j  d t j k S(   Ni    (   R   R   t   NegativeInfinity(   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_zeroc   s    c         C  s1   |  j    \ } } t j t | | d t |  S(   s;   exp(arg)**e -> exp(arg*e) if assumptions allow it.
        t   evaluate(   R   R   t   _eval_powerR%   (   R   t   othert   bt   e(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR1   f   s    c         K  s]   |  j  d } | j rP | j rP d } x$ | j  D] } | |  j |  9} q/ W| S|  j |  S(   Ni    i   (   R   t   is_Addt   is_commutativeR   (   R   t   hintsR'   t   exprt   x(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_expand_power_expl   s    (   t   __name__t
   __module__R#   t
   unbranchedR   R   t   propertyR   R   R!   R(   R-   R/   R1   R:   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR      s   				
	
		t	   exp_polarc           B  sG   e  Z d  Z e Z e Z d   Z d   Z d   Z	 d   Z
 d   Z RS(   so  
    Represent a 'polar number' (see g-function Sphinx documentation).

    ``exp_polar`` represents the function
    `Exp: \mathbb{C} \rightarrow \mathcal{S}`, sending the complex number
    `z = a + bi` to the polar number `r = exp(a), \theta = b`. It is one of
    the main functions to construct polar numbers.

    >>> from sympy import exp_polar, pi, I, exp

    The main difference is that polar numbers don't "wrap around" at `2 \pi`:

    >>> exp(2*pi*I)
    1
    >>> exp_polar(2*pi*I)
    exp_polar(2*I*pi)

    apart from that they behave mostly like classical complex numbers:

    >>> exp_polar(2)*exp_polar(3)
    exp_polar(5)

    See Also
    ========

    sympy.simplify.simplify.powsimp
    sympy.functions.elementary.complexes.polar_lift
    sympy.functions.elementary.complexes.periodic_argument
    sympy.functions.elementary.complexes.principal_branch
    c         C  s'   d d l  m } t | |  j d   S(   Ni(   t   rei    (   t$   sympy.functions.elementary.complexesR@   R   R   (   R   R@   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt	   _eval_Abs   s    c         C  s   d d l  m } m } m } | |  j d  } y | | k pH | | k } Wn t k
 re t } n X| rp |  St |  j d  j |  } | d k r | |  d k  r | |  S| S(   s.    Careful! any evalf of polar numbers is flaky i(   t   imt   piR@   i    (	   t   sympyRC   RD   R@   R   t	   TypeErrorR#   R   t   _eval_evalf(   R   t   precRC   RD   R@   t   it   badt   res(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRG      s    

c         C  s   |  j  |  j d |  S(   Ni    (   R   R   (   R   R2   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR1      s    c         C  s   |  j  d j r t Sd  S(   Ni    (   R   t   is_realR#   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_real   s    c         C  s0   |  j  d d k r# |  t d  f St j |   S(   Ni    i   (   R   R   R   R   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR      s    (   R;   R<   t   __doc__R#   t   is_polarR%   t   is_comparableRB   RG   R1   RM   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR?   v   s   				R   c           B  s   e  Z d  Z d d  Z d   Z e d    Z e d    Z e	 e
 d     Z e d  Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sT   
    The exponential function, :math:`e^x`.

    See Also
    ========

    log
    i   c         C  s#   | d k r |  St  |  |   d S(   s@   
        Returns the first derivative of this function.
        i   N(   R   (   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   fdiff   s    c         C  s  d d l  m } m } |  j d } | j rt j t j } | | | g k rV t j S| j	 t j
 t j  } | r| | j d |   r| | j |   r t j S| | j |   r t j S| | j | t j   r t j S| | j | t j   rt j Sqqn  d  S(   Ni(   t   askt   Qi    i   (   t   sympy.assumptionsRR   RS   R   t   is_MulR   t   ImaginaryUnitt   Infinityt   NaNt   as_coefficientt   Pit   integert   evenR   t   oddt   NegativeOnet   Half(   R   t   assumptionsRR   RS   R'   t   Ioot   coeff(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_refine   s"    	c         C  s  d d l  m } m } d d l m } d d l m } d d l m } d d l	 m
 } | j r | t j k ru t j S| t j k r t j S| t j k r t j S| t j k r t j S| t j k rt j Sn| t j k r t j St | t  r | j d St | |  r.| t | j  t | j   St | |  rJ| j |   S| j r| j se| j r%| j t j t j   } | r%| | j! d |   r"| | j" |   rt j S| | j# |   rt j$ S| | j" | t j%   rt j  S| | j# | t j%   rt j  Sq"q%n  | j&   \ } }	 | t j t j g k rSd  S| g d  }
 } xr t( j) |	  D]a } | |  } t | t  r| d  k r| j d } qd  Sqs| j* r|
 j+ |  qsd  SqsW| r| t( |
   Sd  S| j, rg  } g  } xk | j D]` } | t j k r7| j+ |  qn  |  |  } t | |   rb| j+ |  q| j+ |  qW| rt( |   |  t- |   d	 t. Sn t | |  r| j   Sd  S(
   Ni(   RR   RS   (   t   AccumBounds(   t   SetExpr(   t
   MatrixBase(   t
   logcombinei    i   R0   (/   RT   RR   RS   t   sympy.calculusRd   t   sympy.sets.setexprRe   t   sympy.matrices.matricesRf   RE   Rg   t	   is_NumberR   RX   R)   R   t   Exp1RW   R.   t   ComplexInfinityt
   isinstanceR   R   R   t   mint   maxt
   _eval_funcRU   t	   is_numbert	   is_SymbolRb   RZ   RV   R[   R\   R]   R^   R_   t   as_coeff_Mult   NoneR
   t	   make_argsRP   t   appendR5   R   R%   (   t   clsR'   RR   RS   Rd   Re   Rf   Rg   Rb   t   termst   coeffst   log_termt   termt   term_t   outt   addt   at   newa(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   eval   s    	
			#c         C  s   t  j S(   s?   
        Returns the base of the exponential function.
        (   R   Rl   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   base6  s    c         G  so   |  d k  r t  j S|  d k r& t  j St |  } | r] | d } | d k	 r] | | |  Sn  | |  t |   S(   sJ   
        Calculates the next term in the Taylor series expansion.
        i    iN(   R   R)   R   R   Ru   R   (   t   nR9   t   previous_termst   p(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   taylor_term=  s    
c         K  s   d d l  } |  j d j   \ } } | rR | j | |  } | j | |  } n  | j |  | j |  } } t |  | t |  | f S(   sq  
        Returns this function as a 2-tuple representing a complex number.

        Examples
        ========

        >>> from sympy import I
        >>> from sympy.abc import x
        >>> from sympy.functions import exp
        >>> exp(x).as_real_imag()
        (exp(re(x))*cos(im(x)), exp(re(x))*sin(im(x)))
        >>> exp(1).as_real_imag()
        (E, 0)
        >>> exp(I).as_real_imag()
        (cos(1), sin(1))
        >>> exp(1+I).as_real_imag()
        (E*cos(1), E*sin(1))

        See Also
        ========

        sympy.functions.elementary.complexes.re
        sympy.functions.elementary.complexes.im
        iNi    (   RE   R   t   as_real_imagt   expandt   cost   sinR   (   R   t   deepR7   RE   R@   RC   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   N  s    c         C  s   | j  r( t | j t | j   } n! | t j k rI | j rI t } n  t | t  sg | t j k r d   } t j	 | |   | |  |  S| t k r | j r | |  j j
 | |  St j	 |  | |  S(   Nc         S  s2   |  j  s t |  t  r. t d t |  j    S|  S(   NR0   (   t   is_PowRn   R   R   R%   R   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   <lambda>v  s    (   R   R   R   R   R   Rl   t   is_FunctionRn   R   t
   _eval_subst   _subsR   (   R   t   oldt   newt   f(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   o  s    			c         C  sU   |  j  d j r t S|  j  d j rQ t d  t j |  j  d t j } | j Sd  S(   Ni    i   (   R   RL   R#   t   is_imaginaryR   RV   RZ   t   is_even(   R   t   arg2(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRM   ~  s
    &c         C  sn   |  j  |  j   } | j  |  j  k rc t |  j j  rj |  j j rF t S|  j t j j	 r` t Sqj n | j Sd  S(   N(
   R   R   R	   R   R+   t   is_algebraicR%   R   RZ   R*   (   R   R,   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_algebraic  s    
c         C  s[   |  j  d j r$ |  j  d t j k	 S|  j  d j rW t j |  j  d t j } | j Sd  S(   Ni    (   R   RL   R   R.   R   RV   RZ   R   (   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_positive  s
    c         C  s.  d d l  m } m } m } m } |  j d } | j | d | d | }	 |	 j r[ d |	 S| |	 j   | d  }
 |
 | | g k r |  St	 d  } t
 |  j | |  } | j   } | j   } t
 |
  | j | |	 |
  } | | | j j | |	 |
  |  7} | j   } | | d t d	 d
 S(   Ni(   t   limitt   oot   Ordert   powsimpi    R   t   logxi   t   tR   t   combineR   (   RE   R   R   R   R   R   t   _eval_nseriest   is_Ordert   removeOR   R   t   _taylort   getOt   subsR8   R   R#   (   R   R9   R   R   R   R   R   R   R'   t
   arg_seriest   arg0R   t
   exp_seriest   ot   r(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s     "	 &c         C  s   d d l  m } g  } d  } xR t |  D]D } |  j | |  j d |  } | j | d | } | j |  q) Wt |   | | | |  S(   Ni(   R   i    R   (	   RE   R   Ru   R   R   R   t   nseriesRw   R   (   R   R9   R   R   t   lt   gRI   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    c         C  s   d d l  m } |  j d } | j rU t g  | j D] } t |  j |  ^ q3   S|  j d j |  } | d |  j |  r t j	 St |  S(   Ni(   R   i    i   (
   RE   R   R   R5   R
   R   t   as_leading_termt   containsR   R   (   R   R9   R   R'   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_as_leading_term  s    	/c         K  sD   d d l  m } t j } | | | t j d  | | | |  S(   Ni(   R   i   (   RE   R   R   RV   RZ   (   R   R'   t   kwargsR   t   I(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_rewrite_as_sin  s    	c         K  sD   d d l  m } t j } | | |  | | | | t j d  S(   Ni(   R   i   (   RE   R   R   RV   RZ   (   R   R'   R   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_rewrite_as_cos  s    	c         K  s4   d d l  m } d | | d  d | | d  S(   Ni(   t   tanhi   i   (   RE   R   (   R   R'   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_rewrite_as_tanh  s    c         K  s   d d l  m } m } | j r | j t j t j  } | r | j r | t j |  | t j |  } } t	 | |  r t	 | |  r | t j | Sq n  d  S(   Ni(   R   R   (
   t(   sympy.functions.elementary.trigonometricR   R   RU   Rb   R   RZ   RV   Rr   Rn   (   R   R'   R   R   R   Rb   t   cosinet   sine(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_rewrite_as_sqrt  s    	' c         K  s{   | j  rw g  | j D]0 } t | t  r t | j  d k r | ^ q } | rw t | d j d | j | d   Sn  d  S(   Ni   i    (   RU   R   Rn   R   t   lenR   Rb   (   R   R'   R   R   t   logs(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_rewrite_as_Pow  s    	@(   R;   R<   RN   RQ   Rc   t   classmethodR   R>   R   t   staticmethodR   R   R#   R   R   RM   R   R   R   R   R   R   R   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR      s(   		T!						
	
					R   c           B  s   e  Z d  Z d d  Z d d  Z e d d   Z d   Z e	 e
 d     Z e d  Z d   Z e d	  Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    The natural logarithm function `\ln(x)` or `\log(x)`.
    Logarithms are taken with the natural base, `e`. To get
    a logarithm of a different base ``b``, use ``log(x, b)``,
    which is essentially short-hand for ``log(x)/log(b)``.

    See Also
    ========

    exp
    i   c         C  s.   | d k r d |  j  d St |  |   d S(   s?   
        Returns the first derivative of the function.
        i   i    N(   R   R   (   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRQ     s    c         C  s   t  S(   sC   
        Returns `e^x`, the inverse function of `\log(x)`.
        (   R   (   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    c   	      C  s  d d l  m } d d l m } d d l m } t |  } | d  k	 r<t |  } | d k r} | d k rs t j	 St j
 Sn  y{ t | |  } | r | | } | j r | t | |  t |  S| t | |  t |  Sn t |  t |  SWn t k
 rn X| t j k	 r/|  |  |  |  S|  |  Sn  | j r| t j k r[t j
 S| t j k rqt j S| t j k rt j S| t j k rt j S| t j	 k rt j	 S| j r| j d k r|  | j  Sn  | t j
 k rt j
 St | t  r| j d j r| j d St | t  r8| | j  St | |  ry| j j rr| t | j  t | j   Sd  Sn t | |  r| j  |   S| j! r| j" rt j# t j$ |  |  S| t j
 k rt j
 S| t j k rt j Sn  | j% s| j& t j$  } | d  k	 r| t j k r,t j S| t j k rBt j S| j r| j' rst j# t j$ t j( |  |  St j# t j$ t j( |  |  Sqqn  d  S(   Ni(   t
   unpolarify(   Rd   (   Re   i   i    ()   RE   R   Rh   Rd   Ri   Re   R   Ru   R   RX   Rm   R   t
   is_IntegerR   t
   ValueErrorRl   Rk   R)   R   RW   R.   t   is_RationalR   t   qRn   R   R   RL   R?   Ro   R$   Rp   Rq   Rr   R   RZ   RV   R5   RY   t   is_nonnegativeR_   (	   Rx   R'   R   R   Rd   Re   R   t   denRb   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    

				
			c         C  s   |  t  j f S(   sE   
        Returns this function in the form (base, exponent).
        (   R   R   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   N  s    c         G  s   d d l  m } |  d k  r# t j St |  } |  d k r? | S| r | d } | d	 k	 r | |  | | |  d d t d d Sn  d d |  d | |  d |  d S(
   sV   
        Returns the next term in the Taylor series expansion of `\log(1+x)`.
        i(   R   i    i   R   R   R   i   N(   RE   R   R   R)   R   Ru   R#   (   R   R9   R   R   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   T  s    
*c         K  s  d d l  m } m } d d l m } m } | j d t  } t |  j	  d k ru | |  j
 |  j	   d | d | S|  j	 d } | j r t t |   }	 |	 t k	 r|	 d |  j
 |	 d  Sn| j r t | j  t | j  S| j rg  }
 g  } x | j	 D] } | s%| j s%| j ru|  j
 |  } t | t  re|
 j |  j
 |  j |    q|
 j |  q| j r|  j
 |  } |
 j |  | j t j  q| j |  qWt |
   t t |    S| j st | t  r| s;| j j r/| j  j s;| j d j r/| j d j! s;| j  j r| j  } | j } |  j
 |  } t | t  r| |  | j |   S| |  | Sqn7 t | |  r| j" j r| t | j"  | j#  Sn  |  j
 |  S(	   Ni(   R   t
   expand_log(   t   Sumt   Productt   forcei   R   i    i   ($   RE   R   R   t   sympy.concreteR   R   t   getR%   R   R   R   R   R   t   intR   R   R   R   RU   R$   RO   Rn   Rw   t   _eval_expand_logR   R   R^   R   R
   R   R   RL   R   t   is_nonpositivet   functiont   limits(   R   R   R7   R   R   R   R   R   R'   R   R8   t   nonposR9   R   R3   R4   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   f  sP    "			"	.		c   	      C  s   d d l  m } m } m } t |  j  d k r_ | |  j |  j   d | d | d | d | S|  j | |  j d d | d | d | d |  } | r | |  } n  | | d	 t } t | |  g d
 | S(   Ni(   R   t   simplifyt   inversecombinei   t   ratiot   measuret   rationalR   i    R   t   key(	   t   sympy.simplify.simplifyR   R   R   R   R   R   R#   Ro   (	   R   R   R   R   R   R   R   R   R8   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_simplify  s    !"c         K  s   d d l  m } m } | r] | |  j d j | |   } | |  j d j | |   } n& | |  j d  } | |  j d  } | j d t  r t | d <t |  j | |  | f St |  | f Sd S(   s  
        Returns this function as a complex coordinate.

        Examples
        ========

        >>> from sympy import I
        >>> from sympy.abc import x
        >>> from sympy.functions import log
        >>> log(x).as_real_imag()
        (log(Abs(x)), arg(x))
        >>> log(I).as_real_imag()
        (0, pi/2)
        >>> log(1 + I).as_real_imag()
        (log(sqrt(2)), pi/4)
        >>> log(I*x).as_real_imag()
        (log(Abs(x)), arg(I*x))

        i(   t   AbsR'   i    R   t   complexN(   RE   R   R'   R   R   R   R%   R   (   R   R   R7   R   R'   t   abs(    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    "
c         C  sx   |  j  |  j   } | j  |  j  k rm |  j d d j r< t S| j d j rt t |  j d d j  rt t Sn | j Sd  S(   Ni    i   (   R   R   R+   R#   R*   R	   R%   (   R   R,   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR-     s    *c         C  s{   |  j  |  j   } | j  |  j  k rp |  j d d j r< t St |  j d d j  rw |  j d j rm t Sqw n | j Sd  S(   Ni    i   (   R   R   R+   R#   R	   R   R%   (   R   R,   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    
c         C  s   |  j  d j S(   Ni    (   R   R$   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRM     s    c         C  s!   |  j  d } | j r t S| j S(   Ni    (   R   R+   R%   R&   (   R   R'   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR(     s    	c         C  s   |  j  d d j S(   Ni    i   (   R   R$   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s    c         C  s   |  j  d d j S(   Ni    i   (   R   R+   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR/     s    c         C  s   |  j  d d j S(   Ni    i   (   R   R   (   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   _eval_is_nonnegative  s    c         C  s  d d l  m } m } | s+ t |  } n  |  j d | k rB | S|  j d } t d  t d  } } | j | | |  }	 |	 d  k	 r |	 | |	 | } } | d k r | j |  r | j |  r t |  | | }	 |	 Sn  |  j d j	 | d | d | }
 x9 |
 j
 rD| d 7} |  j d j	 | d | d | }
 qW|
 j |  \ } } | |
 | | | d  } d  } g  } xU t | d	  D]C } t j | | |  } | j	 | d | d | } | j |  qWt |  | | t |   | | | |  S(
   Ni(   t   cancelR   i    t   kR   R   R   i   i   (   RE   R   R   R   R   R   t   matchRu   t   hasR   R   t   leadtermR   R   Rw   R   (   R   R9   R   R   R   R   R'   R   R   R   R,   R   R3   R   R   RI   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s4    ,"
&c         C  sJ   |  j  d j |  } | t j k r= |  j  d d j |  S|  j |  S(   Ni    i   (   R   R   R   R   R   (   R   R9   R'   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   	  s    N(   R;   R<   RN   RQ   R   R   Ru   R   R   R   R   R   R#   R   R   R   R-   R   RM   R(   R   R/   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s(   	T	/	!	
							 t   LambertWc           B  s>   e  Z d  Z e d d   Z d d  Z d   Z d   Z RS(   s  
    The Lambert W function `W(z)` is defined as the inverse
    function of `w \exp(w)` [1]_.

    In other words, the value of `W(z)` is such that `z = W(z) \exp(W(z))`
    for any complex number `z`.  The Lambert W function is a multivalued
    function with infinitely many branches `W_k(z)`, indexed by
    `k \in \mathbb{Z}`.  Each branch gives a different solution `w`
    of the equation `z = w \exp(w)`.

    The Lambert W function has two partially real branches: the
    principal branch (`k = 0`) is real for real `z > -1/e`, and the
    `k = -1` branch is real for `-1/e < z < 0`. All branches except
    `k = 0` have a logarithmic singularity at `z = 0`.

    Examples
    ========

    >>> from sympy import LambertW
    >>> LambertW(1.2)
    0.635564016364870
    >>> LambertW(1.2, -1).n()
    -1.34747534407696 - 4.41624341514535*I
    >>> LambertW(-1).is_real
    False

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Lambert_W_function
    c         C  sa  | t  j k r |  |  S| d  k r1 t  j } n  | t  j k r | t  j k rV t  j S| t  j k rl t  j S| d t  j k r t  j S| t d  d k r t d  S| t  j k r t  j Sn  t | j	  r | t  j k r t  j
 Sn  | t  j k r]| t  j d k rt  j t  j d S| d t  j k r9t  j S| d t d  k r]t d  Sn  d  S(   Nii   i(   R   R)   Ru   Rl   R   R^   R   RW   R	   R+   R.   RZ   RV   R   R   (   Rx   R9   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   1  s2    


i   c         C  s   |  j  d } t |  j   d k rM | d k r t |  | d t |  Sn; |  j  d } | d k r t | |  | d t | |  St |  |   d S(   s?   
        Return the first derivative of this function.
        i    i   N(   R   R   R   R   (   R   R   R9   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRQ   O  s    "c         C  s   |  j  d } t |  j   d k r. t j } n |  j  d } | j rw | d t j j r\ t S| d t j j r t	 Sn | d j r | j
 r | d t j j r t S| j s | d t j j r t	 Sn2 t | j  r t | d j  r | j r t	 Sn  d  S(   Ni    i   (   R   R   R   R)   R+   Rl   R$   R#   R   R%   R   R   R	   RL   (   R   R9   R   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyRM   _  s"    	"	c         C  s\   |  j  |  j   } | j  |  j  k rQ t |  j d j  rX |  j d j rX t Sn | j Sd  S(   Ni    (   R   R   R	   R+   R   R%   (   R   R,   (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR   s  s
    &N(	   R;   R<   RN   R   Ru   R   RQ   RM   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyR     s   	N(&   t
   __future__R    R   t
   sympy.coreR   t   sympy.core.addR   t   sympy.core.cacheR   t   sympy.core.compatibilityR   t   sympy.core.functionR   R   R   t   sympy.core.logicR	   t   sympy.core.mulR
   t   sympy.core.numbersR   t   sympy.core.powerR   t   sympy.core.singletonR   t   sympy.core.symbolR   R   t(   sympy.functions.combinatorial.factorialsR   t   sympy.ntheoryR   R   R   R?   R   R   R   (    (    (    sE   lib/python2.7/site-packages/sympy/functions/elementary/exponential.pyt   <module>   s(   YE # 4