
    \hL                    J   S 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S
KJr  SSKJr  SSKJr   " S S\5      r " S S\5      r " S S\5      r " S S5      r " S S\\5      r\" 5       =r\l         " S S\\5      r\" 5       =r\l        g)zDomains of Gaussian type.    )annotations)I)DMP)CoercionFailed)ZZ)QQ)AlgebraicField)Domain)DomainElement)Field)Ringc                     ^  \ rS rSr% SrS\S'   S\S'   SrS S jr\U 4S j5       r	S	 r
S
 rS rS rS rS rS rS r\S 5       rS r\rS rS rS r\rS rS rS rS rS rS rS rS r S r!Sr"U =r#$ )!GaussianElement   z1Base class for elements of Gaussian type domains.r
   base_parent)xyc                j    U R                   R                  nU R                  U" U5      U" U5      5      $ N)r   convertnew)clsr   r   convs       [/var/www/auris/envauris/lib/python3.13/site-packages/sympy/polys/domains/gaussiandomains.py__new__GaussianElement.__new__   s*    xxwwtAwQ((    c                >   > [         TU ]  U 5      nXl        X#l        U$ )z0Create a new GaussianElement of the same domain.)superr   r   r   )r   r   r   obj	__class__s       r   r   GaussianElement.new   s"     goc"
r   c                    U R                   $ )z4The domain that this is an element of (ZZ_I or QQ_I))r   selfs    r   parentGaussianElement.parent#   s    ||r   c                D    [        U R                  U R                  45      $ r   )hashr   r   r%   s    r   __hash__GaussianElement.__hash__'   s    TVVTVV$%%r   c                    [        XR                  5      (       a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ [        $ r   )
isinstancer"   r   r   NotImplementedr&   others     r   __eq__GaussianElement.__eq__*   s<    e^^,,66UWW$:577)::!!r   c                    [        U[        5      (       d  [        $ U R                  U R                  /UR                  UR                  /:  $ r   )r.   r   r/   r   r   r0   s     r   __lt__GaussianElement.__lt__0   s:    %11!!577EGG"444r   c                    U $ r    r%   s    r   __pos__GaussianElement.__pos__5   s    r   c                R    U R                  U R                  * U R                  * 5      $ r   r   r   r   r%   s    r   __neg__GaussianElement.__neg__8   s    xx$&&))r   c                n    U R                   R                  < SU R                  < SU R                  < S3$ )N(z, ))r   repr   r   r%   s    r   __repr__GaussianElement.__repr__;   s!    #||//@@r   c                J    [        U R                  R                  U 5      5      $ r   )strr   to_sympyr%   s    r   __str__GaussianElement.__str__>   s    4<<((.//r   c                    [        X5      (       d   U R                  R                  U5      nUR                  UR
                  4$ ! [         a     gf = f)N)NN)r.   r   r   r   r   r   )r   r1   s     r   _get_xyGaussianElement._get_xyA   sO    %%%"++E2 ww " "!"s   A 
AAc                    U R                  U5      u  p#Ub,  U R                  U R                  U-   U R                  U-   5      $ [        $ r   rK   r   r   r   r/   r&   r1   r   r   s       r   __add__GaussianElement.__add__J   >    ||E"=88DFFQJ
33!!r   c                    U R                  U5      u  p#Ub,  U R                  U R                  U-
  U R                  U-
  5      $ [        $ r   rN   rO   s       r   __sub__GaussianElement.__sub__S   rR   r   c                    U R                  U5      u  p#Ub*  U R                  X R                  -
  X0R                  -
  5      $ [        $ r   rN   rO   s       r   __rsub__GaussianElement.__rsub__Z   s:    ||E"=88AJFF
33!!r   c                    U R                  U5      u  p#UbL  U R                  U R                  U-  U R                  U-  -
  U R                  U-  U R                  U-  -   5      $ [        $ r   rN   rO   s       r   __mul__GaussianElement.__mul__a   sX    ||E"=88DFF1Htvvax/DFF1H1DEE!!r   c                    US:X  a  U R                  SS5      $ US:  a  SU -  U* pUS:X  a  U $ U nUS-  (       a  U OU R                  R                  nUS-  nU(       a   X"-  nUS-  (       a  X2-  nUS-  nU(       a  M   U$ )Nr         )r   r   one)r&   exppow2prods       r   __pow__GaussianElement.__pow__j   s    !888Aq>!7$#!8KQwtDLL$4$4	LDQwAIC	 c
 r   c                d    [        U R                  5      =(       d    [        U R                  5      $ r   )boolr   r   r%   s    r   __bool__GaussianElement.__bool__{   s    DFF|+tDFF|+r   c                    U R                   S:  a  U R                  S:  a  S$ S$ U R                   S:  a  U R                  S:  a  S$ S$ U R                  S:  a  S$ S$ )z9Return quadrant index 0-3.

0 is included in quadrant 0.
r   r]   r^      )r   r   r%   s    r   quadrantGaussianElement.quadrant~   sY    
 66A:
1))VVaZ
1))!1**r   c                     U R                   R                  U5      nUR                  U 5      $ ! [         a	    [        s $ f = fr   )r   r   
__divmod__r   r/   r0   s     r   __rdivmod__GaussianElement.__rdivmod__   sE    	*LL((/E ##D))  	"!!	"s   . A Ac                |     [         R                  U5      nUR                  U 5      $ ! [         a	    [        s $ f = fr   )QQ_Ir   __truediv__r   r/   r0   s     r   __rtruediv__GaussianElement.__rtruediv__   s?    	+LL'E $$T**  	"!!	"s   ( ;;c                D    U R                  U5      nU[        L a  U$ US   $ Nr   rn   r/   r&   r1   qrs      r   __floordiv__GaussianElement.__floordiv__   &    __U#>)r4r!u4r   c                D    U R                  U5      nU[        L a  U$ US   $ rw   ro   r/   ry   s      r   __rfloordiv__GaussianElement.__rfloordiv__   (    e$>)r4r!u4r   c                D    U R                  U5      nU[        L a  U$ US   $ Nr]   rx   ry   s      r   __mod__GaussianElement.__mod__   r}   r   c                D    U R                  U5      nU[        L a  U$ US   $ r   r   ry   s      r   __rmod__GaussianElement.__rmod__   r   r   r8   )r   )$__name__
__module____qualname____firstlineno____doc____annotations__	__slots__r   classmethodr   r'   r+   r2   r5   r9   r=   rC   rH   rK   rP   __radd__rT   rW   rZ   __rmul__rc   rg   rk   ro   rt   r{   r   r   r   __static_attributes____classcell__)r"   s   @r   r   r      s    ;
LOI)  &"5
*A0    " H""" H",
+*+5555 5r   r   c                  (    \ rS rSrSr\rS rS rSr	g)GaussianInteger   zGaussian integer: domain element for :ref:`ZZ_I`

>>> from sympy import ZZ_I
>>> z = ZZ_I(2, 3)
>>> z
(2 + 3*I)
>>> type(z)
<class 'sympy.polys.domains.gaussiandomains.GaussianInteger'>
c                2    [         R                  U 5      U-  $ )Return a Gaussian rational.)rr   r   r0   s     r   rs   GaussianInteger.__truediv__   s    ||D!%''r   c                h   U(       d  [        SR                  U 5      5      eU R                  U5      u  p#Uc  [        $ U R                  U-  U R
                  U-  -   U R                  * U-  U R
                  U-  -   pTX"-  X3-  -   nSU-  U-   SU-  -  nSU-  U-   SU-  -  n[        Xx5      n	XX-  -
  4$ )Nzdivmod({}, 0)r^   )ZeroDivisionErrorformatrK   r/   r   r   r   )
r&   r1   r   r   abcqxqyqs
             r   rn   GaussianInteger.__divmod__   s    #O$:$:4$@AA||E"9!! vvax$&&("TVVGAIq$81C!#I cAg1Q3cAg1Q3B# .  r   r8   N)
r   r   r   r   r   r   r   rs   rn   r   r8   r   r   r   r      s     D(!r   r   c                  (    \ rS rSrSr\rS rS rSr	g)GaussianRational   zGaussian rational: domain element for :ref:`QQ_I`

>>> from sympy import QQ_I, QQ
>>> z = QQ_I(QQ(2, 3), QQ(4, 5))
>>> z
(2/3 + 4/5*I)
>>> type(z)
<class 'sympy.polys.domains.gaussiandomains.GaussianRational'>
c                (   U(       d  [        SR                  U 5      5      eU R                  U5      u  p#Uc  [        $ X"-  X3-  -   n[	        U R
                  U-  U R                  U-  -   U-  U R
                  * U-  U R                  U-  -   U-  5      $ )r   z{} / 0)r   r   rK   r/   r   r   r   )r&   r1   r   r   r   s        r   rs   GaussianRational.__truediv__   s    #HOOD$9::||E"9!!C!#IDFF1H!4a 7"&&&TVVAX!5q 8: 	:r   c                     U R                   R                  U5      nU(       d  [	        SR                  U 5      5      eX-  [        R                  4$ ! [         a	    [        s $ f = f)Nz{} % 0)r   r   r   r/   r   r   rr   zeror0   s     r   rn   GaussianRational.__divmod__   s\    	"LL((/E #HOOD$9:::tyy((  	"!!	"s   A A%$A%r8   N)
r   r   r   r   r   r   r   rs   rn   r   r8   r   r   r   r      s     D
:)r   r   c                      \ rS rSr% SrS\S'   SrSrSrSr	S r
S rS rS	 rS
 rS rS rS rS rS rS rS rS rS rS rSrg)GaussianDomain   z Base class for Gaussian domains.r
   domTc                    U R                   R                  nU" UR                  5      [        U" UR                  5      -  -   $ )z!Convert ``a`` to a SymPy object. )r   rG   r   r   r   )r&   r   r   s      r   rG   GaussianDomain.to_sympy   s0    xx  ACCy1T!##Y;&&r   c                P   UR                  5       u  p#U R                  R                  U5      nU(       d  U R                  US5      $ UR	                  5       u  p#U R                  R                  U5      nU[
        L a  U R                  XE5      $ [        SR                  U5      5      e)z)Convert a SymPy object to ``self.dtype``.r   z{} is not Gaussian)as_coeff_Addr   
from_sympyr   as_coeff_Mulr   r   r   )r&   r   rr   r   r   s         r   r   GaussianDomain.from_sympy  s    ~~HH"88Aq>!~~HH"688A>! !5!<!<Q!?@@r   c                     U R                   " U6 $ )z$Inject generators into this domain. )	poly_ring)r&   genss     r   injectGaussianDomain.inject  s    ~~t$$r   c                B    U R                   UR                  5       *    nU$ r   )unitsrk   )r&   dunits      r   canonical_unitGaussianDomain.canonical_unit  s    zz1::<-(r   c                    gz/Returns ``False`` for any ``GaussianElement``. Fr8   r&   elements     r   is_negativeGaussianDomain.is_negative      r   c                    gr   r8   r   s     r   is_positiveGaussianDomain.is_positive  r   r   c                    gr   r8   r   s     r   is_nonnegativeGaussianDomain.is_nonnegative"  r   r   c                    gr   r8   r   s     r   is_nonpositiveGaussianDomain.is_nonpositive&  r   r   c                    U " U5      $ )z%Convert a GMPY mpz to ``self.dtype``.r8   K1r   K0s      r   from_ZZ_gmpyGaussianDomain.from_ZZ_gmpy*      !ur   c                    U " U5      $ z.Convert a ZZ_python element to ``self.dtype``.r8   r   s      r   from_ZZGaussianDomain.from_ZZ.  r   r   c                    U " U5      $ r   r8   r   s      r   from_ZZ_pythonGaussianDomain.from_ZZ_python2  r   r   c                    U " U5      $ z%Convert a GMPY mpq to ``self.dtype``.r8   r   s      r   from_QQGaussianDomain.from_QQ6  r   r   c                    U " U5      $ r   r8   r   s      r   from_QQ_gmpyGaussianDomain.from_QQ_gmpy:  r   r   c                    U " U5      $ )z.Convert a QQ_python element to ``self.dtype``.r8   r   s      r   from_QQ_pythonGaussianDomain.from_QQ_python>  r   r   c                    UR                   R                  S   [        :X  a   U R                  UR	                  U5      5      $ g)z9Convert an element from ZZ<I> or QQ<I> to ``self.dtype``.r   N)extargsr   r   rG   r   s      r   from_AlgebraicField"GaussianDomain.from_AlgebraicFieldB  s2    66;;q>Q==Q00 r   r8   N)r   r   r   r   r   r   is_Numericalis_Exacthas_assoc_Ringhas_assoc_FieldrG   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r8   r   r   r   r      sj    *	KLHNO'
A%1r   r   c                  j   \ rS rSrSr\r\" \R                  \R                  \R                  /\5      r
\r\" \" S5      \" S5      5      r	\" \" S5      \" S5      5      r\" \" S5      \" S5      5      r\\\* \* 4rSrSrSrSrS rS rS	 r\S
 5       rS rS rS rS rS rS rS rS rS r Sr!g)GaussianIntegerRingiH  a?	  Ring of Gaussian integers ``ZZ_I``

The :ref:`ZZ_I` domain represents the `Gaussian integers`_ `\mathbb{Z}[i]`
as a :py:class:`~.Domain` in the domain system (see
:ref:`polys-domainsintro`).

By default a :py:class:`~.Poly` created from an expression with
coefficients that are combinations of integers and ``I`` (`\sqrt{-1}`)
will have the domain :ref:`ZZ_I`.

>>> from sympy import Poly, Symbol, I
>>> x = Symbol('x')
>>> p = Poly(x**2 + I)
>>> p
Poly(x**2 + I, x, domain='ZZ_I')
>>> p.domain
ZZ_I

The :ref:`ZZ_I` domain can be used to factorise polynomials that are
reducible over the Gaussian integers.

>>> from sympy import factor
>>> factor(x**2 + 1)
x**2 + 1
>>> factor(x**2 + 1, domain='ZZ_I')
(x - I)*(x + I)

The corresponding `field of fractions`_ is the domain of the Gaussian
rationals :ref:`QQ_I`. Conversely :ref:`ZZ_I` is the `ring of integers`_
of :ref:`QQ_I`.

>>> from sympy import ZZ_I, QQ_I
>>> ZZ_I.get_field()
QQ_I
>>> QQ_I.get_ring()
ZZ_I

When using the domain directly :ref:`ZZ_I` can be used as a constructor.

>>> ZZ_I(3, 4)
(3 + 4*I)
>>> ZZ_I(5)
(5 + 0*I)

The domain elements of :ref:`ZZ_I` are instances of
:py:class:`~.GaussianInteger` which support the rings operations
``+,-,*,**``.

>>> z1 = ZZ_I(5, 1)
>>> z2 = ZZ_I(2, 3)
>>> z1
(5 + 1*I)
>>> z2
(2 + 3*I)
>>> z1 + z2
(7 + 4*I)
>>> z1 * z2
(7 + 17*I)
>>> z1 ** 2
(24 + 10*I)

Both floor (``//``) and modulo (``%``) division work with
:py:class:`~.GaussianInteger` (see the :py:meth:`~.Domain.div` method).

>>> z3, z4 = ZZ_I(5), ZZ_I(1, 3)
>>> z3 // z4  # floor division
(1 + -1*I)
>>> z3 % z4   # modulo division (remainder)
(1 + -2*I)
>>> (z3//z4)*z4 + z3%z4 == z3
True

True division (``/``) in :ref:`ZZ_I` gives an element of :ref:`QQ_I`. The
:py:meth:`~.Domain.exquo` method can be used to divide in :ref:`ZZ_I` when
exact division is possible.

>>> z1 / z2
(1 + -1*I)
>>> ZZ_I.exquo(z1, z2)
(1 + -1*I)
>>> z3 / z4
(1/2 + -3/2*I)
>>> ZZ_I.exquo(z3, z4)
Traceback (most recent call last):
    ...
ExactQuotientFailed: (1 + 3*I) does not divide (5 + 0*I) in ZZ_I

The :py:meth:`~.Domain.gcd` method can be used to compute the `gcd`_ of any
two elements.

>>> ZZ_I.gcd(ZZ_I(10), ZZ_I(2))
(2 + 0*I)
>>> ZZ_I.gcd(ZZ_I(5), ZZ_I(2, 1))
(2 + 1*I)

.. _Gaussian integers: https://en.wikipedia.org/wiki/Gaussian_integer
.. _gcd: https://en.wikipedia.org/wiki/Greatest_common_divisor

r   r]   ZZ_ITc                    g)zFor constructing ZZ_I.Nr8   r%   s    r   __init__GaussianIntegerRing.__init__      r   c                :    [        U[        5      (       a  g[        $ z0Returns ``True`` if two domains are equivalent. T)r.   r   r/   r0   s     r   r2   GaussianIntegerRing.__eq__  s    e011!!r   c                    [        S5      $ )Compute hash code of ``self``. r   r*   r%   s    r   r+   GaussianIntegerRing.__hash__      F|r   c                    gNTr8   r%   s    r   has_CharacteristicZero*GaussianIntegerRing.has_CharacteristicZero      r   c                    grw   r8   r%   s    r   characteristic"GaussianIntegerRing.characteristic      r   c                    U $ z)Returns a ring associated with ``self``. r8   r%   s    r   get_ringGaussianIntegerRing.get_ring      r   c                    [         $ z*Returns a field associated with ``self``. )rr   r%   s    r   	get_fieldGaussianIntegerRing.get_field      r   c                x   ^ U R                  U5      mUT-  n[        U4S jU 5       5      nU(       a  U4U-   $ U$ )zpReturn first quadrant element associated with ``d``.

Also multiply the other arguments by the same power of i.
c              3  ,   >#    U  H	  oT-  v   M     g 7fr   r8   ).0r   r   s     r   	<genexpr>0GaussianIntegerRing.normalize.<locals>.<genexpr>  s     *TtVTs   )r   tuple)r&   r   r   r   s      @r   	normalizeGaussianIntegerRing.normalize  sA    
 ""1%	T	*T**"td{))r   c                N    U(       a  X!U-  p!U(       a  M  U R                  U5      $ )z-Greatest common divisor of a and b over ZZ_I.)r  r&   r   r   s      r   gcdGaussianIntegerRing.gcd  s$    !eq a~~a  r   c                    U R                   nU R                  nU R                  nU R                   nU(       a"  X-  nX!Xr-  -
  p!XCXt-  -
  pCXeXv-  -
  peU(       a  M"  U R                  XU5      u  pnX5U4$ )z6Return x, y, g such that x * a + y * b = g = gcd(a, b))r_   r   r  )r&   r   r   x_ax_by_ay_br   s           r   gcdexGaussianIntegerRing.gcdex  sx    hhiiiihhA!%iq!'M!'M	 a nnQS1{r   c                .    X-  U R                  X5      -  $ )z+Least common multiple of a and b over ZZ_I.)r"  r!  s      r   lcmGaussianIntegerRing.lcm  s    $((1.((r   c                    U$ )zConvert a ZZ_I element to ZZ_I.r8   r   s      r   from_GaussianIntegerRing,GaussianIntegerRing.from_GaussianIntegerRing      r   c                    U R                  [        R                  " UR                  5      [        R                  " UR                  5      5      $ )zConvert a QQ_I element to ZZ_I.)r   r   r   r   r   r   s      r   from_GaussianRationalField.GaussianIntegerRing.from_GaussianRationalField  s+    vvbjjorzz!##77r   r8   N)"r   r   r   r   r   r   r   r   r_   r   modr   dtype	imag_unitr   rB   is_GaussianRingis_ZZ_Iis_PIDr   r2   r+   propertyr  r  r  r  r  r"  r)  r,  r/  r3  r   r8   r   r   r   r   H  s    bF C
rvvrww'
,CEA1D
1r!u
CbeRU#I)cTI:.E
COGF%"  *!)8r   r   c                  f   \ rS rSrSr\r\" \R                  \R                  \R                  /\5      r
\r\" \" S5      \" S5      5      r	\" \" S5      \" S5      5      r\" \" S5      \" S5      5      r\\\* \* 4rSrSrSrS rS rS	 r\S
 5       rS rS rS rS rS rS rS rS rS rSr g)GaussianRationalFieldi  a  Field of Gaussian rationals ``QQ_I``

The :ref:`QQ_I` domain represents the `Gaussian rationals`_ `\mathbb{Q}(i)`
as a :py:class:`~.Domain` in the domain system (see
:ref:`polys-domainsintro`).

By default a :py:class:`~.Poly` created from an expression with
coefficients that are combinations of rationals and ``I`` (`\sqrt{-1}`)
will have the domain :ref:`QQ_I`.

>>> from sympy import Poly, Symbol, I
>>> x = Symbol('x')
>>> p = Poly(x**2 + I/2)
>>> p
Poly(x**2 + I/2, x, domain='QQ_I')
>>> p.domain
QQ_I

The polys option ``gaussian=True`` can be used to specify that the domain
should be :ref:`QQ_I` even if the coefficients do not contain ``I`` or are
all integers.

>>> Poly(x**2)
Poly(x**2, x, domain='ZZ')
>>> Poly(x**2 + I)
Poly(x**2 + I, x, domain='ZZ_I')
>>> Poly(x**2/2)
Poly(1/2*x**2, x, domain='QQ')
>>> Poly(x**2, gaussian=True)
Poly(x**2, x, domain='QQ_I')
>>> Poly(x**2 + I, gaussian=True)
Poly(x**2 + I, x, domain='QQ_I')
>>> Poly(x**2/2, gaussian=True)
Poly(1/2*x**2, x, domain='QQ_I')

The :ref:`QQ_I` domain can be used to factorise polynomials that are
reducible over the Gaussian rationals.

>>> from sympy import factor, QQ_I
>>> factor(x**2/4 + 1)
(x**2 + 4)/4
>>> factor(x**2/4 + 1, domain='QQ_I')
(x - 2*I)*(x + 2*I)/4
>>> factor(x**2/4 + 1, domain=QQ_I)
(x - 2*I)*(x + 2*I)/4

It is also possible to specify the :ref:`QQ_I` domain explicitly with
polys functions like :py:func:`~.apart`.

>>> from sympy import apart
>>> apart(1/(1 + x**2))
1/(x**2 + 1)
>>> apart(1/(1 + x**2), domain=QQ_I)
I/(2*(x + I)) - I/(2*(x - I))

The corresponding `ring of integers`_ is the domain of the Gaussian
integers :ref:`ZZ_I`. Conversely :ref:`QQ_I` is the `field of fractions`_
of :ref:`ZZ_I`.

>>> from sympy import ZZ_I, QQ_I, QQ
>>> ZZ_I.get_field()
QQ_I
>>> QQ_I.get_ring()
ZZ_I

When using the domain directly :ref:`QQ_I` can be used as a constructor.

>>> QQ_I(3, 4)
(3 + 4*I)
>>> QQ_I(5)
(5 + 0*I)
>>> QQ_I(QQ(2, 3), QQ(4, 5))
(2/3 + 4/5*I)

The domain elements of :ref:`QQ_I` are instances of
:py:class:`~.GaussianRational` which support the field operations
``+,-,*,**,/``.

>>> z1 = QQ_I(5, 1)
>>> z2 = QQ_I(2, QQ(1, 2))
>>> z1
(5 + 1*I)
>>> z2
(2 + 1/2*I)
>>> z1 + z2
(7 + 3/2*I)
>>> z1 * z2
(19/2 + 9/2*I)
>>> z2 ** 2
(15/4 + 2*I)

True division (``/``) in :ref:`QQ_I` gives an element of :ref:`QQ_I` and
is always exact.

>>> z1 / z2
(42/17 + -2/17*I)
>>> QQ_I.exquo(z1, z2)
(42/17 + -2/17*I)
>>> z1 == (z1/z2)*z2
True

Both floor (``//``) and modulo (``%``) division can be used with
:py:class:`~.GaussianRational` (see :py:meth:`~.Domain.div`)
but division is always exact so there is no remainder.

>>> z1 // z2
(42/17 + -2/17*I)
>>> z1 % z2
(0 + 0*I)
>>> QQ_I.div(z1, z2)
((42/17 + -2/17*I), (0 + 0*I))
>>> (z1//z2)*z2 + z1%z2 == z1
True

.. _Gaussian rationals: https://en.wikipedia.org/wiki/Gaussian_rational
r   r]   rr   Tc                    g)zFor constructing QQ_I.Nr8   r%   s    r   r   GaussianRationalField.__init__  r   r   c                :    [        U[        5      (       a  g[        $ r   )r.   r=  r/   r0   s     r   r2   GaussianRationalField.__eq__  s    e233!!r   c                    [        S5      $ )r  rr   r  r%   s    r   r+   GaussianRationalField.__hash__  r  r   c                    gr  r8   r%   s    r   r  ,GaussianRationalField.has_CharacteristicZero  r	  r   c                    grw   r8   r%   s    r   r  $GaussianRationalField.characteristic  r  r   c                    [         $ r  )r   r%   s    r   r  GaussianRationalField.get_ring  r  r   c                    U $ r  r8   r%   s    r   r  GaussianRationalField.get_field  r  r   c                6    [        U R                  [        5      $ )z0Get equivalent domain as an ``AlgebraicField``. )r	   r   r   r%   s    r   as_AlgebraicField'GaussianRationalField.as_AlgebraicField  s    dhh**r   c                f    U R                  5       nUR                  XR                  U5      -  5      $ )zGet the numerator of ``a``.)r  r   denom)r&   r   r   s      r   numerGaussianRationalField.numer  s'    }}||A

1-..r   c                    U R                   R                  5       nU R                   nU R                  5       nUR                  " UR                  " UR                  5      UR                  " UR
                  5      5      nU" XRR                  5      $ )zGet the denominator of ``a``.)r   r  r,  rP  r   r   r   )r&   r   r   r   r   denom_ZZs         r   rP  GaussianRationalField.denom  s_    XX XX}}66"((133-!##7Hgg&&r   c                N    U R                  UR                  UR                  5      $ )zConvert a ZZ_I element to QQ_I.r<   r   s      r   r/  .GaussianRationalField.from_GaussianIntegerRing  s    vvacc133r   c                    U$ )zConvert a QQ_I element to QQ_I.r8   r   s      r   r3  0GaussianRationalField.from_GaussianRationalField  r1  r   c                    U R                  [        R                  " UR                  5      [        R                  " UR                  5      5      $ )z'Convert a ComplexField element to QQ_I.)r   r   r   realimagr   s      r   from_ComplexField'GaussianRationalField.from_ComplexField  s-    vvbjj("**QVV*<==r   r8   N)!r   r   r   r   r   r   r   r   r_   r   r5  r   r6  r7  r   rB   is_GaussianFieldis_QQ_Ir   r2   r+   r;  r  r  r  r  rM  rQ  rP  r/  r3  r]  r   r8   r   r   r=  r=    s    sh C
rvvrww'
,CEA1D
1r!u
CbeRU#I)cTI:.E
CG%"  +/
' >r   r=  N) r   
__future__r   sympy.core.numbersr   sympy.polys.polyclassesr   sympy.polys.polyerrorsr   sympy.polys.domains.integerringr   !sympy.polys.domains.rationalfieldr   "sympy.polys.domains.algebraicfieldr	   sympy.polys.domains.domainr
   !sympy.polys.domains.domainelementr   sympy.polys.domains.fieldr   sympy.polys.domains.ringr   r   r   r   r   r   r   r   r=  rr   r8   r   r   <module>rl     s     "   ' 1 . 0 = - ; + )X5m X5v%!o %!P )  )FO1 O1dx8.$ x8t "5!6 6z>NE z>z #8"9 9r   