
    \h0                         S SK Jr  S SKJrJr  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KJr  S S	KJr  S S
KJr  S rS r " S S\5      r " S S\5      rg)    )prod)SInteger)DefinedFunction)	fuzzy_not)Ne)default_sort_key)
SYMPY_INTS)	factorial)	Piecewise)has_dupsc                      [        U 0 UD6$ )zy
Represent the Levi-Civita symbol.

This is a compatibility wrapper to ``LeviCivita()``.

See Also
========

LeviCivita

)
LeviCivita)argskwargss     `/var/www/auris/envauris/lib/python3.13/site-packages/sympy/functions/special/tensor_functions.pyEijkr      s     t&v&&    c                  Z   ^ ^ [        T 5      m[        U U4S j[        T5       5       5      $ )zEvaluate Levi-Civita symbol.c              3      >^#    U  H4  m[        UU4S  j[        TS-   T5       5       5      [        T5      -  v   M6     g7f)c              3   :   >#    U  H  nTU   TT   -
  v   M     g 7fN ).0jr   is     r   	<genexpr>,eval_levicivita.<locals>.<genexpr>.<genexpr>%   s     81T!WtAws      N)r   ranger   )r   r   r   ns    @r   r   "eval_levicivita.<locals>.<genexpr>$   s9      * (1 	8a!eQ88
A,	 (s   <A )lenr   r    )r   r!   s   `@r   eval_levicivitar$   !   s*    D	A * %a* * *r   c                   2    \ rS rSrSrSr\S 5       rS rSr	g)r   *   a  
Represent the Levi-Civita symbol.

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

For even permutations of indices it returns 1, for odd permutations -1, and
for everything else (a repeated index) it returns 0.

Thus it represents an alternating pseudotensor.

Examples
========

>>> from sympy import LeviCivita
>>> from sympy.abc import i, j, k
>>> LeviCivita(1, 2, 3)
1
>>> LeviCivita(1, 3, 2)
-1
>>> LeviCivita(1, 2, 2)
0
>>> LeviCivita(i, j, k)
LeviCivita(i, j, k)
>>> LeviCivita(i, j, i)
0

See Also
========

Eijk

Tc                     [        S U 5       5      (       a  [        U6 $ [        U5      (       a  [        R                  $ g )Nc              3   N   #    U  H  n[        U[        [        45      v   M     g 7fr   )
isinstancer
   r   )r   as     r   r   "LeviCivita.eval.<locals>.<genexpr>Q   s     BTz!j'233Ts   #%)allr$   r   r   Zero)clsr   s     r   evalLeviCivita.evalO   s5    BTBBB"D))D>>66M r   c                 &    [        U R                  6 $ r   )r$   r   )selfhintss     r   doitLeviCivita.doitV   s    		**r   r   N)
__name__
__module____qualname____firstlineno____doc__
is_integerclassmethodr/   r4   __static_attributes__r   r   r   r   r   *   s&     D J +r   r   c                       \ rS rSrSrSr\SS j5       r\S 5       r	S r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       rS r\S 5       rS rSrg)KroneckerDeltaZ   a  
The discrete, or Kronecker, delta function.

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

A function that takes in two integers $i$ and $j$. It returns $0$ if $i$
and $j$ are not equal, or it returns $1$ if $i$ and $j$ are equal.

Examples
========

An example with integer indices:

    >>> from sympy import KroneckerDelta
    >>> KroneckerDelta(1, 2)
    0
    >>> KroneckerDelta(3, 3)
    1

Symbolic indices:

    >>> from sympy.abc import i, j, k
    >>> KroneckerDelta(i, j)
    KroneckerDelta(i, j)
    >>> KroneckerDelta(i, i)
    1
    >>> KroneckerDelta(i, i + 1)
    0
    >>> KroneckerDelta(i, i + 1 + k)
    KroneckerDelta(i, i + k + 1)

Parameters
==========

i : Number, Symbol
    The first index of the delta function.
j : Number, Symbol
    The second index of the delta function.

See Also
========

eval
DiracDelta

References
==========

.. [1] https://en.wikipedia.org/wiki/Kronecker_delta

TNc                 (   Ubp  Uu  pEXA-
  S:  S:X  a  [         R                  $ XB-
  S:  S:X  a  [         R                  $ XQ-
  S:  S:X  a  [         R                  $ XR-
  S:  S:X  a  [         R                  $ X-
  nUR                  (       a  [         R                  $ [	        UR                  5      (       a  [         R                  $ UR
                  R                  S5      (       a0  UR
                  R                  S5      (       a  [         R                  $ UR
                  R                  S5      (       a0  UR
                  R                  S5      (       a  [         R                  $ [        U5      [        U5      :  a  U(       a	  U " X!U5      $ U " X!5      $ g)a?  
Evaluates the discrete delta function.

Examples
========

>>> from sympy import KroneckerDelta
>>> from sympy.abc import i, j, k

>>> KroneckerDelta(i, j)
KroneckerDelta(i, j)
>>> KroneckerDelta(i, i)
1
>>> KroneckerDelta(i, i + 1)
0
>>> KroneckerDelta(i, i + 1 + k)
KroneckerDelta(i, i + k + 1)

# indirect doctest

Nr   Tbelow_fermiabove_fermi)r   r-   is_zeroOner   assumptions0getr	   )r.   r   r   delta_rangedinfdsupdiffs          r   r/   KroneckerDelta.eval   s6   0 "$JD1%vv1%vv1%vv1%vvu<<55Lt||$$66M>>m,,""=1166M>>m,,""=1166M A!1!!441--1y 	 5r   c                 T    [        U R                  5      S:  a  U R                  S   $ g )N   )r#   r   r2   s    r   rH   KroneckerDelta.delta_range   s%    tyy>A99Q< r   c                 ~    UR                   (       a  U $ UR                  (       a  U[        R                  La  SU -  $ g g )Nr   )is_positiveis_negativer   NegativeOne)r2   expts     r   _eval_powerKroneckerDelta._eval_power   s5    KAMM 9T6M !:r   c                     U R                   S   R                  R                  S5      (       a  gU R                   S   R                  R                  S5      (       a  gg)a  
True if Delta can be non-zero above fermi.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> p = Symbol('p')
>>> q = Symbol('q')
>>> KroneckerDelta(p, a).is_above_fermi
True
>>> KroneckerDelta(p, i).is_above_fermi
False
>>> KroneckerDelta(p, q).is_above_fermi
True

See Also
========

is_below_fermi, is_only_below_fermi, is_only_above_fermi

r   rB   Fr   Tr   rF   rG   rO   s    r   is_above_fermiKroneckerDelta.is_above_fermi   K    4 99Q<$$((7799Q<$$((77r   c                     U R                   S   R                  R                  S5      (       a  gU R                   S   R                  R                  S5      (       a  gg)a  
True if Delta can be non-zero below fermi.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> p = Symbol('p')
>>> q = Symbol('q')
>>> KroneckerDelta(p, a).is_below_fermi
False
>>> KroneckerDelta(p, i).is_below_fermi
True
>>> KroneckerDelta(p, q).is_below_fermi
True

See Also
========

is_above_fermi, is_only_above_fermi, is_only_below_fermi

r   rC   Fr   TrY   rO   s    r   is_below_fermiKroneckerDelta.is_below_fermi   r\   r   c                     U R                   S   R                  R                  S5      =(       d(    U R                   S   R                  R                  S5      =(       d    S$ )a  
True if Delta is restricted to above fermi.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> p = Symbol('p')
>>> q = Symbol('q')
>>> KroneckerDelta(p, a).is_only_above_fermi
True
>>> KroneckerDelta(p, q).is_only_above_fermi
False
>>> KroneckerDelta(p, i).is_only_above_fermi
False

See Also
========

is_above_fermi, is_below_fermi, is_only_below_fermi

r   rC   r   FrY   rO   s    r   is_only_above_fermi"KroneckerDelta.is_only_above_fermi  P    4 1**..}= =		!))--m< 	r   c                     U R                   S   R                  R                  S5      =(       d(    U R                   S   R                  R                  S5      =(       d    S$ )a  
True if Delta is restricted to below fermi.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> p = Symbol('p')
>>> q = Symbol('q')
>>> KroneckerDelta(p, i).is_only_below_fermi
True
>>> KroneckerDelta(p, q).is_only_below_fermi
False
>>> KroneckerDelta(p, a).is_only_below_fermi
False

See Also
========

is_above_fermi, is_below_fermi, is_only_above_fermi

r   rB   r   FrY   rO   s    r   is_only_below_fermi"KroneckerDelta.is_only_below_fermi4  rc   r   c                    U R                   S   R                  R                  S5      (       a.  U R                   S   R                  R                  S5      (       a  gU R                   S   R                  R                  S5      (       a.  U R                   S   R                  R                  S5      (       a  gU R                  =(       a    U R                  $ )a  
Returns True if indices are either both above or below fermi.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> p = Symbol('p')
>>> q = Symbol('q')
>>> KroneckerDelta(p, q).indices_contain_equal_information
True
>>> KroneckerDelta(p, q+1).indices_contain_equal_information
True
>>> KroneckerDelta(i, p).indices_contain_equal_information
False

r   rB   r   TrC   )r   rF   rG   r^   rZ   rO   s    r   !indices_contain_equal_information0KroneckerDelta.indices_contain_equal_informationS  s    * IIaL%%))-88		!))--m<<IIaL%%))-88IIaL--11-@@ "":t':'::r   c                 h    U R                  5       (       a  U R                  S   $ U R                  S   $ )aa  
Returns the index which is preferred to keep in the final expression.

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

The preferred index is the index with more information regarding fermi
level. If indices contain the same information, 'a' is preferred before
'b'.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> j = Symbol('j', below_fermi=True)
>>> p = Symbol('p')
>>> KroneckerDelta(p, i).preferred_index
i
>>> KroneckerDelta(p, a).preferred_index
a
>>> KroneckerDelta(i, j).preferred_index
i

See Also
========

killable_index

r   r   _get_preferred_indexr   rO   s    r   preferred_indexKroneckerDelta.preferred_indexr  s0    B $$&&99Q<99Q<r   c                 h    U R                  5       (       a  U R                  S   $ U R                  S   $ )ai  
Returns the index which is preferred to substitute in the final
expression.

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

The index to substitute is the index with less information regarding
fermi level. If indices contain the same information, 'a' is preferred
before 'b'.

Examples
========

>>> from sympy import KroneckerDelta, Symbol
>>> a = Symbol('a', above_fermi=True)
>>> i = Symbol('i', below_fermi=True)
>>> j = Symbol('j', below_fermi=True)
>>> p = Symbol('p')
>>> KroneckerDelta(p, i).killable_index
p
>>> KroneckerDelta(p, a).killable_index
p
>>> KroneckerDelta(i, j).killable_index
j

See Also
========

preferred_index

r   r   rk   rO   s    r   killable_indexKroneckerDelta.killable_index  s0    D $$&&99Q<99Q<r   c                    U R                   (       d/  U R                  S   R                  R                  S5      (       a  ggU R                  (       d/  U R                  S   R                  R                  S5      (       a  ggg)z
Returns the index which is preferred to keep in the final expression.

The preferred index is the index with more information regarding fermi
level. If indices contain the same information, index 0 is returned.

r   rB   r   rC   )rZ   r   rF   rG   r^   rO   s    r   rl   #KroneckerDelta._get_preferred_index  sc     ""yy|((,,];;$$yy|((,,];;r   c                      U R                   SS $ )Nr   rN   )r   rO   s    r   indicesKroneckerDelta.indices  s    yy1~r   c                 8    Uu  p4[        S[        X45      4S5      $ )Nr   )r   T)r   r   )r2   r   r   r   r   s        r   _eval_rewrite_as_Piecewise)KroneckerDelta._eval_rewrite_as_Piecewise  s    !RX	22r   r   r   )r6   r7   r8   r9   r:   r;   r<   r/   propertyrH   rV   rZ   r^   ra   re   rh   rm   rp   rl   ru   rx   r=   r   r   r   r?   r?   Z   s    3j J5! 5!n      >  >  <  < ; ;< #  # J $  $ L*  3r   r?   N)mathr   
sympy.corer   r   sympy.core.functionr   sympy.core.logicr   sympy.core.relationalr   sympy.core.sortingr	   sympy.external.gmpyr
   (sympy.functions.combinatorial.factorialsr   $sympy.functions.elementary.piecewiser   sympy.utilities.iterablesr   r   r$   r   r?   r   r   r   <module>r      sH     ! / & $ / * > : .'*-+ -+`@3_ @3r   