ó
î&]\c           @` s§   d  d l  m Z m Z m Z d  d l m Z y d  d l Z Wn e k
 rO n Xy6 e   ' Z	 e	 j
 e d  d  d l m Z Wd QXWn e k
 r n Xd   Z d S(   i    (   t   divisiont   print_functiont   absolute_import(   t   suppress_warningsNs"   inspect.getargspec.. is deprecated(   t   xc         ` sų   t     } t   f d   t t      D  } t | j t d |  j   } | d g } x/ t |  D]! } | j | d | j    qm Wt j	 d  g } x< t d |  D]+ } | j | | j
 t | d  |  qī Wt d   |  } | S(   s  Given a series

    f(x) = a[1]*x + a[2]*x**2 + ... + a[n-1]*x**(n - 1),

    use the Lagrange inversion formula to compute a series

    g(x) = b[1]*x + b[2]*x**2 + ... + b[n-1]*x**(n - 1)

    so that f(g(x)) = g(f(x)) = x mod x**n. We must have a[0] = 0, so
    necessarily b[0] = 0 too.

    The algorithm is naive and could be improved, but speed isn't an
    issue here and it's easy to read.

    c         3` s!   |  ] }   | t  | Vq d  S(   N(   R   (   t   .0t   i(   t   a(    s>   lib/python2.7/site-packages/scipy/special/_precompute/utils.pys	   <genexpr>%   s    i    iĸĸĸĸi   c         S` s   t  j |   S(   N(   t   mpt   mpf(   R   (    (    s>   lib/python2.7/site-packages/scipy/special/_precompute/utils.pyt   <lambda>-   s    (   t   lent   sumt   rangeR   t   seriest   removeOt   appendt   expandR   R	   t   coefft   map(   R   t   nt   ft   ht   hpowert   kt   b(    (   R   s>   lib/python2.7/site-packages/scipy/special/_precompute/utils.pyt   lagrange_inversion   s    ()(   t
   __future__R    R   R   t   scipy._lib._numpy_compatR   t   mpmathR   t   ImportErrort   supt   filtert   DeprecationWarningt	   sympy.abcR   R   (    (    (    s>   lib/python2.7/site-packages/scipy/special/_precompute/utils.pyt   <module>   s   