+
    þäûjX,  ã                   óV   € ^ RI Ht ^ RIHt ^ RIHt  ! R R]4      t ! R R]4      tR# )	é    )ÚExprWithLimits)ÚS)ÚEqc                   ó6   a a€ ] tR t^t oRtV 3R ltRtVtV ;t# )ÚReorderErrorz;
Exception raised when trying to reorder dependent limits.
c                ó6   <€ \         SV `  V: R V: R24       R# )z could not be reordered: Ú.N)ÚsuperÚ__init__)ÚselfÚexprÚmsgÚ	__class__s   &&&€Ú^C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\concrete\expr_with_intlimits.pyr   ÚReorderError.__init__	   s   ø€ Ü‰ÑÛ04³cÐ:ö	<ó    © )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r   Ú__classdict__s   @@r   r   r      s   ù‡ € ñ÷<õ <r   r   c                   óT   a € ] tR t^t o RtRtR	R ltR tR tR t	]
R 4       tRtV tR# )
ÚExprWithIntLimitsz¢
Superclass for Product and Sum.

See Also
========

sympy.concrete.expr_with_limits.ExprWithLimits
sympy.concrete.products.Product
sympy.concrete.summations.Sum
Nc                óà  € Vf   Tp. pV P                    EFˆ  pV^ ,          V8X  Ede   VP                  V4      pVP                  4       ^8w  d   \        R4      hVP	                  V4      pVP	                  \
        P                  4      pVP                  '       d³   V\
        P                  8X  d?   VP                  W7V^,          ,          V,           Wu^,          ,          V,           34       KÙ  V\
        P                  8X  d@   VP                  W7V^,          ,          V,           Wu^,          ,          V,           34       EK-  \        R4      hVP                  W7V^,          ,          V,           Wu^,          ,          V,           34       EKw  VP                  V4       EK‹  	  V P                  P                  WX,
          X,          4      p	V	P                  W4      p	V P                  ! V	.VO5!  # )aw	  
Change index of a Sum or Product.

Perform a linear transformation `x \mapsto a x + b` on the index variable
`x`. For `a` the only values allowed are `\pm 1`. A new variable to be used
after the change of index can also be specified.

Explanation
===========

``change_index(expr, var, trafo, newvar=None)`` where ``var`` specifies the
index variable `x` to transform. The transformation ``trafo`` must be linear
and given in terms of ``var``. If the optional argument ``newvar`` is
provided then ``var`` gets replaced by ``newvar`` in the final expression.

Examples
========

>>> from sympy import Sum, Product, simplify
>>> from sympy.abc import x, y, a, b, c, d, u, v, i, j, k, l

>>> S = Sum(x, (x, a, b))
>>> S.doit()
-a**2/2 + a/2 + b**2/2 + b/2

>>> Sn = S.change_index(x, x + 1, y)
>>> Sn
Sum(y - 1, (y, a + 1, b + 1))
>>> Sn.doit()
-a**2/2 + a/2 + b**2/2 + b/2

>>> Sn = S.change_index(x, -x, y)
>>> Sn
Sum(-y, (y, -b, -a))
>>> Sn.doit()
-a**2/2 + a/2 + b**2/2 + b/2

>>> Sn = S.change_index(x, x+u)
>>> Sn
Sum(-u + x, (x, a + u, b + u))
>>> Sn.doit()
-a**2/2 - a*u + a/2 + b**2/2 + b*u + b/2 - u*(-a + b + 1) + u
>>> simplify(Sn.doit())
-a**2/2 + a/2 + b**2/2 + b/2

>>> Sn = S.change_index(x, -x - u, y)
>>> Sn
Sum(-u - y, (y, -b - u, -a - u))
>>> Sn.doit()
-a**2/2 - a*u + a/2 + b**2/2 + b*u + b/2 - u*(-a + b + 1) + u
>>> simplify(Sn.doit())
-a**2/2 + a/2 + b**2/2 + b/2

>>> P = Product(i*j**2, (i, a, b), (j, c, d))
>>> P
Product(i*j**2, (i, a, b), (j, c, d))
>>> P2 = P.change_index(i, i+3, k)
>>> P2
Product(j**2*(k - 3), (k, a + 3, b + 3), (j, c, d))
>>> P3 = P2.change_index(j, -j, l)
>>> P3
Product(l**2*(k - 3), (k, a + 3, b + 3), (l, -d, -c))

When dealing with symbols only, we can make a
general linear transformation:

>>> Sn = S.change_index(x, u*x+v, y)
>>> Sn
Sum((-v + y)/u, (y, b*u + v, a*u + v))
>>> Sn.doit()
-v*(a*u - b*u + 1)/u + (a**2*u**2/2 + a*u*v + a*u/2 - b**2*u**2/2 - b*u*v + b*u/2 + v)/u
>>> simplify(Sn.doit())
a**2*u/2 + a/2 - b**2*u/2 + b/2

However, the last result can be inconsistent with usual
summation where the index increment is always 1. This is
obvious as we get back the original value only for ``u``
equal +1 or -1.

See Also
========

sympy.concrete.expr_with_intlimits.ExprWithIntLimits.index,
reorder_limit,
sympy.concrete.expr_with_intlimits.ExprWithIntLimits.reorder,
sympy.concrete.summations.Sum.reverse_order,
sympy.concrete.products.Product.reverse_order
z"Index transformation is not linearz>Linear transformation results in non-linear summation stepsize)ÚlimitsÚas_polyÚdegreeÚ
ValueErrorÚcoeff_monomialr   ÚOneÚ	is_numberÚappendÚNegativeOneÚfunctionÚsubsÚfunc)
r   ÚvarÚtrafoÚnewvarr    ÚlimitÚpÚalphaÚbetar)   s
   &&&&      r   Úchange_indexÚExprWithIntLimits.change_index   ss  € ðr Š>ØˆFàˆØ—[•[ˆEØ�Q�x˜3�Ø—M‘M #Ó&�Ø—8‘8“: ”?Ü$Ð%IÓJÐJØ×(Ñ(¨Ó-�Ø×'Ñ'¬¯©Ó.�Ø—?—?�?Ø¤§¡”~ØŸ™ v°U¸1µX­~ÀÕ/DÀeÐRSÍHÅnÐW[ÕF[Ð&\Ö]Ø¤!§-¡-Ô/ØŸ™ v°U¸1µX­~ÀÕ/DÀeÐRSÍHÅnÐW[ÕF[Ð&\×]ä(Ð)iÓjÐjð —M‘M 6°°qµ­>¸DÕ+@À%ÈaÍÅ.ÐSWÕBWÐ"X×Yà—‘˜e×$ñ% !ð( —=‘=×%Ñ% c°$­J¸Õ+=Ó>ˆØ—=‘= Ó-ˆà�yŠy˜Ð+ FÓ+Ð+r   c                ó´   € V P                    Uu. uF  q"^ ,          NK  	  ppVP                  V4      ^8w  d   \        V R4      hVP                  V4      # u upi )a   
Return the index of a dummy variable in the list of limits.

Explanation
===========

``index(expr, x)``  returns the index of the dummy variable ``x`` in the
limits of ``expr``. Note that we start counting with 0 at the inner-most
limits tuple.

Examples
========

>>> from sympy.abc import x, y, a, b, c, d
>>> from sympy import Sum, Product
>>> Sum(x*y, (x, a, b), (y, c, d)).index(x)
0
>>> Sum(x*y, (x, a, b), (y, c, d)).index(y)
1
>>> Product(x*y, (x, a, b), (y, c, d)).index(x)
0
>>> Product(x*y, (x, a, b), (y, c, d)).index(y)
1

See Also
========

reorder_limit, reorder, sympy.concrete.summations.Sum.reverse_order,
sympy.concrete.products.Product.reverse_order
z0Number of instances of variable not equal to one)r    Úcountr#   Úindex)r   Úxr/   Ú	variabless   &&  r   r7   ÚExprWithIntLimits.index‘   sS   € ð> ,0¯;ª;Ó7©; %˜1—X�X©;ˆ	Ð7à�?‰?˜1Ó Ô"Ü˜TÐ#UÓVÐVà—?‘? 1Ó%Ð%ùò 8s   �Ac                ón  € T pV F¬  p\        V4      ^8w  d   \        VR4      hV^ ,          pV^,          p\        V^ ,          \        4      '       g   V P	                  V^ ,          4      p\        V^,          \        4      '       g   V P	                  V^,          4      pVP                  WE4      pK®  	  V# )aò  
Reorder limits in a expression containing a Sum or a Product.

Explanation
===========

``expr.reorder(*arg)`` reorders the limits in the expression ``expr``
according to the list of tuples given by ``arg``. These tuples can
contain numerical indices or index variable names or involve both.

Examples
========

>>> from sympy import Sum, Product
>>> from sympy.abc import x, y, z, a, b, c, d, e, f

>>> Sum(x*y, (x, a, b), (y, c, d)).reorder((x, y))
Sum(x*y, (y, c, d), (x, a, b))

>>> Sum(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder((x, y), (x, z), (y, z))
Sum(x*y*z, (z, e, f), (y, c, d), (x, a, b))

>>> P = Product(x*y*z, (x, a, b), (y, c, d), (z, e, f))
>>> P.reorder((x, y), (x, z), (y, z))
Product(x*y*z, (z, e, f), (y, c, d), (x, a, b))

We can also select the index variables by counting them, starting
with the inner-most one:

>>> Sum(x**2, (x, a, b), (x, c, d)).reorder((0, 1))
Sum(x**2, (x, c, d), (x, a, b))

And of course we can mix both schemes:

>>> Sum(x*y, (x, a, b), (y, c, d)).reorder((y, x))
Sum(x*y, (y, c, d), (x, a, b))
>>> Sum(x*y, (x, a, b), (y, c, d)).reorder((y, 0))
Sum(x*y, (y, c, d), (x, a, b))

See Also
========

reorder_limit, index, sympy.concrete.summations.Sum.reverse_order,
sympy.concrete.products.Product.reverse_order
zInvalid number of arguments)Úlenr#   Ú
isinstanceÚintr7   Úreorder_limit)r   ÚargÚnew_exprÚrÚindex1Úindex2s   &*    r   ÚreorderÚExprWithIntLimits.reorder·   sœ   € ð\ ˆãˆAÜ�1‹v˜Œ{Ü  Ð$AÓBÐBà�q•TˆFØ�q•TˆFä˜a �d¤C×(Ò(ØŸ™ A a¥DÓ)�Ü˜a �d¤C×(Ò(ØŸ™ A a¥DÓ)�à×-Ñ-¨fÓ=ŠHñ ð ˆr   c                ó|  € V P                    Uu0 uF  q3^ ,          kK  	  ppV P                   V,          pV P                   V,          p\        \        V^,          P                  4      P	                  V4      4      ^ 8X  Ed,   \        \        V^,          P                  4      P	                  V4      4      ^ 8X  dó   \        \        V^,          P                  4      P	                  V4      4      ^ 8X  dº   \        \        V^,          P                  4      P	                  V4      4      ^ 8X  d�   . p\        V P                   4       FH  w  rƒW�8X  d   VP                  V4       K  W‚8X  d   VP                  V4       K7  VP                  V4       KJ  	  \        V 4      ! V P                  .VO5!  # \        V R4      hu upi )a}  
Interchange two limit tuples of a Sum or Product expression.

Explanation
===========

``expr.reorder_limit(x, y)`` interchanges two limit tuples. The
arguments ``x`` and ``y`` are integers corresponding to the index
variables of the two limits which are to be interchanged. The
expression ``expr`` has to be either a Sum or a Product.

Examples
========

>>> from sympy.abc import x, y, z, a, b, c, d, e, f
>>> from sympy import Sum, Product

>>> Sum(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder_limit(0, 2)
Sum(x*y*z, (z, e, f), (y, c, d), (x, a, b))
>>> Sum(x**2, (x, a, b), (x, c, d)).reorder_limit(1, 0)
Sum(x**2, (x, c, d), (x, a, b))

>>> Product(x*y*z, (x, a, b), (y, c, d), (z, e, f)).reorder_limit(0, 2)
Product(x*y*z, (z, e, f), (y, c, d), (x, a, b))

See Also
========

index, reorder, sympy.concrete.summations.Sum.reverse_order,
sympy.concrete.products.Product.reverse_order
z.could not interchange the two limits specified)
r    r<   ÚsetÚfree_symbolsÚintersectionÚ	enumerater'   Útyper)   r   )	r   r8   Úyr/   r,   Úlimit_xÚlimit_yr    Úis	   &&&      r   r?   ÚExprWithIntLimits.reorder_limitø   sL  € ð@ &*§[¢[Ó1¡[˜E�Q�xˆx¡[ˆÐ1Ø—+‘+˜a•.ˆØ—+‘+˜a•.ˆä”�G˜A•J×+Ñ+Ó,×9Ñ9¸#Ó>Ó?À1ÕDÜ”�G˜A•J×+Ñ+Ó,×9Ñ9¸#Ó>Ó?À1ÔDÜ”�G˜A•J×+Ñ+Ó,×9Ñ9¸#Ó>Ó?À1ÔDÜ”�G˜A•J×+Ñ+Ó,×9Ñ9¸#Ó>Ó?À1ÔDàˆFÜ% d§k¡kÖ2‘�Ø”6Ø—M‘M 'Ö*Ø”VØ—M‘M 'Ö*à—M‘M %Ö(ñ 3ô ˜”:˜dŸm™mÐ5¨fÓ5Ð5ä˜tÐ%UÓVÐVùò) 2s   �F9c                ó´   € RpV P                    F;  pV^,          V^,          ,
          p\        V^4      pVR8X  d    R# VR8X  d   K9  RpK=  	  V'       d   R# R# )a¹  
Returns True if the Sum or Product is computed for an empty sequence.

Examples
========

>>> from sympy import Sum, Product, Symbol
>>> m = Symbol('m')
>>> Sum(m, (m, 1, 0)).has_empty_sequence
True

>>> Sum(m, (m, 1, 1)).has_empty_sequence
False

>>> M = Symbol('M', integer=True, positive=True)
>>> Product(m, (m, 1, M)).has_empty_sequence
False

>>> Product(m, (m, 2, M)).has_empty_sequence

>>> Product(m, (m, M + 1, M)).has_empty_sequence
True

>>> N = Symbol('N', integer=True, positive=True)
>>> Sum(m, (m, N, M)).has_empty_sequence

>>> N = Symbol('N', integer=True, negative=True)
>>> Sum(m, (m, N, M)).has_empty_sequence
False

See Also
========

has_reversed_limits
has_finite_limits

FTN)r    r   )r   Úret_NoneÚlimÚdifÚeqs   &    r   Úhas_empty_sequenceÚ$ExprWithIntLimits.has_empty_sequence.  sX   € ðN ˆØ—;”;ˆCØ�a•&˜3˜q�6•/ˆCÜ�C˜“ˆBØ�TŒzÚØ�u”Ùà’ñ ÷ ÙÙr   r   )N)r   r   r   r   r   Ú	__slots__r3   r7   rE   r?   ÚpropertyrW   r   r   )r   s   @r   r   r      s?   ø‡ € ñ	ð €Iôt,òn$&òL>òB4Wðl ñ3ó ö3r   r   N)	Úsympy.concrete.expr_with_limitsr   Úsympy.core.singletonr   Úsympy.core.relationalr   ÚNotImplementedErrorr   r   r   r   r   Ú<module>r_      s)   ðÝ :Ý "Ý $ô<Ð&ô <ôU˜ö Ur   