ó
~9­\c           @  s‹  d  Z  d d l m Z m Z d d l m Z m Z 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 d d	 l m Z m Z d d
 l m Z d d l m Z m Z m Z d d l m Z d d l m Z d d l  m! Z! d d l" m# Z# m$ Z$ m% Z% m& Z& m' Z' d „  Z( d „  Z) d „  Z* d „  Z+ d e f d „  ƒ  YZ, d e, f d „  ƒ  YZ- e. e/ d „ Z0 d S(   s   Fourier Seriesiÿÿÿÿ(   t   print_functiont   division(   t   pit   oot   Wildt   Basic(   t   Expr(   t   Add(   t   is_sequence(   t   Tuple(   t   S(   t   Dummyt   Symbol(   t   sympify(   t   sint   cost   sinc(   t
   SeriesBase(   t
   SeqFormula(   t   Interval(   t   TR8t   TR2t   TR1t   TR10t   sincos_to_sumc   	      C  s¶   d d l  m } | d | d | d } } t d | t | | ƒ } d | | |  | | ƒ | } | j | t j ƒ d } | t d | | |  | | ƒ | | d t f ƒ f S(   s,   Returns the cos sequence in a Fourier seriesiÿÿÿÿ(   t	   integratei    i   i   (	   t   sympy.integralsR   R   R   t   subsR
   t   ZeroR   R   (	   t   funct   limitst   nR   t   xt   Lt   cos_termt   formulat   a0(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   fourier_cos_seq   s    c         C  sx   d d l  m } | d | d | d } } t d | t | | ƒ } t d | | |  | | ƒ | | d t f ƒ S(   s,   Returns the sin sequence in a Fourier seriesiÿÿÿÿ(   R   i    i   i   (   R   R   R   R   R   R   (   R   R   R   R   R    R!   t   sin_term(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   fourier_sin_seq   s
    c         C  s2  d „  } d \ } } } | d k rB | |  ƒ t t } } } n  t | t ƒ r¥ t | ƒ d k ru | \ } } } q¥ t | ƒ d k r¥ | |  ƒ } | \ } } q¥ n  t | t ƒ sÍ | d k sÍ | d k ræ t d t | ƒ ƒ ‚ n  t	 j
 t	 j g } | | k s| | k rt d ƒ ‚ n  t | | | f ƒ S(   s  
    Limits should be of the form (x, start, stop).
    x should be a symbol. Both start and stop should be bounded.

    * If x is not given, x is determined from func.
    * If limits is None. Limit of the form (x, -pi, pi) is returned.

    Examples
    ========

    >>> from sympy import pi
    >>> from sympy.series.fourier import _process_limits as pari
    >>> from sympy.abc import x
    >>> pari(x**2, (x, -2, 2))
    (x, -2, 2)
    >>> pari(x**2, (-2, 2))
    (x, -2, 2)
    >>> pari(x**2, None)
    (x, -pi, pi)
    c         S  sI   |  j  } t | ƒ d k r% | j ƒ  S| s5 t d ƒ St d |  ƒ ‚ d  S(   Ni   t   ks¬    specify dummy variables for %s. If the function contains more than one free symbol, a dummy variable should be supplied explicitly e.g. FourierSeries(m*n**2, (n, -pi, pi))(   t   free_symbolst   lent   popR   t
   ValueError(   R   t   free(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   _find_x=   s    	

i   i   s   Invalid limits given: %ss.   Both the start and end value should be boundedN(   NNN(   t   NoneR   R   R	   R*   t
   isinstanceR   R,   t   strR
   t   NegativeInfinityt   InfinityR   (   R   R   R.   R    t   startt   stopt	   unbounded(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   _process_limits(   s     	(c   
        sæ   d „  } ‡  ‡ f d †  } t  t t |  ƒ ƒ ƒ } | j ƒ  } t d d d „  d „  g ƒ‰  t d d ‡ f d †  g ƒ‰ x^ | d	 D]R } | j ƒ  d	 } x9 | D]1 }	 | |	 ˆ ƒ pÇ | |	 ˆ | ƒ s£ t |  f Sq£ Wq† Wt | f S(
   Nc         S  s   | |  j  k S(   N(   R)   (   t   exprsR    (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   check_fx`   s    c           sV   t  |  t t f ƒ rR |  j d } | j ˆ  t | | ˆ ƒ d  k	 rK t St Sn  d  S(   Ni    (	   R0   R   R   t   argst   matchR   R/   t   Truet   False(   t   _exprR    R!   t   sincos_args(   t   at   b(    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   check_sincosc   s
    %R@   t
   propertiesc         S  s   |  j  S(   N(   t
   is_Integer(   R(   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   <lambda>o   t    c         S  s   |  t  j k S(   N(   R
   R   (   R(   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRE   o   RF   RA   c           s   ˆ  |  j  k S(   N(   R)   (   R(   (   R    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRE   p   RF   i   (   R   R   R   t   as_coeff_addR   t   as_coeff_mulR=   R<   (
   t   fR    R!   R9   RB   R>   t	   add_coefft   st
   mul_coeffst   t(    (   R@   RA   R    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   finite_check^   s    		!t   FourierSeriesc           B  s.  e  Z d  Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z	 e d „  ƒ Z
 e d „  ƒ Z e d	 „  ƒ Z e d
 „  ƒ Z e d „  ƒ Z e d „  ƒ Z d „  Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s  Represents Fourier sine/cosine series.

    This class only represents a fourier series.
    No computation is performed.

    For how to compute Fourier series, see the :func:`fourier_series`
    docstring.

    See Also
    ========

    sympy.series.fourier.fourier_series
    c         G  s   t  t | ƒ } t j |  | Œ S(   N(   t   mapR   R   t   __new__(   t   clsR:   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRQ   ‰   s    c         C  s   |  j  d S(   Ni    (   R:   (   t   self(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   function   s    c         C  s   |  j  d d S(   Ni   i    (   R:   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR    ‘   s    c         C  s    |  j  d d |  j  d d f S(   Ni   i   (   R:   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   period•   s    c         C  s   |  j  d d S(   Ni   i    (   R:   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR$   ™   s    c         C  s   |  j  d d S(   Ni   i   (   R:   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   an   s    c         C  s   |  j  d d S(   Ni   (   R:   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   bn¡   s    c         C  s   t  d t ƒ S(   Ni    (   R   R   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   interval¥   s    c         C  s
   |  j  j S(   N(   RX   t   inf(   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR4   ©   s    c         C  s
   |  j  j S(   N(   RX   t   sup(   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR5   ­   s    c         C  s   t  S(   N(   R   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   length±   s    c         C  s    t  |  j d |  j d ƒ d S(   Ni   i    i   (   t   absRU   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR!   µ   s    c         C  s    |  j  } | j | ƒ r |  Sd  S(   N(   R    t   has(   RS   t   oldt   newR    (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt
   _eval_subs¹   s    	i   c         C  sl   | d k r t |  ƒ Sg  } xC |  D]; } t | ƒ | k r? Pn  | t j k	 r# | j | ƒ q# q# Wt | Œ  S(   sÅ  
        Return the first n nonzero terms of the series.

        If n is None return an iterator.

        Parameters
        ==========
        n : int or None
            Amount of non-zero terms in approximation or None.

        Returns
        =======
        Expr or iterator
            Approximation of function expanded into Fourier series.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x, (x, -pi, pi))
        >>> s.truncate(4)
        2*sin(x) - sin(2*x) + 2*sin(3*x)/3 - sin(4*x)/2

        See Also
        ========

        sympy.series.fourier.FourierSeries.sigma_approximation
        N(   R/   t   iterR*   R
   R   t   appendR   (   RS   R   t   termsRM   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   truncate¾   s    
c         C  sT   g  t  |  |  ƒ D]3 \ } } | t j k	 r t t | | ƒ | ^ q } t | Œ  S(   sð  
        Return :math:`\sigma`-approximation of Fourier series with respect
        to order n.

        Sigma approximation adjusts a Fourier summation to eliminate the Gibbs
        phenomenon which would otherwise occur at discontinuities.
        A sigma-approximated summation for a Fourier series of a T-periodical
        function can be written as

        .. math::
            s(\theta) = \frac{1}{2} a_0 + \sum _{k=1}^{m-1}
            \operatorname{sinc} \Bigl( \frac{k}{m} \Bigr) \cdot
            \left[ a_k \cos \Bigl( \frac{2\pi k}{T} \theta \Bigr)
            + b_k \sin \Bigl( \frac{2\pi k}{T} \theta \Bigr) \right],

        where :math:`a_0, a_k, b_k, k=1,\ldots,{m-1}` are standard Fourier
        series coefficients and
        :math:`\operatorname{sinc} \Bigl( \frac{k}{m} \Bigr)` is a Lanczos
        :math:`\sigma` factor (expressed in terms of normalized
        :math:`\operatorname{sinc}` function).

        Parameters
        ==========
        n : int
            Highest order of the terms taken into account in approximation.

        Returns
        =======
        Expr
            Sigma approximation of function expanded into Fourier series.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x, (x, -pi, pi))
        >>> s.sigma_approximation(4)
        2*sin(x)*sinc(pi/4) - 2*sin(2*x)/pi + 2*sin(3*x)*sinc(3*pi/4)/3

        See Also
        ========

        sympy.series.fourier.FourierSeries.truncate

        Notes
        =====

        The behaviour of
        :meth:`~sympy.series.fourier.FourierSeries.sigma_approximation`
        is different from :meth:`~sympy.series.fourier.FourierSeries.truncate`
        - it takes all nonzero terms of degree smaller than n, rather than
        first n nonzero ones.

        References
        ==========

        .. [1] https://en.wikipedia.org/wiki/Gibbs_phenomenon
        .. [2] https://en.wikipedia.org/wiki/Sigma_approximation
        (   t	   enumerateR
   R   R   R   R   (   RS   R   t   iRM   Rc   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   sigma_approximationè   s    =-c         C  s   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j | } |  j | } |  j | |  j d | |  j |  j	 f ƒ S(   s˜  Shift the function by a term independent of x.

        f(x) -> f(x) + s

        This is fast, if Fourier series of f(x) is already
        computed.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x**2, (x, -pi, pi))
        >>> s.shift(1).truncate()
        -4*cos(x) + cos(2*x) + 1 + pi**2/3
        s    '%s' should be independent of %si   (
   R   R    R)   R,   R$   RT   R   R:   RV   RW   (   RS   RK   R    R$   t   sfunc(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   shift)  s    c         C  s¯   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j j | | | ƒ } |  j j | | | ƒ } |  j j | | | ƒ } |  j | |  j	 d |  j
 | | f ƒ S(   s’  Shift x by a term independent of x.

        f(x) -> f(x + s)

        This is fast, if Fourier series of f(x) is already
        computed.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x**2, (x, -pi, pi))
        >>> s.shiftx(1).truncate()
        -4*cos(x + 1) + cos(2*x + 2) + pi**2/3
        s    '%s' should be independent of %si   (   R   R    R)   R,   RV   R   RW   RT   R   R:   R$   (   RS   RK   R    RV   RW   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   shiftxD  s    c         C  s£   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j j | ƒ } |  j j | ƒ } |  j | } |  j d | } |  j	 | |  j d | | | f ƒ S(   s˜  Scale the function by a term independent of x.

        f(x) -> s * f(x)

        This is fast, if Fourier series of f(x) is already
        computed.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x**2, (x, -pi, pi))
        >>> s.scale(2).truncate()
        -8*cos(x) + 2*cos(2*x) + 2*pi**2/3
        s    '%s' should be independent of %si    i   (
   R   R    R)   R,   RV   t	   coeff_mulRW   R$   R:   R   (   RS   RK   R    RV   RW   R$   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   scale`  s    c         C  s¯   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j j | | | ƒ } |  j j | | | ƒ } |  j j | | | ƒ } |  j | |  j	 d |  j
 | | f ƒ S(   sŠ  Scale x by a term independent of x.

        f(x) -> f(s*x)

        This is fast, if Fourier series of f(x) is already
        computed.

        Examples
        ========

        >>> from sympy import fourier_series, pi
        >>> from sympy.abc import x
        >>> s = fourier_series(x**2, (x, -pi, pi))
        >>> s.scalex(2).truncate()
        -4*cos(2*x) + cos(4*x) + pi**2/3
        s    '%s' should be independent of %si   (   R   R    R)   R,   RV   R   RW   RT   R   R:   R$   (   RS   RK   R    RV   RW   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   scalex}  s    c         C  s(   x! |  D] } | t  j k	 r | Sq Wd  S(   N(   R
   R   (   RS   R    RM   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   _eval_as_leading_term™  s    c         C  s3   | d k r |  j  S|  j j | ƒ |  j j | ƒ S(   Ni    (   R$   RV   t   coeffRW   (   RS   t   pt(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt
   _eval_termž  s    c         C  s   |  j  d ƒ S(   Niÿÿÿÿ(   Rl   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   __neg__£  s    c         C  sÕ   t  | t ƒ rÈ |  j | j k r0 t d ƒ ‚ n  |  j | j } } |  j | j j | | ƒ } |  j | j k ru | S|  j | j } |  j	 | j	 } |  j
 | j
 } |  j | |  j d | | | f ƒ St |  | ƒ S(   Ns(   Both the series should have same periodsi   (   R0   RO   RU   R,   R    RT   R   R)   RV   RW   R$   R   R:   R   (   RS   t   otherR    t   yRT   RV   RW   R$   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   __add__¦  s    #c         C  s   |  j  | ƒ S(   N(   Ru   (   RS   Rs   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   __sub__¹  s    (   t   __name__t
   __module__t   __doc__RQ   t   propertyRT   R    RU   R$   RV   RW   RX   R4   R5   R[   R!   R`   Rd   Rg   Ri   Rj   Rl   Rm   Rn   Rq   Rr   Ru   Rv   (    (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRO   {   s2   		*A								t   FiniteFourierSeriesc           B  sb   e  Z d  Z d „  Z e d „  ƒ Z e d „  ƒ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(	   s÷  Represents Finite Fourier sine/cosine series.

    For how to compute Fourier series, see the :func:`fourier_series`
    docstring.

    Parameters
    ==========
    f : Expr
        Expression for finding fourier_series

    limits : ( x, start, stop)
        x is the independent variable for the expression f
        (start, stop) is the period of the fourier series

    exprs: (a0, an, bn) or Expr
        a0 is the constant term a0 of the fourier series
        an is a dictionary of coefficients of cos terms
         an[k] = coefficient of cos(pi*(k/L)*x)
        bn is a dictionary of coefficients of sin terms
         bn[k] = coefficient of sin(pi*(k/L)*x)

        or exprs can be an expression to be converted to fourier form

    Methods
    =======
    This class is an extension of FourierSeries class.
    Please refer to sympy.series.fourier.FourierSeries for
    further information.

    See Also
    ========

    sympy.series.fourier.FourierSeries
    sympy.series.fourier.fourier_series
    c      	     s  t  | ƒ t k o! t | ƒ d k sÞ| j ƒ  \ } } | t g  | D] } t | ƒ ^ qC Œ  } | j d t d t d t d t ƒ j ƒ  \ } }	 | d ‰  t | d | d ƒ d }
 t	 d	 d
 d „  d „  g ƒ} t	 d d
 ‡  f d †  g ƒ} t
 ƒ  } t
 ƒ  } xÆ |	 D]¾ } | j | t | t |
 ˆ  ƒ ƒ } | j | t | t |
 ˆ  ƒ ƒ } | rŒ| | | j | | t j ƒ | | | <q
| r¾| | | j | | t j ƒ | | | <q
| | 7} q
W| | | f } n  t t | | | f ƒ } t j |  | Œ S(   Ni   t   trigt
   power_baset	   power_expt   logi    i   i   R@   RC   c         S  s   |  j  S(   N(   RD   (   R(   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRE   ì  RF   c         S  s   |  t  j k	 S(   N(   R
   R   (   R(   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRE   ì  RF   RA   c           s   ˆ  |  j  k S(   N(   R)   (   R(   (   R    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRE   í  RF   (   t   typet   tupleR*   RG   R   R   t   expandR=   R\   R   t   dictR;   R   R   R   t   getR
   R   RP   R   R   RQ   (   RR   RI   R   R8   t   ct   eRf   t   rexprR$   t   exp_lsR!   R@   RA   RV   RW   t   pRM   t   qR:   (    (   R    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRQ   â  s*    $)0
		%%,,c         C  s]   |  j  r d n d } | t t |  j j ƒ  ƒ j t |  j j ƒ  ƒ ƒ ƒ d 7} t d | ƒ S(   Ni   i    (   R$   t   maxt   setRV   t   keyst   unionRW   R   (   RS   t   _length(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRX     s    ;c         C  s   |  j  |  j S(   N(   R5   R4   (   RS   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR[   	  s    c         C  s   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j ƒ  j | | | ƒ } |  j j | | | ƒ } |  j | |  j d | ƒ S(   Ns    '%s' should be independent of %si   (	   R   R    R)   R,   Rd   R   RT   R   R:   (   RS   RK   R    R>   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRj     s    c         C  su   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j ƒ  | } |  j | } |  j | |  j d | ƒ S(   Ns    '%s' should be independent of %si   (   R   R    R)   R,   Rd   RT   R   R:   (   RS   RK   R    R>   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRl     s    c         C  s   t  | ƒ |  j } } | | j k r> t d | | f ƒ ‚ n  |  j ƒ  j | | | ƒ } |  j j | | | ƒ } |  j | |  j d | ƒ S(   Ns    '%s' should be independent of %si   (	   R   R    R)   R,   Rd   R   RT   R   R:   (   RS   RK   R    R>   Rh   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRm   #  s    c         C  s}   | d k r |  j  S|  j j | t j ƒ t | t |  j |  j ƒ |  j	 j | t j ƒ t
 | t |  j |  j ƒ } | S(   Ni    (   R$   RV   R„   R
   R   R   R   R!   R    RW   R   (   RS   Rp   t   _term(    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRq   .  s
    15c         C  sÅ   t  | t ƒ r5 | j t |  j |  j d d t ƒƒ St  | t ƒ rÁ |  j | j k re t	 d ƒ ‚ n  |  j
 | j
 } } |  j | j j | | ƒ } |  j
 | j k rª | St | d |  j d ƒSd  S(   Ni   t   finites(   Both the series should have same periodsR   (   R0   RO   Ru   t   fourier_seriesRT   R:   R=   R{   RU   R,   R    R   R)   (   RS   Rs   R    Rt   RT   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyRu   6  s    
(   Rw   Rx   Ry   RQ   Rz   RX   R[   Rj   Rl   Rm   Rq   Ru   (    (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR{   ½  s   #	!				c         C  si  t  |  ƒ }  t |  | ƒ } | d } | |  j k r8 |  S| r‹ t | d | d ƒ d } t |  | | ƒ \ } } | r‹ t |  | | ƒ Sn  t d ƒ } |  j | | ƒ } |  | k ræ t |  | | ƒ \ }	 }
 t	 d d t
 f ƒ } nj |  | k r&t j }	 t	 d d t
 f ƒ }
 t |  | | ƒ } n* t |  | | ƒ \ }	 }
 t |  | | ƒ } t |  | |	 |
 | f ƒ S(   s©  Computes Fourier sine/cosine series expansion.

    Returns a :class:`FourierSeries` object.

    Examples
    ========

    >>> from sympy import fourier_series, pi, cos
    >>> from sympy.abc import x

    >>> s = fourier_series(x**2, (x, -pi, pi))
    >>> s.truncate(n=3)
    -4*cos(x) + cos(2*x) + pi**2/3

    Shifting

    >>> s.shift(1).truncate()
    -4*cos(x) + cos(2*x) + 1 + pi**2/3
    >>> s.shiftx(1).truncate()
    -4*cos(x + 1) + cos(2*x + 2) + pi**2/3

    Scaling

    >>> s.scale(2).truncate()
    -8*cos(x) + 2*cos(2*x) + 2*pi**2/3
    >>> s.scalex(2).truncate()
    -4*cos(2*x) + cos(4*x) + pi**2/3

    Notes
    =====

    Computing Fourier series can be slow
    due to the integration required in computing
    an, bn.

    It is faster to compute Fourier series of a function
    by using shifting and scaling on an already
    computed Fourier series rather than computing
    again.

    e.g. If the Fourier series of ``x**2`` is known
    the Fourier series of ``x**2 - 1`` can be found by shifting by ``-1``.

    See Also
    ========

    sympy.series.fourier.FourierSeries

    References
    ==========

    .. [1] mathworld.wolfram.com/FourierSeries.html
    i    i   i   R   (   R   R7   R)   R\   RN   R{   R   R   R%   R   R   R
   R   R'   RO   (   RI   R   R‘   R    R!   t	   is_finitet   res_fR   t   neg_fR$   RV   RW   (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyR’   G  s,    6
	N(1   Ry   t
   __future__R    R   t   sympyR   R   R   R   t   sympy.core.exprR   t   sympy.core.addR   t   sympy.core.compatibilityR   t   sympy.core.containersR	   t   sympy.core.singletonR
   t   sympy.core.symbolR   R   t   sympy.core.sympifyR   t(   sympy.functions.elementary.trigonometricR   R   R   t   sympy.series.series_classR   t   sympy.series.sequencesR   t   sympy.sets.setsR   t   sympy.simplify.fuR   R   R   R   R   R%   R'   R7   RN   RO   R{   R/   R<   R’   (    (    (    s3   lib/python2.7/site-packages/sympy/series/fourier.pyt   <module>   s,   "(				6	ÿ CŠ