+
    7åûj�Y  ã                   ó  € R t ^ RIHtHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHtHtHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt RR./tR tR t R t!R t" ! R R]4      t# ! R R]#4      t$RR lt%R# )zFourier Series)ÚooÚpi)ÚWild)ÚExpr)ÚAdd)ÚTuple)ÚS)ÚDummyÚSymbol)Úsympify)ÚsinÚcosÚsinc)Ú
SeriesBase)Ú
SeqFormula)ÚInterval)Úis_sequenceÚ
matplotlibc                ó¦  € ^ RI Hp V^ ,          V^,          V^,          ,
          rT\        ^V,          \        ,          V,          V,          4      p^V,          V! W,          V4      ,          V,          pVP	                  V\
        P                  4      ^,          pV\        ^V,          V! W,          V4      ,          V,          V^\        34      3# )z,Returns the cos sequence in a Fourier series©Ú	integrate)	Úsympy.integralsr   r   r   Úsubsr   ÚZeror   r   )	ÚfuncÚlimitsÚnr   ÚxÚLÚcos_termÚformulaÚa0s	   &&&      ÚPC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\series\fourier.pyÚfourier_cos_seqr#      s¥   € å)Ø�!�9�f˜Q•i &¨¥)Õ+€qÜ�1�Q•3”r•6˜!•8˜a•<Ó €HØ�(�l™Y t¥¸Ó?Õ?À!ÕC€GØ	�‰�aœŸ™Ó	  1Õ	$€BØŒz˜!˜h�,©°4µ?ÀFÓ)KÕKØõØ ! 1¤b˜zó+ð +ð +ó    c                ó  € ^ RI Hp V^ ,          V^,          V^,          ,
          rT\        ^V,          \        ,          V,          V,          4      p\	        ^V,          V! W,          V4      ,          V,          V^\
        34      # )z,Returns the sin sequence in a Fourier seriesr   )r   r   r   r   r   r   )r   r   r   r   r   r   Úsin_terms   &&&    r"   Úfourier_sin_seqr'       si   € å)Ø�!�9�f˜Q•i &¨¥)Õ+€qÜ�1�Q•3”r•6˜!•8˜a•<Ó €HÜ�a˜(•l¡Y¨t­ÀÓ%GÕGØõØ˜q¤"˜:ó'ð 'r$   c                óÌ  € R pRRRrTpVf   V! V 4      \         ) \         rTp\        V\        4      '       d3   \        V4      ^8X  d   Vw  r4pM\        V4      ^8X  d   V! V 4      pVw  rE\	        V\
        4      '       d	   Ve   Vf   \        R\        V4      ,          4      h\        P                  \        P                  .pWF9   g   WV9   d   \        R4      h\        W4V34      # )aÐ  
Limits should be of the form (x, start, stop).
x should be a symbol. Both start and stop should be bounded.

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

* 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.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                 ó¤   € V P                   p\        V4      ^8X  d   VP                  4       # V'       g   \        R4      # \	        RV ,          4      h)é   Úkz¬ 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)))Úfree_symbolsÚlenÚpopr	   Ú
ValueError)r   Úfrees   & r"   Ú_find_xÚ _process_limits.<locals>._find_x@   sN   € Ø× Ñ ˆÜˆt‹9˜Œ>Ø—8‘8“:ÐßÜ˜“:ÐäðPð õóð r$   NzInvalid limits given: %sz.Both the start and end value should be bounded)r   r   r   r-   Ú
isinstancer
   r/   Ústrr   ÚNegativeInfinityÚInfinityr   )r   r   r1   r   ÚstartÚstopÚ	unboundeds   &&     r"   Ú_process_limitsr:   )   sÍ   € ò.ð ˜4 ˆd€AØ‚~Ù  ›¬¨¬R�$ˆÜ�6œ5×!Ò!Üˆv‹;˜!ÔØ#‰NˆA‘dÜ�‹[˜AÔÙ˜“ˆAØ ‰KˆEä�aœ× Ò  E¢M°T²\ÜÐ3´c¸&³kÕAÓBÐBä×#Ñ#¤Q§Z¡ZÐ0€IØÔ˜TÔ.ÜÐIÓJÐJä�A˜dÐ#Ó$Ð$r$   c                 óx  aaa€ R  pVV3R lp^ RI HpHpHp V! V! V! V 4      4      4      pVP	                  4       p	\        RR R .R7      o\        RV3R l.R7      oV	^,           FL  p
V
P                  4       ^,          pV F,  pV! VS4      '       d   K  V! VSV4      '       d   K&  R	V 3u u # 	  KN  	  R
V3# )c                 ó   € WP                   9  # ©N©r,   )Úexprsr   s   &&r"   Úcheck_fxÚfinite_check.<locals>.check_fxc   s   € Ø×*Ñ*Ñ*Ð*r$   c                 óÔ   <€ \        V \        \        34      '       dK   V P                  ^ ,          pVP	                  S\
        V,          ,          V,          S,           4      e   R# R# R# )é    NTF)r3   r   r   ÚargsÚmatchr   )Ú_exprr   r   Úsincos_argsÚaÚbs   &&& €€r"   Úcheck_sincosÚ"finite_check.<locals>.check_sincosf   sM   ø€ Ü�eœc¤3˜Z×(Ò(ØŸ*™* Q�-ˆKà× Ñ  ¤B q¥D¥¨!¥¨a¥Ó0Ò<Ùáñ )r$   )ÚTR2ÚTR1Úsincos_to_sumrH   c                 ó   € V P                   # r=   ©Ú
is_Integer©r+   s   &r"   Ú<lambda>Úfinite_check.<locals>.<lambda>s   s   € ¨¯ªr$   c                 ó(   € V \         P                  8g  # r=   ©r   r   rR   s   &r"   rS   rT   s   s   € ÀÄQÇVÁVÂr$   ©Ú
propertiesrI   c                 ó"   <€ SV P                   9  # r=   r>   ©r+   r   s   &€r"   rS   rT   t   s   ø€ ¨°·±Ò(?r$   FT)Úsympy.simplify.furL   rM   rN   Úas_coeff_addr   Úas_coeff_mul)Úfr   r   r@   rJ   rL   rM   rN   rF   Ú	add_coeffÚsÚ
mul_coeffsÚtrH   rI   s   &f&          @@r"   Úfinite_checkrc   a   s±   ú€ ò+ö÷ :Ñ9Ù™#™c !›f›+Ó&€EØ×"Ñ"Ó$€IäˆSÑ4Ñ6KÐNÔO€AÜˆSÔ?ÐBÔC€Aà�q�\ˆ\ˆØ—^‘^Ó% aÕ(ˆ
ÛˆAÙ˜Q —N”N¡l°1°a¸×&;Ô&;Ø˜a�x”ó ñ ð �ˆ;Ðr$   c                   ó*  a € ] tR t^t o RtR t]R 4       t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       tR tRR ltRR ltR tR tR tR tR tR tR tR tR tRtV tR# )ÚFourierSeriesa  Represents Fourier sine/cosine series.

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

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                óR   € \        \        V4      p\        P                  ! V .VO5!  # r=   )Úmapr   r   Ú__new__)ÚclsrD   s   &*r"   rh   ÚFourierSeries.__new__�   s"   € Ü”7˜DÓ!ˆÜ�|Š|˜CÐ' $Ó'Ð'r$   c                ó(   € V P                   ^ ,          # ©rC   ©rD   ©Úselfs   &r"   ÚfunctionÚFourierSeries.function”   s   € à�y‰y˜�|Ðr$   c                ó6   € V P                   ^,          ^ ,          # ©r*   rm   rn   s   &r"   r   ÚFourierSeries.x˜   ó   € à�y‰y˜�|˜A�Ðr$   c                ój   € V P                   ^,          ^,          V P                   ^,          ^,          3# rs   rm   rn   s   &r"   ÚperiodÚFourierSeries.periodœ   s%   € à—	‘	˜!•˜Q• §¡¨1¥¨a¥Ð1Ð1r$   c                ó6   € V P                   ^,          ^ ,          # ©é   rm   rn   s   &r"   r!   ÚFourierSeries.a0    ru   r$   c                ó6   € V P                   ^,          ^,          # rz   rm   rn   s   &r"   ÚanÚFourierSeries.an¤   ru   r$   c                ó6   € V P                   ^,          ^,          # rz   rm   rn   s   &r"   ÚbnÚFourierSeries.bn¨   ru   r$   c                ó"   € \        ^ \        4      # rl   )r   r   rn   s   &r"   ÚintervalÚFourierSeries.interval¬   s   € ä˜œ2‹Ðr$   c                ó.   € V P                   P                  # r=   )r„   Úinfrn   s   &r"   r7   ÚFourierSeries.start°   ó   € à�}‰}× Ñ Ð r$   c                ó.   € V P                   P                  # r=   )r„   Úsuprn   s   &r"   r8   ÚFourierSeries.stop´   r‰   r$   c                ó   € \         # r=   )r   rn   s   &r"   ÚlengthÚFourierSeries.length¸   s   € äˆ	r$   c                óx   € \        V P                  ^,          V P                  ^ ,          ,
          4      ^,          # rs   )Úabsrw   rn   s   &r"   r   ÚFourierSeries.L¼   s'   € ä�4—;‘;˜q•> D§K¡K°¥NÕ2Ó3°aÕ7Ð7r$   c                óP   € V P                   pVP                  V4      '       d   V # R # r=   )r   Úhas)ro   ÚoldÚnewr   s   &&& r"   Ú
_eval_subsÚFourierSeries._eval_subsÀ   s"   € Ø�F‰FˆØ�7‰7�1�:Š:ØˆKñ r$   c                óº   € Vf   \        V 4      # . pV  F<  p\        V4      V8X  d    M+V\        P                  Jg   K+  VP	                  V4       K>  	  \        V!  # )a%  
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
)Úiterr-   r   r   Úappendr   )ro   r   Útermsrb   s   &&  r"   ÚtruncateÚFourierSeries.truncateÅ   sS   € ð@ Š9Ü˜“:ÐàˆÛˆAÜ�5‹z˜QŒÙØœŸ™�Ø—‘˜Q–ñ	 ô �E‰{Ðr$   c                óÒ   € \        V RV 4       UUu. uF?  w  r#V\        P                  Jg   K  \        \        V,          V,          4      V,          NKA  	  ppp\        V!  # u uppi )a�  
Return :math:`\sigma`-approximation of Fourier series with respect
to order n.

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

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
N)Ú	enumerater   r   r   r   r   )ro   r   Úirb   rœ   s   &&   r"   Úsigma_approximationÚ!FourierSeries.sigma_approximationñ   s`   € ôD 3<¸DÀÀ!¸HÔ2Eô %Ñ2E©$¨!ØœQŸV™V�Oô &””b˜1•f˜q•jÓ! A×%Ð%Ñ2Eˆñ %ä�E‰{Ðùó%s
   ’A#¯(A#c                ó2  € \        V4      V P                  r!W!P                  9   d   \        RV: RV: 24      hV P                  V,           pV P
                  V,           pV P                  W@P                  ^,          W0P                  V P                  34      # )aZ  
Shift the function by a term independent of x.

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

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
Ú'ú' should be independent of )
r   r   r,   r/   r!   rp   r   rD   r~   r�   )ro   r`   r   r!   Úsfuncs   &&   r"   ÚshiftÚFourierSeries.shift7  sn   € ô* �q‹z˜4Ÿ6™6ˆ1à—‘ÔÝÃ1ÂaÐHÓIÐIà�W‰W�q�[ˆØ—‘ Õ!ˆà�y‰y˜§	¡	¨!¥¨r·7±7¸D¿G¹GÐ.DÓEÐEr$   c                óž  € \        V4      V P                  r!W!P                  9   d   \        RV: RV: 24      hV P                  P                  W"V,           4      pV P                  P                  W"V,           4      pV P                  P                  W"V,           4      pV P                  WPP                  ^,          V P                  W434      # )aT  
Shift x by a term independent of x.

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

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
r¥   r¦   ©r   r   r,   r/   r~   r   r�   rp   r   rD   r!   ©ro   r`   r   r~   r�   r§   s   &&    r"   ÚshiftxÚFourierSeries.shiftxV  ó“   € ô* �q‹z˜4Ÿ6™6ˆ1à—‘ÔÝÃ1ÂaÐHÓIÐIà�W‰W�\‰\˜! �UÓ#ˆØ�W‰W�\‰\˜! �UÓ#ˆØ—‘×"Ñ" 1¨!¥eÓ,ˆà�y‰y˜§	¡	¨!¥¨t¯w©w¸Ð.?Ó@Ð@r$   c                ó„  € \        V4      V P                  r!W!P                  9   d   \        RV: RV: 24      hV P                  P                  V4      pV P                  P                  V4      pV P                  V,          pV P                  ^ ,          V,          pV P                  W`P                  ^,          WSV34      # )aZ  
Scale the function by a term independent of x.

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

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
r¥   r¦   )
r   r   r,   r/   r~   Ú	coeff_mulr�   r!   rD   r   )ro   r`   r   r~   r�   r!   r§   s   &&     r"   ÚscaleÚFourierSeries.scalev  s‘   € ô* �q‹z˜4Ÿ6™6ˆ1à—‘ÔÝÃ1ÂaÐHÓIÐIà�W‰W×Ñ˜qÓ!ˆØ�W‰W×Ñ˜qÓ!ˆØ�W‰W�q�[ˆØ—	‘	˜!•˜qÕ ˆà�y‰y˜§	¡	¨!¥¨r°r¨lÓ;Ð;r$   c                óž  € \        V4      V P                  r!W!P                  9   d   \        RV: RV: 24      hV P                  P                  W"V,          4      pV P                  P                  W"V,          4      pV P                  P                  W"V,          4      pV P                  WPP                  ^,          V P                  W434      # )aL  
Scale x by a term independent of x.

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

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
r¥   r¦   r«   r¬   s   &&    r"   ÚscalexÚFourierSeries.scalex—  r¯   r$   c                óH   € V  F  pV\         P                  Jg   K  Vu # 	  R # r=   rV   )ro   r   ÚlogxÚcdirrb   s   &&&& r"   Ú_eval_as_leading_termÚ#FourierSeries._eval_as_leading_term·  s   € ÛˆAØœŸ™�Ø’ó r$   c                óž   € V^ 8X  d   V P                   # V P                  P                  V4      V P                  P                  V4      ,           # rl   )r!   r~   Úcoeffr�   )ro   Úpts   &&r"   Ú
_eval_termÚFourierSeries._eval_term¼  s7   € Ø�Œ7Ø—7‘7ˆNØ�w‰w�}‰}˜RÓ  4§7¡7§=¡=°Ó#4Õ4Ð4r$   c                ó$   € V P                  R4      # )r*   éÿÿÿÿ)r²   rn   s   &r"   Ú__neg__ÚFourierSeries.__neg__Á  s   € Ø�z‰z˜"‹~Ðr$   c                óJ  € \        V\        4      '       Ed   V P                  VP                  8w  d   \        R 4      hV P                  VP                  r2V P
                  VP
                  P                  W24      ,           pV P                  VP                  9  d   V# V P                  VP                  ,           pV P                  VP                  ,           pV P                  VP                  ,           pV P                  W@P                  ^,          WuV34      # \        W4      # )ú(Both the series should have same periods)r3   re   rw   r/   r   rp   r   r,   r~   r�   r!   r   rD   r   )ro   Úotherr   Úyrp   r~   r�   r!   s   &&      r"   Ú__add__ÚFourierSeries.__add__Ä  sÌ   € Ü�eœ]×+Ó+Ø�{‰{˜eŸl™lÔ*Ü Ð!KÓLÐLà—6‘6˜5Ÿ7™7ˆqØ—}‘} u§~¡~×':Ñ':¸1Ó'@Õ@ˆHà�v‰v˜X×2Ñ2Ô2Ø�à—‘˜5Ÿ8™8Õ#ˆBØ—‘˜5Ÿ8™8Õ#ˆBØ—‘˜5Ÿ8™8Õ#ˆBà—9‘9˜X§y¡y°¥|°b¸b°\ÓBÐBä�4ÓÐr$   c                ó&   € V P                  V) 4      # r=   )rÉ   )ro   rÇ   s   &&r"   Ú__sub__ÚFourierSeries.__sub__×  s   € Ø�|‰|˜U˜FÓ#Ð#r$   © N)é   ) Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rh   Úpropertyrp   r   rw   r!   r~   r�   r„   r7   r8   rŽ   r   r—   r�   r¢   r¨   r­   r²   rµ   rº   r¿   rÃ   rÉ   rÌ   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r"   re   re      s5  ø‡ € ñò (ð ñó ðð ñó ðð ñ2ó ð2ð ñó ðð ñó ðð ñó ðð ñó ðð ñ!ó ð!ð ñ!ó ð!ð ñó ðð ñ8ó ð8òô
*ôXDòLFò>Aò@<òBAò@ò
5ò
ò ÷&$ð $r$   re   c                   óh   a € ] tR tRt o RtR t]R 4       t]R 4       tR t	R t
R tR	 tR
 tRtV tR# )ÚFiniteFourierSeriesiÛ  a‘  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           	     óŒ  a€ \        V4      p\        V4      p\        V4      p\        V\        4      '       d   \        V4      ^8X  Egá   TP	                  4       w  rE^ RIHp T\        V Uu. uF
  qv! V4      NK  	  up!  ,           pVP                  RRRRR7      P	                  4       w  ršV^ ,          o\        V^,          V^,          ,
          4      ^,          p\        RR R .R7      p\        RV3R	 l.R7      p/ p/ pV
 EF  pVP                  V\        V\        V,          ,          S,          4      ,          4      pVP                  V\        V\        V,          ,          S,          4      ,          4      pV'       dB   VV,          VP                  VV,          \         P"                  4      ,           VVV,          &   KÁ  V'       dC   VV,          VP                  VV,          \         P"                  4      ,           VVV,          &   EK  V	V,          p	EK  	  \        WžV4      p\$        P&                  ! WW#4      # u upi )
rÏ   )ÚTR10F)ÚtrigÚ
power_baseÚ	power_expÚlogrH   c                 ó   € V P                   # r=   rP   rR   s   &r"   rS   Ú-FiniteFourierSeries.__new__.<locals>.<lambda>  s   € °·²r$   c                 ó&   € V \         P                  J# r=   rV   rR   s   &r"   rS   rã     s   € ÈÔQR×QWÑQWÉr$   rW   rI   c                 ó"   <€ SV P                   9  # r=   r>   rZ   s   &€r"   rS   rã     s   ø€ °¸¿¹Ò0Gr$   )r   r3   r   r-   r\   r[   rÝ   r   Úexpandr‘   r   rE   r   r   r   Úgetr   r   r   rh   )ri   r^   r   r?   ÚcÚerÝ   r¡   Úrexprr!   Úexp_lsr   rH   rI   r~   r�   Úprb   Úqr   s   &&&&               @r"   rh   ÚFiniteFourierSeries.__new__  s¹  ø€ Ü�A‹JˆÜ˜“ˆÜ˜“ˆä˜5¤%×(Ò(¬S°«Z¸1­_à×%Ñ%Ó'‰DˆAÝ.Øœ©qÓ1©q¨!˜d 1žg©qÑ1Ñ2Õ2ˆEØŸ™¨5¸UÈeÐY^˜Ó_×lÑlÓn‰JˆBà�q•	ˆAÜ�F˜1•I  q¥	Õ)Ó*¨QÕ.ˆAä�SÑ&<Ñ>WÐ%ZÔ[ˆAÜ�SÔ&GÐ%JÔKˆAàˆBØˆBô �Ø—G‘G˜A¤ A¬¨a­¥L°1Õ$4Ó 5Õ5Ó6�Ø—G‘G˜A¤ A¬¨a­¥L°1Õ$4Ó 5Õ5Ó6�ßØ  �t b§f¡f¨Q¨q­T´1·6±6Ó&:Õ:�B�q˜•t“HßØ  �t b§f¡f¨Q¨q­T´1·6±6Ó&:Õ:�B�q˜•t”Hà˜!•G“Bñ ô ˜" "Ó%ˆEä�|Š|˜C FÓ2Ð2ùò3 2s   Á,I
c           	     ó  € V P                   '       d   ^M^ pV\        \        V P                  P	                  4       4      P                  \        V P                  P	                  4       4      4      4      ^,           ,          p\        ^ V4      # rs   )r!   ÚmaxÚsetr~   ÚkeysÚunionr�   r   )ro   Ú_lengths   & r"   r„   ÚFiniteFourierSeries.interval&  s[   € à—w—w�w‘! AˆØ”3”s˜4Ÿ7™7Ÿ<™<›>Ó*×0Ñ0´°T·W±W·\±\³^Ó1DÓEÓFÈÕJÕJˆÜ˜˜7Ó#Ð#r$   c                ó<   € V P                   V P                  ,
          # r=   )r8   r7   rn   s   &r"   rŽ   ÚFiniteFourierSeries.length,  s   € à�y‰y˜4Ÿ:™:Õ%Ð%r$   c                óJ  € \        V4      V P                  r!W!P                  9   d   \        R V: RV: 24      hV P	                  4       P                  W"V,           4      pV P                  P                  W"V,           4      pV P                  W@P                  ^,          V4      # ©r¥   r¦   ©	r   r   r,   r/   r�   r   rp   r   rD   ©ro   r`   r   rF   r§   s   &&   r"   r­   ÚFiniteFourierSeries.shiftx0  óv   € Ü�q‹z˜4Ÿ6™6ˆ1à—‘ÔÝÃ1ÂaÐHÓIÐIà—‘“×$Ñ$ Q¨A­Ó.ˆØ—‘×"Ñ" 1¨!¥eÓ,ˆà�y‰y˜§	¡	¨!¥¨eÓ4Ð4r$   c                ó  € \        V4      V P                  r!W!P                  9   d   \        R V: RV: 24      hV P	                  4       V,          pV P
                  V,          pV P                  W@P                  ^,          V4      # rù   )r   r   r,   r/   r�   rp   r   rD   rû   s   &&   r"   r²   ÚFiniteFourierSeries.scale;  sb   € Ü�q‹z˜4Ÿ6™6ˆ1à—‘ÔÝÃ1ÂaÐHÓIÐIà—‘“ !Õ#ˆØ—‘ Õ!ˆà�y‰y˜§	¡	¨!¥¨eÓ4Ð4r$   c                óJ  € \        V4      V P                  r!W!P                  9   d   \        R V: RV: 24      hV P	                  4       P                  W"V,          4      pV P                  P                  W"V,          4      pV P                  W@P                  ^,          V4      # rù   rú   rû   s   &&   r"   rµ   ÚFiniteFourierSeries.scalexF  rý   r$   c                óÒ  € V^ 8X  d   V P                   # V P                  P                  V\        P                  4      \        V\        V P                  ,          ,          V P                  ,          4      ,          V P                  P                  V\        P                  4      \        V\        V P                  ,          ,          V P                  ,          4      ,          ,           pV# rl   )r!   r~   rç   r   r   r   r   r   r   r�   r   )ro   r¾   Ú_terms   && r"   r¿   ÚFiniteFourierSeries._eval_termQ  s‹   € Ø�Œ7Ø—7‘7ˆNà—‘—‘˜B¤§¡Ó'¬#¨b´B¸¿¹µKÕ.@À4Ç6Á6Õ.IÓ*JÕJØ—'‘'—+‘+˜b¤!§&¡&Ó)¬C°´b¸4¿6¹6µkÕ0BÀTÇVÁVÕ0KÓ,LÕLõMˆàˆr$   c                ó  € \        V\        4      '       d9   VP                  \        V P                  V P
                  ^,          RR7      4      # \        V\        4      '       d¤   V P                  VP                  8w  d   \        R4      hV P                  VP                  r2V P                  VP                  P                  W24      ,           pV P                  VP                  9  d   V# \        W@P
                  ^,          R7      # R# )r*   F)ÚfiniterÆ   )r   N)r3   re   rÉ   Úfourier_seriesrp   rD   rÛ   rw   r/   r   r   r,   )ro   rÇ   r   rÈ   rp   s   &&   r"   rÉ   ÚFiniteFourierSeries.__add__Y  s¿   € Ü�eœ]×+Ò+Ø—=‘=¤°·±¸t¿y¹yÈ½|Ø7<ô">ó ?ð ?ä˜Ô2×3Ò3Ø�{‰{˜eŸl™lÔ*Ü Ð!KÓLÐLà—6‘6˜5Ÿ7™7ˆqØ—}‘} u§~¡~×':Ñ':¸1Ó'@Õ@ˆHà�v‰v˜X×2Ñ2Ô2Ø�ä! (·9±9¸Qµ<Ô@Ð@ñ 4r$   rÎ   N)rÐ   rÑ   rÒ   rÓ   rÔ   rh   rÕ   r„   rŽ   r­   r²   rµ   r¿   rÉ   rÖ   r×   rØ   s   @r"   rÛ   rÛ   Û  sY   ø‡ € ñ$òL"3ðH ñ$ó ð$ð
 ñ&ó ð&ò	5ò	5ò	5ò÷Að Ar$   rÛ   Nc                óÞ  € \        V 4      p \        W4      pV^ ,          pW0P                  9  d   V # V'       dJ   \        V^,          V^,          ,
          4      ^,          p\	        WV4      w  rVV'       d   \        WV4      # \        R4      pV^,          V^,          ,           ^,          pVP                  '       dŠ   V P                  W3) 4      p	W	8X  d/   \        WV4      w  r«\        ^ ^\        34      p\        WW«V34      # W	) 8X  d=   \        P                  p
\        ^ ^\        34      p\        WV4      p\        WW«V34      # \        WV4      w  r«\        WV4      p\        WW«V34      # )a„  Computes the Fourier trigonometric series expansion.

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

Fourier trigonometric series of $f(x)$ over the interval $(a, b)$
is defined as:

.. math::
    \frac{a_0}{2} + \sum_{n=1}^{\infty}
    (a_n \cos(\frac{2n \pi x}{L}) + b_n \sin(\frac{2n \pi x}{L}))

where the coefficients are:

.. math::
    L = b - a

.. math::
    a_0 = \frac{2}{L} \int_{a}^{b}{f(x) dx}

.. math::
    a_n = \frac{2}{L} \int_{a}^{b}{f(x) \cos(\frac{2n \pi x}{L}) dx}

.. math::
    b_n = \frac{2}{L} \int_{a}^{b}{f(x) \sin(\frac{2n \pi x}{L}) dx}

The condition whether the function $f(x)$ given should be periodic
or not is more than necessary, because it is sufficient to consider
the series to be converging to $f(x)$ only in the given interval,
not throughout the whole real line.

This also brings a lot of ease for the computation because
you do not have to make $f(x)$ artificially periodic by
wrapping it with piecewise, modulo operations,
but you can shape the function to look like the desired periodic
function only in the interval $(a, b)$, and the computed series will
automatically become the series of the periodic version of $f(x)$.

This property is illustrated in the examples section below.

Parameters
==========

limits : (sym, start, end), optional
    *sym* denotes the symbol the series is computed with respect to.

    *start* and *end* denotes the start and the end of the interval
    where the fourier series converges to the given function.

    Default range is specified as $-\pi$ and $\pi$.

Returns
=======

FourierSeries
    A symbolic object representing the Fourier trigonometric series.

Examples
========

Computing the Fourier series of $f(x) = x^2$:

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

Shifting of the Fourier series:

>>> 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 of the Fourier series:

>>> 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

Computing the Fourier series of $f(x) = x$:

This illustrates how truncating to the higher order gives better
convergence.

.. plot::
    :context: reset
    :format: doctest
    :include-source: True

    >>> from sympy import fourier_series, pi, plot
    >>> from sympy.abc import x
    >>> f = x
    >>> s = fourier_series(f, (x, -pi, pi))
    >>> s1 = s.truncate(n = 3)
    >>> s2 = s.truncate(n = 5)
    >>> s3 = s.truncate(n = 7)
    >>> p = plot(f, s1, s2, s3, (x, -pi, pi), show=False, legend=True)

    >>> p[0].line_color = (0, 0, 0)
    >>> p[0].label = 'x'
    >>> p[1].line_color = (0.7, 0.7, 0.7)
    >>> p[1].label = 'n=3'
    >>> p[2].line_color = (0.5, 0.5, 0.5)
    >>> p[2].label = 'n=5'
    >>> p[3].line_color = (0.3, 0.3, 0.3)
    >>> p[3].label = 'n=7'

    >>> p.show()

This illustrates how the series converges to different sawtooth
waves if the different ranges are specified.

.. plot::
    :context: close-figs
    :format: doctest
    :include-source: True

    >>> s1 = fourier_series(x, (x, -1, 1)).truncate(10)
    >>> s2 = fourier_series(x, (x, -pi, pi)).truncate(10)
    >>> s3 = fourier_series(x, (x, 0, 1)).truncate(10)
    >>> p = plot(x, s1, s2, s3, (x, -5, 5), show=False, legend=True)

    >>> p[0].line_color = (0, 0, 0)
    >>> p[0].label = 'x'
    >>> p[1].line_color = (0.7, 0.7, 0.7)
    >>> p[1].label = '[-1, 1]'
    >>> p[2].line_color = (0.5, 0.5, 0.5)
    >>> p[2].label = '[-pi, pi]'
    >>> p[3].line_color = (0.3, 0.3, 0.3)
    >>> p[3].label = '[0, 1]'

    >>> p.show()

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] https://mathworld.wolfram.com/FourierSeries.html
r   )r   r:   r,   r‘   rc   rÛ   r	   Úis_zeror   r#   r   r   re   r   r   r'   )r^   r   r  r   r   Ú	is_finiteÚres_fr   ÚcenterÚneg_fr!   r~   r�   s   &&&          r"   r  r  j  sB  € ôH 	�‹
€Aä˜QÓ'€FØˆq�	€Aà—‘ÔØˆçÜ��q•	˜F 1�IÕ%Ó&¨Õ*ˆÜ'¨¨aÓ0Ñˆ	ßÜ& q°%Ó8Ð8äˆc‹
€AØ�Q�i˜& �)Õ# qÕ(€FØ‡~‡~€~Ø—‘�q˜"“ˆØŒ:Ü$ Q°Ó2‰FˆBÜ˜A ¤2˜wÓ'ˆBÜ  ¨R°R¨LÓ9Ð9Ø�&Œ[Ü—‘ˆBÜ˜A ¤2˜wÓ'ˆBÜ  ¨AÓ.ˆBÜ  ¨R°R¨LÓ9Ð9Ü˜Q¨Ó*�F€BÜ	˜ AÓ	&€BÜ˜ R¨R LÓ1Ð1r$   )r  )NT)&rÔ   Úsympy.core.numbersr   r   Úsympy.core.symbolr   Úsympy.core.exprr   Úsympy.core.addr   Úsympy.core.containersr   Úsympy.core.singletonr   r	   r
   Úsympy.core.sympifyr   Ú(sympy.functions.elementary.trigonometricr   r   r   Úsympy.series.series_classr   Úsympy.series.sequencesr   Úsympy.sets.setsr   Úsympy.utilities.iterablesr   Ú__doctest_requires__r#   r'   r:   rc   re   rÛ   r  rÎ   r$   r"   Ú<module>r     s|   ðÙ ç 'Ý "Ý  Ý Ý 'Ý "ß +Ý &ß CÑ CÝ 0Ý -Ý $Ý 1ð ,¨l¨^Ð<Ð ò+ò'ò5%òpô<Y$�Jô Y$ôx
LA˜-ô LAö^A2r$   