ó
    ˆ*£h,Á  ã                   ó¶  • S r SrSSKrSSKrSSKJr  SSKJrJr  SSK	J
r
  SSK
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^Jr  SS	K	J_r_  SS
K	J`r`  \aRÄ                  rc\RÈ                  " S5      re\S:X  a  SSKfJgrh  SSKfJis  Jjs  Jkrl  OSSKmJnrh  SSK	Jmrl  SSKmJoroJprpJqrq   " S S\h\5      rr " S S5      rs\tS:X  a  SSKuru\uRì                  " 5         gg)z[
This module defines the mpf, mpc classes, and standard functions for
operating with them.
Ú	plaintexté    Né   )ÚStandardBaseContext)Ú
basestringÚBACKEND)Úlibmp)UÚMPZÚMPZ_ZEROÚMPZ_ONEÚ	int_typesÚrepr_dpsÚround_floorÚround_ceilingÚdps_to_precÚround_nearestÚprec_to_dpsÚComplexResultÚto_pickableÚfrom_pickableÚ	normalizeÚfrom_intÚ
from_floatÚfrom_strÚto_intÚto_floatÚto_strÚfrom_rationalÚfrom_man_expÚfoneÚfzeroÚfinfÚfninfÚfnanÚmpf_absÚmpf_posÚmpf_negÚmpf_addÚmpf_subÚmpf_mulÚmpf_mul_intÚmpf_divÚmpf_rdiv_intÚmpf_pow_intÚmpf_modÚmpf_eqÚmpf_cmpÚmpf_ltÚmpf_gtÚmpf_leÚmpf_geÚmpf_hashÚmpf_randÚmpf_sumÚbitcountÚto_fixedÚ
mpc_to_strÚmpc_to_complexÚmpc_hashÚmpc_posÚmpc_is_nonzeroÚmpc_negÚmpc_conjugateÚmpc_absÚmpc_addÚmpc_add_mpfÚmpc_subÚmpc_sub_mpfÚmpc_mulÚmpc_mul_mpfÚmpc_mul_intÚmpc_divÚmpc_div_mpfÚmpc_powÚmpc_pow_mpfÚmpc_pow_intÚmpc_mpf_divÚmpf_powÚmpf_piÚ
mpf_degreeÚmpf_eÚmpf_phiÚmpf_ln2Úmpf_ln10Ú	mpf_eulerÚmpf_catalanÚ	mpf_aperyÚmpf_khinchinÚmpf_glaisherÚmpf_twinprimeÚmpf_mertensr   )Úfunction_docs)Úrationalz\^\(?(?P<re>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?)??(?P<im>[\+\-]?\d*(\.\d*)?(e[\+\-]?\d+)?j)?\)?$Úsage)ÚContext)ÚPythonMPContext)Úctx_mp_python)Ú_mpfÚ_mpcÚ	mpnumericc                   ó†  • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS:S jrS rS rS rS rS rS rS rS rS rS rS rS rS r\S 5       r\S 5       rS;S jrS;S jrS;S jr S;S jr!S<S" jr"S=S# jr#S$ r$S% r%S& r&S'r'S(r(S>S) jr)S* r*S+ r+S, r,S- r-S. r.S/ r/S0 r0S1 r1S2 r2S3 r3S4 r4S5 r5S6 r6S7 r7 S8/S4S9 jr8S!r9g )?Ú	MPContexté:   z@
Context for multiprecision arithmetic with a global precision.
c                 óø  • [         R                  " U 5        SU l        SU l        U R                  U R
                  U R                  /U l        [        R                  U l
        U R                  5         [        R                  " U 5        [        R                  U l	        U R                  5         0 U l        U R                  5          [         R"                  U R"                  R$                  l        [         R(                  U R(                  R$                  l        [         R*                  U R*                  R$                  l        [         R,                  U R,                  R$                  l        [         R2                  U R2                  l        [         R4                  U R4                  l        [         R6                  U R6                  l        g ! [.         a¨    [         R"                  U R"                  R0                  l        [         R(                  U R(                  R0                  l        [         R*                  U R*                  R0                  l        [         R,                  U R,                  R0                  l         GNf = f©NF)ÚBaseMPContextÚ__init__Útrap_complexÚprettyÚmpfÚmpcÚconstantÚtypesr^   ÚmpqÚ_mpqÚdefaultr   Úinit_builtinsÚhyp_summatorsÚ_init_aliasesr]   Ú	bernoulliÚim_funcÚfunc_docÚprimepiÚpsiÚatan2ÚAttributeErrorÚ__func__ÚdigammaÚcospiÚsinpi©Úctxs    ÚJ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/mpmath/ctx_mp.pyrl   ÚMPContext.__init__?   s’  € Ü×Ò˜sÔ#Ø ˆÔØˆŒ
Ø—W‘W˜cŸg™g s§|¡|Ð4ˆŒ	Ü—<‘<ˆŒØ�‰ŒÜ×$Ò$ SÔ)ä—,‘,ˆŒØ×ÑÔàˆÔà×ÑÔð
	>Ü-:×-DÑ-DˆC�M‰M×!Ñ!Ô*Ü+8×+@Ñ+@ˆC�K‰K×ÑÔ(Ü'4×'8Ñ'8ˆC�G‰G�O‰OÔ$Ü)6×)<Ñ)<ˆC�I‰I×ÑÔ&ô  -×4Ñ4ˆ�‰ÔÜ*×0Ñ0ˆ�	‰	ÔÜ*×0Ñ0ˆ�	‰	Õøô ó 	>ä.;×.EÑ.EˆC�M‰M×"Ñ"Ô+Ü,9×,AÑ,AˆC�K‰K× Ñ Ô)Ü(5×(9Ñ(9ˆC�G‰G×ÑÔ%Ü*7×*=Ñ*=ˆC�I‰I×Ñ×'ð	>ús   ÃB$G ÇB.I9É8I9c                 óâ  • U R                   nU R                  nU R                  [        5      U l        U R                  [
        5      U l        U R                  [
        [        45      U l        U R                  [        5      U l
        U R                  [        5      U l        U R                  [        5      U l        U R                  S SS5      nX0l        U R                  ["        SS5      U l        U R                  [&        SS5      U l        U R                  [*        SS5      U l        U R                  [.        S	S
5      U l        U R                  [2        SS5      U l        U R                  [6        SS5      U l        U R                  [:        SS5      U l        U R                  [>        SS5      U l         U R                  [B        SS5      U l"        U R                  [F        SS5      U l$        U R                  [J        SS5      U l&        U R                  [N        SS5      U l(        U R                  [R        SS5      U l*        U RW                  [X        RZ                  [X        R\                  5      U l/        U RW                  [X        R`                  [X        Rb                  5      U l2        U RW                  [X        Rf                  [X        Rh                  5      U l5        U RW                  [X        Rl                  [X        Rn                  5      U l8        U RW                  [X        Rr                  [X        Rt                  5      U l;        U RW                  [X        Rx                  [X        Rz                  5      U l>        U RW                  [X        R~                  [X        R€                  5      U lA        U RW                  [X        R„                  [X        R†                  5      U lD        U RW                  [X        RŠ                  [X        RŒ                  5      U lG        U RW                  [X        R�                  [X        R’                  5      U lJ        U RW                  [X        R–                  [X        R˜                  5      U lM        U RW                  [X        Rœ                  [X        Rž                  5      U lP        U RW                  [X        R¢                  [X        R¤                  5      U lS        U RW                  [X        R¨                  [X        Rª                  5      U lV        U RW                  [X        R®                  [X        R°                  5      U lY        U RW                  [X        Rl                  [X        Rn                  5      U l8        U RW                  [X        R´                  [X        R¶                  5      U l\        U RW                  [X        Rº                  [X        R¼                  5      U l_        U RW                  [X        RÀ                  [X        RÂ                  5      U lb        U RW                  [X        RÆ                  [X        RÈ                  5      U le        U RW                  [X        RÌ                  [X        RÎ                  5      U lh        U RW                  [X        RÒ                  [X        RÔ                  5      U lk        U RW                  [X        RØ                  [X        RÚ                  5      U ln        U RW                  [X        RÞ                  [X        Rà                  5      U lq        U RW                  [X        Rä                  [X        Ræ                  5      U lt        U RW                  [X        Rê                  [X        Rì                  5      =U lw        U lx        U RW                  [X        Rò                  [X        Rô                  5      U l{        U RW                  [X        Rø                  [X        Rú                  5      U l~        U RW                  [X        Rþ                  [X        GR                   5      U l�        U RW                  [X        GR                  [X        GR                  5      =U l„        U l…        U RW                  [X        GR                  [X        GR                  5      U lˆ        U RW                  [X        GR                  [X        GR                  5      U l‹        U RW                  [X        GR                  [X        GR                  5      U lŽ        U RW                  [X        GR                  [X        GR                   5      U l‘        U RW                  [X        GR$                  [X        GR&                  5      U l”        U RW                  [X        GR*                  [X        GR,                  5      U l—        U RW                  [X        GR0                  [X        GR2                  5      U lš        U RW                  [X        GR6                  [X        GR8                  5      U l�        U RW                  [X        GR<                  [X        GR>                  5      U l         U RW                  [X        GRB                  S 5      U l¢        U RW                  [X        GRF                  S 5      U l¤        U RW                  [X        GRJ                  [X        GRL                  5      U l§        U RW                  [X        GRP                  [X        GRR                  5      U lª        G[W        U SU R^                  5      U l/        G[W        U SU Rv                  5      U l;        G[W        U SU Rj                  5      U l5        G[W        U S U RŽ                  5      U lG        G[W        U S!U Rˆ                  5      U lD        g )"Nc                 ó   • S[         SU -
  S4$ )Nr   r   )r   )ÚprecÚrnds     r†   Ú<lambda>Ú)MPContext.init_builtins.<locals>.<lambda>m   s   € ¨a´¸!¸D¹&À!Ñ-Dó    zepsilon of working precisionÚepsÚpizln(2)Úln2zln(10)Úln10zGolden ratio phiÚphiz
e = exp(1)ÚezEuler's constantÚeulerzCatalan's constantÚcatalanzKhinchin's constantÚkhinchinzGlaisher's constantÚglaisherzApery's constantÚaperyz1 deg = pi / 180ÚdegreezTwin prime constantÚ	twinprimezMertens' constantÚmertensÚ
_sage_sqrtÚ	_sage_expÚ_sage_lnÚ	_sage_cosÚ	_sage_sin)¬ro   rp   Úmake_mpfr   Úoner    ÚzeroÚmake_mpcÚjr!   Úinfr"   Úninfr#   Únanrq   r�   rP   r�   rT   r‘   rU   r’   rS   r“   rR   r”   rV   r•   rW   r–   rY   r—   rZ   r˜   rX   r™   rQ   rš   r[   r›   r\   rœ   Ú_wrap_libmp_functionr   Úmpf_sqrtÚmpc_sqrtÚsqrtÚmpf_cbrtÚmpc_cbrtÚcbrtÚmpf_logÚmpc_logÚlnÚmpf_atanÚmpc_atanÚatanÚmpf_expÚmpc_expÚexpÚmpf_expjÚmpc_expjÚexpjÚ
mpf_expjpiÚ
mpc_expjpiÚexpjpiÚmpf_sinÚmpc_sinÚsinÚmpf_cosÚmpc_cosÚcosÚmpf_tanÚmpc_tanÚtanÚmpf_sinhÚmpc_sinhÚsinhÚmpf_coshÚmpc_coshÚcoshÚmpf_tanhÚmpc_tanhÚtanhÚmpf_asinÚmpc_asinÚasinÚmpf_acosÚmpc_acosÚacosÚ	mpf_asinhÚ	mpc_asinhÚasinhÚ	mpf_acoshÚ	mpc_acoshÚacoshÚ	mpf_atanhÚ	mpc_atanhÚatanhÚ
mpf_sin_piÚ
mpc_sin_pirƒ   Ú
mpf_cos_piÚ
mpc_cos_pir‚   Ú	mpf_floorÚ	mpc_floorÚfloorÚmpf_ceilÚmpc_ceilÚceilÚmpf_nintÚmpc_nintÚnintÚmpf_fracÚmpc_fracÚfracÚmpf_fibonacciÚmpc_fibonacciÚfibÚ	fibonacciÚ	mpf_gammaÚ	mpc_gammaÚgammaÚ
mpf_rgammaÚ
mpc_rgammaÚrgammaÚmpf_loggammaÚmpc_loggammaÚloggammaÚmpf_factorialÚmpc_factorialÚfacÚ	factorialÚmpf_psi0Úmpc_psi0r�   Úmpf_harmonicÚmpc_harmonicÚharmonicÚmpf_eiÚmpc_eiÚeiÚmpf_e1Úmpc_e1Úe1Úmpf_ciÚmpc_ciÚ_ciÚmpf_siÚmpc_siÚ_siÚ
mpf_ellipkÚ
mpc_ellipkÚellipkÚ
mpf_ellipeÚ
mpc_ellipeÚ_ellipeÚmpf_agm1Úmpc_agm1Úagm1Úmpf_erfÚ_erfÚmpf_erfcÚ_erfcÚmpf_zetaÚmpc_zetaÚ_zetaÚmpf_altzetaÚmpc_altzetaÚ_altzetaÚgetattr)r…   ro   rp   r�   s       r†   rv   ÚMPContext.init_builtins`   sô  € à�g‰gˆØ�g‰gˆð —,‘,œtÓ$ˆŒØ—<‘<¤Ó&ˆŒØ—‘œe¤D˜\Ó*ˆŒØ—,‘,œtÓ$ˆŒØ—<‘<¤Ó&ˆŒØ—,‘,œtÓ$ˆŒà�l‰lÑDØ*¨Eó3ˆàŒð —‘œf d¨DÓ1ˆŒØ—,‘,œw¨°Ó7ˆŒØ—<‘<¤¨(°FÓ;ˆŒØ—,‘,œwÐ(:¸EÓBˆŒØ—‘œU L°#Ó6ˆŒØ—L‘L¤Ð,>ÀÓHˆŒ	Ø—l‘l¤;Ð0DÀiÓPˆŒØ—|‘|¤LÐ2GÈÓTˆŒØ—|‘|¤LÐ2GÈÓTˆŒØ—L‘L¤Ð,>ÀÓHˆŒ	Ø—\‘\¤*Ð.@À(ÓKˆŒ
ØŸ™¤]Ð4IÈ;ÓWˆŒØ—l‘l¤;Ð0CÀYÓOˆŒð ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×)Ñ)¬%¯-©-¼¿¹ÓGˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×*Ñ*¬5¯=©=¼%¿-¹-ÓHˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×-Ñ-¬e×.>Ñ.>Ä×@PÑ@PÓQˆŒ
Ø×*Ñ*¬5¯=©=¼%¿-¹-ÓHˆŒØ×*Ñ*¬5¯=©=¼%¿-¹-ÓHˆŒØ×*Ñ*¬5¯=©=¼%¿-¹-ÓHˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×,Ñ,¬U¯_©_¼e¿o¹oÓNˆŒ	Ø×,Ñ,¬U¯_©_¼e¿o¹oÓNˆŒ	Ø×,Ñ,¬U¯_©_¼e¿o¹oÓNˆŒ	Ø×,Ñ,¬U×-=Ñ-=¼u×?OÑ?OÓPˆŒ	Ø×,Ñ,¬U×-=Ñ-=¼u×?OÑ?OÓPˆŒ	Ø×,Ñ,¬U¯_©_¼e¿o¹oÓNˆŒ	Ø×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ×+Ñ+¬E¯N©N¼E¿N¹NÓKˆŒØ"%×":Ñ":¼5×;NÑ;NÔPU×PcÑPcÓ"dÐdˆŒ�#”-à×,Ñ,¬U¯_©_¼e¿o¹oÓNˆŒ	Ø×-Ñ-¬e×.>Ñ.>Ä×@PÑ@PÓQˆŒ
Ø×/Ñ/´×0BÑ0BÄE×DVÒDVÓWˆŒØ"%×":Ñ":¼5×;NÒ;NÔPU×PcÒPcÓ"dÐdˆŒ�#”-à×.Ñ.¬u¯~ª~¼u¿~º~ÓNˆŒØ×/Ñ/´×0BÒ0BÄE×DVÒDVÓWˆŒØ×)Ñ)¬%¯,ª,¼¿ºÓEˆŒØ×)Ñ)¬%¯,ª,¼¿ºÓEˆŒØ×*Ñ*¬5¯<ª<¼¿ºÓFˆŒØ×*Ñ*¬5¯<ª<¼¿ºÓFˆŒØ×-Ñ-¬e×.>Ò.>Ä×@PÒ@PÓQˆŒ
Ø×.Ñ.¬u×/?Ò/?Ä×AQÒAQÓRˆŒØ×+Ñ+¬E¯NªN¼E¿NºNÓKˆŒØ×+Ñ+¬E¯MªM¸4Ó@ˆŒØ×,Ñ,¬U¯^ª^¸TÓBˆŒ	Ø×,Ñ,¬U¯^ª^¼U¿^º^ÓLˆŒ	Ø×/Ñ/´×0AÒ0AÄ5×CTÒCTÓUˆŒõ ˜3 ¨c¯h©hÓ7ˆŒÝ˜#˜{¨C¯G©GÓ4ˆŒÝ˜˜j¨#¯&©&Ó1ˆŒÝ˜#˜{¨C¯G©GÓ4ˆŒÝ˜#˜{¨C¯G©GÓ4ˆ�rŽ   c                 ó$   • UR                  U5      $ ©N)r9   )r…   ÚxrŠ   s      r†   r9   ÚMPContext.to_fixed¶   s   € Ø�z‰z˜$ÓÐrŽ   c                 óÐ   • U R                  U5      nU R                  U5      nU R                  [        R                  " UR                  UR                  /U R
                  Q76 5      $ )zp
Computes the Euclidean norm of the vector `(x, y)`, equal
to `\sqrt{x^2 + y^2}`. Both `x` and `y` must be real.)Úconvertr¢   r   Ú	mpf_hypotÚ_mpf_Ú_prec_rounding)r…   r*  Úys      r†   ÚhypotÚMPContext.hypot¹   sK   € ð �K‰K˜‹NˆØ�K‰K˜‹NˆØ�|‰|œEŸOšO¨A¯G©G°Q·W±WÐR¸s×?QÑ?QÒRÓSÐSrŽ   c                 ó>  • [        U R                  U5      5      nUS:X  a  U R                  U5      $ [        US5      (       d  [        eU R
                  u  p4[        R                  " XR                  X4SS9u  pVUc  U R                  U5      $ U R                  XV45      $ )Nr   r/  T)r÷   )ÚintÚ_rer  ÚhasattrÚNotImplementedErrorr0  r   Ú
mpf_expintr/  r¢   r¥   ©r…   ÚnÚzrŠ   ÚroundingÚrealÚimags          r†   Ú_gamma_upper_intÚMPContext._gamma_upper_intÁ   s‡   € Ü�—‘˜“
‹OˆØ�‹6Ø—6‘6˜!“9ÐÜ�q˜'×"Ñ"Ü%Ð%Ø×+Ñ+‰ˆÜ×%Ò% a¯©°$ÈÑM‰
ˆØ‰<Ø—<‘< Ó%Ð%à—<‘<  Ó-Ð-rŽ   c                 ó"  • [        U5      nUS:X  a  U R                  U5      $ [        US5      (       d  [        eU R                  u  p4[
        R                  " XR                  X45      u  pVUc  U R                  U5      $ U R                  XV45      $ )Nr   r/  )
r5  r  r7  r8  r0  r   r9  r/  r¢   r¥   r:  s          r†   Ú_expint_intÚMPContext._expint_intÎ   s}   € Ü�‹FˆØ�‹6Ø—6‘6˜!“9ÐÜ�q˜'×"Ñ"Ü%Ð%Ø×+Ñ+‰ˆÜ×%Ò% a¯©°$ÓA‰
ˆØ‰<Ø—<‘< Ó%Ð%à—<‘<  Ó-Ð-rŽ   c                 ó�  • [        US5      (       a<   U R                  [        R                  " UR                  U/U R
                  Q76 5      $ UR                  nU R                  [        R                  " X/U R
                  Q76 5      $ ! [         a1    U R                  (       a  e UR                  [        R                  4n Njf = f©Nr/  )r7  r¢   r   Úmpf_nthrootr/  r0  r   rm   r    Ú_mpc_r¥   Úmpc_nthroot©r…   r*  r;  s      r†   Ú_nthrootÚMPContext._nthrootÛ   sž   € Ü�1�g×Ñð+Ø—|‘|¤E×$5Ò$5°a·g±g¸qÐ$VÀ3×CUÑCUÒ$VÓWÐWð —‘ˆAØ�|‰|œE×-Ò-¨aÐH°S×5GÑ5GÒHÓIÐIøô !ó +Ø×#×#ØØ—W‘WœeŸk™kÐ*’ð+ús   “:B
 Â
8CÃCc                 ó$  • U R                   u  p4[        US5      (       a0  U R                  [        R                  " XR
                  X45      5      $ [        US5      (       a0  U R                  [        R                  " XR                  X45      5      $ g ©Nr/  rH  )	r0  r7  r¢   r   Úmpf_besseljnr/  r¥   Úmpc_besseljnrH  )r…   r;  r<  rŠ   r=  s        r†   Ú_besseljÚMPContext._besseljç   sn   € Ø×+Ñ+‰ˆÜ�1�g×ÑØ—<‘<¤× 2Ò 2°1·g±g¸tÓ NÓOÐOÜ�Q˜× Ñ Ø—<‘<¤× 2Ò 2°1·g±g¸tÓ NÓOÐOð !rŽ   c                 ó2  • U R                   u  p4[        US5      (       aO  [        US5      (       a>   [        R                  " UR                  UR                  X45      nU R                  U5      $ [        US5      (       a  UR                  [        R                  4nOUR                  n[        US5      (       a  UR                  [        R                  4nOUR                  nU R                  [        R                  " XX45      5      $ ! [         a     N¦f = frF  )r0  r7  r   Úmpf_agmr/  r¢   r   r    rH  r¥   Úmpc_agm)r…   ÚaÚbrŠ   r=  Úvs         r†   Ú_agmÚMPContext._agmî   sÓ   € Ø×+Ñ+‰ˆÜ�1�g×Ñ¤7¨1¨g×#6Ñ#6ðÜ—M’M !§'¡'¨1¯7©7°DÓC�Ø—|‘| A“Ð&ô �1�g×Ñ Q§W¡W¬e¯k©kÐ$:¡Ø—'‘'ˆaÜ�1�g×Ñ Q§W¡W¬e¯k©kÐ$:¡Ø—'‘'ˆaØ�|‰|œEŸMšM¨!°Ó?Ó@Ð@øô !ó Ùðús   ²<D	 Ä	
DÄDc                 ót   • U R                  [        R                  " [        U5      /U R                  Q76 5      $ r)  )r¢   r   Úmpf_bernoullir5  r0  ©r…   r;  s     r†   ry   ÚMPContext.bernoulliü   s+   € Ø�|‰|œE×/Ò/´°A³ÐL¸×9KÑ9KÒLÓMÐMrŽ   c                 ót   • U R                  [        R                  " [        U5      /U R                  Q76 5      $ r)  )r¢   r   Úmpf_zeta_intr5  r0  r]  s     r†   Ú	_zeta_intÚMPContext._zeta_intÿ   s+   € Ø�|‰|œE×.Ò.¬s°1«vÐK¸×8JÑ8JÒKÓLÐLrŽ   c                 óÐ   • U R                  U5      nU R                  U5      nU R                  [        R                  " UR                  UR                  /U R
                  Q76 5      $ r)  )r-  r¢   r   Ú	mpf_atan2r/  r0  )r…   r1  r*  s      r†   r~   ÚMPContext.atan2  sI   € Ø�K‰K˜‹NˆØ�K‰K˜‹NˆØ�|‰|œEŸOšO¨A¯G©G°Q·W±WÐR¸s×?QÑ?QÒRÓSÐSrŽ   c                 óN  • U R                  U5      n[        U5      nU R                  U5      (       a:  U R                  [        R
                  " XR                  /U R                  Q76 5      $ U R                  [        R                  " XR                  /U R                  Q76 5      $ r)  )r-  r5  Ú_is_real_typer¢   r   Úmpf_psir/  r0  r¥   Úmpc_psirH  )r…   Úmr<  s      r†   r}   ÚMPContext.psi  sw   € Ø�K‰K˜‹NˆÜ�‹FˆØ×Ñ˜Q×ÑØ—<‘<¤§¢¨a·±Ð N¸3×;MÑ;MÒ NÓOÐOà—<‘<¤§¢¨a·±Ð N¸3×;MÑ;MÒ NÓOÐOrŽ   c                 ó   • [        U5      U R                  ;  a  U R                  U5      nU R                  U5      u  p4[	        US5      (       aE  [
        R                  " UR                  X45      u  pVU R                  U5      U R                  U5      4$ [	        US5      (       aE  [
        R                  " UR                  X45      u  pVU R                  U5      U R                  U5      4$ U R                  " U40 UD6U R                  " U40 UD64$ rN  )Útyperr   r-  Ú_parse_precr7  r   Úmpf_cos_sinr/  r¢   Úmpc_cos_sinrH  r¥   rÅ   rÂ   ©r…   r*  ÚkwargsrŠ   r=  ÚcÚss          r†   Úcos_sinÚMPContext.cos_sin  sÖ   € Ü�‹7˜#Ÿ)™)Ó#Ø—‘˜A“ˆAØŸ™¨Ó0‰ˆÜ�1�g×ÑÜ×$Ò$ Q§W¡W¨dÓ=‰DˆAØ—<‘< “? C§L¡L°£OÐ3Ð3Ü�Q˜× Ñ Ü×$Ò$ Q§W¡W¨dÓ=‰DˆAØ—<‘< “? C§L¡L°£OÐ3Ð3à—7’7˜1Ñ' Ñ'¨¯ª°Ñ)=°fÑ)=Ð=Ð=rŽ   c                 ó   • [        U5      U R                  ;  a  U R                  U5      nU R                  U5      u  p4[	        US5      (       aE  [
        R                  " UR                  X45      u  pVU R                  U5      U R                  U5      4$ [	        US5      (       aE  [
        R                  " UR                  X45      u  pVU R                  U5      U R                  U5      4$ U R                  " U40 UD6U R                  " U40 UD64$ rN  )rm  rr   r-  rn  r7  r   Úmpf_cos_sin_pir/  r¢   Úmpc_cos_sin_pirH  r¥   rÅ   rÂ   rq  s          r†   Úcospi_sinpiÚMPContext.cospi_sinpi  sÖ   € Ü�‹7˜#Ÿ)™)Ó#Ø—‘˜A“ˆAØŸ™¨Ó0‰ˆÜ�1�g×ÑÜ×'Ò'¨¯©°Ó@‰DˆAØ—<‘< “? C§L¡L°£OÐ3Ð3Ü�Q˜× Ñ Ü×'Ò'¨¯©°Ó@‰DˆAØ—<‘< “? C§L¡L°£OÐ3Ð3à—7’7˜1Ñ' Ñ'¨¯ª°Ñ)=°fÑ)=Ð=Ð=rŽ   c                 óH   • U R                  5       nU R                  Ul        U$ )z@
Create a copy of the context, with the same working precision.
)Ú	__class__rŠ   )r…   rV  s     r†   ÚcloneÚMPContext.clone)  s   € ð �M‰M‹OˆØ—‘ˆŒØˆrŽ   c                 óL   • [        US5      (       d  [        U5      [        L a  gg)NrH  FT©r7  rm  Úcomplex©r…   r*  s     r†   rg  ÚMPContext._is_real_type4  s    € Ü�1�g×Ñ¤$ q£'¬WÒ"4ØØrŽ   c                 óL   • [        US5      (       d  [        U5      [        L a  gg)NrH  TFr�  rƒ  s     r†   Ú_is_complex_typeÚMPContext._is_complex_type9  s    € Ü�1�g×Ñ¤$ q£'¬WÒ"4ØØrŽ   c                 óš  • [        US5      (       a  UR                  [        :H  $ [        US5      (       a  [        UR                  ;   $ [	        U[
        5      (       d  [	        U[        R                  5      (       a  gU R                  U5      n[        US5      (       d  [        US5      (       a  U R                  U5      $ [        S5      e)a:  
Return *True* if *x* is a NaN (not-a-number), or for a complex
number, whether either the real or complex part is NaN;
otherwise return *False*::

    >>> from mpmath import *
    >>> isnan(3.14)
    False
    >>> isnan(nan)
    True
    >>> isnan(mpc(3.14,2.72))
    False
    >>> isnan(mpc(3.14,nan))
    True

r/  rH  Fzisnan() needs a number as input)r7  r/  r#   rH  Ú
isinstancer   r^   rs   r-  ÚisnanÚ	TypeErrorrƒ  s     r†   rŠ  ÚMPContext.isnan>  sš   € ô" �1�g×ÑØ—7‘7œd‘?Ð"Ü�1�g×ÑÜ˜1Ÿ7™7‘?Ð"Ü�aœ×#Ñ#¤z°!´X·\±\×'BÑ'BØØ�K‰K˜‹NˆÜ�1�g×Ñ¤'¨!¨W×"5Ñ"5Ø—9‘9˜Q“<ÐÜÐ9Ó:Ð:rŽ   c                 ó^   • U R                  U5      (       d  U R                  U5      (       a  gg)aX  
Return *True* if *x* is a finite number, i.e. neither
an infinity or a NaN.

    >>> from mpmath import *
    >>> isfinite(inf)
    False
    >>> isfinite(-inf)
    False
    >>> isfinite(3)
    True
    >>> isfinite(nan)
    False
    >>> isfinite(3+4j)
    True
    >>> isfinite(mpc(3,inf))
    False
    >>> isfinite(mpc(nan,3))
    False

FT)ÚisinfrŠ  rƒ  s     r†   ÚisfiniteÚMPContext.isfiniteZ  s#   € ð, �9‰9�Q�<‰<˜3Ÿ9™9 QŸ<™<ØØrŽ   c                 óè  • U(       d  g[        US5      (       a  UR                  u  p#pEU=(       a    US:¬  $ [        US5      (       a3  UR                  (       + =(       a    U R                  UR                  5      $ [        U5      [        ;   a  US:*  $ [        XR                  5      (       a'  UR                  u  pgU(       d  gUS:H  =(       a    US:*  $ U R                  U R                  U5      5      $ )z,
Determine if *x* is a nonpositive integer.
Tr/  r   rH  r   )r7  r/  r?  Úisnpintr>  rm  r   r‰  rs   Ú_mpq_r-  )r…   r*  ÚsignÚmanr¹   ÚbcÚpÚqs           r†   r’  ÚMPContext.isnpintt  s¾   € ö ØÜ�1�g×ÑØ!"§¡ÑˆD�sØ×$˜C 1™HÐ$Ü�1�g×ÑØ—v‘v”:×5 #§+¡+¨a¯f©fÓ"5Ð5Ü�‹7”iÓØ˜‘6ˆMÜ�aŸ™×!Ñ!Ø—7‘7‰DˆAÞØØ˜‘6×$˜a 1™fÐ$Ø�{‰{˜3Ÿ;™; q›>Ó*Ð*rŽ   c                 óê   • SSU R                   -  R                  S5      S-   SU R                  -  R                  S5      S-   SU R                  -  R                  S5      S-   /nS	R	                  U5      $ )
NzMpmath settings:z  mp.prec = %sé   z[default: 53]z  mp.dps = %sz[default: 15]z  mp.trap_complex = %sz[default: False]Ú
)rŠ   ÚljustÚdpsrm   Újoin)r…   Úliness     r†   Ú__str__ÚMPContext.__str__ˆ  st   € Ø#Ø §¡Ñ(×/Ñ/°Ó3°oÑEØ˜sŸw™wÑ&×-Ñ-¨bÓ1°OÑCØ%¨×(8Ñ(8Ñ8×?Ñ?ÀÓCÐFXÑXð
ˆð
 �y‰y˜ÓÐrŽ   c                 ó,   • [        U R                  5      $ r)  )r   Ú_precr„   s    r†   Ú_repr_digitsÚMPContext._repr_digits�  s   € ä˜Ÿ	™	Ó"Ð"rŽ   c                 ó   • U R                   $ r)  )Ú_dpsr„   s    r†   Ú_str_digitsÚMPContext._str_digits”  s   € à�x‰xˆrŽ   Fc                 ó(   ^• [        U U4S jSU5      $ )aƒ  
The block

    with extraprec(n):
        <code>

increases the precision n bits, executes <code>, and then
restores the precision.

extraprec(n)(f) returns a decorated version of the function f
that increases the working precision by n bits before execution,
and restores the parent precision afterwards. With
normalize_output=True, it rounds the return value to the parent
precision.
c                 ó   >• U T-   $ r)  © ©r—  r;  s    €r†   rŒ   Ú%MPContext.extraprec.<locals>.<lambda>¨  s	   ø€ ¨q°1ªurŽ   N©ÚPrecisionManager©r…   r;  Únormalize_outputs    ` r†   Ú	extraprecÚMPContext.extraprec˜  s   ø€ ô    ¤_°dÐ<LÓMÐMrŽ   c                 ó(   ^• [        U SU4S jU5      $ )z~
This function is analogous to extraprec (see documentation)
but changes the decimal precision instead of the number of bits.
Nc                 ó   >• U T-   $ r)  r­  ©Údr;  s    €r†   rŒ   Ú$MPContext.extradps.<locals>.<lambda>¯  s	   ø€ °Q¸²UrŽ   r°  r²  s    ` r†   ÚextradpsÚMPContext.extradpsª  s   ø€ ô
    T¬?Ð<LÓMÐMrŽ   c                 ó(   ^• [        U U4S jSU5      $ )ak  
The block

    with workprec(n):
        <code>

sets the precision to n bits, executes <code>, and then restores
the precision.

workprec(n)(f) returns a decorated version of the function f
that sets the precision to n bits before execution,
and restores the precision afterwards. With normalize_output=True,
it rounds the return value to the parent precision.
c                 ó   >• T$ r)  r­  r®  s    €r†   rŒ   Ú$MPContext.workprec.<locals>.<lambda>À  s   ø€ ©qrŽ   Nr°  r²  s    ` r†   ÚworkprecÚMPContext.workprec±  s   ø€ ô   ¤[°$Ð8HÓIÐIrŽ   c                 ó(   ^• [        U SU4S jU5      $ )z}
This function is analogous to workprec (see documentation)
but changes the decimal precision instead of the number of bits.
Nc                 ó   >• T$ r)  r­  r¸  s    €r†   rŒ   Ú#MPContext.workdps.<locals>.<lambda>Ç  s   ø€ ±QrŽ   r°  r²  s    ` r†   ÚworkdpsÚMPContext.workdpsÂ  s   ø€ ô
    T¬;Ð8HÓIÐIrŽ   Nr­  c                 ó$   ^ ^^^^• UU UUU4S jnU$ )aÛ  
Return a wrapped copy of *f* that repeatedly evaluates *f*
with increasing precision until the result converges to the
full precision used at the point of the call.

This heuristically protects against rounding errors, at the cost of
roughly a 2x slowdown compared to manually setting the optimal
precision. This method can, however, easily be fooled if the results
from *f* depend "discontinuously" on the precision, for instance
if catastrophic cancellation can occur. Therefore, :func:`~mpmath.autoprec`
should be used judiciously.

**Examples**

Many functions are sensitive to perturbations of the input arguments.
If the arguments are decimal numbers, they may have to be converted
to binary at a much higher precision. If the amount of required
extra precision is unknown, :func:`~mpmath.autoprec` is convenient::

    >>> from mpmath import *
    >>> mp.dps = 15
    >>> mp.pretty = True
    >>> besselj(5, 125 * 10**28)    # Exact input
    -8.03284785591801e-17
    >>> besselj(5, '1.25e30')   # Bad
    7.12954868316652e-16
    >>> autoprec(besselj)(5, '1.25e30')   # Good
    -8.03284785591801e-17

The following fails to converge because `\sin(\pi) = 0` whereas all
finite-precision approximations of `\pi` give nonzero values::

    >>> autoprec(sin)(pi) # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
      ...
    NoConvergence: autoprec: prec increased to 2910 without convergence

As the following example shows, :func:`~mpmath.autoprec` can protect against
cancellation, but is fooled by too severe cancellation::

    >>> x = 1e-10
    >>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x)
    1.00000008274037e-10
    1.00000000005e-10
    1.00000000005e-10
    >>> x = 1e-50
    >>> exp(x)-1; expm1(x); autoprec(lambda t: exp(t)-1)(x)
    0.0
    1.0e-50
    0.0

With *catch*, an exception or list of exceptions to intercept
may be specified. The raised exception is interpreted
as signaling insufficient precision. This permits, for example,
evaluating a function where a too low precision results in a
division by zero::

    >>> f = lambda x: 1/(exp(x)-1)
    >>> f(1e-30)
    Traceback (most recent call last):
      ...
    ZeroDivisionError
    >>> autoprec(f, catch=ZeroDivisionError)(1e-30)
    1.0e+30


c                  ó>  >• T	R                   nTc  T	R                  U5      nOTn US-   T	l          T
" U 0 UD6nUS-   n UT	l          T
" U 0 UD6nXF:X  a  O„T	R                  Xd-
  5      T	R                  U5      -
  nXr* :  a  OXT(       a  [	        SU< SU< SU* < 35        UnXS:¼  a  T	R                  SU-  5      eU[        US-  5      -  n[        XS5      nMš  UT	l         U7$ ! T a    T	R                  n N¾f = f! T a    T	R                  n NÀf = f! UT	l         f = f)Né
   é   zautoprec: target=z, prec=z, accuracy=z2autoprec: prec increased to %i without convergenceé   )rŠ   Ú_default_hyper_maxprecr©   ÚmagÚprintÚNoConvergencer5  Úmin)Úargsrr  rŠ   Úmaxprec2Úv1Úprec2Úv2ÚerrÚcatchr…   ÚfÚmaxprecÚverboses           €€€€€r†   Úf_autoprec_wrappedÚ.MPContext.autoprec.<locals>.f_autoprec_wrapped  sU  ø€ Ø—8‘8ˆDØ‰Ø×5Ñ5°dÓ;‘à"�ð Ø "™9�”ð!Ù˜DÐ+ FÑ+�Bð ˜r™	�ØØ$�C”Hð%Ù Ð/¨Ñ/˜ð “xØØŸ'™' "¡%›.¨3¯7©7°2«;Ñ6�CØ˜e“}ØÞÝÛ#£U¨SªDð2ô 3à�BØÓ(Ø!×/Ñ/ØLØñ ó!ð !ð œS  q¡›\Ñ)�EÜ Ó0�Eñ) ð,  �”Ø�3ˆJøð5 ó !ØŸ™’Bð!ûð !ó %Ø ŸW™Wšð%ûð$  �•úsR   ¦
D ±C# ¹D ÁC; ÁB
D Ã#C8Ã5D Ã7C8Ã8D Ã;DÄD ÄDÄD Ä	Dr­  )r…   rØ  rÙ  r×  rÚ  rÛ  s   ````` r†   ÚautoprecÚMPContext.autoprecÉ  s   ü€ ÷H$	ñ $	ðJ "Ð!rŽ   c                 ó:  ^ ^^• [        U[        5      (       a   SSR                  U UU4S jU 5       5      -  $ [        U[        5      (       a   SSR                  U UU4S jU 5       5      -  $ [	        US5      (       a  [        UR                  T40 TD6$ [	        US5      (       a  S[        UR                  T40 TD6-   S	-   $ [        U[        5      (       a  [        U5      $ [        UT R                  5      (       a  UR                  " T40 TD6$ [        U5      $ )
a;  
Convert an ``mpf`` or ``mpc`` to a decimal string literal with *n*
significant digits. The small default value for *n* is chosen to
make this function useful for printing collections of numbers
(lists, matrices, etc).

If *x* is a list or tuple, :func:`~mpmath.nstr` is applied recursively
to each element. For unrecognized classes, :func:`~mpmath.nstr`
simply returns ``str(x)``.

The companion function :func:`~mpmath.nprint` prints the result
instead of returning it.

The keyword arguments *strip_zeros*, *min_fixed*, *max_fixed*
and *show_zero_exponent* are forwarded to :func:`~mpmath.libmp.to_str`.

The number will be printed in fixed-point format if the position
of the leading digit is strictly between min_fixed
(default = min(-dps/3,-5)) and max_fixed (default = dps).

To force fixed-point format always, set min_fixed = -inf,
max_fixed = +inf. To force floating-point format, set
min_fixed >= max_fixed.

    >>> from mpmath import *
    >>> nstr([+pi, ldexp(1,-500)])
    '[3.14159, 3.05494e-151]'
    >>> nprint([+pi, ldexp(1,-500)])
    [3.14159, 3.05494e-151]
    >>> nstr(mpf("5e-10"), 5)
    '5.0e-10'
    >>> nstr(mpf("5e-10"), 5, strip_zeros=False)
    '5.0000e-10'
    >>> nstr(mpf("5e-10"), 5, strip_zeros=False, min_fixed=-11)
    '0.00000000050000'
    >>> nstr(mpf(0), 5, show_zero_exponent=True)
    '0.0e+0'

z[%s]z, c              3   óL   >#   • U  H  nTR                   " UT40 TD6v •  M     g 7fr)  ©Únstr©Ú.0rs  r…   rr  r;  s     €€€r†   Ú	<genexpr>Ú!MPContext.nstr.<locals>.<genexpr>]  ó!   øé € Ð&KÊÀA s§x¢x°°1Ñ'?¸Ö'?Êùó   ƒ!$z(%s)c              3   óL   >#   • U  H  nTR                   " UT40 TD6v •  M     g 7fr)  rá  rã  s     €€€r†   rå  ræ  _  rç  rè  r/  rH  Ú(Ú))r‰  ÚlistrŸ  Útupler7  r   r/  r:   rH  r   ÚreprÚmatrixÚ__nstr__Ústr)r…   r*  r;  rr  s   ` ``r†   râ  ÚMPContext.nstr4  sè   ú€ ôP �aœ×ÑØ˜TŸY™YÖ&KÉÓ&KÓKÑLÐLÜ�aœ×ÑØ˜TŸY™YÖ&KÉÓ&KÓKÑLÐLÜ�1�g×ÑÜ˜!Ÿ'™' 1Ñ/¨Ñ/Ð/Ü�1�g×ÑØœ A§G¡G¨QÑ9°&Ñ9Ñ9¸SÑ@Ð@Ü�aœ×$Ñ$Ü˜“7ˆNÜ�a˜Ÿ™×$Ñ$Ø—:’:˜aÑ* 6Ñ*Ð*Ü�1‹vˆrŽ   c                 óN  • U(       aÈ  [        U[        5      (       a³  SUR                  5       ;   aŸ  UR                  5       R                  SS5      n[        R                  U5      nUR                  S5      nU(       d  SnUR                  S5      R                  S5      nU R                  U R                  U5      U R                  U5      5      $ [        US5      (       a/  UR                  u  pgXg:X  a  U R                  U5      $ [        S5      e[        S	[        U5      -   5      e)
Nr¦   Ú Ú Úrer   ÚimÚ_mpi_z,can only create mpf from zero-width intervalzcannot create mpf from )r‰  r   ÚlowerÚreplaceÚget_complexÚmatchÚgroupÚrstriprp   r-  r7  rø  r¢   Ú
ValueErrorr‹  rî  )r…   r*  Ústringsrü  rö  r÷  rV  rW  s           r†   Ú_convert_fallbackÚMPContext._convert_fallbackj  sã   € Þ”z !¤Z×0Ñ0Ø�a—g‘g“iÓØ—G‘G“I×%Ñ% c¨2Ó.�Ü#×)Ñ)¨!Ó,�Ø—[‘[ Ó&�ÞØ�BØ—[‘[ Ó&×-Ñ-¨cÓ2�Ø—w‘w˜sŸ{™{¨2›°·±¸B³Ó@Ð@Ü�1�g×ÑØ—7‘7‰DˆAØ‹vØ—|‘| A“Ð&ä Ð!OÓPÐPÜÐ1´D¸³GÑ;Ó<Ð<rŽ   c                 ó&   • U R                   " U0 UD6$ r)  )r-  )r…   rÑ  rr  s      r†   Ú	mpmathifyÚMPContext.mpmathify|  s   € Ø�{Š{˜DÐ+ FÑ+Ð+rŽ   c                 ó.  • U(       aƒ  UR                  S5      (       a  gU R                  u  p#SU;   a  US   nSU;   a$  US   nX R                  :X  a  g[        U5      n X#4$ SU;   a   US   nX@R                  :X  a  g[	        U5      nX#4$ U R                  $ )NÚexact)r   rØ  r=  rŠ   rž  )Úgetr0  r§   r5  r   )r…   rr  rŠ   r=  rž  s        r†   rn  ÚMPContext._parse_prec  s¢   € ÞØ�z‰z˜'×"Ñ"ØØ ×/Ñ/‰NˆDØ˜VÓ#Ø! *Ñ-�Ø˜ÓØ˜f‘~�ØŸ7™7“?Ø!ä˜t›9‘Dð �>Ð!ð ˜&“Ø˜U‘m�ØŸ'™'“>Ø!Ü" 3Ó'�Ø�>Ð!Ø×!Ñ!Ð!rŽ   z'the exact result does not fit in memoryzœhypsum() failed to converge to the requested %i bits of accuracy
using a working precision of %i bits. Try with a higher maxprec,
maxterms, or set zeroprec.c                 ó´  • [        US5      (       a  XUS4nUR                  n	O"[        US5      (       a  XUS4nUR                  n	WU R                  ;  a&  [        R
                  " U5      S   U R                  U'   U R                  U   n
U R                  nUR                  SU R                  U5      5      nSnSn0 nS	n[        U5       HÔ  u  nnUU   S
:X  aW  UU:¼  aO  US	::  aI  Sn[        US U 5       H#  u  nnUU   S
:X  d  M  US	::  d  M  UU::  d  M!  SnM%     U(       d  [        S5      eMf  U R                  U5      u  nn[        U5      * nU* nUU:¼  a7  US	:¼  a1  US:”  a+  UU;   a  UU==   U-  ss'   OUUU'   [        UUU-
  S-   5      nU[        U5      -  nMÖ      XÜ:”  a  [        U R                   X»U-   4-  5      eX½-   nU(       a  [#        S U 5       5      nO0 nU
" UW	UUUU40 UD6u  nnnU* nSnUU:  a$  UR%                  5        H  nUb  UU:  d  M  Sn  O   UUS-
  S-
  :  =(       d    U(       + nU(       aF  U(       a  OOUR                  S5      n U b*  UU :”  a$  U(       a  U R'                  S	5      $ U R(                  $ US-  nUS-  nUS-  nMù  [+        U5      [,        L a)  U(       a  U R/                  U5      $ U R1                  U5      $ U$ )Nr/  ÚRrH  ÚCr   rÙ  é2   é   r   ÚZFTzpole in hypergeometric seriesé   é<   c              3   ó(   #   • U  H  oS 4v •  M
     g 7fr)  r­  )rä  r;  s     r†   rå  Ú#MPContext.hypsum.<locals>.<genexpr>Ç  s   é € ÐB²/¨Q 4¥²/ùs   ‚é   ÚzeroprecrË  )r7  r/  rH  rw   r   Úmake_hyp_summatorrŠ   r  rÌ  Ú	enumerateÚZeroDivisionErrorÚnint_distancer5  ÚmaxÚabsrÿ  Ú_hypsum_msgÚdictÚvaluesrp   r¤   rm  rí  r¥   r¢   )!r…   r—  r˜  ÚflagsÚcoeffsr<  Úaccurate_smallrr  ÚkeyrX  ÚsummatorrŠ   rÙ  r´  ÚepsshiftÚmagnitude_checkÚmax_total_jumpÚirs  ÚokÚiiÚccr;  r¹  ÚwpÚmag_dictÚzvÚhave_complexÚ	magnitudeÚcancelÚjumps_resolvedÚaccurater  s!                                    r†   ÚhypsumÚMPContext.hypsumš  s  € Ü�1�g×ÑØ˜˜sÐ"ˆCØ—‘‰AÜ�Q˜× Ñ Ø˜˜sÐ"ˆCØ—‘ˆAØ�c×'Ñ'Ó'Ü%*×%<Ò%<¸SÓ%AÀ!Ñ%DˆC×Ñ˜cÑ"Ø×$Ñ$ SÑ)ˆØ�x‰xˆØ—*‘*˜Y¨×(BÑ(BÀ4Ó(HÓIˆØˆ	Øˆð ˆØˆÜ˜fÖ%‰DˆAˆqØ�Q‰x˜3‹Ø˜“6˜a 1›fØ�BÜ"+¨F°2°A¨JÖ"7™˜˜Bà  ™9¨Õ+°°aµ¸AÀ½GØ!%šBñ #8ö Ü/Ð0OÓPÐPÙØ×$Ñ$ QÓ'‰DˆAˆqÜ�Q“�ˆAØ�ˆAØ�A‹v˜!˜q›& Q¨£UØ˜Ó'Ø# AÓ&¨!Ñ+Ô&à)*�O AÑ&Ü 	¨1¨t©8°b©=Ó9�	Øœc !›fÑ$ŠNñ) &ð* ØÓ"Ü  §¡°D¸y¹.Ð3IÑ!IÓJÐJØÑ!ˆBÞÜÑB±/ÓBÓB‘à�Ù*2°6¸1¸dÀBØ˜(ñ+.Ø&,ñ+.Ñ'ˆB�˜ià�ZˆFØ!ˆNØ˜>Ó)Ø!Ÿ™Ö*�AØ™	 q¨4¥xØ).˜Ùñ +ð  ¨2¡¨a¡Ñ/×E°~Ô3EˆHÞÞØà!Ÿ:™: jÓ1�ØÑ'Ø Ó(Þ'Ø#&§7¡7¨1£:Ð-à#&§8¡8˜Oð ˜‰NˆIà˜‰MˆHØ˜‰NˆIñG ôJ �‹8”uÒÞØ—|‘| BÓ'Ð'à—|‘| BÓ'Ð'àˆIrŽ   c                 ó„   • U R                  U5      nU R                  [        R                  " UR                  U5      5      $ )aF  
Computes `x 2^n` efficiently. No rounding is performed.
The argument `x` must be a real floating-point number (or
possible to convert into one) and `n` must be a Python ``int``.

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> ldexp(1, 10)
    mpf('1024.0')
    >>> ldexp(1, -3)
    mpf('0.125')

)r-  r¢   r   Ú	mpf_shiftr/  rJ  s      r†   ÚldexpÚMPContext.ldexpï  s/   € ð �K‰K˜‹NˆØ�|‰|œEŸOšO¨A¯G©G°QÓ7Ó8Ð8rŽ   c                 óŽ   • U R                  U5      n[        R                  " UR                  5      u  p#U R	                  U5      U4$ )zý
Given a real number `x`, returns `(y, n)` with `y \in [0.5, 1)`,
`n` a Python integer, and such that `x = y 2^n`. No rounding is
performed.

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> frexp(7.5)
    (mpf('0.9375'), 3)

)r-  r   Ú	mpf_frexpr/  r¢   )r…   r*  r1  r;  s       r†   ÚfrexpÚMPContext.frexp   s8   € ð �K‰K˜‹NˆÜ�Š˜qŸw™wÓ'‰ˆØ�|‰|˜A‹ Ð!Ð!rŽ   c                 ó8  • U R                  U5      u  p4U R                  U5      n[        US5      (       a%  U R                  [	        UR
                  X45      5      $ [        US5      (       a%  U R                  [        UR                  X45      5      $ [        S5      e)a…  
Negates the number *x*, giving a floating-point result, optionally
using a custom precision and rounding mode.

See the documentation of :func:`~mpmath.fadd` for a detailed description
of how to specify precision and rounding.

**Examples**

An mpmath number is returned::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fneg(2.5)
    mpf('-2.5')
    >>> fneg(-5+2j)
    mpc(real='5.0', imag='-2.0')

Precise control over rounding is possible::

    >>> x = fadd(2, 1e-100, exact=True)
    >>> fneg(x)
    mpf('-2.0')
    >>> fneg(x, rounding='f')
    mpf('-2.0000000000000004')

Negating with and without roundoff::

    >>> n = 200000000000000000000001
    >>> print(int(-mpf(n)))
    -200000000000000016777216
    >>> print(int(fneg(n)))
    -200000000000000016777216
    >>> print(int(fneg(n, prec=log(n,2)+1)))
    -200000000000000000000001
    >>> print(int(fneg(n, dps=log(n,10)+1)))
    -200000000000000000000001
    >>> print(int(fneg(n, prec=inf)))
    -200000000000000000000001
    >>> print(int(fneg(n, dps=inf)))
    -200000000000000000000001
    >>> print(int(fneg(n, exact=True)))
    -200000000000000000000001

r/  rH  ú2Arguments need to be mpf or mpc compatible numbers)
rn  r-  r7  r¢   r&   r/  r¥   r?   rH  rÿ  )r…   r*  rr  rŠ   r=  s        r†   ÚfnegÚMPContext.fneg  s|   € ð\ Ÿ™¨Ó0‰ˆØ�K‰K˜‹NˆÜ�1�g×ÑØ—<‘<¤¨¯©°Ó @ÓAÐAÜ�1�g×ÑØ—<‘<¤¨¯©°Ó @ÓAÐAÜÐMÓNÐNrŽ   c                 ó"  • U R                  U5      u  pEU R                  U5      nU R                  U5      n [        US5      (       a‚  [        US5      (       a0  U R                  [	        UR
                  UR
                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR
                  XE5      5      $ [        US5      (       a‚  [        US5      (       a0  U R                  [        UR                  UR
                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR                  XE5      5      $ [        S5      e! [        [        4 a    [        U R                  5      ef = f)a3  
Adds the numbers *x* and *y*, giving a floating-point result,
optionally using a custom precision and rounding mode.

The default precision is the working precision of the context.
You can specify a custom precision in bits by passing the *prec* keyword
argument, or by providing an equivalent decimal precision with the *dps*
keyword argument. If the precision is set to ``+inf``, or if the flag
*exact=True* is passed, an exact addition with no rounding is performed.

When the precision is finite, the optional *rounding* keyword argument
specifies the direction of rounding. Valid options are ``'n'`` for
nearest (default), ``'f'`` for floor, ``'c'`` for ceiling, ``'d'``
for down, ``'u'`` for up.

**Examples**

Using :func:`~mpmath.fadd` with precision and rounding control::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fadd(2, 1e-20)
    mpf('2.0')
    >>> fadd(2, 1e-20, rounding='u')
    mpf('2.0000000000000004')
    >>> nprint(fadd(2, 1e-20, prec=100), 25)
    2.00000000000000000001
    >>> nprint(fadd(2, 1e-20, dps=15), 25)
    2.0
    >>> nprint(fadd(2, 1e-20, dps=25), 25)
    2.00000000000000000001
    >>> nprint(fadd(2, 1e-20, exact=True), 25)
    2.00000000000000000001

Exact addition avoids cancellation errors, enforcing familiar laws
of numbers such as `x+y-x = y`, which don't hold in floating-point
arithmetic with finite precision::

    >>> x, y = mpf(2), mpf('1e-1000')
    >>> print(x + y - x)
    0.0
    >>> print(fadd(x, y, prec=inf) - x)
    1.0e-1000
    >>> print(fadd(x, y, exact=True) - x)
    1.0e-1000

Exact addition can be inefficient and may be impossible to perform
with large magnitude differences::

    >>> fadd(1, '1e-100000000000000000000', prec=inf)
    Traceback (most recent call last):
      ...
    OverflowError: the exact result does not fit in memory

r/  rH  r>  )rn  r-  r7  r¢   r'   r/  r¥   rC   rH  rB   rÿ  ÚOverflowErrorÚ_exact_overflow_msg©r…   r*  r1  rr  rŠ   r=  s         r†   ÚfaddÚMPContext.faddF  s7  € ðp Ÿ™¨Ó0‰ˆØ�K‰K˜‹NˆØ�K‰K˜‹Nˆð	9Ü�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRÜ˜1˜g×&Ñ&ØŸ<™<¬°A·G±G¸Q¿W¹WÀdÓ(UÓVÐVÜ�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°A·G±G¸Q¿W¹WÀdÓ(UÓVÐVÜ˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRô ÐMÓNÐNøô œMÐ*ó 	9Ü × 7Ñ 7Ó8Ð8ð	9úó!   ·AE( Â	A E( Ã
AE( ÄA E( Å(&Fc                 ó.  • U R                  U5      u  pEU R                  U5      nU R                  U5      n [        US5      (       aˆ  [        US5      (       a0  U R                  [	        UR
                  UR
                  XE5      5      $ [        US5      (       a6  U R                  [        UR
                  [        4UR                  XE5      5      $ [        US5      (       a‚  [        US5      (       a0  U R                  [        UR                  UR
                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR                  XE5      5      $ [        S5      e! [        [        4 a    [        U R                  5      ef = f)aY  
Subtracts the numbers *x* and *y*, giving a floating-point result,
optionally using a custom precision and rounding mode.

See the documentation of :func:`~mpmath.fadd` for a detailed description
of how to specify precision and rounding.

**Examples**

Using :func:`~mpmath.fsub` with precision and rounding control::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fsub(2, 1e-20)
    mpf('2.0')
    >>> fsub(2, 1e-20, rounding='d')
    mpf('1.9999999999999998')
    >>> nprint(fsub(2, 1e-20, prec=100), 25)
    1.99999999999999999999
    >>> nprint(fsub(2, 1e-20, dps=15), 25)
    2.0
    >>> nprint(fsub(2, 1e-20, dps=25), 25)
    1.99999999999999999999
    >>> nprint(fsub(2, 1e-20, exact=True), 25)
    1.99999999999999999999

Exact subtraction avoids cancellation errors, enforcing familiar laws
of numbers such as `x-y+y = x`, which don't hold in floating-point
arithmetic with finite precision::

    >>> x, y = mpf(2), mpf('1e1000')
    >>> print(x - y + y)
    0.0
    >>> print(fsub(x, y, prec=inf) + y)
    2.0
    >>> print(fsub(x, y, exact=True) + y)
    2.0

Exact addition can be inefficient and may be impossible to perform
with large magnitude differences::

    >>> fsub(1, '1e-100000000000000000000', prec=inf)
    Traceback (most recent call last):
      ...
    OverflowError: the exact result does not fit in memory

r/  rH  r>  )rn  r-  r7  r¢   r(   r/  r¥   rD   r    rH  rE   rÿ  rB  rC  rD  s         r†   ÚfsubÚMPContext.fsub�  s<  € ð` Ÿ™¨Ó0‰ˆØ�K‰K˜‹NˆØ�K‰K˜‹Nˆð	9Ü�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRÜ˜1˜g×&Ñ&ØŸ<™<¬°·±¼%Ð0@À!Ç'Á'È4Ó(ZÓ[Ð[Ü�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°A·G±G¸Q¿W¹WÀdÓ(UÓVÐVÜ˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRô ÐMÓNÐNøô œMÐ*ó 	9Ü × 7Ñ 7Ó8Ð8ð	9ús!   ·AE. Â	AE. ÃAE. Ä"A E. Å.&Fc                 ó"  • U R                  U5      u  pEU R                  U5      nU R                  U5      n [        US5      (       a‚  [        US5      (       a0  U R                  [	        UR
                  UR
                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR
                  XE5      5      $ [        US5      (       a‚  [        US5      (       a0  U R                  [        UR                  UR
                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR                  XE5      5      $ [        S5      e! [        [        4 a    [        U R                  5      ef = f)ae  
Multiplies the numbers *x* and *y*, giving a floating-point result,
optionally using a custom precision and rounding mode.

See the documentation of :func:`~mpmath.fadd` for a detailed description
of how to specify precision and rounding.

**Examples**

The result is an mpmath number::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fmul(2, 5.0)
    mpf('10.0')
    >>> fmul(0.5j, 0.5)
    mpc(real='0.0', imag='0.25')

Avoiding roundoff::

    >>> x, y = 10**10+1, 10**15+1
    >>> print(x*y)
    10000000001000010000000001
    >>> print(mpf(x) * mpf(y))
    1.0000000001e+25
    >>> print(int(mpf(x) * mpf(y)))
    10000000001000011026399232
    >>> print(int(fmul(x, y)))
    10000000001000011026399232
    >>> print(int(fmul(x, y, dps=25)))
    10000000001000010000000001
    >>> print(int(fmul(x, y, exact=True)))
    10000000001000010000000001

Exact multiplication with complex numbers can be inefficient and may
be impossible to perform with large magnitude differences between
real and imaginary parts::

    >>> x = 1+2j
    >>> y = mpc(2, '1e-100000000000000000000')
    >>> fmul(x, y)
    mpc(real='2.0', imag='4.0')
    >>> fmul(x, y, rounding='u')
    mpc(real='2.0', imag='4.0000000000000009')
    >>> fmul(x, y, exact=True)
    Traceback (most recent call last):
      ...
    OverflowError: the exact result does not fit in memory

r/  rH  r>  )rn  r-  r7  r¢   r)   r/  r¥   rG   rH  rF   rÿ  rB  rC  rD  s         r†   ÚfmulÚMPContext.fmulÒ  s7  € ðf Ÿ™¨Ó0‰ˆØ�K‰K˜‹NˆØ�K‰K˜‹Nˆð	9Ü�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRÜ˜1˜g×&Ñ&ØŸ<™<¬°A·G±G¸Q¿W¹WÀdÓ(UÓVÐVÜ�q˜'×"Ñ"Ü˜1˜g×&Ñ&ØŸ<™<¬°A·G±G¸Q¿W¹WÀdÓ(UÓVÐVÜ˜1˜g×&Ñ&ØŸ<™<¬°·±¸¿¹À$Ó(QÓRÐRô ÐMÓNÐNøô œMÐ*ó 	9Ü × 7Ñ 7Ó8Ð8ð	9úrG  c                 óþ  • U R                  U5      u  pEU(       d  [        S5      eU R                  U5      nU R                  U5      n[        US5      (       aˆ  [        US5      (       a0  U R	                  [        UR                  UR                  XE5      5      $ [        US5      (       a6  U R                  [        UR                  [        4UR                  XE5      5      $ [        US5      (       a‚  [        US5      (       a0  U R                  [        UR                  UR                  XE5      5      $ [        US5      (       a0  U R                  [        UR                  UR                  XE5      5      $ [        S5      e)a‰  
Divides the numbers *x* and *y*, giving a floating-point result,
optionally using a custom precision and rounding mode.

See the documentation of :func:`~mpmath.fadd` for a detailed description
of how to specify precision and rounding.

**Examples**

The result is an mpmath number::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fdiv(3, 2)
    mpf('1.5')
    >>> fdiv(2, 3)
    mpf('0.66666666666666663')
    >>> fdiv(2+4j, 0.5)
    mpc(real='4.0', imag='8.0')

The rounding direction and precision can be controlled::

    >>> fdiv(2, 3, dps=3)    # Should be accurate to at least 3 digits
    mpf('0.6666259765625')
    >>> fdiv(2, 3, rounding='d')
    mpf('0.66666666666666663')
    >>> fdiv(2, 3, prec=60)
    mpf('0.66666666666666667')
    >>> fdiv(2, 3, rounding='u')
    mpf('0.66666666666666674')

Checking the error of a division by performing it at higher precision::

    >>> fdiv(2, 3) - fdiv(2, 3, prec=100)
    mpf('-3.7007434154172148e-17')

Unlike :func:`~mpmath.fadd`, :func:`~mpmath.fmul`, etc., exact division is not
allowed since the quotient of two floating-point numbers generally
does not have an exact floating-point representation. (In the
future this might be changed to allow the case where the division
is actually exact.)

    >>> fdiv(2, 3, exact=True)
    Traceback (most recent call last):
      ...
    ValueError: division is not an exact operation

z"division is not an exact operationr/  rH  r>  )rn  rÿ  r-  r7  r¢   r+   r/  r¥   rI   r    rH  rJ   rD  s         r†   ÚfdivÚMPContext.fdiv  s  € ðb Ÿ™¨Ó0‰ˆÞÜÐAÓBÐBØ�K‰K˜‹NˆØ�K‰K˜‹NˆÜ�1�g×ÑÜ�q˜'×"Ñ"Ø—|‘|¤G¨A¯G©G°Q·W±W¸dÓ$MÓNÐNÜ�q˜'×"Ñ"Ø—|‘|¤G¨Q¯W©W´eÐ,<¸a¿g¹gÀtÓ$VÓWÐWÜ�1�g×ÑÜ�q˜'×"Ñ"Ø—|‘|¤K°·±¸¿¹À$Ó$QÓRÐRÜ�q˜'×"Ñ"Ø—|‘|¤G¨A¯G©G°Q·W±W¸dÓ$MÓNÐNÜÐMÓNÐNrŽ   c                 óf  • [        U5      nU[        ;   a  [        U5      U R                  4$ U[        R
                  L af  UR                  u  p4[        X45      u  pVSU-  U:¼  a  US-  nOU(       d  XPR                  4$ [        [        X5U-  -
  5      5      [        U5      -
  nXW4$ [        US5      (       a  UR                  nU R                  n	O¡[        US5      (       aA  UR                  u  pŠU
u  p¼pÞU(       a  XÞ-   n	OqU
[        :X  a  U R                  n	OZ[        S5      eU R                  U5      n[        US5      (       d  [        US5      (       a  U R!                  U5      $ [#        S5      eUu  nnnnUU-   nUS:  a  SnUnO�U(       ar  US:¼  a  UU-  nU R                  nOOUS:X  a  US-	  S-   nSnO>U* S-
  nUU-	  nUS-  (       a  US-  nUU-  U-
  nOUUU-  -  nUS-	  nU[        U5      -   nU(       a  U* nO$U[        :X  a  U R                  nSnO[        S5      eU[%        UU	5      4$ )	aÒ  
Return `(n,d)` where `n` is the nearest integer to `x` and `d` is
an estimate of `\log_2(|x-n|)`. If `d < 0`, `-d` gives the precision
(measured in bits) lost to cancellation when computing `x-n`.

    >>> from mpmath import *
    >>> n, d = nint_distance(5)
    >>> print(n); print(d)
    5
    -inf
    >>> n, d = nint_distance(mpf(5))
    >>> print(n); print(d)
    5
    -inf
    >>> n, d = nint_distance(mpf(5.00000001))
    >>> print(n); print(d)
    5
    -26
    >>> n, d = nint_distance(mpf(4.99999999))
    >>> print(n); print(d)
    5
    -26
    >>> n, d = nint_distance(mpc(5,10))
    >>> print(n); print(d)
    5
    4
    >>> n, d = nint_distance(mpc(5,0.000001))
    >>> print(n); print(d)
    5
    -19

rË  r   r/  rH  zrequires a finite numberzrequires an mpf/mpcr   éÿÿÿÿ)rm  r   r5  r¨   r^   rs   r“  Údivmodr8   r  r7  r/  rH  r    rÿ  r-  r  r‹  r  )r…   r*  Útypxr—  r˜  r;  Úrr¹  rö  Úim_distr÷  ÚisignÚimanÚiexpÚibcr”  r•  r¹   r–  rÍ  Úre_distÚts                         r†   r  ÚMPContext.nint_distanceY  s,  € ôB �A‹wˆØ”9ÓÜ�q“6˜3Ÿ8™8Ð#Ð#Ø”X—\‘\Ò!Ø—7‘7‰DˆAÜ˜!“<‰DˆAØ�‰s�a‹xØ�Q‘‘ÞØŸ(™(�{Ð"äœ˜Q ™s™U›Ó$¤x°£{Ñ2ˆAØ�4ˆKÜ�1�g×ÑØ—‘ˆBØ—h‘h‰GÜ�Q˜× Ñ Ø—W‘W‰FˆBØ%'Ñ"ˆE˜ÞØ™*‘Ø”u“ØŸ(™(‘ä Ð!;Ó<Ð<à—‘˜A“ˆAÜ�q˜'×"Ñ"¤g¨a°×&9Ñ&9Ø×(Ñ(¨Ó+Ð+äÐ 5Ó6Ð6ØÑˆˆc�3˜Ø�"‰fˆà�‹7ØˆAØ‰GÞà�a‹xØ˜3‘J�ØŸ(™(‘à˜“Ø˜!‘V˜Q‘J�Ø‘à�T˜!‘V�Ø˜1‘H�Ø�q—5Ø˜‘F�AØ˜a™4 3™,‘Cà˜A˜q™D‘M�CØ�q‘D�Øœh s›mÑ+�ÞØ�B�øØ”5‹[Ø—h‘hˆGØ‰AäÐ7Ó8Ð8Ø”#�g˜wÓ'Ð'Ð'rŽ   c                 óv   • U R                   n U R                  nU H  nX4-  nM	     X l         U7$ ! X l         f = f)a  
Calculates a product containing a finite number of factors (for
infinite products, see :func:`~mpmath.nprod`). The factors will be
converted to mpmath numbers.

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> fprod([1, 2, 0.5, 7])
    mpf('7.0')

)rŠ   r£   )r…   ÚfactorsÚorigrX  r—  s        r†   ÚfprodÚMPContext.fprod»  sC   € ð �x‰xˆð	Ø—‘ˆAÛ�Ø‘’ñ ð ŒHØˆrˆ	øð �Hús   Ž0 °8c                 óJ   • U R                  [        U R                  5      5      $ )z—
Returns an ``mpf`` with value chosen randomly from `[0, 1)`.
The number of randomly generated bits in the mantissa is equal
to the working precision.
)r¢   r6   r¤  r„   s    r†   ÚrandÚMPContext.randÐ  s   € ð �|‰|œH S§Y¡YÓ/Ó0Ð0rŽ   c                 óB   ^^• U R                  UU4S jT< ST< 35      $ )a   
Given Python integers `(p, q)`, returns a lazy ``mpf`` representing
the fraction `p/q`. The value is updated with the precision.

    >>> from mpmath import *
    >>> mp.dps = 15
    >>> a = fraction(1,100)
    >>> b = mpf(1)/100
    >>> print(a); print(b)
    0.01
    0.01
    >>> mp.dps = 30
    >>> print(a); print(b)      # a will be accurate
    0.01
    0.0100000000000000002081668171172
    >>> mp.dps = 15
c                 ó   >• [        TTX5      $ r)  )r   )rŠ   r‹   r—  r˜  s     €€r†   rŒ   Ú$MPContext.fraction.<locals>.<lambda>ê  s   ø€ ¬m¸A¸qÀ$Ô.LrŽ   Ú/)rq   )r…   r—  r˜  s    ``r†   ÚfractionÚMPContext.fractionØ  s!   ù€ ð$ �|‰|ÕLÛš!Ðóð 	rŽ   c                 ó6   • [        U R                  U5      5      $ r)  ©r  r-  rƒ  s     r†   ÚabsminÚMPContext.absminí  ó   € Ü�3—;‘;˜q“>Ó"Ð"rŽ   c                 ó6   • [        U R                  U5      5      $ r)  rm  rƒ  s     r†   ÚabsmaxÚMPContext.absmaxð  rp  rŽ   c                 óˆ   • [        US5      (       a0  UR                  u  p#U R                  U5      U R                  U5      /$ U$ )Nrø  )r7  rø  r¢   )r…   r*  rV  rW  s       r†   Ú
_as_pointsÚMPContext._as_pointsó  s:   € ä�1�g×ÑØ—7‘7‰DˆAØ—L‘L “O S§\¡\°!£_Ð5Ð5ØˆrŽ   r   c                 ón  • U R                  U5      (       a  [        US5      (       d  [        e[        U5      nU R                  n[
        R                  " UR                  X#XEU5      u  pxU V	s/ s H  o�R                  U	5      PM     nn	U V
s/ s H  o R                  U
5      PM     nn
Xx4$ s  sn	f s  sn
f )NrH  )	Úisintr7  r8  r5  r¤  r   Úmpc_zetasumrH  r¥   )r…   rt  rV  r;  ÚderivativesÚreflectrŠ   ÚxsÚysr*  r1  s              r†   Ú_zetasum_fastÚMPContext._zetasum_fast  s’   € Ø—	‘	˜!—‘¤¨¨G×!4Ñ!4Ü%Ð%Ü�‹FˆØ�y‰yˆÜ×"Ò" 1§7¡7¨A°+ÈÓM‰ˆÙ')Ó*¢r !�l‰l˜1Žo¡rˆÐ*Ù')Ó*¢r !�l‰l˜1Žo¡rˆÐ*Øˆvˆùò +ùÚ*s   Á.B-ÂB2)r   ©F)Nr­  F)é   )T):Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rl   rv   r9   r2  r@  rC  rK  rQ  rY  ry   ra  r~   r}   ru  rz  r~  rg  r†  rŠ  r�  r’  r¡  Úpropertyr¥  r©  r´  r»  rÀ  rÅ  rÝ  râ  r  r  rn  rC  r  r3  r7  r;  r?  rE  rI  rL  rO  r  ra  rd  rj  rn  rr  ru  r~  Ú__static_attributes__r­  rŽ   r†   rg   rg   :   s\  † ñò1òBT5òl òTò.ò.ò
JòPôAòNòMòTò
Pò>ò>òòò
ò
;ò8ò4+ò( ð ñ#ó ð#ð ñó ðôNô$NôJô"Jôi"ôV4òl=ò$,ò"ð* DÐð€KôSòj9ò""ò 4OòlHOòT@OòDCOòJ@OòD`(òDò*1òò*#ò#òðð" 23°¸U÷ rŽ   rg   c                   ó0   • \ rS rSrSS jrS rS rS rSrg)	r±  i  c                 ó4   • Xl         X l        X0l        X@l        g r)  )r…   ÚprecfunÚdpsfunr³  )Úselfr…   r‹  rŒ  r³  s        r†   rl   ÚPrecisionManager.__init__  s   € ØŒØŒØŒØ 0ÕrŽ   c                 óJ   ^ ^• [         R                  " T5      UU 4S j5       nU$ )Nc                  óf  >• TR                   R                  n TR                  (       a5  TR                  TR                   R                  5      TR                   l        O4TR                  TR                   R                  5      TR                   l        TR
                  (       a[  T" U 0 UD6n[        U5      [        L a-  [        U Vs/ s H  oD7PM     sn5      UTR                   l        $ U7UTR                   l        $ T" U 0 UD6UTR                   l        $ s  snf ! UTR                   l        f = fr)  )r…   rŠ   r‹  rŒ  rž  r³  rm  rí  )rÑ  rr  r`  rX  rV  rØ  r�  s        €€r†   ÚgÚ$PrecisionManager.__call__.<locals>.g  sÜ   ø€ à—8‘8—=‘=ˆDð%Ø—<—<Ø$(§L¡L°·±·±Ó$?�D—H‘H•Mà#'§;¡;¨t¯x©x¯|©|Ó#<�D—H‘H”LØ×(×(Ù˜4Ð* 6Ñ*�AÜ˜A“w¤%Ò'Ü$±!£_²!¨Q£b±!¡_Ó5ð
 !%�—‘•ð	 ˜2ð !%�—‘•ñ ˜dÐ- fÑ-à $�—‘•ùò &5øð
 !%�—‘•ús*   ™B.D ÃDÃD Ã+D Ã?D ÄD ÄD0)Ú	functoolsÚwraps)r�  rØ  r‘  s   `` r†   Ú__call__ÚPrecisionManager.__call__  s%   ù€ Ü	�Š˜Ó	õ	%ó 
ð	%ð  ˆrŽ   c                 ó.  • U R                   R                  U l        U R                  (       a5  U R                  U R                   R                  5      U R                   l        g U R	                  U R                   R
                  5      U R                   l        g r)  )r…   rŠ   Úorigpr‹  rŒ  rž  )r�  s    r†   Ú	__enter__ÚPrecisionManager.__enter__.  sP   € Ø—X‘X—]‘]ˆŒ
Ø�<�<Ø ŸL™L¨¯©¯©Ó7ˆD�H‰H�MàŸ;™; t§x¡x§|¡|Ó4ˆD�H‰H�LrŽ   c                 ó:   • U R                   U R                  l        grj   )r˜  r…   rŠ   )r�  Úexc_typeÚexc_valÚexc_tbs       r†   Ú__exit__ÚPrecisionManager.__exit__4  s   € ØŸ
™
ˆ�‰ŒØrŽ   )r…   rŒ  r³  r˜  r‹  Nr€  )	r‚  rƒ  r„  r…  rl   r•  r™  rŸ  rˆ  r­  rŽ   r†   r±  r±    s   † ô1ò
ò&5õrŽ   r±  Ú__main__)wr†  Ú__docformat__r“  rö  Úctx_baser   Úlibmp.backendr   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   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   ÚobjectÚ__new__ÚnewÚcompilerû  Úsage.libs.mpmath.ext_mainr`   rk   ÚlibsÚmpmathÚext_mainÚ_mpf_modulerb   ra   rc   rd   re   rg   r±  r‚  ÚdoctestÚtestmodr­  rŽ   r†   Ú<module>r°     s  ðñð €ã ã 	å )ç .å ÷÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ ÷ õ õ. Ý à‡n�n€à�jŠjð Kó L€ð ˆfÓÝBç3Ô3å?Ý.ç 0Ñ 0ôY�Ð2ô Y÷v&!ñ !ðH ˆzÓÛØ‡O‚OÕð rŽ   