§ <ˆjg™ãób—dZddlZddlZddlZddlZddlmZdgZ Gd„dej ¦«Z dS)a Abstract base class for the various polynomial Classes. The ABCPolyBase class provides the methods needed to implement the common API for the various polynomial classes. It operates as a mixin, but uses the abc module from the stdlib, hence it is only available for Python >= 2.6. éNé)Ú polyutilsÚ ABCPolyBasec ó¦—eZdZdZdZdZdZe dddddd d d d d dœ ¦«Z e dddddddddddœ ¦«Z e j dk Z ed„¦«Zeejd„¦«¦«Zeejd„¦«¦«Zeejd„¦«¦«Zeejd„¦«¦«Zeejd„¦«¦«Zeejd „¦«¦«Zeejd!„¦«¦«Zeejdfd"„¦«¦«Zeejd#„¦«¦«Zeejd$„¦«¦«Zeejd%„¦«¦«Zeejd&„¦«¦«Zeejd'„¦«¦«Zeejd(„¦«¦«Z eejd)„¦«¦«Z!d*„Z"d+„Z#d,„Z$d-„Z%d.„Z&dgd0„Z'd1„Z(d2„Z)d3„Z*d4„Z+e,d5„¦«Z-e,d6„¦«Z.e,d7„¦«Z/edhd9„¦«Z0d:„Z1d;„Z2d<„Z3d=„Z4d>„Z5d?„Z6d@„Z7dA„Z8dB„Z9dC„Z:dD„Z;dE„ZdH„Z?dI„Z@dJ„ZAdK„ZBdL„ZCdM„ZDdN„ZEdO„ZFdP„ZGdQ„ZHdR„ZIdS„ZJdT„ZKdU„ZLdV„ZMdidX„ZNdY„ZOdjdZ„ZPd[„ZQd\gdfd]„ZRdkd^„ZSd_„ZTdld`„ZUe, dmda„¦«ZVe,gdd/fdb„¦«ZWe,dgdc„¦«ZXe,dgdd„¦«ZYe,dnde„¦«ZZdS)oraAn abstract base class for immutable series classes. ABCPolyBase provides the standard Python numerical methods '+', '-', '*', '//', '%', 'divmod', '**', and '()' along with the methods listed below. .. versionadded:: 1.9.0 Parameters ---------- coef : array_like Series coefficients in order of increasing degree, i.e., ``(1, 2, 3)`` gives ``1*P_0(x) + 2*P_1(x) + 3*P_2(x)``, where ``P_i`` is the basis polynomials of degree ``i``. domain : (2,) array_like, optional Domain to use. The interval ``[domain[0], domain[1]]`` is mapped to the interval ``[window[0], window[1]]`` by shifting and scaling. The default value is the derived class domain. window : (2,) array_like, optional Window, see domain for its use. The default value is the derived class window. symbol : str, optional Symbol used to represent the independent variable in string representations of the polynomial expression, e.g. for printing. The symbol must be a valid Python identifier. Default value is 'x'. .. versionadded:: 1.24 Attributes ---------- coef : (N,) ndarray Series coefficients in order of increasing degree. domain : (2,) ndarray Domain that is mapped to window. window : (2,) ndarray Window that domain is mapped to. symbol : str Symbol representing the independent variable. Class Attributes ---------------- maxpower : int Maximum power allowed, i.e., the largest number ``n`` such that ``p(x)**n`` is allowed. This is to limit runaway polynomial size. domain : (2,) ndarray Default domain of the class. window : (2,) ndarray Default window of the class. Néduâ�°õ¹õ²õ³uâ�´uâ�µuâ�¶uâ�·uâ�¸uâ�¹) Ú0Ú1Ú2Ú3Ú4Ú5Ú6Ú7Ú8Ú9uâ‚€uâ‚�uâ‚‚u₃uâ‚„uâ‚…u₆u₇u₈u₉Úntcó—|jS©N)Ú_symbol©Úselfs úQ/opt/cloudlinux/venv/lib64/python3.11/site-packages/numpy/polynomial/_polybase.pyÚsymbolzABCPolyBase.symbolns €àŒ|Ðócó—dSr©rs rÚdomainzABCPolyBase.domainró €ð ˆrcó—dSrrrs rÚwindowzABCPolyBase.windowwr!rcó—dSrrrs rÚ basis_namezABCPolyBase.basis_name|r!rcó—dSrr©Úc1Úc2s rÚ_addzABCPolyBase._add�r!rcó—dSrrr's rÚ_subzABCPolyBase._sub†r!rcó—dSrrr's rÚ_mulzABCPolyBase._mul‹r!rcó—dSrrr's rÚ_divzABCPolyBase._div�r!rcó—dSrr)ÚcÚpowÚmaxpowers rÚ_powzABCPolyBase._pow•r!rcó—dSrr)Úxr2s rÚ_valzABCPolyBase._valšr!rcó—dSrr)r2ÚmÚkÚlbndÚscls rÚ_intzABCPolyBase._intŸr!rcó—dSrr)r2r:r=s rÚ_derzABCPolyBase._der¤r!rcó—dSrr)r7ÚyÚdegÚrcondÚfulls rÚ_fitzABCPolyBase._fit©r!rcó—dSrr)Úoffr=s rÚ_linezABCPolyBase._line®r!rcó—dSrr)r2s rÚ_rootszABCPolyBase._roots³r!rcó—dSrr)Úrs rÚ _fromrootszABCPolyBase._fromroots¸r!rcó¦—t|j¦«t|j¦«krdStj|j|jk¦«sdSdS)aGCheck if coefficients match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``coef`` attribute. Returns ------- bool : boolean True if the coefficients are the same, False otherwise. FT)ÚlenÚcoefÚnpÚall©rÚothers rÚ has_samecoefzABCPolyBase.has_samecoef½sI€õ ˆtŒy‰>Œ>�S ¤™_œ_Ò ,Ð ,Ø�5Ý”˜œ  U¤ZÒ/Ñ0Ô0ð Ø�5à�4rcóF—tj|j|jk¦«S)a?Check if domains match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``domain`` attribute. Returns ------- bool : boolean True if the domains are the same, False otherwise. )rRrSr rTs rÚhas_samedomainzABCPolyBase.has_samedomainÔó€õ Œv�d”k U¤\Ò1Ñ2Ô2Ð2rcóF—tj|j|jk¦«S)a?Check if windows match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``window`` attribute. Returns ------- bool : boolean True if the windows are the same, False otherwise. )rRrSr#rTs rÚhas_samewindowzABCPolyBase.has_samewindowærYrcó,—t||j¦«S)aCheck if types match. .. versionadded:: 1.7.0 Parameters ---------- other : object Class instance. Returns ------- bool : boolean True if other is same class as self )Ú isinstanceÚ __class__rTs rÚ has_sametypezABCPolyBase.has_sametypeøs€õ ˜% ¤Ñ0Ô0Ð0rcóˆ—t|t¦«r¬t||j¦«std¦«‚t j|j|jk¦«std¦«‚t j|j|jk¦«std¦«‚|j|jkrtd¦«‚|j S|S)a‘Interpret other as polynomial coefficients. The `other` argument is checked to see if it is of the same class as self with identical domain and window. If so, return its coefficients, otherwise return `other`. .. versionadded:: 1.9.0 Parameters ---------- other : anything Object to be checked. Returns ------- coef The coefficients of`other` if it is a compatible instance, of ABCPolyBase, otherwise `other`. Raises ------ TypeError When `other` is an incompatible instance of ABCPolyBase. zPolynomial types differzDomains differzWindows differzPolynomial symbols differ) r]rr^Ú TypeErrorrRrSr r#rÚ ValueErrorrQrTs rÚ_get_coefficientszABCPolyBase._get_coefficients s¸€õ4 �e�[Ñ )Ô )ð ݘe T¤^Ñ4Ô4ð >ÝÐ 9Ñ:Ô:Ð:Ý”V˜DœK¨5¬<Ò7Ñ8Ô8ð >ÝÐ 0Ñ1Ô1Ð1Ý”V˜DœK¨5¬<Ò7Ñ8Ô8ð >ÝÐ 0Ñ1Ô1Ð1Ø” ¤ Ò,Ð,Ý Ð!<Ñ=Ô=Ð=Ø”:Р؈ rr7cóè—tj|gd¬¦«\}||_|�Btj|gd¬¦«\}t|¦«dkrt d¦«‚||_|�Btj|gd¬¦«\}t|¦«dkrt d¦«‚||_ | ¦«st d¦«‚n#t$rtd¦«‚wxYw||_ dS)NF©Útriméz$Domain has wrong number of elements.z$Window has wrong number of elements.z/Symbol string must be a valid Python identifierz!Symbol must be a non-empty string) ÚpuÚ as_seriesrQrPrbr r#Ú isidentifierÚAttributeErrorrar)rrQr r#rs rÚ__init__zABCPolyBase.__init__0s€Ý”˜t˜f¨5Ð1Ñ1Ô1‰ˆØˆŒ à Ð Ý”| V H°5Ð9Ñ9Ô9‰HˆVÝ�6‰{Œ{˜aÒÐÝ Ð!GÑHÔHÐHØ ˆDŒKà Ð Ý”| V H°5Ð9Ñ9Ô9‰HˆVÝ�6‰{Œ{˜aÒÐÝ Ð!GÑHÔHÐHØ ˆDŒKð AØ×&Ò&Ñ(Ô(ð Ý ØEñôðð øõð Að Að AÝÐ?Ñ@Ô@Ð @ð AøøøðˆŒ ˆ ˆ s Â*#CÃC(c óî—t|j¦«dd…}t|j¦«dd…}t|j¦«dd…}|jj}|›d|›d|›d|›d|j›d� S)Nééÿÿÿÿú(z , domain=z , window=z , symbol='z'))ÚreprrQr r#r^Ú__name__r)rrQr r#Únames rÚ__repr__zABCPolyBase.__repr__Nsœ€Ý�D”I‰Œ˜q ˜tÔ$ˆÝ�d”kÑ"Ô" 1 R 4Ô(ˆÝ�d”kÑ"Ô" 1 R 4Ô(ˆØŒ~Ô&ˆØð+ð+˜$ð+ð+¨ð+ð+¸&ð+ð+Øœ;ð+ð+ð+ð ,rcóè—|dkr| ¦«S|dvrtd|›d|j›d�¦«‚|dkr| |j¦«S| |j¦«S)NÚ)ÚasciiÚunicodezUnsupported format string 'z ' passed to z4.__format__. Valid options are 'ascii' and 'unicode'rw)Ú__str__rbr^Ú_generate_stringÚ_str_term_asciiÚ_str_term_unicode)rÚfmt_strs rÚ __format__zABCPolyBase.__format__Vs—€Ø �bŠ=ˆ=Ø—<’<‘>”>Ð !Ø Ð.Ð .Ð .Ýð)¨gð)ð)Ø”>ð)ð)ð)ñôð ð �gÒ Ð Ø×(Ò(¨Ô)=Ñ>Ô>Ð >Ø×$Ò$ TÔ%;Ñ<Ô<ÐÔ>ˆ Ø �qŠ=ˆ=؈IÝŒo˜dœi¨œlÑ+Ô+ˆÝ  ¤¨1¨2¨2¤Ñ/Ô/ð ñ ‰GˆAˆtØ �3‰JˆCݘ˜A™‘J”JˆEð  (ؘ1’9�9Ø %­¬¸ÀTÐ(JÑ(JÔ(JÑ J�I�Ià %­¬¸¸ÀdÐ(KÑ(KÔ(KÑ K�IøøÝð (ð (ð (Ø' ˜K˜K� � � ð (øøøð ˜˜ U¨D¬KÑ8Ô8Ñ 8ˆIå˜3Ÿ9š9 T™?œ?¨2Ô.Ñ/Ô/µ#°i±.´.Ñ@ˆHð•3�t”y   ”}Ñ%Ô%¨Ñ)Ò)Ð)ؘA‘ �à˜9Ò$Ð$Ø%×-Ò-¨c°4¸Ñ;Ô;� Ø �9Ñ ˆC‰C؈ s :CÃCÃCcó~—|j€td¦«‚d|j›| |j¦«›d|›d�S)zƒ String representation of single polynomial term using unicode characters for superscripts and subscripts. NzZSubclasses must define either a basis_name, or override _str_term_unicode(cls, i, arg_str)õ·rpú))r%ÚNotImplementedErrorÚ translateÚ_subscript_mapping©Úclsr‘Úarg_strs rr|zABCPolyBase._str_term_unicodeŽsc€ð Œ>Ð !Ý%ð5ñôð ð�S”^ð Q§[¢[°Ô1GÑ%HÔ%HððØðððð rcóP—|j€td¦«‚d|j›d|›d|›d�S)z’ String representation of a single polynomial term using ** and _ to represent superscripts and subscripts, respectively. NzXSubclasses must define either a basis_name, or override _str_term_ascii(cls, i, arg_str)r„Ú_rpr—©r%r˜r›s rr{zABCPolyBase._str_term_asciiœsH€ð Œ>Ð !Ý%ð3ñôð ð3�3”>Ð2Ð2 AÐ2Ð2¨Ð2Ð2Ð2Ð2rcóP—|j€td¦«‚d|j›d|›d|›d�S)NzbSubclasses must define either a basis name, or override _repr_latex_term(i, arg_str, needs_parens)ú{z}_{z}(r—r )rœr‘r�Ú needs_parenss rÚ_repr_latex_termzABCPolyBase._repr_latex_term©sF€à Œ>Ð !Ý%ð=ñ>ô>ð >ð:�C”NÐ9Ð9¨Ð9Ð9¨wÐ9Ð9Ð9Ð9rFcóT—d tj||¬¦«¦«S)Nz \text{{{}}}r…)ÚformatrhrŠ)r7r†s rÚ_repr_latex_scalarzABCPolyBase._repr_latex_scalar²s'€ð×$Ò$¥R¤_°Q¸vÐ%FÑ%FÔ%FÑGÔGÐGrcóÌ—| ¦«\}}|dkr|dkr |j}d}n…|dkr"| |¦«›d|j›�}d}n]|dkr!| |¦«›|j›�}d}n6| |¦«›d| |¦«›|j›�}d}dj}g}t |j¦«D]í\}}|dkr| |¦«›} n~t |tj¦«sd| |¦«›d�} nJtj |¦«sd| |d¬ ¦«›�} nd | | d¬ ¦«›�} |  |||¦«} | d kr| } n| ›d | ›�} |dkr || ¦«} |  | ¦«Œî|rd   |¦«} nd} d|j›d| ›d�S)NrrFz + Tz\color{{LightGray}}{{{}}}z + (r—r…z - r z\,rvr ú$z \mapsto )Úmapparmsrr§r¦r‹rQr]ÚnumbersÚRealrRÚsignbitr¤ÚappendÚjoin) rrHÚscaleÚtermr£ÚmuteÚpartsr‘r2Úcoef_strÚterm_strÚpartÚbodys rÚ _repr_latex_zABCPolyBase._repr_latex_¸s_€à—]’]‘_”_‰ ˆˆUØ �!Š8ˆ8˜ š ˜ Ø”;ˆDØ ˆLˆLØ �aŠZˆZØ×-Ò-¨cÑ2Ô2ÐDÐD°t´{ÐDÐDˆD؈LˆLØ �AŠXˆXØ×-Ò-¨eÑ4Ô4ÐC°d´kÐCÐCˆD؈LˆLð×*Ò*¨3Ñ/Ô/ðAðAØ×*Ò*¨5Ñ1Ô1ðAØ37´;ðAðAð ð ˆLà+Ô2ˆàˆÝ˜dœiÑ(Ô(ð ð ‰DˆAˆqà�AŠvˆvØ"×5Ò5°aÑ8Ô8Ð:��Ý ¥7¤<Ñ0Ô0ð LØ? $×"9Ò"9¸!Ñ"<Ô"<Ð?Ð?Ð?��Ý”Z ‘]”]ð LØJ ×!8Ò!8¸À4Ð!8Ñ!HÔ!HÐJÐJ��àK ×!8Ò!8¸!¸ÀDÐ!8Ñ!IÔ!IÐKÐK�ð×,Ò,¨Q°°lÑCÔCˆHؘ3ŠˆØ��à#Ð1Ð1 xÐ1Ð1�à�AŠvˆvØ�t˜D‘z”z�à �LŠL˜Ñ Ô Ð Ð à ð Ø—7’7˜5‘>”>ˆDˆDðˆDà1�D”KÐ1Ð1¨$Ð1Ð1Ð1Ð1rcóô—|j ¦«}|j ¦«|d<|j ¦«|d<|j ¦«|d<|j|d<|S)NrQr r#r)Ú__dict__ÚcopyrQr r#r)rÚrets rÚ __getstate__zABCPolyBase.__getstate__ñsh€ØŒm× Ò Ñ"Ô"ˆØ”i—n’nÑ&Ô&ˆˆF‰ Øœ ×(Ò(Ñ*Ô*ˆˆH‰ Øœ ×(Ò(Ñ*Ô*ˆˆH‰ Øœ ˆˆH‰ ؈ rcó—||_dSr)rº)rÚdicts rÚ __setstate__zABCPolyBase.__setstate__ùs €ØˆŒ ˆ ˆ rcóŒ—tj|j|j¦«\}}|||zz}| ||j¦«Sr)rhrªr r#r8rQ)rÚargrHr=s rÚ__call__zABCPolyBase.__call__þs>€Ý”;˜tœ{¨D¬KÑ8Ô8‰ˆˆSØ�C˜‘G‰mˆØ�yŠy˜˜dœiÑ(Ô(Ð(rcó*—t|j¦«Sr)ÚiterrQrs rÚ__iter__zABCPolyBase.__iter__s€Ý�D”I‰ŒÐrcó*—t|j¦«Sr)rPrQrs rÚ__len__zABCPolyBase.__len__s€Ý�4”9‰~Œ~Ðrcó\—| |j |j|j|j¦«Sr©r^rQr r#rrs rÚ__neg__zABCPolyBase.__neg__ s+€Ø�~Š~Ø ŒYˆJ˜œ  T¤[°$´+ñ ô ð rcó—|Srrrs rÚ__pos__zABCPolyBase.__pos__s€Øˆ rcóâ—| |¦«} | |j|¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr) rcr*rQÚ ExceptionÚNotImplementedr^r r#r©rrUÚ othercoefrQs rÚ__add__zABCPolyBase.__add__óv€Ø×*Ò*¨5Ñ1Ô1ˆ ð "Ø—9’9˜TœY¨ Ñ2Ô2ˆDˆDøÝð "ð "ð "Ý!Ð !Ð !Ð !ð "øøøà�~Š~˜d D¤K°´¸d¼kÑJÔJÐJó—3³AÁAcóâ—| |¦«} | |j|¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr) rcr,rQrÏrÐr^r r#rrÑs rÚ__sub__zABCPolyBase.__sub__rÔrÕcóâ—| |¦«} | |j|¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr) rcr.rQrÏrÐr^r r#rrÑs rÚ__mul__zABCPolyBase.__mul__#rÔrÕcóê—t|tj¦«rt|t¦«r0t dt |¦«›dt |¦«›d�¦«‚| |¦«S)Nz&unsupported types for true division: 'z', 'ú')r]r«ÚNumberÚboolraÚtypeÚ __floordiv__rTs rÚ __truediv__zABCPolyBase.__truediv__+s�€õ˜%¥¤Ñ0Ô0ð µJ¸uÅdÑ4KÔ4Kð Ýð3ݘ‘J”Jð3ð3Ý$(¨¡K¤Kð3ð3ð3ñôð ð× Ò  Ñ'Ô'Ð'rcóR—| |¦«}|tur|S|dS©Nr©Ú __divmod__rЩrrUÚress rrßzABCPolyBase.__floordiv__6ó,€Ø�oŠo˜eÑ$Ô$ˆØ •.РР؈JØ�1Œvˆ rcóR—| |¦«}|tur|S|dS©Nrrãrås rÚ__mod__zABCPolyBase.__mod__<rçrcóR—| |¦«} | |j|¦«\}}n!#t$r‚t$r t cYSwxYw| ||j|j|j ¦«}| ||j|j|j ¦«}||fSr) rcr0rQÚZeroDivisionErrorrÏrÐr^r r#r)rrUrÒÚquoÚrems rräzABCPolyBase.__divmod__Bs´€Ø×*Ò*¨5Ñ1Ô1ˆ ð "Ø—y’y ¤¨IÑ6Ô6‰HˆC��øÝ ð ð ð Ø Ýð "ð "ð "Ý!Ð !Ð !Ð !ð "øøøà�nŠn˜S $¤+¨t¬{¸D¼KÑHÔHˆØ�nŠn˜S $¤+¨t¬{¸D¼KÑHÔHˆØ�Cˆxˆs—6¶AÁAcó˜—| |j||j¬¦«}| ||j|j|j¦«}|S)N)r4)r5rQr4r^r r#r)rrUrQræs rÚ__pow__zABCPolyBase.__pow__Ns?€Ø�yŠy˜œ E°D´MˆyÑBÔBˆØ�nŠn˜T 4¤;°´ ¸T¼[ÑIÔIˆØˆ rcó¸— | ||j¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr)r*rQrÏrÐr^r r#r©rrUrQs rÚ__radd__zABCPolyBase.__radd__Sóc€ð "Ø—9’9˜U D¤IÑ.Ô.ˆDˆDøÝð "ð "ð "Ý!Ð !Ð !Ð !ð "øøøà�~Š~˜d D¤K°´¸d¼kÑJÔJÐJó ‚ž2±2có¸— | ||j¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr)r,rQrÏrÐr^r r#rròs rÚ__rsub__zABCPolyBase.__rsub__Zrôrõcó¸— | ||j¦«}n#t$r tcYSwxYw| ||j|j|j¦«Sr)r.rQrÏrÐr^r r#rròs rÚ__rmul__zABCPolyBase.__rmul__arôrõcó,—| |¦«Sr)Ú __rfloordiv__rTs rÚ__rdiv__zABCPolyBase.__rdiv__hs€à×!Ò! %Ñ(Ô(Ð(rcó—tSr)rÐrTs rÚ __rtruediv__zABCPolyBase.__rtruediv__ls €õÐrcóR—| |¦«}|tur|S|dSrâ©Ú __rdivmod__rÐrås rrûzABCPolyBase.__rfloordiv__qó.€Ø×Ò˜uÑ%Ô%ˆØ •.РР؈JØ�1Œvˆ rcóR—| |¦«}|tur|S|dSrérrås rÚ__rmod__zABCPolyBase.__rmod__wrrcó(— | ||j¦«\}}n!#t$r‚t$r tcYSwxYw| ||j|j|j¦«}| ||j|j|j¦«}||fSr) r0rQrìrÏrÐr^r r#r)rrUrírîs rrzABCPolyBase.__rdivmod__}s¡€ð "Ø—y’y ¨¬ Ñ2Ô2‰HˆC��øÝ ð ð ð Ø Ýð "ð "ð "Ý!Ð !Ð !Ð !ð "øøøà�nŠn˜S $¤+¨t¬{¸D¼KÑHÔHˆØ�nŠn˜S $¤+¨t¬{¸D¼KÑHÔHˆØ�Cˆxˆs ‚!¡?¾?cóP—t||j¦«o�tj|j|jk¦«omtj|j|jk¦«oK|jj|jjko1tj|j|jk¦«o|j|jk}|Sr) r]r^rRrSr r#rQÚshaperrås rÚ__eq__zABCPolyBase.__eq__ˆs›€Ý˜% ¤Ñ0Ô0ð-ÝŒv�d”k U¤\Ò1Ñ2Ô2ð-åŒv�d”k U¤\Ò1Ñ2Ô2ð-ð” ” 5¤:Ô#3Ò3ð-õŒv�d”i 5¤:Ò-Ñ.Ô.ð -ð ” ˜uœ|Ò+ð ð ˆ rcó.—| |¦« Sr)rrTs rÚ__ne__zABCPolyBase.__ne__‘s€Ø—;’;˜uÑ%Ô%Ð%Ð%rcóZ—| |j|j|j|j¦«S)zoReturn a copy. Returns ------- new_series : series Copy of self. rÊrs rr»zABCPolyBase.copy˜s$€ð�~Š~˜dœi¨¬°d´kÀ4Ä;ÑOÔOÐOrcó&—t|¦«dz S)uThe degree of the series. .. versionadded:: 1.5.0 Returns ------- degree : int Degree of the series, one less than the number of coefficients. Examples -------- Create a polynomial object for ``1 + 7*x + 4*x**2``: >>> poly = np.polynomial.Polynomial([1, 7, 4]) >>> print(poly) 1.0 + 7.0·x + 4.0·x² >>> poly.degree() 2 Note that this method does not check for non-zero coefficients. You must trim the polynomial to remove any trailing zeroes: >>> poly = np.polynomial.Polynomial([1, 7, 0]) >>> print(poly) 1.0 + 7.0·x + 0.0·x² >>> poly.degree() 2 >>> poly.trim().degree() 1 r)rPrs rÚdegreezABCPolyBase.degree£s€õB�4‰yŒy˜1‰}Ðrcó2—| |dz¦«S)aÒTruncate series to the given degree. Reduce the degree of the series to `deg` by discarding the high order terms. If `deg` is greater than the current degree a copy of the current series is returned. This can be useful in least squares where the coefficients of the high degree terms may be very small. .. versionadded:: 1.5.0 Parameters ---------- deg : non-negative int The series is reduced to degree `deg` by discarding the high order terms. The value of `deg` must be a non-negative integer. Returns ------- new_series : series New instance of series with reduced degree. r)Útruncate)rrCs rÚcutdegzABCPolyBase.cutdegÆs€ð.�}Š}˜S 1™WÑ%Ô%Ð%rrcó„—tj|j|¦«}| ||j|j|j¦«S)a—Remove trailing coefficients Remove trailing coefficients until a coefficient is reached whose absolute value greater than `tol` or the beginning of the series is reached. If all the coefficients would be removed the series is set to ``[0]``. A new series instance is returned with the new coefficients. The current instance remains unchanged. Parameters ---------- tol : non-negative number. All trailing coefficients less than `tol` will be removed. Returns ------- new_series : series New instance of series with trimmed coefficients. )rhÚtrimcoefrQr^r r#r)rÚtolrQs rrfzABCPolyBase.trimßs5€õ(Œ{˜4œ9 cÑ*Ô*ˆØ�~Š~˜d D¤K°´¸d¼kÑJÔJÐJrcó—t|¦«}||ks|dkrtd¦«‚|t|j¦«kr|j}n|jd|…}| ||j|j|j¦«S)aTruncate series to length `size`. Reduce the series to length `size` by discarding the high degree terms. The value of `size` must be a positive integer. This can be useful in least squares where the coefficients of the high degree terms may be very small. Parameters ---------- size : positive int The series is reduced to length `size` by discarding the high degree terms. The value of `size` must be a positive integer. Returns ------- new_series : series New instance of series with truncated coefficients. rzsize must be a positive integerN)ÚintrbrPrQr^r r#r)rÚsizeÚisizerQs rrzABCPolyBase.truncateösy€õ(�D‘ ” ˆØ �DŠ=ˆ=˜E AšI˜IÝÐ>Ñ?Ô?Ð ?Ø •C˜œ ‘N”NÒ "Ð "Ø”9ˆDˆDà”9˜V˜e˜VÔ$ˆDØ�~Š~˜d D¤K°´¸d¼kÑJÔJÐJrcó„—|€|j}|€|j}|€|j}|| |||j¬¦«¦«S)aéConvert series to a different kind and/or domain and/or window. Parameters ---------- domain : array_like, optional The domain of the converted series. If the value is None, the default domain of `kind` is used. kind : class, optional The polynomial series type class to which the current instance should be converted. If kind is None, then the class of the current instance is used. window : array_like, optional The window of the converted series. If the value is None, the default window of `kind` is used. Returns ------- new_series : series The returned class can be of different type than the current instance and/or have a different domain and/or different window. Notes ----- Conversion between domains and class types can result in numerically ill defined series. N)r#r)r^r r#Úidentityr)rr Úkindr#s rÚconvertzABCPolyBase.convertsL€ð: ˆ<Ø”>ˆDØ ˆ>Ø”[ˆFØ ˆ>Ø”[ˆF؈t�D—M’M &°ÀÄ �MÑLÔLÑMÔMÐMrcó@—tj|j|j¦«S)aÃReturn the mapping parameters. The returned values define a linear map ``off + scl*x`` that is applied to the input arguments before the series is evaluated. The map depends on the ``domain`` and ``window``; if the current ``domain`` is equal to the ``window`` the resulting map is the identity. If the coefficients of the series instance are to be used by themselves outside this class, then the linear function must be substituted for the ``x`` in the standard representation of the base polynomials. Returns ------- off, scl : float or complex The mapping function is defined by ``off + scl*x``. Notes ----- If the current domain is the interval ``[l1, r1]`` and the window is ``[l2, r2]``, then the linear mapping function ``L`` is defined by the equations:: L(l1) = l2 L(r1) = r2 )rhrªr r#rs rrªzABCPolyBase.mapparms8s€õ6Œ{˜4œ;¨¬ Ñ4Ô4Ð4rrcóÚ—| ¦«\}}|€d}n|||zz}| |j|||d|z ¦«}| ||j|j|j¦«S)aIntegrate. Return a series instance that is the definite integral of the current series. Parameters ---------- m : non-negative int The number of integrations to perform. k : array_like Integration constants. The first constant is applied to the first integration, the second to the second, and so on. The list of values must less than or equal to `m` in length and any missing values are set to zero. lbnd : Scalar The lower bound of the definite integral. Returns ------- new_series : series A new series representing the integral. The domain is the same as the domain of the integrated series. Nrgð?)rªr>rQr^r r#r)rr:r;r<rHr=rQs rÚintegzABCPolyBase.integUsk€ð2—=’=‘?”?‰ˆˆSØ ˆ<؈DˆDà˜˜T™‘>ˆDØ�yŠy˜œ A q¨$°°3±Ñ7Ô7ˆØ�~Š~˜d D¤K°´¸d¼kÑJÔJÐJrcó¶—| ¦«\}}| |j||¦«}| ||j|j|j¦«S)a§Differentiate. Return a series instance of that is the derivative of the current series. Parameters ---------- m : non-negative int Find the derivative of order `m`. Returns ------- new_series : series A new series representing the derivative. The domain is the same as the domain of the differentiated series. )rªr@rQr^r r#r)rr:rHr=rQs rÚderivzABCPolyBase.derivvsJ€ð$—=’=‘?”?‰ˆˆSØ�yŠy˜œ A sÑ+Ô+ˆØ�~Š~˜d D¤K°´¸d¼kÑJÔJÐJrcóv—| |j¦«}tj||j|j¦«S)a/Return the roots of the series polynomial. Compute the roots for the series. Note that the accuracy of the roots decreases the further outside the `domain` they lie. Returns ------- roots : ndarray Array containing the roots of the series. )rKrQrhÚ mapdomainr#r )rÚrootss rr#zABCPolyBase.rootsŒs/€ð— ’ ˜DœIÑ&Ô&ˆÝŒ|˜E 4¤;°´ Ñ<Ô<ÐØ”[ˆFÝ ŒK˜˜qœ  6¨!¤9¨aÑ 0Ô 0ˆØ ˆD�‰GŒGˆØ�!ˆtˆ rc óV—|€tj|¦«}n0t|¦«turt |¦«dkr|j}|€|j}tj|||¦«} | | |||||¬¦«} |r| \} } || ||| ¬¦«| fS| } || ||| ¬¦«S)a0 Least squares fit to data. Return a series instance that is the least squares fit to the data `y` sampled at `x`. The domain of the returned instance can be specified and this will often result in a superior fit with less chance of ill conditioning. Parameters ---------- x : array_like, shape (M,) x-coordinates of the M sample points ``(x[i], y[i])``. y : array_like, shape (M,) y-coordinates of the M sample points ``(x[i], y[i])``. deg : int or 1-D array_like Degree(s) of the fitting polynomials. If `deg` is a single integer all terms up to and including the `deg`'th term are included in the fit. For NumPy versions >= 1.11.0 a list of integers specifying the degrees of the terms to include may be used instead. domain : {None, [beg, end], []}, optional Domain to use for the returned series. If ``None``, then a minimal domain that covers the points `x` is chosen. If ``[]`` the class domain is used. The default value was the class domain in NumPy 1.4 and ``None`` in later versions. The ``[]`` option was added in numpy 1.5.0. rcond : float, optional Relative condition number of the fit. Singular values smaller than this relative to the largest singular value will be ignored. The default value is len(x)*eps, where eps is the relative precision of the float type, about 2e-16 in most cases. full : bool, optional Switch determining nature of return value. When it is False (the default) just the coefficients are returned, when True diagnostic information from the singular value decomposition is also returned. w : array_like, shape (M,), optional Weights. If not None, the weight ``w[i]`` applies to the unsquared residual ``y[i] - y_hat[i]`` at ``x[i]``. Ideally the weights are chosen so that the errors of the products ``w[i]*y[i]`` all have the same variance. When using inverse-variance weighting, use ``w[i] = 1/sigma(y[i])``. The default value is None. .. versionadded:: 1.5.0 window : {[beg, end]}, optional Window to use for the returned series. The default value is the default class domain .. versionadded:: 1.6.0 symbol : str, optional Symbol representing the independent variable. Default is 'x'. Returns ------- new_series : series A series that represents the least squares fit to the data and has the domain and window specified in the call. If the coefficients for the unscaled and unshifted basis polynomials are of interest, do ``new_series.convert().coef``. [resid, rank, sv, rcond] : list These values are only returned if ``full == True`` - resid -- sum of squared residuals of the least squares fit - rank -- the numerical rank of the scaled Vandermonde matrix - sv -- singular values of the scaled Vandermonde matrix - rcond -- value of `rcond`. For more details, see `linalg.lstsq`. Nr)ÚwrDrE©r r#r) rhÚ getdomainrÞÚlistrPr r#r"rF)rœr7rBrCr rDrEr(r#rÚxnewrærQÚstatuss rÚfitzABCPolyBase.fit»sÑ€ðR ˆ>Ý”\ !‘_”_ˆFˆFÝ �&‰\Œ\�TÐ !Ð !¥c¨&¡k¤k°QÒ&6Ð&6Ø”ZˆFà ˆ>Ø”ZˆFåŒ|˜A˜v vÑ.Ô.ˆØ�hŠh�t˜Q  q°¸DˆhÑAÔAˆØ ð JØ ‰NˆT�6à��D °¸vÐFÑFÔFÈðð ðˆDØ�3�t F°6À&ÐIÑIÔIÐ Ircó†—tj|gd¬¦«\}|€tj|¦«}n0t|¦«turt |¦«dkr|j}|€|j}t |¦«}tj||¦«\}}|||zz}|  |¦«||zz } || |||¬¦«S)a”Return series instance that has the specified roots. Returns a series representing the product ``(x - r[0])*(x - r[1])*...*(x - r[n-1])``, where ``r`` is a list of roots. Parameters ---------- roots : array_like List of roots. domain : {[], None, array_like}, optional Domain for the resulting series. If None the domain is the interval from the smallest root to the largest. If [] the domain is the class domain. The default is []. window : {None, array_like}, optional Window for the returned series. If None the class window is used. The default is None. symbol : str, optional Symbol representing the independent variable. Default is 'x'. Returns ------- new_series : series Series with the specified roots. FreNrr)) rhrir*rÞr+rPr r#rªrN) rœr#r r#rrCrHr=ÚrnewrQs rÚ fromrootszABCPolyBase.fromrootssÆ€õ8”, ˜w¨UÐ3Ñ3Ô3‰ˆØ ˆ>Ý”\ %Ñ(Ô(ˆFˆFÝ �&‰\Œ\�TÐ !Ð !¥c¨&¡k¤k°QÒ&6Ð&6Ø”ZˆFà ˆ>Ø”ZˆFå�%‰jŒjˆÝ”;˜v vÑ.Ô.‰ˆˆSØ�S˜‘Y‰ˆØ�~Š~˜dÑ#Ô# c¨3¡hÑ.ˆØˆs�4 ¨v¸fÐEÑEÔEÐErcóž—|€|j}|€|j}tj||¦«\}}| ||¦«}|||||¦«S)aŸIdentity function. If ``p`` is the returned series, then ``p(x) == x`` for all values of x. Parameters ---------- domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. symbol : str, optional Symbol representing the independent variable. Default is 'x'. Returns ------- new_series : series Series of representing the identity. )r r#rhrªrI)rœr r#rrHr=rQs rrzABCPolyBase.identityBsZ€ð6 ˆ>Ø”ZˆFØ ˆ>Ø”ZˆFÝ”;˜v vÑ.Ô.‰ˆˆSØ�yŠy˜˜cÑ"Ô"ˆØˆs�4˜ ¨Ñ0Ô0Ð0rcó¦—|€|j}|€|j}t|¦«}||ks|dkrtd¦«‚|dg|zdgz|||¦«S)a\Series basis polynomial of degree `deg`. Returns the series representing the basis polynomial of degree `deg`. .. versionadded:: 1.7.0 Parameters ---------- deg : int Degree of the basis polynomial for the series. Must be >= 0. domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. symbol : str, optional Symbol representing the independent variable. Default is 'x'. Returns ------- new_series : series A series with the coefficient of the `deg` term set to one and all others zero. Nrz deg must be non-negative integerr)r r#rrb)rœrCr r#rÚidegs rÚbasiszABCPolyBase.basisesi€ð> ˆ>Ø”ZˆFØ ˆ>Ø”ZˆFÝ�3‰xŒxˆà �3Š;ˆ;˜$ š(˜(ÝÐ?Ñ@Ô@Ð @؈s�A�3�t‘8˜q˜c‘> 6¨6°6Ñ:Ô:Ð:rcóT—|€|j}|€|j}| |||¦«S)aÊConvert series to series of this class. The `series` is expected to be an instance of some polynomial series of one of the types supported by by the numpy.polynomial module, but could be some other class that supports the convert method. .. versionadded:: 1.7.0 Parameters ---------- series : series The series instance to be converted. domain : {None, array_like}, optional If given, the array must be of the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the domain. If None is given then the class domain is used. The default is None. window : {None, array_like}, optional If given, the resulting array must be if the form ``[beg, end]``, where ``beg`` and ``end`` are the endpoints of the window. If None is given then the class window is used. The default is None. Returns ------- new_series : series A series of the same kind as the calling class and equal to `series` when evaluated. See Also -------- convert : similar instance method )r r#r)rœÚseriesr r#s rÚcastzABCPolyBase.castŽs3€ðH ˆ>Ø”ZˆFØ ˆ>Ø”ZˆFØ�~Š~˜f c¨6Ñ2Ô2Ð2rr)NNr7)F)r)NNN)r)rN)NNFNNr7)NN)[rrÚ __module__Ú __qualname__Ú__doc__Ú__hash__Ú__array_ufunc__r4rŒÚ maketransÚ_superscript_mappingršÚosrsr€ÚpropertyrÚabcÚabstractmethodr r#r%Ú staticmethodr*r,r.r0r5r8r>r@rFrIrKrNrVrXr[r_rcrlrtr~ryrzÚ classmethodr|r{r¤r§r¸r½rÀrÃrÆrÈrËrÍrÓr×rÙràrßrêrärðrór÷rùrürþrûrrrr r»r rrfrrrªrr r#r%r.r1rr5r8rrrrrsŽ€€€€€ð1ð1ðh€Hð€Oð€HðŸ=š=Ø Ø Ø Ø Ø Ø Ø Ø Ø Ø ð *ð *ñ ô ÐðŸšØ Ø Ø Ø Ø Ø Ø Ø Ø Ø ð (ð (ñ ô Ðð ”w $’Ð&€Là ððñ„XððØÔð ð ñÔñ„Xð ðØÔð ð ñÔñ„Xð ðØÔð ð ñÔñ„Xð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðØÔð ð ñÔñ„\ð ðððð.3ð3ð3ð$3ð3ð3ð$1ð1ð1ð$$ð$ð$ðLðððð<,ð,ð,ð =ð =ð =ð;ð;ð;ð $ð$ð$ðLð  ð  ñ„[ð  ðð 3ð 3ñ„[ð 3ðð:ð:ñ„[ð:ððHðHðHñ„\ðHð 32ð32ð32ðrðððððð )ð)ð)ð ðððððð  ð ð ð ðððKðKðKðKðKðKðKðKðKð (ð (ð (ðððð ððð ð ð ðððð KðKðKðKðKðKðKðKðKð)ð)ð)ðððð ððð ððð ð ð ðððð&ð&ð&ð Pð Pð Pð!ð!ð!ðF&ð&ð&ð2KðKðKðKð.KðKðKð:#Nð#Nð#Nð#NðJ5ð5ð5ð:˜2 DðKðKðKðKðBKðKðKðKð, =ð =ð =ððððð@ØCGØðYJðYJðYJñ„[ðYJðvØ%'°¸Sð(Fð(Fð(Fñ„[ð(FðTð 1ð 1ð 1ñ„[ð 1ðDð&;ð&;ð&;ñ„[ð&;ðPð'3ð'3ð'3ñ„[ð'3ð'3ð'3r) r;r@rBr«ÚnumpyrRrvrrhÚ__all__ÚABCrrrrúrIs‘ðððð € € € Ø € € € Ø€€€àÐÐÐØÐÐÐÐÐà ˆ/€ðd3ðd3ðd3ðd3ðd3�#”'ñd3ôd3ðd3ðd3ðd3r