�
��gH � �� � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ dd lmZ dd
lmZmZ ddlmZ ddlmZ dd
lmZmZ ddlmZmZ ddlmZ dd�Z d� Z!d� Z"d� Z#dd�Z$dS )zLimits of sequences� )�AccumulationBounds)�Add)� PoleError)�Pow)�S)�Dummy)�sympify)� fibonacci)� factorial�subfactorial)�gamma)�Abs)�Max�Min)�cos�sin)�LimitN� c �� � t | � � } |�`| j }t |� � dk r|� � � }n1t |� � dk rt j S t
d| z � � �t |� � }|j du s |j du rt
d� � �t | d� � r| �
||� � }|r|S | � |||z � � | z
S )a� Difference Operator.
Explanation
===========
Discrete analog of differential operator. Given a sequence x[n],
returns the sequence x[n + step] - x[n].
Examples
========
>>> from sympy import difference_delta as dd
>>> from sympy.abc import n
>>> dd(n*(n + 1), n)
2*n + 2
>>> dd(n*(n + 1), n, 2)
4*n + 6
References
==========
.. [1] https://reference.wolfram.com/language/ref/DifferenceDelta.html
Nr r zqSince there is more than one variable in the expression, a variable must be supplied to take the difference of %sFzStep should be a finite number.�_eval_difference_delta)r �free_symbols�len�popr �Zero�
ValueError� is_number� is_finite�hasattrr �subs)�expr�n�step�f�results �e/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sympy/series/limitseq.py�difference_deltar&