O
|Ĥ|Pc               @   s0   d  Z  d d l m Z m Z Gd   d  Z d S(   u<   
The PolarPoint Class

>>> print("I am Polar!")
I am Polar!
i    (   u   sinu   cosc             B   s5   |  Ee  Z d  Z d d d  Z d   Z d   Z d S(   uğ   
    This class represents a 2D point in polar coordinates defined
    by its distance from the center of the reference system and
    an angle (in radians) from the positive x-axis.
    g        c             C   s   | |  _  | |  _ d S(   uô   
        specifies a polar point by a `rho` (`magnitude`), its
        distance from the origin, and `theta` (`argument`) its
        polar angle (in radians)

        >>> PolarPoint()
        <__main__.PolarPoint object at 0xb76fceec>
        N(   u   rhou   theta(   u   selfu   rhou   theta(    (    u   1_polar_problem.pyu   __init__   s    		c             C   s*   |  j  t |  j  |  j  t |  j  f S(   uö   
        returns rectangular (Cartesian) coords of the PolarPoint
        as an (x, y) tuple

        >>> from math import pi
        >>> PolarPoint(2, 0).rect()
        (2.0, 0.0)
        >>> PolarPoint(2, pi).rect()
        (-2.0, 0.0)
        (   u   rhou   cosu   thetau   sin(   u   self(    (    u   1_polar_problem.pyu   rect   s    c             C   s   |  j    \ } } t | |  S(   uv   
        returns the polar point as a complex number

        >>> PolarPoint(2, 0).asComplex()
        (2+0j)
        (   u   rectu   complex(   u   selfu   realu   imag(    (    u   1_polar_problem.pyu	   asComplex)   s    N(   u   __name__u
   __module__u   __doc__u   __init__u   rectu	   asComplex(   u
   __locals__(    (    u   1_polar_problem.pyu
   PolarPoint	   s   
	u
   PolarPointN(   u   __doc__u   mathu   sinu   cosu
   PolarPoint(    (    (    u   1_polar_problem.pyu   <module>   s   