
    \h]                     V    S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	   " S S\	5      r
g)	    )Indexed)Tuple)Dummy)sympify)Integralc                   B   ^  \ rS rSrSrS rU 4S jr\S 5       rSr	U =r
$ )IndexedIntegral   a  
Experimental class to test integration by indexed variables.

Usage is analogue to ``Integral``, it simply adds awareness of
integration over indices.

Contraction of non-identical index symbols referring to the same
``IndexedBase`` is not yet supported.

Examples
========

>>> from sympy.sandbox.indexed_integrals import IndexedIntegral
>>> from sympy import IndexedBase, symbols
>>> A = IndexedBase('A')
>>> i, j = symbols('i j', integer=True)
>>> ii = IndexedIntegral(A[i], A[i])
>>> ii
Integral(_A[i], _A[i])
>>> ii.doit()
A[i]**2/2

If the indices are different, indexed objects are considered to be
different variables:

>>> i2 = IndexedIntegral(A[j], A[i])
>>> i2
Integral(A[j], _A[i])
>>> i2.doit()
A[i]*A[j]
c                    [         R                  U5      u  pB[        U5      nUR                  U5      n[        R
                  " X/UQ70 UD6nXEl        UR                  5        VVs0 s H  u  pgXv_M	     snnUl        U$ s  snnf N)	r	   _indexed_process_limitsr   xreplacer   __new___indexed_replitems_indexed_reverse_repl)clsfunctionlimitsassumptionsreplobjkeyvals           W/var/www/auris/envauris/lib/python3.13/site-packages/sympy/sandbox/indexed_integrals.pyr   IndexedIntegral.__new__)   sz    &>>vF8$$$T*sEvEE >Bjjl$Kl(#SXl$K!
 %Ls   'B c                 V   > [         TU ]  5       nUR                  U R                  5      $ r   )superdoitr   r   )selfres	__class__s     r   r   IndexedIntegral.doit2   s#    gln||D6677    c                 4   0 n/ nU  H  n[        U[        [        [        45      (       a  US   nUSS  nOUnSn[        U[        5      (       a4  XA;  a  [        [        U5      5      nXaU'   UR                  W4U-   5        M{  UR                  U5        M     X4$ )Nr       )
isinstancetuplelistr   r   r   strappend)r   r   	newlimitsivvrestrs          r   r   'IndexedIntegral._indexed_process_limits6   s    	A!eT5122aD!"!W%%=c!fAG  !e,  #  r$   r'   )__name__
__module____qualname____firstlineno____doc__r   r   staticmethodr   __static_attributes____classcell__)r"   s   @r   r	   r	      s'    @8  r$   r	   N)sympy.tensorr   sympy.core.containersr   sympy.core.symbolr   sympy.core.sympifyr   sympy.integrals.integralsr   r	   r'   r$   r   <module>r@      s"      ' # & .@h @r$   