Ë
    7^(h  ã                   óT   — 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
mZ d„ Zd„ Zy	)
é    )ÚMul)ÚS)Údefault_sort_key)Ú
DiracDeltaÚ	Heavisideé   )ÚIntegralÚ	integratec           	      óš  — g }d}| j                  «       \  }}t        |t        ¬«      }|j                  |«       |D ]£  }|j                  r^t        |j                  t        «      rD|j                  |j                  |j                  |j                  dz
  «      «       |j                  }|€$t        |t        «      r|j                  |«      r|}Œ“|j                  |«       Œ¥ |sßg }|D ]³  }t        |t        «      r#|j                  |j                  d|¬«      «       Œ6|j                  rat        |j                  t        «      rG|j                  |j                  |j                  j                  d|¬«      |j                  «      «       Œ£|j                  |«       Œµ ||k7  rt        |Ž j                  «       }d|fS d}d|fS |t        |Ž fS )a¶  change_mul(node, x)

       Rearranges the operands of a product, bringing to front any simple
       DiracDelta expression.

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

       If no simple DiracDelta expression was found, then all the DiracDelta
       expressions are simplified (using DiracDelta.expand(diracdelta=True, wrt=x)).

       Return: (dirac, new node)
       Where:
         o dirac is either a simple DiracDelta expression or None (if no simple
           expression was found);
         o new node is either a simplified DiracDelta expressions or None (if it
           could not be simplified).

       Examples
       ========

       >>> from sympy import DiracDelta, cos
       >>> from sympy.integrals.deltafunctions import change_mul
       >>> from sympy.abc import x, y
       >>> change_mul(x*y*DiracDelta(x)*cos(x), x)
       (DiracDelta(x), x*y*cos(x))
       >>> change_mul(x*y*DiracDelta(x**2 - 1)*cos(x), x)
       (None, x*y*cos(x)*DiracDelta(x - 1)/2 + x*y*cos(x)*DiracDelta(x + 1)/2)
       >>> change_mul(x*y*DiracDelta(cos(x))*cos(x), x)
       (None, None)

       See Also
       ========

       sympy.functions.special.delta_functions.DiracDelta
       deltaintegrate
    N)Úkeyr   T©Ú
diracdeltaÚwrt)Úargs_cncÚsortedr   ÚextendÚis_PowÚ
isinstanceÚbaser   ÚappendÚfuncÚexpÚ	is_simpleÚexpandr   )	ÚnodeÚxÚnew_argsÚdiracÚcÚncÚsorted_argsÚargÚnnodes	            ú\/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/integrals/deltafunctions.pyÚ
change_mulr%      s‡  € ðN €HØ€Eð �M‰M‹O�E€A€rÜ˜Ô 0Ô1€KØ×Ñ�rÔàò !ˆØ�:Š:œ* S§X¡X¬zÔ:Ø�O‰O˜CŸH™H S§X¡X¨s¯w©w¸©{Ó;Ô<Ø—(‘(ˆCØˆ=œj¨¬jÔ9¸c¿m¹mÈAÔ>NØ‰Eà�O‰O˜CÕ ð!ñ ØˆØò 	%ˆCÜ˜#œzÔ*Ø—‘ §
¡
°dÀ 
Ó BÕCØ—’¤
¨3¯8©8´ZÔ @Ø—‘ §¡¨¯©¯©ÀDÈa¨Ó)PÐRU×RYÑRYÓ ZÕ[à—‘ Õ$ð	%ð �{Ò"Ü˜�N×)Ñ)Ó+ˆEð �eˆ}Ðð ˆEØ�eˆ}ÐØ”3˜�>Ð"Ð"ó    c                 óð  — | j                  t        «      sy| j                  t        k(  rÏ| j                  d|¬«      }|| k(  r¨| j	                  |«      r¥t        | j                  «      dk  s| j                  d   dk(  rt        | j                  d   «      S t        | j                  d   | j                  d   dz
  «      | j                  d   j                  «       j                  «       z  S t        ||«      }|S y| j                  s| j                  �re| j                  «       }| |k7  r!t        ||«      }|�t        |t        «      s|S yt        | |«      \  }}|s|rt        ||«      }|S yddlm} |j                  d|¬«      }|j                  rt        ||«      \  }}||z  } ||j                  d   |«      d   }	t        |j                  «      dk(  rdn|j                  d   }
d}|
dk\  r{t$        j&                  |
z  |j)                  ||
«      j+                  ||	«      z  }|j,                  r|
dz  }
|dz  }n(|dk(  r|t        ||	z
  «      z  S |t        ||dz
  «      z  S |
dk\  rŒ{t$        j.                  S y)aß  
    deltaintegrate(f, x)

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

    The idea for integration is the following:

    - If we are dealing with a DiracDelta expression, i.e. DiracDelta(g(x)),
      we try to simplify it.

      If we could simplify it, then we integrate the resulting expression.
      We already know we can integrate a simplified expression, because only
      simple DiracDelta expressions are involved.

      If we couldn't simplify it, there are two cases:

      1) The expression is a simple expression: we return the integral,
         taking care if we are dealing with a Derivative or with a proper
         DiracDelta.

      2) The expression is not simple (i.e. DiracDelta(cos(x))): we can do
         nothing at all.

    - If the node is a multiplication node having a DiracDelta term:

      First we expand it.

      If the expansion did work, then we try to integrate the expansion.

      If not, we try to extract a simple DiracDelta term, then we have two
      cases:

      1) We have a simple DiracDelta term, so we return the integral.

      2) We didn't have a simple term, but we do have an expression with
         simplified DiracDelta terms, so we integrate this expression.

    Examples
    ========

        >>> from sympy.abc import x, y, z
        >>> from sympy.integrals.deltafunctions import deltaintegrate
        >>> from sympy import sin, cos, DiracDelta
        >>> deltaintegrate(x*sin(x)*cos(x)*DiracDelta(x - 1), x)
        sin(1)*cos(1)*Heaviside(x - 1)
        >>> deltaintegrate(y**2*DiracDelta(x - z)*DiracDelta(y - z), y)
        z**2*DiracDelta(x - z)*Heaviside(y - z)

    See Also
    ========

    sympy.functions.special.delta_functions.DiracDelta
    sympy.integrals.integrals.Integral
    NTr   r   r   )Úsolve)Úhasr   r   r   r   ÚlenÚargsr   Úas_polyÚLCr
   Úis_Mulr   r   r	   r%   Úsympy.solversr(   r   ÚNegativeOneÚdiffÚsubsÚis_zeroÚZero)Úfr   ÚhÚfhÚgÚ	deltatermÚ	rest_multr(   Úrest_mult_2ÚpointÚnÚmÚrs                r$   Údeltaintegrater@   Q   s_  € ðp �5‰5”ÔØð 	‡v�v”ÒØ�H‰H ¨!ˆHÓ,ˆØ�Š6ð �{‰{˜1Œ~Ü˜Ÿ™“K 1Ò$¨¯©¨q©	°QªÜ$ Q§V¡V¨A¡YÓ/Ð/ä& q§v¡v¨a¡y°!·&±&¸±)¸a±-Ó@ØŸ™˜q™	×)Ñ)Ó+×.Ñ.Ó0ñ1ð 2ô ˜1˜a“ˆBØˆIð^ ð] 
�Š�Q—X“XØ�H‰H‹JˆØ�Š6Ü˜1˜a“ˆBØˆ~¤j°´XÔ&>Ø�	ðR ôM $.¨a°Ó#3Ñ ˆI�yáÙÜ" 9¨aÓ0�BØ�IðB õ? 0Ø%×,Ñ,¸À!Ð,ÓD�	Ø×#Ò#Ü-7¸	À1Ó-EÑ*�I˜{Ø )¨+Ñ 5�IÙ˜iŸn™n¨QÑ/°Ó3°AÑ6�ô ˜iŸn™nÓ-¨qÒ0‘Q°i·n±nÀQÑ6G�Ø�Ø˜1’fÜŸ™ qÑ(¨¯©¸¸1Ó)=×)BÑ)BÀ1ÀeÓ)LÑL�AØ—y’yØ˜Q™˜Ø˜Q™™à š6Ø#$¤Y¨q°5©yÓ%9Ñ#9Ð9à#$¤Z°°!°A±#Ó%6Ñ#6Ð6ð ˜1“fô —v‘v�Ør&   N)Úsympy.core.mulr   Úsympy.core.singletonr   Úsympy.core.sortingr   Úsympy.functionsr   r   Ú	integralsr	   r
   r%   r@   © r&   r$   ú<module>rG      s!   ðÝ Ý "Ý /ß 1ß *òF#óRxr&   