B
    edห  ใ               @   sd   d dl mZ d dlmZmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZ G dd deZdd	 Zd
S )้    )ฺExpr)ฺcall_highest_priorityฺ
_sympifyit้   )ฺImageSet)ฺset_addฺset_subฺset_mulฺset_divฺset_powฺset_functionc               @   s<  e Zd ZdZdZdd Zedd Zdd Ze	d	e
ed
dd Ze	d	e
eddd Ze	d	e
eddd Ze	d	e
eddd Ze	d	e
eddd Ze	d	e
eddd Ze	d	e
eddd Ze	d	e
edd d! Ze	d	e
ed"d#d$ Ze	d	e
ed%d&d' Zd(d) Zd*S )+ฺSetExprab  An expression that can take on values of a set.

    Examples
    ========

    >>> from sympy import Interval, FiniteSet
    >>> from sympy.sets.setexpr import SetExpr

    >>> a = SetExpr(Interval(0, 5))
    >>> b = SetExpr(FiniteSet(1, 10))
    >>> (a + b).set
    Union(Interval(1, 6), Interval(10, 15))
    >>> (2*a + b).set
    Interval(1, 20)
    g      &@c             C   s   t  | |กS )N)r   ฺ__new__)ฺclsZsetargฉ r   ๚_/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/sympy/sets/setexpr.pyr      s    zSetExpr.__new__c             C   s
   | j d S )Nr   )ฺargs)ฺselfr   r   r   ฺ<lambda>   ๓    zSetExpr.<lambda>c             C   s   d  | | jกกS )NzSetExpr\left({}\right))ฺformatZ_printฺset)r   ฺprinterr   r   r   ฺ_latex   s    zSetExpr._latexฺotherฺ__radd__c             C   s   t t| |S )N)ฺ_setexpr_apply_operationr   )r   r   r   r   r   ฺ__add__!   s    zSetExpr.__add__r   c             C   s   t t|| S )N)r   r   )r   r   r   r   r   r   &   s    zSetExpr.__radd__ฺ__rmul__c             C   s   t t| |S )N)r   r	   )r   r   r   r   r   ฺ__mul__+   s    zSetExpr.__mul__r   c             C   s   t t|| S )N)r   r	   )r   r   r   r   r   r   0   s    zSetExpr.__rmul__ฺ__rsub__c             C   s   t t| |S )N)r   r   )r   r   r   r   r   ฺ__sub__5   s    zSetExpr.__sub__r!   c             C   s   t t|| S )N)r   r   )r   r   r   r   r   r    :   s    zSetExpr.__rsub__ฺ__rpow__c             C   s   t t| |S )N)r   r   )r   r   r   r   r   ฺ__pow__?   s    zSetExpr.__pow__r#   c             C   s   t t|| S )N)r   r   )r   r   r   r   r   r"   D   s    zSetExpr.__rpow__ฺ__rtruediv__c             C   s   t t| |S )N)r   r
   )r   r   r   r   r   ฺ__truediv__I   s    zSetExpr.__truediv__r%   c             C   s   t t|| S )N)r   r
   )r   r   r   r   r   r$   N   s    zSetExpr.__rtruediv__c             C   s,   t || j}|d kr$tt|| jS t|S )N)r   r   r   r   )r   ฺfuncฺresr   r   r   ฺ
_eval_funcS   s    zSetExpr._eval_funcN)ฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__Z_op_priorityr   ฺpropertyr   r   r   ฺNotImplementedr   r   r   r   r   r!   r    r#   r"   r%   r$   r(   r   r   r   r   r      s4   r   c             C   s2   t |tr|j}t |tr |j}| ||}t|S )N)ฺ
isinstancer   r   )ฺopฺxฺyฺoutr   r   r   r   [   s    


r   N)Z
sympy.corer   Zsympy.core.decoratorsr   r   Z	fancysetsr   Zsetsr   r   r	   r
   r   r   r   r   r   r   r   r   ฺ<module>   s
    T