ó
    ‰*£h  ã                   óT   • S SK Jr  S SKJr  S SKJr  S SKJrJr  SSK	J
r
Jr  S rS rg	)
é    )ÚMul)ÚS)Údefault_sort_key)Ú
DiracDeltaÚ	Heavisideé   )ÚIntegralÚ	integratec           
      óæ  • / nSnU R                  5       u  pE[        U[        S9nUR                  U5        U Hº  nUR                  (       ac  [        UR                  [        5      (       aD  UR                  UR                  UR                  UR                  S-
  5      5        UR                  nUc/  [        U[        5      (       a  UR                  U5      (       a  UnM©  UR                  U5        M¼     U(       dì  / nU H¿  n[        U[        5      (       a!  UR                  UR                  SUS95        M9  UR                  (       ad  [        UR                  [        5      (       aE  UR                  UR                  UR                  R                  SUS9UR                  5      5        M®  UR                  U5        MÁ     X&:w  a  [        U6 R                  5       nSU4$ SnSU4$ U[        U6 4$ )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	            Ú[/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/integrals/deltafunctions.pyÚ
change_mulr%      sˆ  € ðN €HØ€Eð �M‰M‹O�E€AÜ˜Ô 0Ñ1€KØ×Ñ�rÔãˆØ�:�:œ* S§X¡X¬z×:Ñ:Ø�O‰O˜CŸH™H S§X¡X¨s¯w©w¸©{Ó;Ô<Ø—(‘(ˆCØ‰=œj¨¬j×9Ñ9¸c¿m¹mÈA×>NÑ>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                 ó<  • U R                  [        5      (       d  gU R                  [        :X  aÓ  U R                  SUS9nX :X  a±  U R	                  U5      (       a™  [        U R                  5      S::  d  U R                  S   S:X  a  [        U R                  S   5      $ [        U R                  S   U R                  S   S-
  5      U R                  S   R                  5       R                  5       -  $  g[        X!5      nU$ U R                  (       d  U R                  (       Gaw  U R                  5       nX:w  a&  [        XA5      nUb  [        U[        5      (       d  U$ g[        X5      u  pVU(       d  U(       a  [        Xa5      nU$  gSSKJn  UR                  SUS9nUR                  (       a  [        XQ5      u  pXXh-  nU" UR                  S   U5      S   n	[        UR                  5      S:X  a  SOUR                  S   n
SnU
S:¼  a  [$        R&                  U
-  UR)                  X5      R+                  X5      -  nUR,                  (       a  U
S-  n
US-  nO'US:X  a  U[        X-
  5      -  $ U[        XS-
  5      -  $ U
S:¼  a  M  [$        R.                  $ g)aK  
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   sU  € ð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ð	 ðn ôa ˜1“ˆBØˆIØ	
���Q—X—X�XØ�H‰H‹JˆØ‹6Ü˜1“ˆBØ‰~¤j°´X×&>Ñ&>Ø�	ðR ôM $.¨aÓ#3Ñ ˆIæÞÜ" 9Ó0�BØ�Ið ðF õ? 0Ø%×,Ñ,¸À!Ð,ÐD�	Ø×#×#Ü-7¸	Ó-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Ñ(¨¯©¸Ó)=×)BÑ)BÀ1Ó)LÑL�AØ—y—yØ˜Q™˜Ø˜Q™™à ›6Ø#$¤Y¨q©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&   