
    (phw                     R     S SK r S SKJr  S rg! \ a     Nf = f! \ a     Nf = f)    Nxc                 0  ^  [        T 5      n[        U 4S j[        U5       5       5      n[        U-  R	                  [        SU5      R                  5       nUS-  /n[        U5       H(  nUR                  US   U-  R                  5       5        M*     [        R                  " S5      /n[        SU5       H0  nUR                  XE   R                  [        US-
  5      U-  5        M2     U Vs/ s H  n[        R                  " U5      PM     nnU$ s  snf )at  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   B   >#    U  H  nTU   [         U-  -  v   M     g 7f)Nr   ).0ias     R/var/www/html/venv/lib/python3.13/site-packages/scipy/special/_precompute/utils.py	<genexpr>%lagrange_inversion.<locals>.<genexpr>   s     (x!AaDAIxs   r      )lensumranger   seriesremoveOappendexpandmpmpfcoeff)r	   nfhhpowerkbr   s   `       r
   lagrange_inversionr      s      	AA(uQx((A	
1Q1%%'AdVF1Xvbz!|++-. 	A1a[	AE*1,- AqAAH 	s   / D)mpmathr   ImportError	sympy.abcr   r        r
   <module>r%      sA   		
  		
  		s     &&