+
    i3                         ^ RI Ht ^ RIHtHtHtHtHtHtH	t	 ^ RI
Ht ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHtHt ^ R	IHtHt ^ R
IHt ^ RIH t H!t! ^ RI"H#t# ^RI$H$t$ RR lt%R t& ! R R]4      t'R# )    )AccumBounds)SSymbolAddsympifyExpr	PoleErrorMul)factor_terms)Float_illegal)AppliedUndef)Dummy)	factorial)Abssignargre)explog)gamma)PolynomialErrorfactor)Order)gruntzc                :    \        WW#4      P                  RR7      # )a  Computes the limit of ``e(z)`` at the point ``z0``.

Parameters
==========

e : expression, the limit of which is to be taken

z : symbol representing the variable in the limit.
    Other symbols are treated as constants. Multivariate limits
    are not supported.

z0 : the value toward which ``z`` tends. Can be any expression,
    including ``oo`` and ``-oo``.

dir : string, optional (default: "+")
    The limit is bi-directional if ``dir="+-"``, from the right
    (z->z0+) if ``dir="+"``, and from the left (z->z0-) if
    ``dir="-"``. For infinite ``z0`` (``oo`` or ``-oo``), the ``dir``
    argument is determined from the direction of the infinity
    (i.e., ``dir="-"`` for ``oo``).

Examples
========

>>> from sympy import limit, sin, oo
>>> from sympy.abc import x
>>> limit(sin(x)/x, x, 0)
1
>>> limit(1/x, x, 0) # default dir='+'
oo
>>> limit(1/x, x, 0, dir="-")
-oo
>>> limit(1/x, x, 0, dir='+-')
zoo
>>> limit(1/x, x, oo)
0

Notes
=====

First we try some heuristics for easy and frequent cases like "x", "1/x",
"x**2" and similar, so that it's fast. For all other cases, we use the
Gruntz algorithm (see the gruntz() function).

See Also
========

 limit_seq : returns the limit of a sequence.
F)deep)Limitdoit)ezz0dirs   &&&&s/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/series/limits.pylimitr%      s     f r$$%$00    c                   RpV\         P                  J dO   \        V P                  V^V,          4      V\         P                  R4      p\        V\        4      '       d   R#  V# V P                  '       gO   V P                  '       g=   V P                  '       g+   V P                  '       Ed   \        V \        4      '       Eg   . p^ RIHp V P                   EF  p\        WqW#4      pVP                  \         P                  4      '       d   VP                   f   \        V \"        4      '       dr   \%        V 4      p	\        V	\&        4      '       g	   V! V	4      p	\        V	\&        4      '       g   \)        V 4      p	\        V	\&        4      '       d   \+        WW#4      u #  R#  R# \        V\        4      '       d    R# V\         P,                  J d    R# VP/                  V4       EK  	  V'       Edd   V P0                  ! V!  pV\         P,                  J d   V P                  '       d   \2        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   . p
. p\5        V4       FP  w  r\        V\6        4      '       d   V
P/                  V4       K.  VP/                  V P                  V,          4       KR  	  \9        V4      ^ 8  d4   \'        V!  P;                  4       p\        WW#4      pV\'        V
!  ,          pV\         P,                  J d:    ^ RIHp V! V 4      pT\         P,                  J g   TT 8X  d   R# \        TYT4      # V#   \@         d     R# i ; i)a  Computes the limit of an expression term-wise.
Parameters are the same as for the ``limit`` function.
Works with the arguments of expression ``e`` one by one, computing
the limit of each and then combining the results. This approach
works only for simple limits, but it is fast.
N+)togetherc              3   B   "   T F  p\        V\        4      x  K  	  R # 5iN)
isinstancer   ).0rrs   & r$   	<genexpr>heuristics.<locals>.<genexpr>j   s     /XVWPR
2{0K0KVWs   TF)ratsimp)!r   Infinityr%   subsZeror,   r   is_Mulis_Addis_Powis_Functionr   sympy.simplify.simplifyr)   argshas	is_finiter   r   r
   r   
heuristicsNaNappendfuncany	enumerater   lensimplifysympy.simplify.ratsimpr1   r   )r    r!   r"   r#   rvrr)   almr2e2iirvale3r1   rat_es   &&&&             r$   r=   r=   E   sp    
B	QZZ166!QqS>1affc2b%   !b I_ (((ahhh!(((q}}}ZPQS_E`E`4AaB$AuuQZZ  Q[[%8a%%$QA%a--$QK%a--"1I!!S)))!88Au%%aee% & 1BQUU{qxxxCC/XVW/XCCC/XVW/X,X,X )!HB!$44		$		!&&*-	 !- r7Q;b**,BbR-AS"XBQUU{>#AJE AEE>UaZUA3//I ' s    M M)(M)c                   J   a  ] tR t^t o RtRR lt]R 4       tR tR t	Rt
V tR# )	r   zRepresents an unevaluated limit.

Examples
========

>>> from sympy import Limit, sin
>>> from sympy.abc import x
>>> Limit(sin(x)/x, x, 0)
Limit(sin(x)/x, x, 0, dir='+')
>>> Limit(1/x, x, 0, dir="-")
Limit(1/x, x, 0, dir='-')

c                   \        V4      p\        V4      p\        V4      pV\        P                  \        P                  \        P                  ,          39   d   R pM<V\        P                  \        P                  \        P                  ,          39   d   RpVP                  V4      '       d   \        RV: RV: R24      h\        V\        4      '       d   \        V4      pM1\        V\        4      '       g   \        R\        V4      ,          4      h\        V4      R9  d   \        RV,          4      h\        P                  ! V 4      pWW43Vn        V# )-r(   z7Limits approaching a variable point are not supported (z -> )z6direction must be of type basestring or Symbol, not %sz1direction must be one of '+', '-' or '+-', not %s)r(   rS   +-)r   r   r2   ImaginaryUnitNegativeInfinityr;   NotImplementedErrorr,   strr   	TypeErrortype
ValueErrorr   __new___args)clsr    r!   r"   r#   objs   &&&&& r$   r]   Limit.__new__   s   AJAJR[!**aooajj899CA&&8J8J(JKKC66!99%34b': ; ;c3+CC(( %'+Cy1 2 2s8++ &(+, - - ll32O	
r&   c                    V P                   ^ ,          pVP                  pVP                  V P                   ^,          P                  4       VP                  V P                   ^,          P                  4       V# )r   )r:   free_symbolsdifference_updateupdate)selfr    isymss   &  r$   rc   Limit.free_symbols   sS    IIaL		! 9 9:TYYq\../r&   c                ,   V P                   w  r#rBVP                  VP                  reVP                  V4      '       g(   \	        V\        V4      ,          W44      p\        V4      # \	        WcV4      p\	        WSV4      p	V	\        P                  J dJ   V\        P                  \        P                  39   d%   \	        We^,
          ,          W44      p\        V4      # V	\        P                  J d'   V\        P                  J d   \        P                  # R# R# )   N)r:   baser   r;   r%   r   r   Oner2   rW   ComplexInfinity)
rf   r    _r!   r"   b1e1resex_limbase_lims
   &&        r$   pow_heuristicsLimit.pow_heuristics   s    iibBvvayy3r7
A*Cs8Orb!#quu!**a&8&899BQK/3xq)))f

.B$$$ /C)r&   c           	       aaaa V P                   w  pooo\        S4      R8X  d   \        VSSRR7      p\        VSSRR7      p\        V\        4      '       dB   \        V\        4      '       d,   VP                   ^ ,          VP                   ^ ,          8X  d   V # W48X  d   V# VP
                  '       d#   VP
                  '       d   \        P                  # \        RV: RV: 24      hS\        P                  J d   \        R4      hSP
                  '       dI   \        S4      pV\        V4      ,          pVP                  SVS,          4      pRo\        P                  oVP                  RR	4      '       d7   VP                  ! R/ VB pSP                  ! R/ VB oSP                  ! R/ VB oVS8X  d   S# VP!                  S4      '       g   V# S\        P"                  J d   \        P"                  # VP                   ! \%         '       d   V # VP&                  '       d4   \)        \        VP*                  SS4      .VP                   R
,          O5!  # \        P,                  p\        S4      R8X  d   \        P.                  pM \        S4      R8X  d   \        P0                  pVVVV3R loVP!                  \2        4      '       d   ^ RIHp V! V4      pS! V4      pVP9                  SS4      '       d   S\        P                  J d   VP                  S^S,          4      pV) pMVP                  SSS,           4      p VP;                  SVR7      w  rV	^ 8  d   \        P,                  # V	^ 8X  d   V# V^8X  g   \=        V	4      ^,          '       g!   \        P                  \        V4      ,          # VR8X  d!   \        P>                  \        V4      ,          # \        P                  # S\        P                  J dj   VP@                  '       d   \C        V4      p\E        RSPF                  SPH                  SPJ                  R7      p
VP                  S^V
,          4      pV) pT
pMVP                  SSS,           4      pSp VP;                  WR7      w  r\        V\L        4      '       d   V	\        P,                  8X  d   V# VP!                  \        P                  \        P>                  \        P                  \        P"                  4      '       d   V # VP!                  V4      '       g   V	PF                  '       d   \        P,                  # V	^ 8X  d   V# V	PH                  '       d   V^8X  d!   \        P                  \        V4      ,          # VR8X  dR   \        P>                  \        V4      ,          \        P0                  \        P.                  V	,           ,          ,          # \        P                  # \        RV	,          4      h SPb                  '       d   TPe                  \f        \h        4      pRp \_        TSSS4      pT\        P"                  J g   T\        P"                  J d   \O        4       h T#   \         d     ELi ; i  \        \        \N        3 d    ^ RI(H)p T! T4      pTPT                  '       d   T PW                  T4      pTe   Tu #  TPY                  YR7      pY8w  dm   TP!                  \Z        4      '       g&   TP!                  \        P\                  4      '       d-   \_        Y^ \a        T4      PH                  '       d   RMR4      u #  EL[  \        \        \N        3 d      ELui ; ii ; i  \N        \        3 d     Te   h \k        TSSS4      pTf   T u #  T# i ; i)a  Evaluates the limit.

Parameters
==========

deep : bool, optional (default: True)
    Invoke the ``doit`` method of the expressions involved before
    taking the limit.

hints : optional keyword arguments
    To be passed to ``doit`` methods; only used if deep is True.
rU   r(   )r#   rS   z1The limit does not exist since left hand limit = z and right hand limit = z.Limits at complex infinity are not implementedr   T:rj   NNc                   < V P                   '       g   V # \        ;QJ d!    . V3R  lV P                    4       F  NK  	  5M! V3R  lV P                    4       4      pWP                   8w  d   V P                  ! V!  p \        V \        4      p\        V \
        4      p\        V \        4      pV'       g   V'       g
   V'       Ed    \        V P                   ^ ,          SS	S4      pVP                  '       d'   \        ^V P                   ^ ,          ,          SS	S4      pVP                  '       d   V^ 8  R8X  dE   V'       d   V P                   ^ ,          ) # V'       d   \        P                  # \        P                  # V^ 8  R8X  dD   V'       d   V P                   ^ ,          # V'       d   \        P                  # \        P                  # V # V #   \         d    T u # i ; i)c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir+    )r-   r   	set_signss   & r$   r/   0Limit.doit.<locals>.set_signs.<locals>.<genexpr>  s     @isIcNNis   T)r:   tupler@   r,   r   r   r   r%   is_zerois_extended_realr   NegativeOnePirl   r4   rX   )
exprnewargsabs_flagarg_flag	sign_flagsigr#   rz   r!   r"   s
   &     r$   rz   Limit.doit.<locals>.set_signs  sd   999e@dii@ee@dii@@G))#yy'*!$,H!$,H"4.I9D		!aS9C{{{#AdiilNAr3? +++!G,5=TYYq\M J5>AMMJDEDDJ!Ag$.4<DIIaL D-6AEED<=FFDK4K +  K s   AG GG)	nsimplify)cdirr!   )positivenegativerealzNot sure of sign of %s)powsimpNry   )6r:   rY   r%   r,   r   is_infiniter   rm   r\   rX   r   absr3   r2   getr   r;   r>   r   is_Orderr   r   r4   rl   r   r   r9   r   is_meromorphicleadtermintrW   r5   r   r   is_positiveis_negativeis_realr   r	   sympy.simplify.powsimpr   r7   rt   as_leading_termr   Exp1r   r   is_extended_nonnegativerewriter   r   r=   )rf   hintsr    rG   rI   r   r   newecoeffexdummynewzr   r#   rz   r!   r"   s   &,           @@@@r$   r   
Limit.doit   s    		1b#s8taBC(AaBC(A!U##
1e(<(<66!9q	)Kv}}}((( !1& ' ' """% 'C D D >>>8DD	>Dq$q&!ACB99VT""AA!5!B6IuuQxxH;55L55(K:::qvvq"-;r
;;vvs8s?55DX_==D	 	4 55<<
 :!AaL Ar""QZZvva1~uvvaR(- MM!$M7	 666M1W L19CGaKK::d5k11RZ--d5k99,,,xxx O#TUT]T]^E66!QuW%D5DD66!QV$DD"	Md6IE  %--",yyQ%7%79J9JAEERR99T??>>>66M1W L^^^qy zz$u+55 11$u+=ammaeeVXj>YYY 000-.F.KLL #& %%%		)U+A		q!R%AAEEzQ!%%Zk! ( c  6 /; 	6
Axxx''*=H,,T,==eiinn		!&&8I8I!%qD9M9M9M#SVWW 3Y? 	^ :& 	}1aS)Ay  	sg   Z 	Z A ^ ZZ5^^(2]/$]/ )]/)^/^
^	^

^*_ _ry   Nr(   )__name__
__module____qualname____firstlineno____doc__r]   propertyrc   rt   r   __static_attributes____classdictcell__)__classdict__s   @r$   r   r      s4     6  %$A Ar&   r   Nr   )(!sympy.calculus.accumulationboundsr   
sympy.corer   r   r   r   r   r	   r
   sympy.core.exprtoolsr   sympy.core.numbersr   r   sympy.core.functionr   sympy.core.symbolr   (sympy.functions.combinatorial.factorialsr   $sympy.functions.elementary.complexesr   r   r   r   &sympy.functions.elementary.exponentialr   r   'sympy.functions.special.gamma_functionsr   sympy.polysr   r   sympy.series.orderr   r   r%   r=   r   ry   r&   r$   <module>r      sO    9 D D D - . , # > E E = 9 / $ 31l<~FD Fr&   