B
    [                 @   sX   d 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 G dd deZd	S )
zA
Contains the base class for series
Made using sequences in mind
    )print_functiondivision)Expr)S)cacheit)integer_typesc               @   s   e Zd ZdZedd Zedd Zedd Zedd	 Zed
d Z	edd Z
edd Zdd Zdd Zdd Zdd ZdS )
SeriesBasezBase Class for seriesc             C   s   t d|  dS )z+The interval on which the series is definedz(%s).intervalN)NotImplementedError)self r   8lib/python3.7/site-packages/sympy/series/series_class.pyinterval   s    zSeriesBase.intervalc             C   s   t d|  dS )z8The starting point of the series. This point is includedz
(%s).startN)r	   )r
   r   r   r   start   s    zSeriesBase.startc             C   s   t d|  dS )z6The ending point of the series. This point is includedz	(%s).stopN)r	   )r
   r   r   r   stop   s    zSeriesBase.stopc             C   s   t d|  dS )zLength of the series expansionz(%s).lengthN)r	   )r
   r   r   r   length    s    zSeriesBase.lengthc             C   s   dS )z-Returns a tuple of variables that are boundedr   r   )r
   r   r   r   	variables%   s    zSeriesBase.variablesc             C   s   t dd | jD | jS )z
        This method returns the symbols in the object, excluding those
        that take on a specific value (i.e. the dummy symbols).
        c             s   s   | ]}|j D ]
}|V  qqd S )N)free_symbols).0ijr   r   r   	<genexpr>0   s    z*SeriesBase.free_symbols.<locals>.<genexpr>)setargs
differencer   )r
   r   r   r   r   *   s    zSeriesBase.free_symbolsc             C   s0   || j k s|| jkr&td|| jf | |S )zTerm at point pt of a serieszIndex %s out of bounds %s)r   r   
IndexErrorr   
_eval_term)r
   ptr   r   r   term3   s    zSeriesBase.termc             C   s   t d| j d S )NzhThe _eval_term method should be added to%s to return series term so it is availablewhen 'term' calls it.)r	   func)r
   r   r   r   r   r   :   s    zSeriesBase._eval_termc             C   s.   | j tjkr| j}d}n
| j }d}|||  S )z
        Returns the i'th point of a series
        If start point is negative infinity, point is returned from the end.
        Assumes the first point to be indexed zero.

        Examples
        ========

        TODO
           )r   r   ZNegativeInfinityr   )r
   r   initialstepr   r   r   
_ith_point@   s    zSeriesBase._ith_pointc             c   s6   d}x,|| j k r0| |}| |V  |d7 }qW d S )Nr   r    )r   r#   r   )r
   r   r   r   r   r   __iter__T   s
    
zSeriesBase.__iter__c                st   t |tr |} |S t |trp|j|j }}|d krBd}|d krP j} fddt|||j	phdD S d S )Nr   c                s   g | ]}   |qS r   )r   r#   )r   r   )r
   r   r   
<listcomp>e   s    z*SeriesBase.__getitem__.<locals>.<listcomp>r    )

isinstancer   r#   r   slicer   r   r   ranger"   )r
   indexr   r   r   )r
   r   __getitem__[   s    




zSeriesBase.__getitem__N)__name__
__module____qualname____doc__propertyr   r   r   r   r   r   r   r   r   r#   r$   r*   r   r   r   r   r      s   	r   N)r.   Z
__future__r   r   Zsympy.core.exprr   Zsympy.core.singletonr   Zsympy.core.cacher   Zsympy.core.compatibilityr   r   r   r   r   r   <module>   s   