+
    iq>                        ^ 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 ^RI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 ^RIHt ^RIH t   ! R R]!4      t" ! R R]"]]]
]]]]]]]]]]4      t#R# )    )gtlt)xrange)SpecialFunctions)RSCache)QuadratureMethods) LaplaceTransformInversionMethods)CalculusMethods)OptimizationMethods)
ODEMethods)MatrixMethods)MatrixCalculusMethods)LinearAlgebraMethods)Eigen)IdentificationMethods)VisualizationMethods)libmpc                       ] tR t^tRtR# )Context N)__name__
__module____qualname____firstlineno____static_attributes__r       o/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/mpmath/ctx_base.pyr   r      s    r   r   c                   f  a  ] tR t^t o ]P
                  t]P                  tR tR tRt	Rt
R tR tR tR tR tR	 tR
 tR tR tR tR!R ltR"R ltR tR#R ltR$R ltR%R ltR tR tR tR tR t] ! ]PB                  4      t"] ! ]PF                  4      t#] ! ]PH                  4      t$] ! ]PJ                  4      t%] ! ]PL                  4      t&] ! ]PN                  4      t(] ! ]PR                  4      t*] ! ]PV                  4      t,] ! ]PZ                  4      t.R&R lt/R&R lt0R t1R t2R t3R t4R t5V t6R# )'StandardBaseContextc                   / V n         \        P                  ! V 4       \        P                  ! V 4       \        P                  ! V 4       \
        P                  ! V 4       \        P                  ! V 4       \        P                  ! V 4       R # N)_aliasesr   __init__r   r   r	   r
   r   )ctxs   &r   r#   StandardBaseContext.__init__*   s]    !!#&""3'(11#6  %s#r   c           	         V P                   P                  4        F  w  r \        W\        W4      4       K  	  R #   \         d     K/  i ; ir!   )r"   itemssetattrgetattrAttributeError)r$   aliasvalues   &  r   _init_aliases!StandardBaseContext._init_aliases4   sC    LL..0LEGC$78 1 " s   <A
AFc                    \        R V4       R# )zWarning:N)printr$   msgs   &&r   warnStandardBaseContext.warn@   s    j#r   c                    \        V4      hr!   )
ValueErrorr1   s   &&r   
bad_domainStandardBaseContext.bad_domainC   s    or   c                B    \        VR 4      '       d   VP                  # V# )real)hasattrr:   r$   xs   &&r   _reStandardBaseContext._reF   s    1f66Mr   c                V    \        VR 4      '       d   VP                  # V P                  # )imag)r;   rA   zeror<   s   &&r   _imStandardBaseContext._imK   s!    1f66Mxxr   c                    V# r!   r   r<   s   &&r   
_as_pointsStandardBaseContext._as_pointsP   s    r   c                &    V P                  V4      ) # r!   convert)r$   r=   kwargss   &&,r   fnegStandardBaseContext.fnegS   s    Ar   c                P    V P                  V4      V P                  V4      ,           # r!   rI   r$   r=   yrK   s   &&&,r   faddStandardBaseContext.faddV       {{1~ckk!n,,r   c                P    V P                  V4      V P                  V4      ,
          # r!   rI   rO   s   &&&,r   fsubStandardBaseContext.fsubY   rS   r   c                P    V P                  V4      V P                  V4      ,          # r!   rI   rO   s   &&&,r   fmulStandardBaseContext.fmul\   rS   r   c                P    V P                  V4      V P                  V4      ,          # r!   rI   rO   s   &&&,r   fdivStandardBaseContext.fdiv_   rS   r   c                
   V'       dC   V'       d   \        R  V 4       V P                  4      # \        R V 4       V P                  4      # V'       d   \        R V 4       V P                  4      # \        WP                  4      # )c              3   F   "   T F  p\        V4      ^,          x  K  	  R# 5i   Nabs.0r=   s   & r   	<genexpr>+StandardBaseContext.fsum.<locals>.<genexpr>e   s     4t!CFAIIts   !c              3   8   "   T F  p\        V4      x  K  	  R # 5ir!   ra   rc   s   & r   re   rf   f   s     -1As   c              3   2   "   T F  q^,          x  K  	  R# 5ir_   r   rc   s   & r   re   rf   h   s     +d1ds   )sumrB   )r$   argsabsolutesquareds   &&&&r   fsumStandardBaseContext.fsumb   s_    4t4chh??--sxx88+d+SXX664""r   Nc                   a Ve   \        W4      pV'       d-   V P                  o\        V3R lV 4       V P                  4      # \        R V 4       V P                  4      # )Nc              3   F   <"   T F  w  rVS! V4      ,          x  K  	  R # 5ir!   r   )rd   r=   rP   cfs   &  r   re   +StandardBaseContext.fdot.<locals>.<genexpr>p   s     0REQ"Q%Rs   !c              3   6   "   T F  w  rW,          x  K  	  R # 5ir!   r   )rd   r=   rP   s   &  r   re   rr   r   s     ,s   )zipconjri   rB   )r$   xsys	conjugaterq   s   &&&&@r   fdotStandardBaseContext.fdotk   sK    >RBB0R0#((;;,,chh77r   c                @    V P                   pV F  pW#,          pK  	  V# r!   )one)r$   rj   prodargs   &&  r   fprodStandardBaseContext.fprodt   s!    wwCKD r   c                >    \        V P                  ! W3/ VB 4       R# )z&
Equivalent to ``print(nstr(x, n))``.
N)r0   nstr)r$   r=   nrK   s   &&&,r   nprintStandardBaseContext.nprintz   s     	chhq&v&'r   c                  a a Sf   ^dS P                   ,          o S P                  V4      p\        V4      p\        V4      S8  d   S P                  # S P	                  V4      '       dp   \        SVS,          4      p\        VP                  4      V8  d   VP                  # \        VP                  4      V8  d   S P                  ^ VP                  4      # V#   \         du    \        TS P                  4      '       d   TP                  T T3R l4      u # \        TR4      '       d+   T Uu. uF  pS P                  TS4      NK  	  Mu upi upu #  T# i ; i)a~  
Chops off small real or imaginary parts, or converts
numbers close to zero to exact zeros. The input can be a
single number or an iterable::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> chop(5+1e-10j, tol=1e-9)
    mpf('5.0')
    >>> nprint(chop([1.0, 1e-20, 3+1e-18j, -4, 2]))
    [1.0, 0.0, 3.0, -4.0, 2.0]

The tolerance defaults to ``100*eps``.
c                 (   < SP                  V S4      # r!   )chop)ar$   tols   &r   <lambda>*StandardBaseContext.chop.<locals>.<lambda>   s    !S)9r   __iter__)epsrJ   rb   rB   _is_complex_typemaxrA   r:   mpc	TypeError
isinstancematrixapplyr;   r   )r$   r=   r   absxpart_tolr   s   f&f   r   r   StandardBaseContext.chop   s    ;cgg+C	5AAq6D1v|xx##A&&sDH-qvv;)66Mqvv;)771aff--   	5!SZZ((ww9::q*%%234!QC(!44 &	5s5   7C C *8C #5C =EE0E	EEc                2   V P                  V4      pVf*   Vf&   V P                  ^V P                  ) ^,           4      ;r4Vf   TpMVf   Tp\        W,
          4      pWT8:  d   R# \        V4      p\        V4      pWg8  d   WW,          pW8*  # WV,          pW8*  # )a  
Determine whether the difference between `s` and `t` is smaller
than a given epsilon, either relatively or absolutely.

Both a maximum relative difference and a maximum difference
('epsilons') may be specified. The absolute difference is
defined as `|s-t|` and the relative difference is defined
as `|s-t|/\max(|s|, |t|)`.

If only one epsilon is given, both are set to the same value.
If none is given, both epsilons are set to `2^{-p+m}` where
`p` is the current working precision and `m` is a small
integer. The default setting typically allows :func:`~mpmath.almosteq`
to be used to check for mathematical equality
in the presence of small rounding errors.

**Examples**

    >>> from mpmath import *
    >>> mp.dps = 15
    >>> almosteq(3.141592653589793, 3.141592653589790)
    True
    >>> almosteq(3.141592653589793, 3.141592653589700)
    False
    >>> almosteq(3.141592653589793, 3.141592653589700, 1e-10)
    True
    >>> almosteq(1e-20, 2e-20)
    True
    >>> almosteq(1e-20, 2e-20, rel_eps=0, abs_eps=0)
    False

T)rJ   ldexpprecrb   )	r$   strel_epsabs_epsdiffabssabsterrs	   &&&&&    r   almosteqStandardBaseContext.almosteq   s    B KKN?w #		!chhYq[ 99G?G_G13x?1v1v;)C ~ )C~r   c                   \        V4      ^8:  g   \        R\        V4      ,          4      h\        V4      ^8  g   \        R\        V4      ,          4      h^ p^p\        V4      ^8X  d   V^ ,          pM"\        V4      ^8  d   V^ ,          pV^,          p\        V4      ^8X  d
   V^,          pV P                  V4      V P                  X4      V P                  V4      r4pW#,           V8w  g   Q R4       hW$8  d   V^ 8  d   . # \        pMV^ 8  d   . # \        p. p^ pTp W#V,          ,           pV^,          pV! W4      '       d   VP                  V4       K:   V# )a  
This is a generalized version of Python's :func:`~mpmath.range` function
that accepts fractional endpoints and step sizes and
returns a list of ``mpf`` instances. Like :func:`~mpmath.range`,
:func:`~mpmath.arange` can be called with 1, 2 or 3 arguments:

``arange(b)``
    `[0, 1, 2, \ldots, x]`
``arange(a, b)``
    `[a, a+1, a+2, \ldots, x]`
``arange(a, b, h)``
    `[a, a+h, a+h, \ldots, x]`

where `b-1 \le x < b` (in the third case, `b-h \le x < b`).

Like Python's :func:`~mpmath.range`, the endpoint is not included. To
produce ranges where the endpoint is included, :func:`~mpmath.linspace`
is more convenient.

**Examples**

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> arange(4)
    [mpf('0.0'), mpf('1.0'), mpf('2.0'), mpf('3.0')]
    >>> arange(1, 2, 0.25)
    [mpf('1.0'), mpf('1.25'), mpf('1.5'), mpf('1.75')]
    >>> arange(1, -1, -0.75)
    [mpf('1.0'), mpf('0.25'), mpf('-0.5')]

z+arange expected at most 3 arguments, got %iz+arange expected at least 1 argument, got %iz0dt is too small and would cause an infinite loop)lenr   mpfr   r   append)	r$   rj   r   dtbopresultir   s	   &*       r   arangeStandardBaseContext.arange   sE   @ 4yA~I!$i( ) )4yA~I!$i( ) ) t9>QAY!^QAQAt9>aB771:swwqz3772;bv{NNN{5Av	BAv	BqDAFA!xxa r   c                n   \        V4      ^8X  dD   V P                  V^ ,          4      pV P                  V^,          4      p\        V^,          4      pM\        V4      ^8X  dU   \        V^ ,          R4      '       g   Q hV^ ,          P                  pV^ ,          P
                  p\        V^,          4      pM\        R\        V4      ,          4      hV^8  d   \        R4      hRV9   d   VR,          '       dl   V^8X  d   V P                  V4      .# WC,
          V P                  V^,
          4      ,          p\        V4       Uu. uF  qwV,          V,           NK  	  ppWHR&   V# WC,
          V P                  V4      ,          p\        V4       Uu. uF  qwV,          V,           NK  	  ppV# u upi u upi )aT  
``linspace(a, b, n)`` returns a list of `n` evenly spaced
samples from `a` to `b`. The syntax ``linspace(mpi(a,b), n)``
is also valid.

This function is often more convenient than :func:`~mpmath.arange`
for partitioning an interval into subintervals, since
the endpoint is included::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = False
    >>> linspace(1, 4, 4)
    [mpf('1.0'), mpf('2.0'), mpf('3.0'), mpf('4.0')]

You may also provide the keyword argument ``endpoint=False``::

    >>> linspace(1, 4, 4, endpoint=False)
    [mpf('1.0'), mpf('1.75'), mpf('2.5'), mpf('3.25')]

_mpi_z*linspace expected 2 or 3 arguments, got %izn must be greater than 0endpoint)	r   r   intr;   r   r   r   r6   r   )	r$   rj   rK   r   r   r   stepr   rP   s	   &*,      r   linspaceStandardBaseContext.linspace   sl   * t9>Q AQ ADGAY!^47G,,,,Q		AQ		ADGAH!$i( ) )q5788V#vj'9'9Av
|#ESWWQU^+D%+AY/Y4!YA/bE  ESWWQZ'D%+AY/Y4!YA/ 0 0s   F-F2c                N    V P                   ! V3/ VB V P                  ! V3/ VB 3# r!   )cossinr$   zrK   s   &&,r   cos_sinStandardBaseContext.cos_sinN  s)    wwq#F#SWWQ%9&%999r   c                N    V P                   ! V3/ VB V P                  ! V3/ VB 3# r!   )cospisinpir   s   &&,r   cospi_sinpiStandardBaseContext.cospi_sinpiQ  s)    yy%f%syy'=f'===r   c                P    \        R VR,          ,          ^V,          ,           4      # )i  g      ?)r   )r$   ps   &&r   _default_hyper_maxprec*StandardBaseContext._default_hyper_maxprecT  s    4!T'>AaC'((r   c                *   V P                   p ^
p W4,           ^,           V n         V P                  pV P                  p^ pV! 4        Fp  pWh,          pWr,          '       gO   V'       dG   V P                  V4      p	\	        WY4      pV P                  V4      p
W,
          V P                   8  d    MV^,          pKr  	  VX
,
          pW8w  d   M8W8  g   V P
                  '       d   MV\        V P                   V4      ,          pK  VW0n         #   Y0n         i ; i
   )r   ninfrB   magr   _fixed_precisionmin)r$   terms
check_stepr   	extraprecmax_magr   ktermterm_magsum_magcancellations   &&&         r   sum_accurately"StandardBaseContext.sum_accuratelya  s    xx	I+a/((HH!GDIANN#&774="%g"8"%''!*"-8!FA $  '0/+s/C/C/CS<88	HtHs   AD
 'A:D
 "!D
 
Dc                0   V P                   p ^
p W4,           ^,           V n         V P                  pV P                  pTp^ pV! 4        Fq  p	Wy,          pW,
          p
W,          '       gH   V P                  V
4      p\	        W[4      pV P                  Wv,
          4      pV) V P                   8  d    MV^,          pKs  	  VX,
          pW8w  d   M8W8  g   V P
                  '       d   MV\        V P                   V4      ,          pK  VW0n         #   Y0n         i ; ir   )r   r   r|   r   r   r   r   )r$   factorsr   r   r   r   r|   r   r   factorr   r   r   r   s   &&&           r   mul_accurately"StandardBaseContext.mul_accurately}  s    xx	I+a/((gg%iFKA!<DNN#&774="%g"8"%''!%. %9sxx/!FA (  '0/+s/C/C/CS<88	HtHs   CD %!D Dc                P    V P                  V4      V P                  V4      ,          # )a  Converts `x` and `y` to mpmath numbers and evaluates
`x^y = \exp(y \log(x))`::

    >>> from mpmath import *
    >>> mp.dps = 30; mp.pretty = True
    >>> power(2, 0.5)
    1.41421356237309504880168872421

This shows the leading few digits of a large Mersenne prime
(performing the exact calculation ``2**43112609-1`` and
displaying the result in Python would be very slow)::

    >>> power(2, 43112609)-1
    3.16470269330255923143453723949e+12978188
rI   )r$   r=   rP   s   &&&r   powerStandardBaseContext.power  s      {{1~Q//r   c                $    V P                  V4      # r!   )zeta)r$   r   s   &&r   	_zeta_intStandardBaseContext._zeta_int  s    xx{r   c                &   a aaa ^ .oVVV V3R lpV# )a  
Return a wrapped copy of *f* that raises ``NoConvergence`` when *f*
has been called more than *N* times::

    >>> from mpmath import *
    >>> mp.dps = 15
    >>> f = maxcalls(sin, 10)
    >>> print(sum(f(n) for n in range(10)))
    1.95520948210738
    >>> f(10) # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
      ...
    NoConvergence: maxcalls: function evaluated 10 times

c                     < S^ ;;,          ^,          uu&   S^ ,          S8  d   SP                  RS,          4      hS! V / VB # )r   z%maxcalls: function evaluated %i times)NoConvergence)rj   rK   Ncounterr$   fs   *,r   f_maxcalls_wrapped8StandardBaseContext.maxcalls.<locals>.f_maxcalls_wrapped  sC    AJ!OJqzA~''(ORS(STTd%f%%r   r   )r$   r   r   r   r   s   fff @r   maxcallsStandardBaseContext.maxcalls  s      #	& 	&
 "!r   c                d   a aa / oV VV3R lpSP                   Vn         SP                  Vn        V# )a  
Return a wrapped copy of *f* that caches computed values, i.e.
a memoized copy of *f*. Values are only reused if the cached precision
is equal to or higher than the working precision::

    >>> from mpmath import *
    >>> mp.dps = 15; mp.pretty = True
    >>> f = memoize(maxcalls(sin, 1))
    >>> f(2)
    0.909297426825682
    >>> f(2)
    0.909297426825682
    >>> mp.dps = 25
    >>> f(2) # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
      ...
    NoConvergence: maxcalls: function evaluated 1 times

c                     < V'       d   V \        VP                  4       4      3pMT pSP                  pVS	9   d   S	V,          w  rEWC8  d   V5# S! V / VB pW63S	V&   V# r!   )tupler'   r   )
rj   rK   keyr   cpreccvaluer,   r$   r   f_caches
   *,     r   f_cached-StandardBaseContext.memoize.<locals>.f_cached  sf    E&,,.1188Dg~ '="7Nt&v&E =GCLLr   )r   __doc__)r$   r   r   r   s   ff @r   memoizeStandardBaseContext.memoize  s.    ( 	 JJ99r   r   )FF)NF)   r!   )NN)   )7r   r   r   r   r   r   ComplexResultr#   r-   r   verboser3   r7   r>   rC   rF   rL   rQ   rU   rX   r[   rm   ry   r   r   r   r   r   r   r   r   r   staticmethodgcd_gcdlist_primesisprimebernfracmoebiusifac_ifaceulernum	_eulernum	stirling1
_stirling1	stirling2
_stirling2r   r   r   r   r   r   r   __classdictcell__)__classdict__s   @r   r   r      sJ     ''M''M$  G

----#8("H1fGR,\:>) 		"Du001K5==)GENN+H5==)G$EU^^,Ieoo.Jeoo.J8@0$"0$ $r   r   N)$operatorr   r   libmp.backendr   functions.functionsr   functions.rszetar   calculus.quadraturer   calculus.inverselaplacer	   calculus.calculusr
   calculus.optimizationr   calculus.odesr   matrices.matricesr   matrices.calculusr   matrices.linalgr   matrices.eigenr   identificationr   visualizationr    r   objectr   r   r   r   r   <module>r#     sv     ! 1 % 2 E . 6 % , 4 1 ! 1 / 	f 	V'$	Vr   