Ë
    7^(h×Š  ã                   óÎ  — 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 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!m"Z" d dl#m$Z$m%Z% d dl&m'Z' d dl(m)Z)m*Z*m+Z+  G d„ de«      Z, G d„ de,e¬«      Z- G d„ de,«      Z. G d„ de.«      Z/ G d„ de.«      Z0 G d„ de,«      Z1d(d!„Z2 G d"„ d#e,«      Z3 G d$„ d%e3«      Z4 G d&„ d'e3«      Z5y ))é    )ÚBasic)Úcacheit)ÚTuple)Úcall_highest_priority)Úglobal_parameters)ÚAppliedUndefÚexpand©ÚMul)ÚInteger)ÚEq)ÚSÚ	Singleton)Úordered)ÚDummyÚSymbolÚWild©Úsympify)ÚMatrix)ÚlcmÚfactor)ÚIntervalÚIntersection)ÚIdx)ÚflattenÚis_sequenceÚiterablec                   óL  — e Zd ZdZdZdZe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d„ Zd„ Zd„ Zd„ Zd„ Zd„ Z ed«      d„ «       Zd„ Z ed«      d„ «       Zd„ Zd„ Z ed«      d„ «       Zd„ Z d„ Z!d!d „Z"y)"ÚSeqBasezBase class for sequencesTé   c                 ó`   — 	 | j                   }|S # t        $ r t        j                  }Y |S w xY w)z[Return start (if possible) else S.Infinity.

        adapted from Set._infimum_key
        )ÚstartÚNotImplementedErrorr   ÚInfinity)Úexprr#   s     úT/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/series/sequences.pyÚ
_start_keyzSeqBase._start_key    s6   € ð	Ø—J‘JˆEð ˆøô #ò 	Ü—J‘J‰EØˆð	ús   ‚ �-¬-c                 ór   — t        | j                  |j                  «      }|j                  |j                  fS )zTReturns start and stop.

        Takes intersection over the two intervals.
        )r   ÚintervalÚinfÚsup)ÚselfÚotherr*   s      r'   Ú_intersect_intervalzSeqBase._intersect_interval,   s+   € ô
   §¡¨u¯~©~Ó>ˆØ�|‰|˜XŸ\™\Ð)Ð)ó    c                 ó   — t        d| z  «      ‚)z&Returns the generator for the sequencez(%s).gen©r$   ©r-   s    r'   ÚgenzSeqBase.gen4   s   € ô " *¨tÑ"3Ó4Ð4r0   c                 ó   — t        d| z  «      ‚)z-The interval on which the sequence is definedz(%s).intervalr2   r3   s    r'   r*   zSeqBase.interval9   s   € ô " /°DÑ"8Ó9Ð9r0   c                 ó   — t        d| z  «      ‚)ú:The starting point of the sequence. This point is includedz
(%s).startr2   r3   s    r'   r#   zSeqBase.start>   s   € ô " ,°Ñ"5Ó6Ð6r0   c                 ó   — t        d| z  «      ‚)z8The ending point of the sequence. This point is includedz	(%s).stopr2   r3   s    r'   ÚstopzSeqBase.stopC   s   € ô " +°Ñ"4Ó5Ð5r0   c                 ó   — t        d| z  «      ‚)zLength of the sequencez(%s).lengthr2   r3   s    r'   ÚlengthzSeqBase.lengthH   s   € ô " -°$Ñ"6Ó7Ð7r0   c                  ó   — y)z-Returns a tuple of variables that are bounded© r=   r3   s    r'   Ú	variableszSeqBase.variablesM   s   € ð r0   c                 óš   — | j                   D ��ch c].  }|j                  j                  | j                  «      D ]  }|’Œ Œ0 c}}S c c}}w )aG  
        This method returns the symbols in the object, excluding those
        that take on a specific value (i.e. the dummy symbols).

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n, m
        >>> SeqFormula(m*n**2, (n, 0, 5)).free_symbols
        {m}
        )ÚargsÚfree_symbolsÚ
differencer>   )r-   ÚiÚjs      r'   rA   zSeqBase.free_symbolsR   sF   € ð !ŸI™I÷ 0�q¨q¯~©~ß‘J˜tŸ~™~Ó.ò0¨!’ð 0�ó 0ð 	1ùó 0s   �3Ac                 ó–   — || j                   k  s|| j                  kD  rt        d|›d| j                  ›�«      ‚| j	                  |«      S )z#Returns the coefficient at point ptzIndex z out of bounds )r#   r9   Ú
IndexErrorr*   Ú_eval_coeff©r-   Úpts     r'   ÚcoeffzSeqBase.coeffc   s>   € ð �—
‘
Š?˜b 4§9¡9šnÝºBÀÇÂÐNÓOÐOØ×Ñ Ó#Ð#r0   c                 ó2   — t        d| j                  z  «      ‚)NzhThe _eval_coeff method should be added to%s to return coefficient so it is availablewhen coeff calls it.)r$   ÚfuncrH   s     r'   rG   zSeqBase._eval_coeffj   s"   € Ü!ð #9ð %)§I¡Iñ#.ó /ð 	/r0   c                 ó¾   — | j                   t        j                  u r| j                  }n| j                   }| j                   t        j                  u rd}nd}|||z  z   S )a¯  Returns the i'th point of a sequence.

        Explanation
        ===========

        If start point is negative infinity, point is returned from the end.
        Assumes the first point to be indexed zero.

        Examples
        =========

        >>> from sympy import oo
        >>> from sympy.series.sequences import SeqPer

        bounded

        >>> SeqPer((1, 2, 3), (-10, 10))._ith_point(0)
        -10
        >>> SeqPer((1, 2, 3), (-10, 10))._ith_point(5)
        -5

        End is at infinity

        >>> SeqPer((1, 2, 3), (0, oo))._ith_point(5)
        5

        Starts at negative infinity

        >>> SeqPer((1, 2, 3), (-oo, 0))._ith_point(5)
        -5
        éÿÿÿÿé   )r#   r   ÚNegativeInfinityr9   )r-   rC   ÚinitialÚsteps       r'   Ú
_ith_pointzSeqBase._ith_pointp   sT   € ð@ �:‰:œ×+Ñ+Ñ+Ø—i‘i‰Gà—j‘jˆGà�:‰:œ×+Ñ+Ñ+Ø‰DàˆDà˜˜4™ÑÐr0   c                  ó   — y)aI  
        Should only be used internally.

        Explanation
        ===========

        self._add(other) returns a new, term-wise added sequence if self
        knows how to add with other, otherwise it returns ``None``.

        ``other`` should only be a sequence object.

        Used within :class:`SeqAdd` class.
        Nr=   ©r-   r.   s     r'   Ú_addzSeqBase._addœ   ó   € ð r0   c                  ó   — y)aS  
        Should only be used internally.

        Explanation
        ===========

        self._mul(other) returns a new, term-wise multiplied sequence if self
        knows how to multiply with other, otherwise it returns ``None``.

        ``other`` should only be a sequence object.

        Used within :class:`SeqMul` class.
        Nr=   rU   s     r'   Ú_mulzSeqBase._mul¬   rW   r0   c                 ó   — t        | |«      S )a�  
        Should be used when ``other`` is not a sequence. Should be
        defined to define custom behaviour.

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n
        >>> SeqFormula(n**2).coeff_mul(2)
        SeqFormula(2*n**2, (n, 0, oo))

        Notes
        =====

        '*' defines multiplication of sequences with sequences only.
        r
   rU   s     r'   Ú	coeff_mulzSeqBase.coeff_mul¼   s   € ô$ �4˜ÓÐr0   c                 óh   — t        |t        «      st        dt        |«      z  «      ‚t	        | |«      S )a4  Returns the term-wise addition of 'self' and 'other'.

        ``other`` should be a sequence.

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n
        >>> SeqFormula(n**2) + SeqFormula(n**3)
        SeqFormula(n**3 + n**2, (n, 0, oo))
        zcannot add sequence and %s©Ú
isinstancer    Ú	TypeErrorÚtypeÚSeqAddrU   s     r'   Ú__add__zSeqBase.__add__Ð   s0   € ô ˜%¤Ô)ÜÐ8¼4À»;ÑFÓGÐGÜ�d˜EÓ"Ð"r0   rb   c                 ó   — | |z   S ©Nr=   rU   s     r'   Ú__radd__zSeqBase.__radd__á   ó   € à�e‰|Ðr0   c                 ój   — t        |t        «      st        dt        |«      z  «      ‚t	        | | «      S )a7  Returns the term-wise subtraction of ``self`` and ``other``.

        ``other`` should be a sequence.

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n
        >>> SeqFormula(n**2) - (SeqFormula(n))
        SeqFormula(n**2 - n, (n, 0, oo))
        zcannot subtract sequence and %sr]   rU   s     r'   Ú__sub__zSeqBase.__sub__å   s2   € ô ˜%¤Ô)ÜÐ=ÄÀUÃÑKÓLÐLÜ�d˜U˜FÓ#Ð#r0   rh   c                 ó   — |  |z   S rd   r=   rU   s     r'   Ú__rsub__zSeqBase.__rsub__ö   s   € à�˜‰Ðr0   c                 ó$   — | j                  d«      S )zÓNegates the sequence.

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n
        >>> -SeqFormula(n**2)
        SeqFormula(-n**2, (n, 0, oo))
        rN   )r[   r3   s    r'   Ú__neg__zSeqBase.__neg__ú   s   € ð �~‰~˜bÓ!Ð!r0   c                 óh   — t        |t        «      st        dt        |«      z  «      ‚t	        | |«      S )a{  Returns the term-wise multiplication of 'self' and 'other'.

        ``other`` should be a sequence. For ``other`` not being a
        sequence see :func:`coeff_mul` method.

        Examples
        ========

        >>> from sympy import SeqFormula
        >>> from sympy.abc import n
        >>> SeqFormula(n**2) * (SeqFormula(n))
        SeqFormula(n**3, (n, 0, oo))
        zcannot multiply sequence and %s)r^   r    r_   r`   ÚSeqMulrU   s     r'   Ú__mul__zSeqBase.__mul__  s0   € ô ˜%¤Ô)ÜÐ=ÄÀUÃÑKÓLÐLÜ�d˜EÓ"Ð"r0   ro   c                 ó   — | |z  S rd   r=   rU   s     r'   Ú__rmul__zSeqBase.__rmul__  rf   r0   c              #   óˆ   K  — t        | j                  «      D ]&  }| j                  |«      }| j                  |«      –— Œ( y ­wrd   )Úranger;   rS   rJ   )r-   rC   rI   s      r'   Ú__iter__zSeqBase.__iter__  s:   è ø€ Ü�t—{‘{Ó#ò 	!ˆAØ—‘ Ó#ˆBØ—*‘*˜R“.Ó ñ	!ùs   ‚A Ac                 ót  — t        |t        «      r"| j                  |«      }| j                  |«      S t        |t        «      rq|j
                  |j                  }}|€d}|€| j                  }t        |||j                  xs d«      D �cg c]"  }| j                  | j                  |«      «      ‘Œ$ c}S y c c}w )Nr   rO   )
r^   ÚintrS   rJ   Úslicer#   r9   r;   rs   rR   )r-   Úindexr#   r9   rC   s        r'   Ú__getitem__zSeqBase.__getitem__"  s    € Ü�eœSÔ!Ø—O‘O EÓ*ˆEØ—:‘:˜eÓ$Ð$Ü˜œuÔ%ØŸ+™+ u§z¡z�4ˆEØˆ}Ø�Øˆ|Ø—{‘{�ä˜%  u§z¡z¢°QÓ7ö9°q�D—J‘J˜tŸ™¨qÓ1Õ2ò 9ð 9ð &ùò9s   Â
'B5Nc           
      ó  — ddl m} | d| D �cg c]  } |t        |«      «      ‘Œ }}t        |«      }|€|dz  }nt	        ||dz  «      }g }	t        d|dz   «      D ]é  }
d|
z  }g }t        |
«      D ]  }|j                  ||||
z    «       Œ t        |«      }|j                  «       dk7  sŒP ||j                  t        ||
| «      «      «      }||k(  rt        |ddd…   «      }	 nag }t        |
||
z
  «      D ]  }|j                  ||||
z    «       Œ t        |«      }||z  t        ||d «      k(  sŒØt        |ddd…   «      }	 n |€|	S t        |	«      }
|
dk(  rg dfS ||
dz
     ||
dz
  z  z  d|	|
dz
     ||
z  z  z
  }}t        |
dz
  «      D ]Q  }|||   ||z  z  z  }t        |
|z
  dz
  «      D ]  }||	|   ||   z  |||z   dz   z  z  z  }Œ ||	|   ||dz   z  z  z  }ŒS |	 |t        |«      t        |«      z  «      fS c c}w )a£  
        Finds the shortest linear recurrence that satisfies the first n
        terms of sequence of order `\leq` ``n/2`` if possible.
        If ``d`` is specified, find shortest linear recurrence of order
        `\leq` min(d, n/2) if possible.
        Returns list of coefficients ``[b(1), b(2), ...]`` corresponding to the
        recurrence relation ``x(n) = b(1)*x(n-1) + b(2)*x(n-2) + ...``
        Returns ``[]`` if no recurrence is found.
        If gfvar is specified, also returns ordinary generating function as a
        function of gfvar.

        Examples
        ========

        >>> from sympy import sequence, sqrt, oo, lucas
        >>> from sympy.abc import n, x, y
        >>> sequence(n**2).find_linear_recurrence(10, 2)
        []
        >>> sequence(n**2).find_linear_recurrence(10)
        [3, -3, 1]
        >>> sequence(2**n).find_linear_recurrence(10)
        [2]
        >>> sequence(23*n**4+91*n**2).find_linear_recurrence(10)
        [5, -10, 10, -5, 1]
        >>> sequence(sqrt(5)*(((1 + sqrt(5))/2)**n - (-(1 + sqrt(5))/2)**(-n))/5).find_linear_recurrence(10)
        [1, 1]
        >>> sequence(x+y*(-2)**(-n), (n, 0, oo)).find_linear_recurrence(30)
        [1/2, 1/2]
        >>> sequence(3*5**n + 12).find_linear_recurrence(20,gfvar=x)
        ([6, -5], 3*(5 - 21*x)/((x - 1)*(5*x - 1)))
        >>> sequence(lucas(n)).find_linear_recurrence(15,gfvar=x)
        ([1, 1], (x - 2)/(x**2 + x - 1))
        r   )ÚsimplifyNé   rO   rN   )Úsympy.simplifyr{   r	   ÚlenÚminrs   Úappendr   ÚdetÚLUsolver   r   )r-   ÚnÚdÚgfvarr{   ÚtÚxÚlxÚrÚcoeffsÚlÚl2ÚmlistÚkÚmÚyrC   rD   s                     r'   Úfind_linear_recurrencezSeqBase.find_linear_recurrence/  sd  € õD 	,Ø*.¨r°¨(Ö3 Q‰X”f˜Q“iÕ Ð3ˆÐ3Ü�‹VˆØˆ9Ø�A‘‰Aä�A�b˜!‘e“ˆAØˆÜ�q˜!˜A™#“ò 	ˆAØ�1‘ˆBØˆEÜ˜1“Xò '�Ø—‘˜Q˜q  1¡˜XÕ&ð'ä�u“ˆAØ�u‰u‹w˜!‹|Ù˜QŸY™Y¤v¨a°°"¨g£Ó7Ó8�Ø˜’8Ü$ Q¡t¨ t¡WÓ-�FÙØ�Ü˜q  A¡›ò +�AØ—L‘L  1 Q q¡S Õ*ð+ä˜5“M�Ø�Q‘3œ&  2 3 ›.Ó(Ü$ Q¡t¨ t¡WÓ-�FÙð#	ð$ ˆ=ØˆMä�F“ˆAØ�AŠvØ˜4�x�à˜˜1™‘v˜e a¨¡c™lÑ*¨A°°q¸±s±¸EÀ1¹HÑ0DÑ,D�1�Ü˜q ™s›ò 0�AØ˜˜1™˜e Q™h™Ñ&�AÜ" 1 Q¡3 q¡5›\ò ;˜Ø˜V A™Y q¨¡t™^¨E°A°a±C¸±E©NÑ:Ñ:™ð;à˜ ™ 5¨1¨Q©3¡<Ñ/Ñ/‘Að	0ð
 ™x¬¨q«	´&¸³)Ñ(;Ó<Ð<Ð<ùòM 4s   ŽH)NN)#Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úis_commutativeÚ_op_priorityÚstaticmethodr(   r/   Úpropertyr4   r*   r#   r9   r;   r>   rA   r   rJ   rG   rS   rV   rY   r[   rb   r   re   rh   rj   rl   ro   rq   rt   ry   r‘   r=   r0   r'   r    r       sO  „ Ù"à€NØ€Làñ	ó ð	ò*ð ñ5ó ð5ð ñ:ó ð:ð ñ7ó ð7ð ñ6ó ð6ð ñ8ó ð8ð ñó ðð ñ1ó ð1ð  ñ$ó ð$ò/ò* òXò ò  ò(#ñ" ˜9Ó%ñó &ðò$ñ" ˜9Ó%ñó &ðò"ò#ñ$ ˜9Ó%ñó &ðò!ò
9ôI=r0   r    c                   ó<   — e Zd ZdZed„ «       Zed„ «       Zd„ Zd„ Zy)ÚEmptySequenceaÌ  Represents an empty sequence.

    The empty sequence is also available as a singleton as
    ``S.EmptySequence``.

    Examples
    ========

    >>> from sympy import EmptySequence, SeqPer
    >>> from sympy.abc import x
    >>> EmptySequence
    EmptySequence
    >>> SeqPer((1, 2), (x, 0, 10)) + EmptySequence
    SeqPer((1, 2), (x, 0, 10))
    >>> SeqPer((1, 2)) * EmptySequence
    EmptySequence
    >>> EmptySequence.coeff_mul(-1)
    EmptySequence
    c                 ó"   — t         j                  S rd   )r   ÚEmptySetr3   s    r'   r*   zEmptySequence.interval�  s   € ä�z‰zÐr0   c                 ó"   — t         j                  S rd   )r   ÚZeror3   s    r'   r;   zEmptySequence.length“  s   € ä�v‰vˆr0   c                 ó   — | S )ú"See docstring of SeqBase.coeff_mulr=   )r-   rJ   s     r'   r[   zEmptySequence.coeff_mul—  s   € àˆr0   c                 ó   — t        g «      S rd   )Úiterr3   s    r'   rt   zEmptySequence.__iter__›  s   € Ü�B‹xˆr0   N)	r’   r“   r”   r•   r™   r*   r;   r[   rt   r=   r0   r'   r›   r›   z  s9   „ ñð( ñó ðð ñó ðòór0   r›   )Ú	metaclassc                   óp   — e Zd ZdZed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z	ed„ «       Z
y)	ÚSeqExpraÙ  Sequence expression class.

    Various sequences should inherit from this class.

    Examples
    ========

    >>> from sympy.series.sequences import SeqExpr
    >>> from sympy.abc import x
    >>> from sympy import Tuple
    >>> s = SeqExpr(Tuple(1, 2, 3), Tuple(x, 0, 10))
    >>> s.gen
    (1, 2, 3)
    >>> s.interval
    Interval(0, 10)
    >>> s.length
    11

    See Also
    ========

    sympy.series.sequences.SeqPer
    sympy.series.sequences.SeqFormula
    c                 ó    — | j                   d   S ©Nr   ©r@   r3   s    r'   r4   zSeqExpr.gen¹  s   € à�y‰y˜‰|Ðr0   c                 óZ   — t        | j                  d   d   | j                  d   d   «      S )NrO   r|   )r   r@   r3   s    r'   r*   zSeqExpr.interval½  s'   € ä˜Ÿ	™	 !™ Q™¨¯©°1©°a©Ó9Ð9r0   c                 ó.   — | j                   j                  S rd   ©r*   r+   r3   s    r'   r#   zSeqExpr.startÁ  ó   € à�}‰}× Ñ Ð r0   c                 ó.   — | j                   j                  S rd   ©r*   r,   r3   s    r'   r9   zSeqExpr.stopÅ  r­   r0   c                 ó:   — | j                   | j                  z
  dz   S ©NrO   ©r9   r#   r3   s    r'   r;   zSeqExpr.lengthÉ  ó   € à�y‰y˜4Ÿ:™:Ñ%¨Ñ)Ð)r0   c                 ó(   — | j                   d   d   fS )NrO   r   r©   r3   s    r'   r>   zSeqExpr.variablesÍ  s   € à—	‘	˜!‘˜Q‘Ð!Ð!r0   N)r’   r“   r”   r•   r™   r4   r*   r#   r9   r;   r>   r=   r0   r'   r¦   r¦   Ÿ  s   „ ñð2 ñó ðð ñ:ó ð:ð ñ!ó ð!ð ñ!ó ð!ð ñ*ó ð*ð ñ"ó ñ"r0   r¦   c                   óP   — e Zd ZdZd
d„Zed„ «       Zed„ «       Zd„ Zd„ Z	d„ Z
d	„ Zy)ÚSeqPeraâ  
    Represents a periodic sequence.

    The elements are repeated after a given period.

    Examples
    ========

    >>> from sympy import SeqPer, oo
    >>> from sympy.abc import k

    >>> s = SeqPer((1, 2, 3), (0, 5))
    >>> s.periodical
    (1, 2, 3)
    >>> s.period
    3

    For value at a particular point

    >>> s.coeff(3)
    1

    supports slicing

    >>> s[:]
    [1, 2, 3, 1, 2, 3]

    iterable

    >>> list(s)
    [1, 2, 3, 1, 2, 3]

    sequence starts from negative infinity

    >>> SeqPer((1, 2, 3), (-oo, 0))[0:6]
    [1, 2, 3, 1, 2, 3]

    Periodic formulas

    >>> SeqPer((k, k**2, k**3), (k, 0, oo))[0:6]
    [0, 1, 8, 3, 16, 125]

    See Also
    ========

    sympy.series.sequences.SeqFormula
    Nc                 óÈ  — t        |«      }d„ }d\  }}}|€ ||«      dt        j                  }}}t        |t        «      r0t        |«      dk(  r|\  }}}nt        |«      dk(  r ||«      }|\  }}t        |t        t        f«      r|�|€t        dt        |«      z  «      ‚|t        j                  u r|t        j                  u rt        d«      ‚t        |||f«      }t        |t        «      rt        t        t        |«      «      «      }nt        d|z  «      ‚t        |d	   |d   «      t        j                  u rt        j                   S t#        j$                  | ||«      S )
Nc                 ó€   — | j                   }t        | j                   «      dk(  r|j                  «       S t        d«      S )NrO   rŽ   )rA   r~   Úpopr   )Ú
periodicalÚfrees     r'   Ú_find_xzSeqPer.__new__.<locals>._find_x  s6   € Ø×*Ñ*ˆDÜ�:×*Ñ*Ó+¨qÒ0Ø—x‘x“zÐ!ä˜S“zÐ!r0   ©NNNr   é   r|   úInvalid limits given: %sz/Both the start and end valuecannot be unboundedz6invalid period %s should be something like e.g (1, 2) rO   )r   r   r%   r   r   r~   r^   r   r   Ú
ValueErrorÚstrrP   Útupler   r   r�   r›   r   Ú__new__)Úclsrº   Úlimitsr¼   r‡   r#   r9   s          r'   rÃ   zSeqPer.__new__  sT  € Ü˜ZÓ(ˆ
ò	"ð *‰ˆˆ5�$Øˆ>Ù$ ZÓ0°!´Q·Z±Z�dˆuˆAÜ�vœuÔ%Ü�6‹{˜aÒØ!'‘��5™$Ü�V“ Ò!Ù˜JÓ'�Ø$‘��tä˜!œf¤c˜]Ô+¨u¨}ÀÀÜÐ7¼#¸f»+ÑEÓFÐFà”A×&Ñ&Ñ&¨4´1·:±:Ñ+=Ü ð "7ó 8ð 8ô ˜!˜U DÐ)Ó*ˆä�z¤5Ô)Ü ¤¤w¨zÓ':Ó!;Ó<‰Jäð 0Ø2<ñ=ó >ð >ô �F˜1‘I˜v a™yÓ)¬Q¯Z©ZÑ7Ü—?‘?Ð"ä�}‰}˜S *¨fÓ5Ð5r0   c                 ó,   — t        | j                  «      S rd   )r~   r4   r3   s    r'   ÚperiodzSeqPer.period+  s   € ä�4—8‘8‹}Ðr0   c                 ó   — | j                   S rd   ©r4   r3   s    r'   rº   zSeqPer.periodical/  ó   € à�x‰xˆr0   c                 ó  — | j                   t        j                  u r| j                  |z
  | j                  z  }n|| j                   z
  | j                  z  }| j
                  |   j                  | j                  d   |«      S r¨   )r#   r   rP   r9   rÇ   rº   Úsubsr>   )r-   rI   Úidxs      r'   rG   zSeqPer._eval_coeff3  se   € Ø�:‰:œ×+Ñ+Ñ+Ø—9‘9˜r‘> T§[¡[Ñ0‰Cà˜Ÿ
™
‘? d§k¡kÑ1ˆCØ�‰˜sÑ#×(Ñ(¨¯©¸Ñ):¸BÓ?Ð?r0   c                 óh  — t        |t        «      r¢| j                  | j                  }}|j                  |j                  }}t	        ||«      }g }t        |«      D ]&  }|||z     }	|||z     }
|j                  |	|
z   «       Œ( | j                  |«      \  }}t        || j                  d   ||f«      S y©zSee docstring of SeqBase._addr   N©	r^   r¶   rº   rÇ   r   rs   r€   r/   r>   ©r-   r.   Úper1Úlper1Úper2Úlper2Ú
per_lengthÚnew_perr‡   Úele1Úele2r#   r9   s                r'   rV   zSeqPer._add:  ó·   € ä�eœVÔ$ØŸ/™/¨4¯;©;�%ˆDØ×*Ñ*¨E¯L©L�%ˆDä˜U EÓ*ˆJàˆGÜ˜:Ó&ò ,�Ø˜A ™I‘�Ø˜A ™I‘�Ø—‘˜t d™{Õ+ð,ð
 ×2Ñ2°5Ó9‰KˆE�4Ü˜' D§N¡N°1Ñ$5°u¸dÐ#CÓDÐDð %r0   c                 óh  — t        |t        «      r¢| j                  | j                  }}|j                  |j                  }}t	        ||«      }g }t        |«      D ]&  }|||z     }	|||z     }
|j                  |	|
z  «       Œ( | j                  |«      \  }}t        || j                  d   ||f«      S y©zSee docstring of SeqBase._mulr   NrÐ   rÑ   s                r'   rY   zSeqPer._mulK  rÚ   r0   c                 óŒ   — t        |«      }| j                  D �cg c]  }||z  ‘Œ	 }}t        || j                  d   «      S c c}w ©r¡   rO   )r   rº   r¶   r@   )r-   rJ   r‡   Úpers       r'   r[   zSeqPer.coeff_mul\  s@   € ä˜“ˆØ"&§/¡/Ö2˜Qˆq�5‹yÐ2ˆÐ2Ü�c˜4Ÿ9™9 Q™<Ó(Ð(ùò 3s   šArd   )r’   r“   r”   r•   rÃ   r™   rÇ   rº   rG   rV   rY   r[   r=   r0   r'   r¶   r¶   Ò  sM   „ ñ.ó`&6ðP ñó ðð ñó ðò@òEò"Eó")r0   r¶   c                   óF   — e Zd ZdZd
d„Zed„ «       Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zy)Ú
SeqFormulaaf  
    Represents sequence based on a formula.

    Elements are generated using a formula.

    Examples
    ========

    >>> from sympy import SeqFormula, oo, Symbol
    >>> n = Symbol('n')
    >>> s = SeqFormula(n**2, (n, 0, 5))
    >>> s.formula
    n**2

    For value at a particular point

    >>> s.coeff(3)
    9

    supports slicing

    >>> s[:]
    [0, 1, 4, 9, 16, 25]

    iterable

    >>> list(s)
    [0, 1, 4, 9, 16, 25]

    sequence starts from negative infinity

    >>> SeqFormula(n**2, (-oo, 0))[0:6]
    [0, 1, 4, 9, 16, 25]

    See Also
    ========

    sympy.series.sequences.SeqPer
    Nc                 óP  — t        |«      }d„ }d\  }}}|€ ||«      dt        j                  }}}t        |t        «      r0t        |«      dk(  r|\  }}}nt        |«      dk(  r ||«      }|\  }}t        |t        t        f«      r|�|€t        dt        |«      z  «      ‚|t        j                  u r|t        j                  u rt        d«      ‚t        |||f«      }t        |d   |d   «      t        j                  u rt        j                  S t        j                   | ||«      S )	Nc                 óŒ   — | j                   }t        |«      dk(  r|j                  «       S |st        d«      S t	        d| z  «      ‚)NrO   rŽ   z¦ specify dummy variables for %s. If the formula contains more than one free symbol, a dummy variable should be supplied explicitly e.g., SeqFormula(m*n**2, (n, 0, 5)))rA   r~   r¹   r   rÀ   )Úformular»   s     r'   r¼   z#SeqFormula.__new__.<locals>._find_x�  sN   € Ø×'Ñ'ˆDÜ�4‹y˜AŠ~Ø—x‘x“zÐ!ÙÜ˜S“zÐ!ä ðOð ñóð r0   r½   r   r¾   r|   r¿   z0Both the start and end value cannot be unboundedrO   )r   r   r%   r   r   r~   r^   r   r   rÀ   rÁ   rP   r   r�   r›   r   rÃ   )rÄ   rä   rÅ   r¼   r‡   r#   r9   s          r'   rÃ   zSeqFormula.__new__Œ  s  € Ü˜'Ó"ˆò	ð *‰ˆˆ5�$Øˆ>Ù$ WÓ-¨q´!·*±*�dˆuˆAÜ�vœuÔ%Ü�6‹{˜aÒØ!'‘��5™$Ü�V“ Ò!Ù˜GÓ$�Ø$‘��tä˜!œf¤c˜]Ô+¨u¨}ÀÀÜÐ7¼#¸f»+ÑEÓFÐFà”A×&Ñ&Ñ&¨4´1·:±:Ñ+=Ü ð "7ó 8ð 8ä˜!˜U DÐ)Ó*ˆä�F˜1‘I˜v a™yÓ)¬Q¯Z©ZÑ7Ü—?‘?Ð"ä�}‰}˜S '¨6Ó2Ð2r0   c                 ó   — | j                   S rd   rÉ   r3   s    r'   rä   zSeqFormula.formula³  rÊ   r0   c                 óX   — | j                   d   }| j                  j                  ||«      S r¨   )r>   rä   rÌ   )r-   rI   r„   s      r'   rG   zSeqFormula._eval_coeff·  s'   € Ø�N‰N˜1ÑˆØ�|‰|× Ñ   BÓ'Ð'r0   c                 ó   — t        |t        «      rn| j                  | j                  d   }}|j                  |j                  d   }}||j	                  ||«      z   }| j                  |«      \  }}t        ||||f«      S yrÏ   ©r^   rá   rä   r>   rÌ   r/   ©	r-   r.   Úform1Úv1Úform2Úv2rä   r#   r9   s	            r'   rV   zSeqFormula._add»  óz   € ä�eœZÔ(ØŸ™ d§n¡n°QÑ&7�2ˆEØŸ™ u§¡°qÑ'9�2ˆEØ˜eŸj™j¨¨RÓ0Ñ0ˆGØ×2Ñ2°5Ó9‰KˆE�4Ü˜g¨¨E°4Ð'8Ó9Ð9ð )r0   c                 ó   — t        |t        «      rn| j                  | j                  d   }}|j                  |j                  d   }}||j	                  ||«      z  }| j                  |«      \  }}t        ||||f«      S yrÜ   rè   ré   s	            r'   rY   zSeqFormula._mulÄ  rî   r0   c                 óh   — t        |«      }| j                  |z  }t        || j                  d   «      S rÞ   )r   rä   rá   r@   )r-   rJ   rä   s      r'   r[   zSeqFormula.coeff_mulÍ  s.   € ä˜“ˆØ—,‘, Ñ&ˆÜ˜' 4§9¡9¨Q¡<Ó0Ð0r0   c                 ób   — t        t        | j                  g|¢­i |¤Ž| j                  d   «      S r±   )rá   r	   rä   r@   )r-   r@   Úkwargss      r'   r	   zSeqFormula.expandÓ  s*   € Üœ& §¡Ð?°Ò?¸Ñ?ÀÇÁÈ1ÁÓNÐNr0   rd   )r’   r“   r”   r•   rÃ   r™   rä   rG   rV   rY   r[   r	   r=   r0   r'   rá   rá   c  s<   „ ñ&óP%3ðN ñó ðò(ò:ò:ò1óOr0   rá   c                   ó´   — e Zd ZdZd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„ Zy)ÚRecursiveSeqaŒ  
    A finite degree recursive sequence.

    Explanation
    ===========

    That is, a sequence a(n) that depends on a fixed, finite number of its
    previous values. The general form is

        a(n) = f(a(n - 1), a(n - 2), ..., a(n - d))

    for some fixed, positive integer d, where f is some function defined by a
    SymPy expression.

    Parameters
    ==========

    recurrence : SymPy expression defining recurrence
        This is *not* an equality, only the expression that the nth term is
        equal to. For example, if :code:`a(n) = f(a(n - 1), ..., a(n - d))`,
        then the expression should be :code:`f(a(n - 1), ..., a(n - d))`.

    yn : applied undefined function
        Represents the nth term of the sequence as e.g. :code:`y(n)` where
        :code:`y` is an undefined function and `n` is the sequence index.

    n : symbolic argument
        The name of the variable that the recurrence is in, e.g., :code:`n` if
        the recurrence function is :code:`y(n)`.

    initial : iterable with length equal to the degree of the recurrence
        The initial values of the recurrence.

    start : start value of sequence (inclusive)

    Examples
    ========

    >>> from sympy import Function, symbols
    >>> from sympy.series.sequences import RecursiveSeq
    >>> y = Function("y")
    >>> n = symbols("n")
    >>> fib = RecursiveSeq(y(n - 1) + y(n - 2), y(n), n, [0, 1])

    >>> fib.coeff(3) # Value at a particular point
    2

    >>> fib[:6] # supports slicing
    [0, 1, 1, 2, 3, 5]

    >>> fib.recurrence # inspect recurrence
    Eq(y(n), y(n - 2) + y(n - 1))

    >>> fib.degree # automatically determine degree
    2

    >>> for x in zip(range(10), fib): # supports iteration
    ...     print(x)
    (0, 0)
    (1, 1)
    (2, 1)
    (3, 2)
    (4, 3)
    (5, 5)
    (6, 8)
    (7, 13)
    (8, 21)
    (9, 34)

    See Also
    ========

    sympy.series.sequences.SeqFormula

    Nc                 ó  — t        |t        «      st        dj                  |«      «      ‚t        |t        «      r|j
                  st        dj                  |«      «      ‚|j                  |fk7  rt        d«      ‚|j                  }t        d|f¬«      }d}|j                  |«      }	|	D ]Ž  }
t        |
j                  «      dk7  rt        d«      ‚|
j                  d   j                  ||z   «      |   }|j                  «       r|j                  r|dk  st        d	j                  |
«      «      ‚| |kD  sŒŒ| }Œ� |s0t        |«      D �cg c]  }t        d
j                  |«      «      ‘Œ }}t        |«      |k7  rt!        d«      ‚t#        |«      }t%        |«      }t'        d„ |D «       Ž }t	        j(                  | |||||«      }t+        |«      D ��ci c]  \  }} |||z   «      |“Œ c}}|_        ||_        |S c c}w c c}}w )NzErecurrence sequence must be an applied undefined function, found `{}`z0recurrence variable must be a symbol, found `{}`z)recurrence sequence does not match symbolrŽ   )Úexcluder   rO   z)Recurrence should be in a single variablezDRecurrence should have constant, negative, integer shifts (found {})zc_{}z)Number of initial terms must equal degreec              3   ó2   K  — | ]  }t        |«      –— Œ y ­wrd   r   )Ú.0r‡   s     r'   ú	<genexpr>z'RecursiveSeq.__new__.<locals>.<genexpr>O  s   è ø€ Ò6¨œ' !Ÿ*Ñ6ùs   ‚)r^   r   r_   Úformatr   Ú	is_symbolr@   rL   r   Úfindr~   ÚmatchÚis_constantÚ
is_integerrs   r   rÀ   r   r   r   rÃ   Ú	enumerateÚcacheÚdegree)rÄ   Ú
recurrenceÚynrƒ   rQ   r#   r�   rŽ   r  Úprev_ysÚprev_yÚshiftÚseqÚinits                 r'   rÃ   zRecursiveSeq.__new__#  së  € Ü˜"œlÔ+Üð +ß+1©6°"«:ó7ð 7ô ˜!œUÔ#¨1¯;ª;Üð +ß+1©6°!«9ó6ð 6ð �7‰7�q�dŠ?ÜÐGÓHÐHà�G‰Gˆä�˜q˜dÔ#ˆØˆð —/‘/ !Ó$ˆØò 	 ˆFÜ�6—;‘;Ó 1Ò$ÜÐ KÓLÐLà—K‘K ‘N×(Ñ(¨¨Q©Ó/°Ñ2ˆEØ×%Ñ%Ô'¨E×,<Ò,<ÀÈÂÜð !.ç.4©f°V«nó>ð >ð ˆv˜‹Ø˜‘ð	 ñ Ü8=¸f»ÖF°1”u˜VŸ]™]¨1Ó-Õ.ÐFˆGÐFäˆw‹<˜6Ò!ÜÐHÓIÐIä˜“ˆÜ˜“ˆäÑ6¨gÔ6Ð7ˆä�m‰m˜C ¨R°°G¸UÓCˆä7@ÀÓ7I×J©G¨A¨t‘Q�u˜q‘y“\ 4Ñ'ÓJˆŒ	ØˆŒ
àˆ
ùò Gùó Ks   Å!G<ÇHc                 ó    — | j                   d   S ©zEquation defining recurrence.r   r©   r3   s    r'   Ú_recurrencezRecursiveSeq._recurrenceX  ó   € ð �y‰y˜‰|Ðr0   c                 óH   — t        | j                  | j                  d   «      S r  )r   r  r@   r3   s    r'   r  zRecursiveSeq.recurrence]  s   € ô �$—'‘'˜4Ÿ9™9 Q™<Ó(Ð(r0   c                 ó    — | j                   d   S )z*Applied function representing the nth termrO   r©   r3   s    r'   r  zRecursiveSeq.ynb  r  r0   c                 ó.   — | j                   j                  S )z3Undefined function for the nth term of the sequence)r  rL   r3   s    r'   r�   zRecursiveSeq.yg  s   € ð �w‰w�|‰|Ðr0   c                 ó    — | j                   d   S )zSequence index symbolr|   r©   r3   s    r'   rƒ   zRecursiveSeq.nl  r  r0   c                 ó    — | j                   d   S )z"The initial values of the sequencer¾   r©   r3   s    r'   rQ   zRecursiveSeq.initialq  r  r0   c                 ó    — | j                   d   S )r7   é   r©   r3   s    r'   r#   zRecursiveSeq.startv  r  r0   c                 ó"   — t         j                  S )z&The ending point of the sequence. (oo))r   r%   r3   s    r'   r9   zRecursiveSeq.stop{  s   € ô �z‰zÐr0   c                 ó:   — | j                   t        j                  fS )z&Interval on which sequence is defined.)r#   r   r%   r3   s    r'   r*   zRecursiveSeq.interval€  s   € ð —
‘
œAŸJ™JÐ'Ð'r0   c                 ó
  — || j                   z
  t        | j                  «      k  r| j                  | j                  |«         S t	        t        | j                  «      |dz   «      D ]q  }| j                   |z   }| j
                  j                  | j                  |i«      }|j                  | j                  «      }|| j                  | j                  |«      <   Œs | j                  | j                  | j                   z   «         S r±   )r#   r~   r  r�   rs   r  Úxreplacerƒ   )r-   rx   ÚcurrentÚ	seq_indexÚcurrent_recurrenceÚnew_terms         r'   rG   zRecursiveSeq._eval_coeff…  sÒ   € Ø�4—:‘:Ñ¤ D§J¡J£Ò/Ø—:‘:˜dŸf™f U›mÑ,Ð,äœS §¡›_¨e°a©iÓ8ò 	5ˆGð Ÿ
™
 WÑ,ˆIØ!%×!1Ñ!1×!:Ñ!:¸D¿F¹FÀIÐ;NÓ!OÐØ)×2Ñ2°4·:±:Ó>ˆHà,4ˆD�J‰J�t—v‘v˜iÓ(Ò)ð	5ð �z‰z˜$Ÿ&™& §¡¨gÑ!5Ó6Ñ7Ð7r0   c              #   óV   K  — | j                   }	 | j                  |«      –— |dz  }Œ­wr±   )r#   rG   )r-   rx   s     r'   rt   zRecursiveSeq.__iter__”  s1   è ø€ Ø—
‘
ˆØØ×"Ñ" 5Ó)Ò)Ø�Q‰JˆEð ùs   ‚')r¨   )r’   r“   r”   r•   rÃ   r™   r  r  r  r�   rƒ   rQ   r#   r9   r*   rG   rt   r=   r0   r'   rô   rô   Ö  sÍ   „ ñJóX3ðj ñó ðð ñ)ó ð)ð ñó ðð ñó ðð ñó ðð ñó ðð ñó ðð ñó ðð ñ(ó ð(ò8ór0   rô   Nc                 óh   — t        | «      } t        | t        «      rt        | |«      S t	        | |«      S )a  
    Returns appropriate sequence object.

    Explanation
    ===========

    If ``seq`` is a SymPy sequence, returns :class:`SeqPer` object
    otherwise returns :class:`SeqFormula` object.

    Examples
    ========

    >>> from sympy import sequence
    >>> from sympy.abc import n
    >>> sequence(n**2, (n, 0, 5))
    SeqFormula(n**2, (n, 0, 5))
    >>> sequence((1, 2, 3), (n, 0, 5))
    SeqPer((1, 2, 3), (n, 0, 5))

    See Also
    ========

    sympy.series.sequences.SeqPer
    sympy.series.sequences.SeqFormula
    )r   r   r   r¶   rá   )r  rÅ   s     r'   Úsequencer  ›  s1   € ô4 �#‹,€Cä�3œÔÜ�c˜6Ó"Ð"ä˜#˜vÓ&Ð&r0   c                   óp   — e Zd ZdZed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z	ed„ «       Z
y)	Ú	SeqExprOpaá  
    Base class for operations on sequences.

    Examples
    ========

    >>> from sympy.series.sequences import SeqExprOp, sequence
    >>> from sympy.abc import n
    >>> s1 = sequence(n**2, (n, 0, 10))
    >>> s2 = sequence((1, 2, 3), (n, 5, 10))
    >>> s = SeqExprOp(s1, s2)
    >>> s.gen
    (n**2, (1, 2, 3))
    >>> s.interval
    Interval(5, 10)
    >>> s.length
    6

    See Also
    ========

    sympy.series.sequences.SeqAdd
    sympy.series.sequences.SeqMul
    c                 ó:   — t        d„ | j                  D «       «      S )zjGenerator for the sequence.

        returns a tuple of generators of all the argument sequences.
        c              3   ó4   K  — | ]  }|j                   –— Œ y ­wrd   rÉ   ©rø   Úas     r'   rù   z SeqExprOp.gen.<locals>.<genexpr>á  s   è ø€ Ò.˜q�Q—U•UÑ.ùó   ‚)rÂ   r@   r3   s    r'   r4   zSeqExprOp.genÛ  s   € ô Ñ. D§I¡IÔ.Ó.Ð.r0   c                 ó4   — t        d„ | j                  D «       Ž S )zeSequence is defined on the intersection
        of all the intervals of respective sequences
        c              3   ó4   K  — | ]  }|j                   –— Œ y ­wrd   ©r*   r$  s     r'   rù   z%SeqExprOp.interval.<locals>.<genexpr>è  s   è ø€ Ò<¨Q˜aŸj�jÑ<ùr&  )r   r@   r3   s    r'   r*   zSeqExprOp.intervalã  s   € ô
 Ñ<°$·)±)Ô<Ð=Ð=r0   c                 ó.   — | j                   j                  S rd   r¬   r3   s    r'   r#   zSeqExprOp.startê  r­   r0   c                 ó.   — | j                   j                  S rd   r¯   r3   s    r'   r9   zSeqExprOp.stopî  r­   r0   c                 óx   — t        t        | j                  D �cg c]  }|j                  ‘Œ c}«      «      S c c}w )z%Cumulative of all the bound variables)rÂ   r   r@   r>   )r-   r%  s     r'   r>   zSeqExprOp.variablesò  s*   € ô ”W°4·9±9Ö=¨a˜aŸk›kÒ=Ó>Ó?Ð?ùÒ=s   ™7c                 ó:   — | j                   | j                  z
  dz   S r±   r²   r3   s    r'   r;   zSeqExprOp.length÷  r³   r0   N)r’   r“   r”   r•   r™   r4   r*   r#   r9   r>   r;   r=   r0   r'   r!  r!  Â  s�   „ ñð0 ñ/ó ð/ð ñ>ó ð>ð ñ!ó ð!ð ñ!ó ð!ð ñ@ó ð@ð ñ*ó ñ*r0   r!  c                   ó,   — e Zd ZdZd„ Zed„ «       Zd„ Zy)ra   aš  Represents term-wise addition of sequences.

    Rules:
        * The interval on which sequence is defined is the intersection
          of respective intervals of sequences.
        * Anything + :class:`EmptySequence` remains unchanged.
        * Other rules are defined in ``_add`` methods of sequence classes.

    Examples
    ========

    >>> from sympy import EmptySequence, oo, SeqAdd, SeqPer, SeqFormula
    >>> from sympy.abc import n
    >>> SeqAdd(SeqPer((1, 2), (n, 0, oo)), EmptySequence)
    SeqPer((1, 2), (n, 0, oo))
    >>> SeqAdd(SeqPer((1, 2), (n, 0, 5)), SeqPer((1, 2), (n, 6, 10)))
    EmptySequence
    >>> SeqAdd(SeqPer((1, 2), (n, 0, oo)), SeqFormula(n**2, (n, 0, oo)))
    SeqAdd(SeqFormula(n**2, (n, 0, oo)), SeqPer((1, 2), (n, 0, oo)))
    >>> SeqAdd(SeqFormula(n**3), SeqFormula(n**2))
    SeqFormula(n**3 + n**2, (n, 0, oo))

    See Also
    ========

    sympy.series.sequences.SeqMul
    c                 óä  ‡— |j                  dt        j                  «      }t        |«      }ˆfd„Š ‰|«      }|D �cg c]  }|t        j
                  usŒ|‘Œ }}|st        j
                  S t        d„ |D «       Ž t        j                  u rt        j
                  S |rt        j                  |«      S t        t        |t        j                  «      «      }t        j                  | g|¢­Ž S c c}w )NÚevaluatec                 óâ   •— t        | t        «      r3t        | t        «      r t        t	        ‰| j
                  «      g «      S | gS t        | «      rt        t	        ‰| «      g «      S t        d«      ‚©Nz2Input must be Sequences or  iterables of Sequences)r^   r    ra   ÚsumÚmapr@   r   r_   ©ÚargÚ_flattens    €r'   r7  z SeqAdd.__new__.<locals>._flatten   sc   ø€ Ü˜#œwÔ'Ü˜c¤6Ô*Üœs 8¨S¯X©XÓ6¸Ó;Ð;à˜5�LÜ˜Œ}Üœ3˜x¨Ó-¨rÓ2Ð2Üð 6ó 7ð 7r0   c              3   ó4   K  — | ]  }|j                   –— Œ y ­wrd   r)  r$  s     r'   rù   z!SeqAdd.__new__.<locals>.<genexpr>2  ó   è ø€ Ò3¨˜!Ÿ*�*Ñ3ùr&  )Úgetr   r0  Úlistr   r›   r   r�   ra   Úreducer   r    r(   r   rÃ   )rÄ   r@   rò   r0  r%  r7  s        @r'   rÃ   zSeqAdd.__new__  sÇ   ø€ Ø—:‘:˜jÔ*;×*DÑ*DÓEˆô �D‹zˆô		7ñ ˜‹~ˆàÖ<�a 1¬A¯O©OÒ#;’Ð<ˆÐ<ñ Ü—?‘?Ð"äÑ3¨dÔ3Ð4¼¿
¹
ÑBÜ—?‘?Ð"ñ Ü—=‘= Ó&Ð&ä”G˜D¤'×"4Ñ"4Ó5Ó6ˆä�}‰}˜SÐ( 4Ò(Ð(ùò =s   ¾C-ÁC-c                 óP  — d}|rst        | «      D ]b  \  }}d}t        | «      D ]G  \  }}||k(  rŒ|j                  |«      }|€Œ | D �cg c]  }|||fvsŒ
|‘Œ }}|j                  |«        n |sŒ`|}  n |rŒst        | «      dk(  r| j	                  «       S t        | d¬«      S c c}w )a  Simplify :class:`SeqAdd` using known rules.

        Iterates through all pairs and ask the constituent
        sequences if they can simplify themselves with any other constituent.

        Notes
        =====

        adapted from ``Union.reduce``

        TFrO   ©r0  )r   rV   r€   r~   r¹   ra   ©r@   Únew_argsÚid1ÚsÚid2r†   Únew_seqr%  s           r'   r<  zSeqAdd.reduce=  sÈ   € ð ˆÙÜ# D›/ò ‘��QØ �Ü'¨›oò 	‘F�C˜Ø˜c’zØ ØŸf™f Q›i�Gð Ñ*Ø/3Ö#G¨!°qÀÀAÀ²¢AÐ#G˜Ð#GØ Ÿ™¨Ô0Ùð	ò Ø#�DÙðò ô" ˆt‹9˜Š>Ø—8‘8“:Ðä˜$¨Ô/Ð/ùò $Hó   ÁB#ÁB#c                 ó@   ‡— t        ˆfd„| j                  D «       «      S )z9adds up the coefficients of all the sequences at point ptc              3   ó@   •K  — | ]  }|j                  ‰«      –— Œ y ­wrd   )rJ   )rø   r%  rI   s     €r'   rù   z%SeqAdd._eval_coeff.<locals>.<genexpr>c  s   øè ø€ Ò2 1�1—7‘7˜2—;Ñ2ùs   ƒ)r3  r@   rH   s    `r'   rG   zSeqAdd._eval_coeffa  s   ø€ äÓ2¨¯	©	Ô2Ó2Ð2r0   N©r’   r“   r”   r•   rÃ   r˜   r<  rG   r=   r0   r'   ra   ra   ü  s'   „ ñò8")ðH ñ!0ó ð!0óF3r0   ra   c                   ó,   — e Zd ZdZd„ Zed„ «       Zd„ Zy)rn   a'  Represents term-wise multiplication of sequences.

    Explanation
    ===========

    Handles multiplication of sequences only. For multiplication
    with other objects see :func:`SeqBase.coeff_mul`.

    Rules:
        * The interval on which sequence is defined is the intersection
          of respective intervals of sequences.
        * Anything \* :class:`EmptySequence` returns :class:`EmptySequence`.
        * Other rules are defined in ``_mul`` methods of sequence classes.

    Examples
    ========

    >>> from sympy import EmptySequence, oo, SeqMul, SeqPer, SeqFormula
    >>> from sympy.abc import n
    >>> SeqMul(SeqPer((1, 2), (n, 0, oo)), EmptySequence)
    EmptySequence
    >>> SeqMul(SeqPer((1, 2), (n, 0, 5)), SeqPer((1, 2), (n, 6, 10)))
    EmptySequence
    >>> SeqMul(SeqPer((1, 2), (n, 0, oo)), SeqFormula(n**2))
    SeqMul(SeqFormula(n**2, (n, 0, oo)), SeqPer((1, 2), (n, 0, oo)))
    >>> SeqMul(SeqFormula(n**3), SeqFormula(n**2))
    SeqFormula(n**5, (n, 0, oo))

    See Also
    ========

    sympy.series.sequences.SeqAdd
    c                 ó–  ‡— |j                  dt        j                  «      }t        |«      }ˆfd„Š ‰|«      }|st        j
                  S t        d„ |D «       Ž t        j                  u rt        j
                  S |rt        j                  |«      S t        t        |t        j                  «      «      }t        j                  | g|¢­Ž S )Nr0  c                 óâ   •— t        | t        «      r3t        | t        «      r t        t	        ‰| j
                  «      g «      S | gS t        | «      rt        t	        ‰| «      g «      S t        d«      ‚r2  )r^   r    rn   r3  r4  r@   r   r_   r5  s    €r'   r7  z SeqMul.__new__.<locals>._flatten�  sc   ø€ Ü˜#œwÔ'Ü˜c¤6Ô*Üœs 8¨S¯X©XÓ6¸Ó;Ð;à˜5�LÜ˜#”Üœ3˜x¨Ó-¨rÓ2Ð2Üð 6ó 7ð 7r0   c              3   ó4   K  — | ]  }|j                   –— Œ y ­wrd   r)  r$  s     r'   rù   z!SeqMul.__new__.<locals>.<genexpr>   r9  r&  )r:  r   r0  r;  r   r›   r   r�   rn   r<  r   r    r(   r   rÃ   )rÄ   r@   rò   r0  r7  s       @r'   rÃ   zSeqMul.__new__‰  s¤   ø€ Ø—:‘:˜jÔ*;×*DÑ*DÓEˆô �D‹zˆô		7ñ ˜‹~ˆñ Ü—?‘?Ð"äÑ3¨dÔ3Ð4¼¿
¹
ÑBÜ—?‘?Ð"ñ Ü—=‘= Ó&Ð&ä”G˜D¤'×"4Ñ"4Ó5Ó6ˆä�}‰}˜SÐ( 4Ò(Ð(r0   c                 óP  — d}|rst        | «      D ]b  \  }}d}t        | «      D ]G  \  }}||k(  rŒ|j                  |«      }|€Œ | D �cg c]  }|||fvsŒ
|‘Œ }}|j                  |«        n |sŒ`|}  n |rŒst        | «      dk(  r| j	                  «       S t        | d¬«      S c c}w )a.  Simplify a :class:`SeqMul` using known rules.

        Explanation
        ===========

        Iterates through all pairs and ask the constituent
        sequences if they can simplify themselves with any other constituent.

        Notes
        =====

        adapted from ``Union.reduce``

        TFrO   r>  )r   rY   r€   r~   r¹   rn   r?  s           r'   r<  zSeqMul.reduce«  sÈ   € ð  ˆÙÜ# D›/ò ‘��QØ �Ü'¨›oò 	‘F�C˜Ø˜c’zØ ØŸf™f Q›i�Gð Ñ*Ø/3Ö#G¨!°qÀÀAÀ²¢AÐ#G˜Ð#GØ Ÿ™¨Ô0Ùð	ò Ø#�DÙðò ô" ˆt‹9˜Š>Ø—8‘8“:Ðä˜$¨Ô/Ð/ùò $HrE  c                 óT   — d}| j                   D ]  }||j                  |«      z  }Œ |S )z<multiplies the coefficients of all the sequences at point ptrO   )r@   rJ   )r-   rI   Úvalr%  s       r'   rG   zSeqMul._eval_coeffÒ  s1   € àˆØ—‘ò 	ˆAØ�1—7‘7˜2“;Ñ‰Cð	àˆ
r0   NrH  r=   r0   r'   rn   rn   f  s(   „ ñ òD )ðD ñ$0ó ð$0óLr0   rn   rd   )6Úsympy.core.basicr   Úsympy.core.cacher   Úsympy.core.containersr   Úsympy.core.decoratorsr   Úsympy.core.parametersr   Úsympy.core.functionr   r	   Úsympy.core.mulr   Úsympy.core.numbersr   Úsympy.core.relationalr   Úsympy.core.singletonr   r   Úsympy.core.sortingr   Úsympy.core.symbolr   r   r   Úsympy.core.sympifyr   Úsympy.matricesr   Úsympy.polysr   r   Úsympy.sets.setsr   r   Úsympy.tensor.indexedr   Úsympy.utilities.iterablesr   r   r   r    r›   r¦   r¶   rá   rô   r  r!  ra   rn   r=   r0   r'   ú<module>rb     sË   ðÝ "Ý $Ý 'Ý 7Ý 3ß 4Ý Ý &Ý $ß -Ý &ß 1Ñ 1Ý &Ý !ß #ß 2Ý $ß DÑ Dô^=ˆeô ^=ô@"�G yõ "ôJ0"ˆgô 0"ôfN)ˆWô N)ôbqO�ô qOôfB�7ô BóJ'ôN7*�ô 7*ôtg3ˆYô g3ôTqˆYõ qr0   