�
��g+2 � �� � d dl mZ d dlmZmZmZmZmZmZm Z d dl
mZ d dlm
Z
mZ d dlmZ d dlmZmZmZmZ d dlmZmZ d dlmZ d d lmZmZ d d
lmZ ddl m Z dd�Z!d� Z" G d� de� � Z#dS )� )�AccumBounds)�S�Symbol�Add�sympify�Expr� PoleError�Mul)�factor_terms)�Float�_illegal)� factorial)�Abs�sign�arg�re)�exp�log)�gamma)�PolynomialError�factor)�Order� )�gruntz�+c �N � t | |||� � � d�� � S )aQ 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 �c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/series/limits.py�limitr%
s* � �f ��A�r�3���$�$�%�$�0�0�0� c �� � d}|t j u rLt | � |d|z � � |t j d� � }t |t � � rdS �n�| j s| j s| j s| j
�rfg }ddlm} | j
D �]}t ||||� � }|� t j � � r�|j ��t | t � � rt# | � � } t | t$ � � s || � � } t | t$ � � st'