+
    i                         R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHt ] ! R
 R]	]]4      4       t]! 4       tR# )z/Implementation of :class:`ComplexField` class. )
SYMPY_INTS)FloatI)CharacteristicZero)FieldQQ_I)SimpleDomain)DomainErrorCoercionFailed)public)	MPContextc                   H  a  ] tR t^t o RtRtR;ttRtRt	Rt
Rt^5t]R 4       t]R 4       t]R 4       t]R 4       tR(R
 lt]R 4       tR)R ltR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$R t%R t&R t'R  t(R! t)R" t*R# t+R*R$ lt,R% t-R& t.R't/V t0R	# )+ComplexFieldz+Complex numbers up to the given precision. CCTFc                4    V P                   V P                  8H  # N)	precision_default_precisionselfs   &ڀ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/polys/domains/complexfield.pyhas_default_precision"ComplexField.has_default_precision    s    ~~!8!888    c                .    V P                   P                  # r   )_contextprecr   s   &r   r   ComplexField.precision$   s    }}!!!r   c                .    V P                   P                  # r   )r   dpsr   s   &r   r    ComplexField.dps(   s    }}   r   c                    V P                   # r   )
_tolerancer   s   &r   	toleranceComplexField.tolerance,   s    r   Nc                   \        4       pVf   Vf   V P                  Vn        M!Vf   Wn        MVf   W$n        M\	        R4      hW@n        VP                  V n        V P                  ^ 4      V n	        V P                  ^4      V n
        \        ^VP                  ,          ^,          ^c4      V n        V P                  V P                  ,          V n        R # )NzCannot set both prec and dps)r   r   r   r    	TypeErrorr   mpc_dtypedtypezeroonemax
_max_denomr#   )r   r   r    tolcontexts   &&&& r   __init__ComplexField.__init__0   s     +<CK22GL[L\K:;;kkJJqM	::a= ao4b9((T__4r   c                    V P                   # r   )r)   r   s   &r   tpComplexField.tpI   s     {{r   c                    \        V\        4      '       d   \        V4      p\        V\        4      '       d   \        V4      pV P                  W4      # r   )
isinstancer   intr)   )r   xys   &&&r   r*   ComplexField.dtypeQ   s?     a$$AAa$$AA{{1  r   c                d    \        V\        4      ;'       d    V P                  VP                  8H  # r   )r7   r   r   )r   others   &&r   __eq__ComplexField.__eq__[   s$    %.TT4>>U__3TTr   c                n    \        V P                  P                  V P                  V P                  34      # r   )hash	__class____name__r)   r   r   s   &r   __hash__ComplexField.__hash__^   s&    T^^,,dkk4>>JKKr   c                    \        VP                  V P                  4      \        \        VP                  V P                  4      ,          ,           # )z%Convert ``element`` to SymPy number. )r   realr    r   imagr   elements   &&r   to_sympyComplexField.to_sympya   s0    W\\488,qw||TXX1N/NNNr   c                    VP                  V P                  R7      pVP                  4       w  r4VP                  '       d$   VP                  '       d   V P	                  W44      # \        RV,          4      h)z%Convert SymPy's number to ``dtype``. )nzexpected complex number, got %s)evalfr    as_real_imag	is_Numberr*   r   )r   exprnumberrG   rH   s   &&   r   
from_sympyComplexField.from_sympye   sW    dhh'((*
>>>dnnn::d)) !BT!IJJr   c                $    V P                  V4      # r   r*   r   rJ   bases   &&&r   from_ZZComplexField.from_ZZo       zz'""r   c                6    V P                  \        V4      4      # r   )r*   r8   rX   s   &&&r   from_ZZ_gmpyComplexField.from_ZZ_gmpyr   s    zz#g,''r   c                $    V P                  V4      # r   rW   rX   s   &&&r   from_ZZ_pythonComplexField.from_ZZ_pythonu   r\   r   c                ~    V P                  \        VP                  4      4      \        VP                  4      ,          # r   r*   r8   	numeratordenominatorrX   s   &&&r   from_QQComplexField.from_QQx   ,    zz#g//01C8K8K4LLLr   c                Z    V P                  VP                  4      VP                  ,          # r   )r*   re   rf   rX   s   &&&r   from_QQ_pythonComplexField.from_QQ_python{   s"    zz'++,w/B/BBBr   c                ~    V P                  \        VP                  4      4      \        VP                  4      ,          # r   rd   rX   s   &&&r   from_QQ_gmpyComplexField.from_QQ_gmpy~   ri   r   c                r    V P                  \        VP                  4      \        VP                  4      4      # r   )r*   r8   r9   r:   rX   s   &&&r   from_GaussianIntegerRing%ComplexField.from_GaussianIntegerRing   s#    zz#gii.#gii.99r   c                6   VP                   pVP                  pV P                  \        VP                  4      4      \        VP
                  4      ,          V P                  ^ \        VP                  4      4      \        VP
                  4      ,          ,           #     )r9   r:   r*   r8   re   rf   )r   rJ   rY   r9   r:   s   &&&  r   from_GaussianRationalField'ComplexField.from_GaussianRationalField   sh    IIII

3q{{+,s1==/AA

1c!++./#amm2DDE 	Fr   c                t    V P                  VP                  V4      P                  V P                  4      4      # r   )rT   rK   rO   r    rX   s   &&&r   from_AlgebraicField ComplexField.from_AlgebraicField   s)    t}}W5;;DHHEFFr   c                $    V P                  V4      # r   rW   rX   s   &&&r   from_RealFieldComplexField.from_RealField   r\   r   c                $    V P                  V4      # r   rW   rX   s   &&&r   from_ComplexFieldComplexField.from_ComplexField   r\   r   c                &    \        RV ,          4      h)z)Returns a ring associated with ``self``. z#there is no ring associated with %s)r
   r   s   &r   get_ringComplexField.get_ring   s    ?$FGGr   c                    \         # )z2Returns an exact domain associated with ``self``. r   r   s   &r   	get_exactComplexField.get_exact   s    r   c                    R# z.Returns ``False`` for any ``ComplexElement``. F rI   s   &&r   is_negativeComplexField.is_negative       r   c                    R# r   r   rI   s   &&r   is_positiveComplexField.is_positive   r   r   c                    R# r   r   rI   s   &&r   is_nonnegativeComplexField.is_nonnegative   r   r   c                    R# r   r   rI   s   &&r   is_nonpositiveComplexField.is_nonpositive   r   r   c                    V P                   # )z Returns GCD of ``a`` and ``b``. )r,   r   abs   &&&r   gcdComplexField.gcd   s    xxr   c                    W,          # )z Returns LCM of ``a`` and ``b``. r   r   s   &&&r   lcmComplexField.lcm   s	    s
r   c                :    V P                   P                  WV4      # )z+Check if ``a`` and ``b`` are almost equal. )r   almosteq)r   r   r   r$   s   &&&&r   r   ComplexField.almosteq   s    }}%%aI66r   c                    R# )zAReturns ``True``. Every complex number has a complex square root.Tr   r   r   s   &&r   	is_squareComplexField.is_square   s    r   c                    VR,          # )zReturns the principal complex square root of ``a``.

Explanation
===========
The argument of the principal square root is always within
$(-\frac{\pi}{2}, \frac{\pi}{2}]$. The square root may be
slightly inaccurate due to floating point rounding error.
g      ?r   r   s   &&r   exsqrtComplexField.exsqrt   s     Cxr   )r   r)   r.   r#   r,   r+   )NNNrt   r   )1rC   
__module____qualname____firstlineno____doc__repis_ComplexFieldis_CCis_Exactis_Numericalhas_assoc_Ringhas_assoc_Fieldr   propertyr   r   r    r$   r1   r4   r*   r>   rD   rK   rT   rZ   r^   ra   rg   rk   rn   rq   rv   ry   r|   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s.    5
C""OeHLNO9 9 " " ! !  52  !ULOK#(#MCM:FG##H7	 	r   r   N)r   sympy.external.gmpyr   sympy.core.numbersr   r   &sympy.polys.domains.characteristiczeror   sympy.polys.domains.fieldr   #sympy.polys.domains.gaussiandomainsr    sympy.polys.domains.simpledomainr	   sympy.polys.polyerrorsr
   r   sympy.utilitiesr   mpmathr   r   r   r   r   r   <module>r      sR    5 + ' E + 4 9 > "  s5,l s sj ^r   