ó
Ąž\c           @  sū   d  Z  d d l m Z m Z d d l m Z m Z d d l m Z d d l	 m
 Z
 d d l m Z d d l m Z d d l m Z m Z d d	 l m Z e d
 e
 e e f d     Y Z d S(   s/   Implementation of :class:`ComplexField` class. iĸĸĸĸ(   t   print_functiont   division(   t   Floatt   I(   t   CharacteristicZero(   t   Field(   t	   MPContext(   t   SimpleDomain(   t   DomainErrort   CoercionFailed(   t   publict   ComplexFieldc           B  s  e  Z d  Z d Z e Z Z e Z e Z	 e Z
 e Z d Z e d    Z e d    Z e d    Z e d    Z e d d d  Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d d  Z" RS(   s+   Complex numbers up to the given precision. t   CCi5   c         C  s   |  j  |  j k S(   N(   t	   precisiont   _default_precision(   t   self(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   has_default_precision   s    c         C  s
   |  j  j S(   N(   t   _contextt   prec(   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyR   !   s    c         C  s
   |  j  j S(   N(   R   t   dps(   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyR   %   s    c         C  s
   |  j  j S(   N(   R   t	   tolerance(   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyR   )   s    c         C  sX   t  | | |  } |  | _ | |  _ | j |  _ |  j d  |  _ |  j d  |  _ d  S(   Ni    i   (   R   t   _parentR   t   mpct   dtypet   zerot   one(   R   R   R   t   tolt   context(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   __init__-   s    		c         C  s1   t  | t  o0 |  j | j k o0 |  j | j k S(   N(   t
   isinstanceR   R   R   (   R   t   other(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   __eq__6   s    c         C  s%   t  |  j j |  j |  j |  j f  S(   N(   t   hasht	   __class__t   __name__R   R   R   (   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   __hash__;   s    c         C  s*   t  | j |  j  t t  | j |  j  S(   s%   Convert ``element`` to SymPy number. (   R   t   realR   R   t   imag(   R   t   element(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   to_sympy>   s    c         C  s]   | j  d |  j  } | j   \ } } | j rI | j rI |  j | |  St d |   d S(   s%   Convert SymPy's number to ``dtype``. t   ns   expected complex number, got %sN(   t   evalfR   t   as_real_imagt	   is_NumberR   R	   (   R   t   exprt   numberR$   R%   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt
   from_sympyB   s
    c         C  s   |  j  |  S(   N(   R   (   R   R&   t   base(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_ZZ_pythonL   s    c         C  s   |  j  | j  | j S(   N(   R   t	   numeratort   denominator(   R   R&   R/   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_QQ_pythonO   s    c         C  s   |  j  t |   S(   N(   R   t   int(   R   R&   R/   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_ZZ_gmpyR   s    c         C  s#   |  j  t | j   t | j  S(   N(   R   R4   R1   R2   (   R   R&   R/   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_QQ_gmpyU   s    c         C  s   |  j  |  S(   N(   R   (   R   R&   R/   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_RealFieldX   s    c         C  s!   |  | k r | S|  j  |  Sd  S(   N(   R   (   R   R&   R/   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   from_ComplexField[   s    c         C  s   t  d |    d S(   s)   Returns a ring associated with ``self``. s#   there is no ring associated with %sN(   R   (   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   get_ringa   s    c         C  s   t  d |    d S(   s2   Returns an exact domain associated with ``self``. s+   there is no exact domain associated with %sN(   R   (   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt	   get_exacte   s    c         C  s   |  j  S(   s    Returns GCD of ``a`` and ``b``. (   R   (   R   t   at   b(    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   gcdi   s    c         C  s   | | S(   s    Returns LCM of ``a`` and ``b``. (    (   R   R;   R<   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   lcmm   s    c         C  s   |  j  j | | |  S(   s+   Check if ``a`` and ``b`` are almost equal. (   R   t   almosteq(   R   R;   R<   R   (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyR?   q   s    N(#   R"   t
   __module__t   __doc__t   rept   Truet   is_ComplexFieldt   is_CCt   Falset   is_Exactt   is_Numericalt   has_assoc_Ringt   has_assoc_FieldR   t   propertyR   R   R   R   t   NoneR   R   R#   R'   R.   R0   R3   R5   R6   R7   R8   R9   R:   R=   R>   R?   (    (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyR      s8   
					
										N(   RA   t
   __future__R    R   t   sympy.core.numbersR   R   t&   sympy.polys.domains.characteristiczeroR   t   sympy.polys.domains.fieldR   t   sympy.polys.domains.mpelementsR   t    sympy.polys.domains.simpledomainR   t   sympy.polys.polyerrorsR   R	   t   sympy.utilitiesR
   R   (    (    (    s?   lib/python2.7/site-packages/sympy/polys/domains/complexfield.pyt   <module>   s   