
    \h                    2   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Jr  SSKJr  SSKJrJrJr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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 r/ " S S\\
5      r0\0r1 " S S\05      r2\2r3 " S S\05      r4\4r5 " S S \05      r6 " S! S"\65      r7 " S# S$\65      r8 " S% S&\75      r9\9r: " S' S(\85      r;\;r< " S) S*\75      r=\=r> " S+ S,\85      r?\?r@\2\2\2\4\4\4\9\9\;\;\=\=\?\?S-.\0lA        S. rB\(" \&\&5      S/ 5       rC\(" \\5      S0 5       rD\(" \*\&5      S1 5       rD\(" \*\5      S2 5       rD\(" \*\,5      S3 5       rD\(" \*\*5      S4 5       rDS<S6 jrES<S7 jrFS<S8 jrGS<S9 jrHS<S: jrIS<S; jrJg5)=    )annotations   )AtomBasic)LazyExceptionMessage)ordered)
EvalfMixin)AppliedUndef)
int_valued)S)_sympifySympifyError)global_parameters)
fuzzy_bool	fuzzy_xor	fuzzy_and	fuzzy_not)BooleanBooleanAtom)sift)
filldedent)sympy_deprecation_warning)RelEqNeLtLeGtGe
RelationalEquality
UnequalityStrictLessThanLessThanStrictGreaterThanGreaterThanExpr)dispatch)Tuple)Symbolc                Z    [        U [        5      =(       a    [        U [        5      (       + $ N)
isinstancer   r   )sides    M/var/www/auris/envauris/lib/python3.13/site-packages/sympy/core/relational.py_nontrivBoolr1      s#    dG$ &$%%&    c                    U R                  [        5       Vs0 s H  oUR                  _M     nnU R                  U5      $ s  snf r-   )atomsr    	canonicalxreplace)condrrepss      r0   
_canonicalr:   )   s;    $(JJz$:;$:qq{{N$:D;== <s   Ac                   U R                   n U R                  (       a  U R                  R                  (       a  U $ [	        U R
                  [        5      (       d  U R                  $ U R
                  R                  SS9u  pUR                  SS9u  p4U R                  U-
  U-  nUS:  a  U R                  R                  XE5      $ U R                  XE5      $ )NT)rationalr   )r5   is_Relationalrhs
is_Booleanr.   lhsr(   reversedas_coeff_Addas_coeff_Mulfunc)relblmr@   r>   s         r0   _canonical_coeffrI   1   s     --C 2 2
cggt$$||77.DA^^T^*FA77Q;/C1u||  **88Cr2   c                      \ rS rSr% SrSr0 rS\S'   SrSS j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S jrS rS rS rSS jrS r\
S 5       rSrg)r    A   a  Base class for all relation types.

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

Subclasses of Relational should generally be instantiated directly, but
Relational can be instantiated with a valid ``rop`` value to dispatch to
the appropriate subclass.

Parameters
==========

rop : str or None
    Indicates what subclass to instantiate.  Valid values can be found
    in the keys of Relational.ValidRelationOperator.

Examples
========

>>> from sympy import Rel
>>> from sympy.abc import x, y
>>> Rel(y, x + x**2, '==')
Eq(y, x**2 + x)

A relation's type can be defined upon creation using ``rop``.
The relation type of an existing expression can be obtained
using its ``rel_op`` property.
Here is a table of all the relation types, along with their
``rop`` and ``rel_op`` values:

+---------------------+----------------------------+------------+
|Relation             |``rop``                     |``rel_op``  |
+=====================+============================+============+
|``Equality``         |``==`` or ``eq`` or ``None``|``==``      |
+---------------------+----------------------------+------------+
|``Unequality``       |``!=`` or ``ne``            |``!=``      |
+---------------------+----------------------------+------------+
|``GreaterThan``      |``>=`` or ``ge``            |``>=``      |
+---------------------+----------------------------+------------+
|``LessThan``         |``<=`` or ``le``            |``<=``      |
+---------------------+----------------------------+------------+
|``StrictGreaterThan``|``>`` or ``gt``             |``>``       |
+---------------------+----------------------------+------------+
|``StrictLessThan``   |``<`` or ``lt``             |``<``       |
+---------------------+----------------------------+------------+

For example, setting ``rop`` to ``==`` produces an
``Equality`` relation, ``Eq()``.
So does setting ``rop`` to ``eq``, or leaving ``rop`` unspecified.
That is, the first three ``Rel()`` below all produce the same result.
Using a ``rop`` from a different row in the table produces a
different relation type.
For example, the fourth ``Rel()`` below using ``lt`` for ``rop``
produces a ``StrictLessThan`` inequality:

>>> from sympy import Rel
>>> from sympy.abc import x, y
>>> Rel(y, x + x**2, '==')
    Eq(y, x**2 + x)
>>> Rel(y, x + x**2, 'eq')
    Eq(y, x**2 + x)
>>> Rel(y, x + x**2)
    Eq(y, x**2 + x)
>>> Rel(y, x + x**2, 'lt')
    y < x**2 + x

To obtain the relation type of an existing expression,
get its ``rel_op`` property.
For example, ``rel_op`` is ``==`` for the ``Equality`` relation above,
and ``<`` for the strict less than inequality above:

>>> from sympy import Rel
>>> from sympy.abc import x, y
>>> my_equality = Rel(y, x + x**2, '==')
>>> my_equality.rel_op
    '=='
>>> my_inequality = Rel(y, x + x**2, 'lt')
>>> my_inequality.rel_op
    '<'

 z"dict[str | None, type[Relational]]ValidRelationOperatorTNc                L   U [         La  [        R                  " XU40 UD6$ U R                  R	                  US 5      n U c  [        SU-  5      e[        U [        [        45      (       d3  [        [        [        X45      5      (       a  [        [        S5      5      eU " X40 UD6$ )Nz&Invalid relational operator symbol: %rz
                    A Boolean argument can only be used in
                    Eq and Ne; all other relationals expect
                    real expressions.
                )r    r   __new__rM   get
ValueError
issubclassr   r   anymapr1   	TypeErrorr   )clsr@   r>   ropassumptionss        r0   rO   Relational.__new__   s    j ==3>+>> ''++C6;EKLL#Bx((
 3|cZ011
 , !   3+{++r2   c                     U R                   S   $ )z#The left-hand side of the relation.r   _argsselfs    r0   r@   Relational.lhs        zz!}r2   c                     U R                   S   $ )z$The right-hand side of the relation.r   r[   r]   s    r0   r>   Relational.rhs   r`   r2   c                   [         [         [        [        [        [        [        [        [        [        [
        [
        0nU R                  u  p#[        R                  UR                  U R                  U R                  5      X25      $ )zReturn the relationship with sides reversed.

Examples
========

>>> from sympy import Eq
>>> from sympy.abc import x
>>> Eq(x, 1)
Eq(x, 1)
>>> _.reversed
Eq(1, x)
>>> x < 1
x < 1
>>> _.reversed
1 > x
)r   r   r   r   r   r   argsr    rO   rP   rD   )r^   opsarF   s       r0   rA   Relational.reversed   sS    $ 2r2r2r2r2r2>yy!!#''$))TYY"?FFr2   c                l   U R                   u  p[        U[        5      (       d  [        U[        5      (       d{  [        [        [        [
        [        [        [
        [        [        [        [        [        0n[        R                  UR                  U R                  U R                  5      U* U* 5      $ U $ )zReturn the relationship with signs reversed.

Examples
========

>>> from sympy import Eq
>>> from sympy.abc import x
>>> Eq(x, 1)
Eq(x, 1)
>>> _.reversedsign
Eq(-x, -1)
>>> x < 1
x < 1
>>> _.reversedsign
-x > -1
)rd   r.   r   r   r   r   r   r   r   r    rO   rP   rD   )r^   rf   rF   re   s       r0   reversedsignRelational.reversedsign   sw    $ yy1k**jK.H.Hr2r2r2r2r2rBC%%cggdii&CaR!LLKr2   c                    [         [        [        [        [        [
        [
        [        [        [        [        [         0n[        R                  " UR                  U R                  5      /U R                  Q76 $ )a  Return the negated relationship.

Examples
========

>>> from sympy import Eq
>>> from sympy.abc import x
>>> Eq(x, 1)
Eq(x, 1)
>>> _.negated
Ne(x, 1)
>>> x < 1
x < 1
>>> _.negated
x >= 1

Notes
=====

This works more or less identical to ``~``/``Not``. The difference is
that ``negated`` returns the relationship even if ``evaluate=False``.
Hence, this is useful in code when checking for e.g. negated relations
to existing ones as it will not be affected by the `evaluate` flag.

)r   r   r   r   r   r   r    rO   rP   rD   rd   )r^   re   s     r0   negatedRelational.negated   sK    6 2r2r2r2r2r2>
 !!#''$))"4AtyyAAr2   c                    U $ )zreturn the non-strict version of the inequality or self

EXAMPLES
========

>>> from sympy.abc import x
>>> (x < 1).weak
x <= 1
>>> _.weak
x <= 1
rL   r]   s    r0   weakRelational.weak  	     r2   c                    U $ )zreturn the strict version of the inequality or self

EXAMPLES
========

>>> from sympy.abc import x
>>> (x <= 1).strict
x < 1
>>> _.strict
x < 1
rL   r]   s    r0   strictRelational.strict"  rq   r2   c                |    U R                   " U R                   Vs/ s H  o"R                  U5      PM     sn6 $ s  snf r-   )rD   rd   _evalf)r^   precss      r0   _eval_evalfRelational._eval_evalf1  s-    yy499=9a88D>9=>>=s   9c           	        [        U R                   Vs/ s H&  n[        U[        5      (       a  UR                  OUPM(     sn5      nX R                  :w  a'  U R
                  " U6 n[        U[        5      (       d  U$ OU nUR                  R                  (       a]  UR                  R                  (       aA  UR                  R                  (       a&  UR                  UR                  :  a  UR                  nOLUR                  R                  (       a  UR                  nO$[        [        U5      5      U:w  a  UR                  n[        UR                  SS5      n[        UR                  SS5      n[        UR                  [        5      (       d  [        UR                  [        5      (       a  U$ U(       a  U" 5       (       a  UR                  $ UR                  R                  (       d\  U(       aU  U" 5       (       aI  [        UR                  UR                  * /5      u  pgXcR                  :w  a  UR                  R                  $ U$ s  snf )a  Return a canonical form of the relational by putting a
number on the rhs, canonically removing a sign or else
ordering the args canonically. No other simplification is
attempted.

Examples
========

>>> from sympy.abc import x, y
>>> x < 2
x < 2
>>> _.reversed.canonical
x < 2
>>> (-y < x).canonical
x > -y
>>> (-y > x).canonical
x < -y
>>> (-y < -x).canonical
x < y

The canonicalization is recursively applied:

>>> from sympy import Eq
>>> Eq(x < y, y > x).canonical
True
could_extract_minus_signN)tuplerd   r.   r    r5   rD   r>   	is_number	is_Numberr@   rA   r   getattrr   ri   )r^   ird   r8   LHS_CEMSRHS_CEMSexpr1_s           r0   r5   Relational.canonical4  s   8 tyyYy!Z:%>%>akkAEyYZ99		4 Aa,, - A55??uu155??quuquu}JJUU__

A74=!T)

A155"<dC155"<dCaee[))Z{-K-KH 

>>!X(** v/HE~zz...E Zs   -I
c           	        [        U[        5      (       Ga  XU R                  4;   a  gXpCUR                  [        [
        4;   d  UR                  [        [
        4;   a  UR                  UR                  :w  a  g[        UR                  UR                  5       VVs/ s H  u  pVUR                  UUS9PM     snnu  pxUSL a  U$ USL a  U$ [        UR                  UR                  R                  5       VVs/ s H  u  pVUR                  XbS9PM     snnu  pU	SL a  U
$ U
SL a  U	$ XxX4n[        S U 5       5      (       a  gU H  nUS;  d  M  Us  $    gUR                  UR                  :w  a  UR                  nUR                  UR                  :w  a  gUR                  R                  UR                  US9nUSL a  gUR                  R                  UR                  US9nUSL a  gUSL a  U$ U$ gs  snnf s  snnf )zReturn True if the sides of the relationship are mathematically
identical and the type of relationship is the same.
If failing_expression is True, return the expression whose truth value
was unknown.TF)failing_expressionc              3  (   #    U  H  oS L v   M
     g7f)FNrL   .0r   s     r0   	<genexpr>$Relational.equals.<locals>.<genexpr>  s     -1aEz1s   )TFN)r.   r    rA   rD   r   r   ziprd   equalsallr@   r>   )r^   otherr   rf   rF   r   jleftrightlrrles               r0   r   Relational.equalst  s   
 eZ((t}}--qvv"b!QVVBx%766QVV#  ,/qvvqvv+>@+>41  !xx;M  (  O+>@ 4< LD=K&)!&&!**//&BD&Bda ((1(L&BD:I:I")-1--- A-   66QVV#

A66QVV# uu||AEE7I $ K5= QUU8J % LE> 4< LS )@Ds   G8:G>c                	   SSK Jn  SSKJn  U nUR                  " UR
                   Vs/ s H  oUR                  " S0 UD6PM     sn6 nUR                  (       Gal  [        UR                  U5      (       a  [        UR                  U5      (       d  U$ UR                  UR                  -
  nS nUR                  (       a~  UR                  S5      n[        S UR                  5        5       5      (       aG  UR                  5        Vs/ s H  oUR                  S5      PM     snu  pU[        R                   U	-  -   nO&UR#                  S5      (       a  [        R$                  nUb*  UR                  R'                  U[        R$                  5      nUR(                  n[+        [-        S UR.                  5      5      n
[1        U
5      S:X  a   SSKJn  U
R7                  5       nUR                  UR                  -
  nU" Xl5      u  pUR8                  S	L a@  UR:                  (       a  UR	                  U* U-  U5      nGOUR	                  X* U-  5      nGOsUR	                  U[        R$                  5      nGOQ[1        U
5      S:  GaA   SSKJn  SSK!J"n  [+        [Q        U
5      5      n
UR                  UR                  -
  nU" U/U
Q76 nUS   nUS	 U" U5      nU Vs/ s H  nUU-  PM
     nn[+        [-        S [+        [S        X5      5      5      5      nUR8                  S	L a  US:w  a5  U" U VVs/ s H  u  nnUU-  PM     snn6 nUR	                  UU* U-  5      nOgUS   S   US   S   -  nUS	 U" U VVs/ s H  u  nnUU-  PM     snn6 nUR	                  UU* 5      nO!UR	                  U[        R$                  5      n UR(                  nUS   nU" U5      US   U" U 5      -  :  a  U$ U $ s  snf s  snf ! [<         a    SS
KJ n  SSK!J"nJ#nJ$n   U" UW5      nURK                  5       nUS   nSUS'   U" U5      nU Vs/ s H  nUU-  PM
     Os  snf nnUR	                  URM                  UU5      RO                  5       U* U-  5      n N! U a      Nf = ff = fs  snf s  snnf s  snnf ! [<         a     Nf = f)Nr   Addr'      c              3  >   #    U  H  oR                   S :H  v   M     g7f)r   N)_precr   s     r0   r   ,Relational._eval_simplify.<locals>.<genexpr>  s     >-=ww!|-=s   r   c                    U R                   SL$ NF)is_real)xs    r0   <lambda>+Relational._eval_simplify.<locals>.<lambda>  s    %)?r2   linear_coeffsF)PolynomialError)gcdPolypoly)r   c                    U S   S:g  $ Nr   rL   )fs    r0   r   r     s    !	r2   measureratiorL   )*addr   exprr(   rD   rd   simplifyr=   r.   r@   r>   is_comparablenrS   as_real_imagr   ImaginaryUnitr   Zero_eval_relationr5   listfilterfree_symbolslensympy.solvers.solvesetr   popis_zerois_negativerQ   sympy.polys.polyerrorsr   sympy.polys.polytoolsr   r   r   
all_coeffs	from_listas_exprr   r   )r^   kwargsr   r(   r8   r   difvrvivfreer   r   rH   rF   r   r   r   r   pcconstantscalectmpmtmpnzmr   newexprlhstermr   s                                 r0   _eval_simplifyRelational._eval_simplify  s%   FF166:6aZZ)&)6:;???aeeT***QUUD2I2I%%!%%-C A  EE!H>Q^^-=>>>.1.>.>.@A.@cc!f.@AFBQ__R//AAFF}FF))!QVV4A ?PQD4yA~D
A%%!%%-C(0DAyyE)== !"rAvq 1A !q"q& 1AFF1aff- TaD9.D%%!%%-C%c1D1A uH"FE234!$!A4v&94A;MNOC}}-#q=&)c+BcdaAEc+B&CG !w	E0A BA '*!fQi#a&)&;G #A&)c+BcdaAEc+B&CG !w 9A FF8QVV4 KK#1:w'$-77HKi ; B2 " FEE	 aLLLN#$R5 !" #A678adTE\a88FF4>>!Q#7#?#?#AH9uCTU* 0 5
 ,C ,C
 " s   O3O8A/O= <O=  O= AR6 R%+AR6 1R*
R6 R6 :R0
R6 % R6 =R"/RQ<RRR"RR"%R6 6
SSc                v    SSK Jn  U R                  U" U R                  40 UD6U" U R                  40 UD65      $ )Nr   )trigsimp)sympy.simplify.trigsimpr   rD   r@   r>   )r^   optsr   s      r0   _eval_trigsimpRelational._eval_trigsimp  s2    4yy$((3d3Xdhh5O$5OPPr2   c                N   ^ U4S jU R                    5       nU R                  " U6 $ )Nc              3  F   >#    U  H  oR                   " S0 TD6v   M     g 7fNrL   )expand)r   argr   s     r0   r   $Relational.expand.<locals>.<genexpr>  s     :	

$V$	s   !)rd   rD   )r^   r   rd   s    ` r0   r   Relational.expand  s     :		:yy$r2   c                4   ^  [        [        U 4S j5      5      e)Nc                    > ST  3$ )Nz,cannot determine truth value of Relational: rL   r]   s   r0   r   %Relational.__bool__.<locals>.<lambda>	  s    FtfMr2   )rU   r   r]   s   `r0   __bool__Relational.__bool__  s     M
 	
r2   c                    SSK Jn  SSKJn  U R                  n[        U5      S:X  d   eUR                  5       n U" XSS9nU$ ! [         a    U" X@[        R                  5      n U$ f = f)Nr   )solve_univariate_inequality)ConditionSetr   F)
relational)
sympy.solvers.inequalitiesr   sympy.sets.conditionsetr   r   r   r   NotImplementedErrorr   Reals)r^   r   r   symsr   xsets         r0   _eval_as_setRelational._eval_as_set  sn    J8  4yA~~HHJ	2.t5ID
 	 # 	2  1D		2s   A !A)(A)c                    [        5       $ r-   )setr]   s    r0   binary_symbolsRelational.binary_symbols  s     ur2   r-   )F)returnbool)__name__
__module____qualname____firstlineno____doc__	__slots__rM   __annotations__r=   rO   propertyr@   r>   rA   ri   rl   ro   rs   ry   r5   r   r   r   r   r   r   r   __static_attributes__rL   r2   r0   r    r    A   s   Pb I@B=BM
,8     G G*  0 B BB    ? = =~.`XtQ 
  r2   r    c                  t   ^  \ rS rSrSrSrSrSrS r\	S 5       r
SS jr\S	 5       rU 4S
 jrS rS rSrU =r$ )r!   i%  a  
An equal relation between two objects.

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

Represents that two objects are equal.  If they can be easily shown
to be definitively equal (or unequal), this will reduce to True (or
False).  Otherwise, the relation is maintained as an unevaluated
Equality object.  Use the ``simplify`` function on this object for
more nontrivial evaluation of the equality relation.

As usual, the keyword argument ``evaluate=False`` can be used to
prevent any evaluation.

Examples
========

>>> from sympy import Eq, simplify, exp, cos
>>> from sympy.abc import x, y
>>> Eq(y, x + x**2)
Eq(y, x**2 + x)
>>> Eq(2, 5)
False
>>> Eq(2, 5, evaluate=False)
Eq(2, 5)
>>> _.doit()
False
>>> Eq(exp(x), exp(x).rewrite(cos))
Eq(exp(x), sinh(x) + cosh(x))
>>> simplify(_)
True

See Also
========

sympy.logic.boolalg.Equivalent : for representing equality between two
    boolean expressions

Notes
=====

Python treats 1 and True (and 0 and False) as being equal; SymPy
does not. And integer will always compare as unequal to a Boolean:

>>> Eq(True, 1), True == 1
(False, True)

This class is not the same as the == operator.  The == operator tests
for exact structural equality between two expressions; this class
compares expressions mathematically.

If either object defines an ``_eval_Eq`` method, it can be used in place of
the default algorithm.  If ``lhs._eval_Eq(rhs)`` or ``rhs._eval_Eq(lhs)``
returns anything other than None, that return value will be substituted for
the Equality.  If None is returned by ``_eval_Eq``, an Equality object will
be created as usual.

Since this object is already an expression, it does not respond to
the method ``as_expr`` if one tries to create `x - y` from ``Eq(x, y)``.
If ``eq = Eq(x, y)`` then write `eq.lhs - eq.rhs` to get ``x - y``.

.. deprecated:: 1.5

   ``Eq(expr)`` with a single argument is a shorthand for ``Eq(expr, 0)``,
   but this behavior is deprecated and will be removed in a future version
   of SymPy.

==rL   Tc                    UR                  S[        R                  5      n[        U5      n[        U5      nU(       a   [	        X5      nUc  U " XSS9$ [        U5      $ [
        R                  XU5      $ NevaluateFr
  )r   r   r
  r   is_eqr    rO   rV   r@   r>   optionsr
  vals         r0   rO   Equality.__new__q  sf    ;;z+<+E+EFsmsm/C{3e44}$!!#C00r2   c                    [        X:H  5      $ r-   r   rV   r@   r>   s      r0   r   Equality._eval_relation~      
##r2   c                    [        SSSSS9  SSKJnJn  US:X  a  U$ US:X  a  U$ U(       a  X-
  $ UR	                  U5      UR	                  U* 5      -   nUc  U" U6 $ UR                  U5      $ )	a  
return Eq(L, R) as L - R. To control the evaluation of
the result set pass `evaluate=True` to give L - R;
if `evaluate=None` then terms in L and R will not cancel
but they will be listed in canonical order; otherwise
non-canonical args will be returned. If one side is 0, the
non-zero side will be returned.

.. deprecated:: 1.13

   The method ``Eq.rewrite(Add)`` is deprecated.
   See :ref:`eq-rewrite-Add` for details.

Examples
========

>>> from sympy import Eq, Add
>>> from sympy.abc import b, x
>>> eq = Eq(x + b, x - b)
>>> eq.rewrite(Add)  #doctest: +SKIP
2*b
>>> eq.rewrite(Add, evaluate=None).args  #doctest: +SKIP
(b, b, x, -x)
>>> eq.rewrite(Add, evaluate=False).args  #doctest: +SKIP
(b, x, b, -x)
z
        Eq.rewrite(Add) is deprecated.

        For ``eq = Eq(a, b)`` use ``eq.lhs - eq.rhs`` to obtain
        ``a - b``.
        z1.13zeq-rewrite-Add   )deprecated_since_versionactive_deprecations_target
stacklevelr   )_unevaluated_Addr   r   )r   r   r  r   	make_args
_from_args)r^   LRr
  r   r  r   rd   s           r0   _eval_rewrite_as_AddEquality._eval_rewrite_as_Add  s    6 	" # &,'7		
 	/6H6H5L}}Q#--"33#T**~~d##r2   c                .   [         R                  U R                  ;   d  [         R                  U R                  ;   aP  U R                  R
                  (       a  U R                  1$ U R                  R
                  (       a  U R                  1$ [        5       $ r-   r   truerd   falser@   	is_Symbolr>   r   r]   s    r0   r   Equality.binary_symbols  Z    66TYY!''TYY"6xx!!z!##z!ur2   c                  > [         TU ]  " S
0 UD6n[        U[        5      (       d  U$ SSKJn  [        UR                  U5      (       a  [        UR                  U5      (       d  U$ U R                  n[        U5      S:X  a   SSK
Jn  SSKJn  UR                  5       nU" U" UR                  UR                  * SS9U5      u  pUR                  SL a  UR!                  Xy* U-  5      n
OUR!                  X-  U	* 5      n
US   nU" U
5      US	   U" U5      -  ::  a  U
nUR$                  $ UR$                  $ ! ["         a     UR$                  $ f = f)Nr   r'   r   r   r   Fr  r   r   rL   )superr   r.   r!   r   r(   r@   r>   r   r   r   r   r   r   r   r   rD   rQ   r5   )r^   r   r   r(   r   r   r   r   rH   rF   enewr   	__class__s               r0   r   Equality._eval_simplify  s/   G",V,!X&&H!%%&&j.E.EH  t9>$@HHJ$v6;99%66!R!V,D66!%!,D +4=F7Ogaj$@@A {{q{{  {{s   BD6 6
EEc                &    SSK Jn  U" U /UQ70 UD6$ )z-See the integrate function in sympy.integralsr   )	integrate)sympy.integrals.integralsr/  )r^   rd   r   r/  s       r0   r/  Equality.integrate  s    7////r2   c                T    U R                   U R                  -
  R                  " U0 UD6$ )zReturns lhs-rhs as a Poly

Examples
========

>>> from sympy import Eq
>>> from sympy.abc import x
>>> Eq(x**2, 1).as_poly(x)
Poly(x**2 - 1, x, domain='ZZ')
)r@   r>   as_poly)r^   gensr   s      r0   r3  Equality.as_poly  s'     488#,,d=f==r2   )T)r   r   r   r   r  rel_opr  is_EqualityrO   classmethodr   r   r  r   r   r/  r3  r  __classcell__)r,  s   @r0   r!   r!   %  sb    DJ FIK1 $ $2$h  60
> >r2   r!   c                  L    \ rS rSrSrSrSrS r\S 5       r	\
S 5       rS rSrg	)
r"   i  a  An unequal relation between two objects.

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

Represents that two objects are not equal.  If they can be shown to be
definitively equal, this will reduce to False; if definitively unequal,
this will reduce to True.  Otherwise, the relation is maintained as an
Unequality object.

Examples
========

>>> from sympy import Ne
>>> from sympy.abc import x, y
>>> Ne(y, x+x**2)
Ne(y, x**2 + x)

See Also
========
Equality

Notes
=====
This class is not the same as the != operator.  The != operator tests
for exact structural equality between two expressions; this class
compares expressions mathematically.

This class is effectively the inverse of Equality.  As such, it uses the
same algorithms, including any available `_eval_Eq` methods.

!=rL   c                    [        U5      n[        U5      nUR                  S[        R                  5      nU(       a   [	        X5      nUc  U " XSS9$ [        U5      $ [
        R                  " XU40 UD6$ r	  )r   r   r   r
  is_neqr    rO   r  s         r0   rO   Unequality.__new__  sl    smsm;;z+<+E+EF"C{3e44}$!!#C;7;;r2   c                    [        X:g  5      $ r-   r  r  s      r0   r   Unequality._eval_relation"  r  r2   c                .   [         R                  U R                  ;   d  [         R                  U R                  ;   aP  U R                  R
                  (       a  U R                  1$ U R                  R
                  (       a  U R                  1$ [        5       $ r-   r#  r]   s    r0   r   Unequality.binary_symbols&  r(  r2   c                    [        U R                  6 R                  " S0 UD6n[        U[         5      (       a  U R                  " UR                  6 $ UR
                  $ r   )r!   rd   r   r.   rD   rl   )r^   r   eqs      r0   r   Unequality._eval_simplify/  sH    tyy!00:6:b(##99bgg&&zzr2   N)r   r   r   r   r  r6  r  rO   r8  r   r  r   r   r  rL   r2   r0   r"   r"     sF    @ FI< $ $  r2   r"   c                  2    \ rS rSrSrSrS r\S 5       rSr	g)_Inequalityi;  zInternal base class for all *Than types.

Each subclass must implement _eval_relation to provide the method for
comparing two real numbers.

rL   c                    [        U5      n[        U5      nUR                  S[        R
                  5      nU(       aX  X4 H>  nUR                  SL a  [        SU-  5      eU[        R                  L d  M5  [        S5      e   U R                  " X40 UD6$ [        R                  " XU40 UD6$ ! [         a	    [        s $ f = f)Nr
  Fz!Invalid comparison of non-real %szInvalid NaN comparison)r   r   NotImplementedr   r   r
  is_extended_realrU   r   NaNr   r    rO   )rV   r@   r>   r  r
  mes         r0   rO   _Inequality.__new__D  s    	"3-C3-C ;;z+<+E+EFj&&%/#$G"$LMM;#$<==	 ! %%c:':: !!#C;7;;+  	"!!	"s   B/ /CCc                N    U R                  X5      nUc  U " XSS9$ [        U5      $ )NFr  )_eval_fuzzy_relationr   )rV   r@   r>   r  r  s        r0   r   _Inequality._eval_relation`  s.    &&s0;s%00C= r2   N)
r   r   r   r   r  r  rO   r8  r   r  rL   r2   r0   rG  rG  ;  s'     I<8 ! !r2   rG  c                  <    \ rS rSrSrSr\S 5       r\S 5       rSr	g)_Greaterii  zNot intended for general use

_Greater is only used so that GreaterThan and StrictGreaterThan may
subclass it for the .gts and .lts properties.

rL   c                     U R                   S   $ r   r[   r]   s    r0   gts_Greater.gtsr      zz!}r2   c                     U R                   S   $ Nr   r[   r]   s    r0   lts_Greater.ltsv  rV  r2   N
r   r   r   r   r  r  r  rT  rY  r  rL   r2   r0   rR  rR  i  4     I   r2   rR  c                  <    \ rS rSrSrSr\S 5       r\S 5       rSr	g)_Lessi{  zNot intended for general use.

_Less is only used so that LessThan and StrictLessThan may subclass it for
the .gts and .lts properties.

rL   c                     U R                   S   $ rX  r[   r]   s    r0   rT  	_Less.gts  rV  r2   c                     U R                   S   $ r   r[   r]   s    r0   rY  	_Less.lts  rV  r2   Nr[  rL   r2   r0   r^  r^  {  r\  r2   r^  c                  @    \ rS rSrSrSrSr\S 5       r\	S 5       r
Srg)r&   i  a  Class representations of inequalities.

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

The ``*Than`` classes represent inequal relationships, where the left-hand
side is generally bigger or smaller than the right-hand side.  For example,
the GreaterThan class represents an inequal relationship where the
left-hand side is at least as big as the right side, if not bigger.  In
mathematical notation:

lhs $\ge$ rhs

In total, there are four ``*Than`` classes, to represent the four
inequalities:

+-----------------+--------+
|Class Name       | Symbol |
+=================+========+
|GreaterThan      | ``>=`` |
+-----------------+--------+
|LessThan         | ``<=`` |
+-----------------+--------+
|StrictGreaterThan| ``>``  |
+-----------------+--------+
|StrictLessThan   | ``<``  |
+-----------------+--------+

All classes take two arguments, lhs and rhs.

+----------------------------+-----------------+
|Signature Example           | Math Equivalent |
+============================+=================+
|GreaterThan(lhs, rhs)       |   lhs $\ge$ rhs |
+----------------------------+-----------------+
|LessThan(lhs, rhs)          |   lhs $\le$ rhs |
+----------------------------+-----------------+
|StrictGreaterThan(lhs, rhs) |   lhs $>$ rhs   |
+----------------------------+-----------------+
|StrictLessThan(lhs, rhs)    |   lhs $<$ rhs   |
+----------------------------+-----------------+

In addition to the normal .lhs and .rhs of Relations, ``*Than`` inequality
objects also have the .lts and .gts properties, which represent the "less
than side" and "greater than side" of the operator.  Use of .lts and .gts
in an algorithm rather than .lhs and .rhs as an assumption of inequality
direction will make more explicit the intent of a certain section of code,
and will make it similarly more robust to client code changes:

>>> from sympy import GreaterThan, StrictGreaterThan
>>> from sympy import LessThan, StrictLessThan
>>> from sympy import And, Ge, Gt, Le, Lt, Rel, S
>>> from sympy.abc import x, y, z
>>> from sympy.core.relational import Relational

>>> e = GreaterThan(x, 1)
>>> e
x >= 1
>>> '%s >= %s is the same as %s <= %s' % (e.gts, e.lts, e.lts, e.gts)
'x >= 1 is the same as 1 <= x'

Examples
========

One generally does not instantiate these classes directly, but uses various
convenience methods:

>>> for f in [Ge, Gt, Le, Lt]:  # convenience wrappers
...     print(f(x, 2))
x >= 2
x > 2
x <= 2
x < 2

Another option is to use the Python inequality operators (``>=``, ``>``,
``<=``, ``<``) directly.  Their main advantage over the ``Ge``, ``Gt``,
``Le``, and ``Lt`` counterparts, is that one can write a more
"mathematical looking" statement rather than littering the math with
oddball function calls.  However there are certain (minor) caveats of
which to be aware (search for 'gotcha', below).

>>> x >= 2
x >= 2
>>> _ == Ge(x, 2)
True

However, it is also perfectly valid to instantiate a ``*Than`` class less
succinctly and less conveniently:

>>> Rel(x, 1, ">")
x > 1
>>> Relational(x, 1, ">")
x > 1

>>> StrictGreaterThan(x, 1)
x > 1
>>> GreaterThan(x, 1)
x >= 1
>>> LessThan(x, 1)
x <= 1
>>> StrictLessThan(x, 1)
x < 1

Notes
=====

There are a couple of "gotchas" to be aware of when using Python's
operators.

The first is that what your write is not always what you get:

    >>> 1 < x
    x > 1

    Due to the order that Python parses a statement, it may
    not immediately find two objects comparable.  When ``1 < x``
    is evaluated, Python recognizes that the number 1 is a native
    number and that x is *not*.  Because a native Python number does
    not know how to compare itself with a SymPy object
    Python will try the reflective operation, ``x > 1`` and that is the
    form that gets evaluated, hence returned.

    If the order of the statement is important (for visual output to
    the console, perhaps), one can work around this annoyance in a
    couple ways:

    (1) "sympify" the literal before comparison

    >>> S(1) < x
    1 < x

    (2) use one of the wrappers or less succinct methods described
    above

    >>> Lt(1, x)
    1 < x
    >>> Relational(1, x, "<")
    1 < x

The second gotcha involves writing equality tests between relationals
when one or both sides of the test involve a literal relational:

    >>> e = x < 1; e
    x < 1
    >>> e == e  # neither side is a literal
    True
    >>> e == x < 1  # expecting True, too
    False
    >>> e != x < 1  # expecting False
    x < 1
    >>> x < 1 != x < 1  # expecting False or the same thing as before
    Traceback (most recent call last):
    ...
    TypeError: cannot determine truth value of Relational

    The solution for this case is to wrap literal relationals in
    parentheses:

    >>> e == (x < 1)
    True
    >>> e != (x < 1)
    False
    >>> (x < 1) != (x < 1)
    False

The third gotcha involves chained inequalities not involving
``==`` or ``!=``. Occasionally, one may be tempted to write:

    >>> e = x < y < z
    Traceback (most recent call last):
    ...
    TypeError: symbolic boolean expression has no truth value.

    Due to an implementation detail or decision of Python [1]_,
    there is no way for SymPy to create a chained inequality with
    that syntax so one must use And:

    >>> e = And(x < y, y < z)
    >>> type( e )
    And
    >>> e
    (x < y) & (y < z)

    Although this can also be done with the '&' operator, it cannot
    be done with the 'and' operarator:

    >>> (x < y) & (y < z)
    (x < y) & (y < z)
    >>> (x < y) and (y < z)
    Traceback (most recent call last):
    ...
    TypeError: cannot determine truth value of Relational

.. [1] This implementation detail is that Python provides no reliable
   method to determine that a chained inequality is being built.
   Chained comparison operators are evaluated pairwise, using "and"
   logic (see
   https://docs.python.org/3/reference/expressions.html#not-in). This
   is done in an efficient way, so that each object being compared
   is only evaluated once and the comparison can short-circuit. For
   example, ``1 > 2 > 3`` is evaluated by Python as ``(1 > 2) and (2
   > 3)``. The ``and`` operator coerces each side into a bool,
   returning the object itself when it short-circuits. The bool of
   the --Than operators will raise TypeError on purpose, because
   SymPy cannot determine the mathematical ordering of symbolic
   expressions. Thus, if we were to compute ``x > y > z``, with
   ``x``, ``y``, and ``z`` being Symbols, Python converts the
   statement (roughly) into these steps:

    (1) x > y > z
    (2) (x > y) and (y > z)
    (3) (GreaterThanObject) and (y > z)
    (4) (GreaterThanObject.__bool__()) and (y > z)
    (5) TypeError

   Because of the ``and`` added at step 2, the statement gets turned into a
   weak ternary statement, and the first object's ``__bool__`` method will
   raise TypeError.  Thus, creating a chained inequality is not possible.

       In Python, there is no way to override the ``and`` operator, or to
       control how it short circuits, so it is impossible to make something
       like ``x > y > z`` work.  There was a PEP to change this,
       :pep:`335`, but it was officially closed in March, 2012.

rL   >=c                    [        X5      $ r-   is_ger  s      r0   rO   GreaterThan._eval_fuzzy_relations      Sr2   c                &    [        U R                  6 $ r-   )r   rd   r]   s    r0   rs   GreaterThan.strictw      499~r2   N)r   r   r   r   r  r  r6  r8  rO  r  rs   r  rL   r2   r0   r&   r&     s;    `B IF   r2   r&   c                  T    \ rS rSr\R
                  rSrSr\S 5       r	\
S 5       rSrg)r$   i~  rL   <=c                    [        X5      $ r-   )is_ler  s      r0   rO  LessThan._eval_fuzzy_relation  ri  r2   c                &    [        U R                  6 $ r-   )r   rd   r]   s    r0   rs   LessThan.strict  rl  r2   N)r   r   r   r   r&   r  r  r6  r8  rO  r  rs   r  rL   r2   r0   r$   r$   ~  s=    !!GIF   r2   r$   c                  T    \ rS rSr\R
                  rSrSr\S 5       r	\
S 5       rSrg)r%   i  rL   >c                    [        X5      $ r-   )is_gtr  s      r0   rO  &StrictGreaterThan._eval_fuzzy_relation  ri  r2   c                &    [        U R                  6 $ r-   )r   rd   r]   s    r0   ro   StrictGreaterThan.weak  rl  r2   Nr   r   r   r   r&   r  r  r6  r8  rO  r  ro   r  rL   r2   r0   r%   r%     =    !!GIF   r2   r%   c                  T    \ rS rSr\R
                  rSrSr\S 5       r	\
S 5       rSrg)r#   i  rL   <c                    [        X5      $ r-   )is_ltr  s      r0   rO  #StrictLessThan._eval_fuzzy_relation  ri  r2   c                &    [        U R                  6 $ r-   )r   rd   r]   s    r0   ro   StrictLessThan.weak  rl  r2   Nr{  rL   r2   r0   r#   r#     r|  r2   r#   )Nr  rD  r;  z<>nerd  gern  leru  gtr~  ltc                    U R                   (       a9  UR                   (       a'  X-
  R                  S5      nUR                   (       a  U$ ggg)z{Return (a - b).evalf(2) if a and b are comparable, else None.
This should only be used when a and b are already sympified.
r   N)r   evalf)rf   rF   r   s      r0   _n2r    s;     	1??ummAJ  +r2   c                    g r-   rL   r@   r>   s     r0   _eval_is_ger        r2   c                    g r-   rL   r  s     r0   _eval_is_eqr    r  r2   c                    gr   rL   r  s     r0   r  r    s    r2   c                    g r-   rL   r  s     r0   r  r    r  r2   c                    g r-   rL   r  s     r0   r  r    r  r2   c                j    [        U 5      [        U5      :w  a  g[        S [        X5       5       5      $ )NFc              3  N   #    U  H  u  p[        [        X5      5      v   M     g 7fr-   )r   r  )r   rx   os      r0   r   _eval_is_eq.<locals>.<genexpr>  s     GZa,,s   #%)r   r   r   r  s     r0   r  r    s*    
3x3s8GSGGGr2   Nc                ,    [        [        XU5      5      $ )z_Fuzzy bool for lhs is strictly less than rhs.

See the docstring for :func:`~.is_ge` for more.
)r   rg  r@   r>   rX   s      r0   r  r        
 U3[122r2   c                ,    [        [        XU5      5      $ )zbFuzzy bool for lhs is strictly greater than rhs.

See the docstring for :func:`~.is_ge` for more.
)r   rp  r  s      r0   rw  rw    r  r2   c                    [        XU5      $ )zbFuzzy bool for lhs is less than or equal to rhs.

See the docstring for :func:`~.is_ge` for more.
rf  r  s      r0   rp  rp    s    
 ;''r2   c                ^   SSK JnJn  [        U [        5      (       a  [        U[        5      (       d  [        S5      e[        X5      nUb  U$ [        X5      nUb4  U[        R                  [        R                  4;   a  [        U5      nUS:  $ U" X5      nU" X5      nUR                  (       a}  UR                  (       ak  UR                  (       a  UR                  (       d"  UR                  (       a  UR                  (       a  gX-
  n	U	[        R                   La  U" X5      n
U
b  U
$ gggg)a\	  
Fuzzy bool for *lhs* is greater than or equal to *rhs*.

Parameters
==========

lhs : Expr
    The left-hand side of the expression, must be sympified,
    and an instance of expression. Throws an exception if
    lhs is not an instance of expression.

rhs : Expr
    The right-hand side of the expression, must be sympified
    and an instance of expression. Throws an exception if
    lhs is not an instance of expression.

assumptions: Boolean, optional
    Assumptions taken to evaluate the inequality.

Returns
=======

``True`` if *lhs* is greater than or equal to *rhs*, ``False`` if *lhs*
is less than *rhs*, and ``None`` if the comparison between *lhs* and
*rhs* is indeterminate.

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

This function is intended to give a relatively fast determination and
deliberately does not attempt slow calculations that might help in
obtaining a determination of True or False in more difficult cases.

The four comparison functions ``is_le``, ``is_lt``, ``is_ge``, and ``is_gt`` are
each implemented in terms of ``is_ge`` in the following way:

is_ge(x, y) := is_ge(x, y)
is_le(x, y) := is_ge(y, x)
is_lt(x, y) := fuzzy_not(is_ge(x, y))
is_gt(x, y) := fuzzy_not(is_ge(y, x))

Therefore, supporting new type with this function will ensure behavior for
other three functions as well.

To maintain these equivalences in fuzzy logic it is important that in cases where
either x or y is non-real all comparisons will give None.

Examples
========

>>> from sympy import S, Q
>>> from sympy.core.relational import is_ge, is_le, is_gt, is_lt
>>> from sympy.abc import x
>>> is_ge(S(2), S(0))
True
>>> is_ge(S(0), S(2))
False
>>> is_le(S(0), S(2))
True
>>> is_gt(S(0), S(2))
False
>>> is_lt(S(2), S(0))
False

Assumptions can be passed to evaluate the quality which is otherwise
indeterminate.

>>> print(is_ge(x, S(0)))
None
>>> is_ge(x, S(0), assumptions=Q.positive(x))
True

New types can be supported by dispatching to ``_eval_is_ge``.

>>> from sympy import Expr, sympify
>>> from sympy.multipledispatch import dispatch
>>> class MyExpr(Expr):
...     def __new__(cls, arg):
...         return super().__new__(cls, sympify(arg))
...     @property
...     def value(self):
...         return self.args[0]
>>> @dispatch(MyExpr, MyExpr)
... def _eval_is_ge(a, b):
...     return is_ge(a.value, b.value)
>>> a = MyExpr(1)
>>> b = MyExpr(2)
>>> is_ge(b, a)
True
>>> is_le(a, b)
True
r   )AssumptionsWrapperis_extended_nonnegativez'Can only compare inequalities with ExprNT)sympy.assumptions.wrapperr  r  r.   r(   rU   r  r  r   InfinityNegativeInfinityfloatrJ  is_infiniteis_extended_positiveis_extended_negativerK  )r@   r>   rX   r  r  retvaln2_lhs_rhsdiffr   s              r0   rg  rg    s    z VsD!!jd&;&;ABB"F]> ajj!"4"4552Y7N!#3!#3  T%:%:  T%>%>DDTDTY]YrYr9D155 ,T?>I " !	 &; r2   c                ,    [        [        XU5      5      $ )zXFuzzy bool for lhs does not equal rhs.

See the docstring for :func:`~.is_eq` for more.
)r   r  r  s      r0   r=  r=    r  r2   c                V	  ^^"^#^$^% X4X44 H&  u  p4[        USS5      nUc  M  U" U5      nUc  M$  Us  $    [        X5      nUb  U$ [        [        U 5      [        U5      5      [        [        U5      [        U 5      5      :w  a  [        X5      nUb  U$ X:X  a  g[	        S X4 5       5      (       a  gU R
                  (       d4  UR
                  (       d#  [        U [        5      [        U[        5      :w  a  gSSKJ	nJ
m%Jm$  SS	KJm"  U" U T5      nU" UT5      n	UR                  (       d  U	R                  (       Ga  [        UR                  U	R                  /5      (       a  g[        UR                  U	R                  /5      (       a  g[        UR                  U	R                  /5      (       a*  [        UR                   [#        U	R                   5      /5      $ [$        R&                  m#U"U#UU$4S
 jn
U
" U 5      nUS   (       dd  U
" U5      nUS   (       dR  [)        T"" US   6 T"" US   6 T5      n[)        T#T"" US   6 -  T#T"" US   6 -  T5      n[        [+        [,        X/5      5      $ SSKJn  U" U 5      nU" U5      nU[$        R2                  :X  a  U[$        R2                  :X  d  [-        [)        UUT5      5      $ [	        S X4 5       5      (       Ga  X-
  nU" UT5      nUR4                  nUb  USL a  UR6                  (       a  gU(       a  gUR9                  5       u  nnUR:                  (       a1  [=        U5      (       a  UR>                  SL a  gOUR@                  SL a  g[C        X5      nUb  [E        US:H  5      $ URG                  5       u  nnSnU" UT5      nU" UT5      nUR4                  (       a  URH                  nOURJ                  (       a  UR                  (       a  SnOUR4                  SL av  UR                  nUcg  SSK&J'n  U" U[$        RP                  5      u  nnX4 V s/ s H  n U RS                  UU5      PM     n!n U!X/:w  a  [-        [)        / U!QTP76 5      nUSL a  SnO,[U        UU%4S jT"RW                  U5       5       5      (       a  SnUb  U$ ggs  sn f )a  
Fuzzy bool representing mathematical equality between *lhs* and *rhs*.

Parameters
==========

lhs : Expr
    The left-hand side of the expression, must be sympified.

rhs : Expr
    The right-hand side of the expression, must be sympified.

assumptions: Boolean, optional
    Assumptions taken to evaluate the equality.

Returns
=======

``True`` if *lhs* is equal to *rhs*, ``False`` is *lhs* is not equal to *rhs*,
and ``None`` if the comparison between *lhs* and *rhs* is indeterminate.

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

This function is intended to give a relatively fast determination and
deliberately does not attempt slow calculations that might help in
obtaining a determination of True or False in more difficult cases.

:func:`~.is_neq` calls this function to return its value, so supporting
new type with this function will ensure correct behavior for ``is_neq``
as well.

Examples
========

>>> from sympy import Q, S
>>> from sympy.core.relational import is_eq, is_neq
>>> from sympy.abc import x
>>> is_eq(S(0), S(0))
True
>>> is_neq(S(0), S(0))
False
>>> is_eq(S(0), S(2))
False
>>> is_neq(S(0), S(2))
True

Assumptions can be passed to evaluate the equality which is otherwise
indeterminate.

>>> print(is_eq(x, S(0)))
None
>>> is_eq(x, S(0), assumptions=Q.zero(x))
True

New types can be supported by dispatching to ``_eval_is_eq``.

>>> from sympy import Basic, sympify
>>> from sympy.multipledispatch import dispatch
>>> class MyBasic(Basic):
...     def __new__(cls, arg):
...         return Basic.__new__(cls, sympify(arg))
...     @property
...     def value(self):
...         return self.args[0]
...
>>> @dispatch(MyBasic, MyBasic)
... def _eval_is_eq(a, b):
...     return is_eq(a.value, b.value)
...
>>> a = MyBasic(1)
>>> b = MyBasic(1)
>>> is_eq(a, b)
True
>>> is_neq(a, b)
False

_eval_EqNTc              3  B   #    U  H  n[        U[        5      v   M     g 7fr-   )r.   r   r   s     r0   r   is_eq.<locals>.<genexpr>  s     <AZ;''   Fr   )r  r  rJ  r   r   c                J   > UUU4S jn[        TR                  U 5      U5      $ )Nc                N   > T" U T5      (       a  S$ T" TU -  T5      (       a  S$ S $ )NrealimagrL   )tIrX   rJ  s    r0   r   0is_eq.<locals>.split_real_imag.<locals>.<lambda>  s:    *1k:: G*1Q3<<GBFGr2   )r   r  )r   	real_imagr   r  rX   rJ  s     r0   split_real_imagis_eq.<locals>.split_real_imag  s#    HI d+Y77r2   r  r  )r   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr-   )r.   r(   r   s     r0   r   r  #  s     
3
1:a
r  )clear_coefficientsc              3  6   >#    U  H  nT" UT5      v   M     g 7fr-   rL   )r   rf   rX   r  s     r0   r   r  R  s     G6FQ,,6Fs   ),r   r  r)   typer   r&  r.   r   r  r  r  rJ  r   r   r   r   r  r   r   r   r  rT   r   $sympy.functions.elementary.complexesr   rK  r   is_commutativerB   is_Floatr   
is_integeris_rationalr  r   as_numer_denom
is_nonzero	is_finitesympy.simplify.simplifyr  r  subsrS   r  )&r@   r>   rX   side1side2	eval_funcr  r  r  r  r  lhs_rirhs_rieq_realeq_imagr   arglhsargrhsr   _difzr   r  r  r   dr   _n_dr  rG   r8   r   rd   r   r  rJ  r  s&     `                               @@@@r0   r  r    s*   d 
SJ.E:t4	 u%F! / "FS	49%$s)T#Y)GGS&M z	<#<	<	<mms}}3 3 	!' 'c;/Dc;/D4+++d&&(8(89::d++T-B-BCDDd++T-B-BCDDd774C\C\9]^__ OO	8 	8 !%d|$S)F$<VF^ 4c6&>6JKXC$8 8!c6&>>R:RT_` Z'1C!DEE<SS!%%FaeeOeFFK@AA

3

333i!#{3LL=Ezd11 !1::!}}<<5(  )%']>B!G$$ !!#1;/;/::B\\~~u$^^: K-a<DAq36*=*QAFF1aL*D=z)'(At(A[(AB:!%BGcmmA6FGGGB>I e 4T >s   0R&r-   )K
__future__r   basicr   r   
coreerrorsr   sortingr   r  r	   functionr
   numbersr   	singletonr   sympifyr   r   
parametersr   logicr   r   r   r   sympy.logic.boolalgr   r   sympy.utilities.iterablesr   sympy.utilities.miscr   sympy.utilities.exceptionsr   __all__r   r(   sympy.multipledispatchr)   
containersr*   symbolr+   r1   r:   rI   r    r   r!   r   r"   r   rG  rR  r^  r&   r   r$   r   r%   r   r#   r   rM   r  r  r  r  rw  rp  rg  r=  r  rL   r2   r0   <module>r     s   "  ,   "   + ) > > 4 * + @  +  & ^* ^B E>z E>P E EP +!* +!\{ $K $l( l\ u    U   








	
	
$
  $	 
$  
%  
%  
%  
%  
%H H33(xv3Hr2   