§
    OŠtjl  ã                   ó.   — d dl mZ d dlmZ dd„Zdd„ZdS )é    )ÚS)ÚPolyNc                 óò  — |�dnd}|r| }t          | g|¢R i |¤Ž} t          |g|¢R i |¤Ž}| j        r|j        st          d¦  «        ‚| j        |j        k    st          d¦  «        ‚| j        }|                      ¦   «         dk     s|                     ¦   «         dk     rdhS |                      ¦   «         }|s|                     ¦   «         n|}t          ¦   «         }|d         D �]\  }	}
|d         D �]\  }}
|	                     ¦   «         }|                     ¦   «         }||k    rŒ5|	                     ¦   «         }|                     ¦   «         }||z
  j        sŒh|	 	                    ||dz
  z  ¦  «        }| 	                    ||dz
  z  ¦  «        }||z
  t          ||z  ¦  «        z  }|j        sŒ¾|dk     s||v rŒÉ|dk    r|	|                     |¦  «        z
  j        sŒí|                     |¦  «         �Œ�Œ|S )a=  Compute the *dispersion set* of two polynomials.

    For two polynomials `f(x)` and `g(x)` with `\deg f > 0`
    and `\deg g > 0` the dispersion set `\operatorname{J}(f, g)` is defined as:

    .. math::
        \operatorname{J}(f, g)
        & := \{a \in \mathbb{N}_0 | \gcd(f(x), g(x+a)) \neq 1\} \\
        &  = \{a \in \mathbb{N}_0 | \deg \gcd(f(x), g(x+a)) \geq 1\}

    For a single polynomial one defines `\operatorname{J}(f) := \operatorname{J}(f, f)`.

    Examples
    ========

    >>> from sympy import poly
    >>> from sympy.polys.dispersion import dispersion, dispersionset
    >>> from sympy.abc import x

    Dispersion set and dispersion of a simple polynomial:

    >>> fp = poly((x - 3)*(x + 3), x)
    >>> sorted(dispersionset(fp))
    [0, 6]
    >>> dispersion(fp)
    6

    Note that the definition of the dispersion is not symmetric:

    >>> fp = poly(x**4 - 3*x**2 + 1, x)
    >>> gp = fp.shift(-3)
    >>> sorted(dispersionset(fp, gp))
    [2, 3, 4]
    >>> dispersion(fp, gp)
    4
    >>> sorted(dispersionset(gp, fp))
    []
    >>> dispersion(gp, fp)
    -oo

    Computing the dispersion also works over field extensions:

    >>> from sympy import sqrt
    >>> fp = poly(x**2 + sqrt(5)*x - 1, x, domain='QQ<sqrt(5)>')
    >>> gp = poly(x**2 + (2 + sqrt(5))*x + sqrt(5), x, domain='QQ<sqrt(5)>')
    >>> sorted(dispersionset(fp, gp))
    [2]
    >>> sorted(dispersionset(gp, fp))
    [1, 4]

    We can even perform the computations for polynomials
    having symbolic coefficients:

    >>> from sympy.abc import a
    >>> fp = poly(4*x**4 + (4*a + 8)*x**3 + (a**2 + 6*a + 4)*x**2 + (a**2 + 2*a)*x, x)
    >>> sorted(dispersionset(fp))
    [0, 1]

    See Also
    ========

    dispersion

    References
    ==========

    .. [1] [ManWright94]_
    .. [2] [Koepf98]_
    .. [3] [Abramov71]_
    .. [4] [Man93]_
    NFTz!Polynomials need to be univariatez(Polynomials must have the same generatoré   r   )r   Úis_univariateÚ
ValueErrorÚgenÚdegreeÚfactor_listÚsetÚLCÚis_zeroÚcoeff_monomialr   Ú
is_integerÚshiftÚadd)ÚpÚqÚgensÚargsÚsamer	   ÚfpÚfqÚJÚsÚunusedÚtÚmÚnÚanÚbnÚanm1Úbnm1Úalphas                      úT/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/dispersion.pyÚdispersionsetr&      s+  € ðR �Mˆ5ˆ5 t€DØð ØˆåˆQÐ�ÐÐÐ˜ÐÐ€AÝˆQÐ�ÐÐÐ˜ÐÐ€AàŒ?ð > !¤/ð >ÝÐ<Ñ=Ô=Ð=ð Œ5�A”EŠ>ˆ>ÝÐCÑDÔDÐDØ
Œ%€Cð 	‡x‚x�z„z�A‚~€~˜Ÿš™œ aš˜Øˆsˆ
ð 
�Š‰Œ€BØ $Ð	,ˆ�Š‰Œˆ¨"€Bõ 	‰Œ€AØ˜”Uð ñ ‰	ˆˆ6Ø˜Aœð 	ñ 	‰IˆAˆvØ—’‘
”
ˆAØ—’‘
”
ˆAØ�AŠvˆvØØ—’‘”ˆBØ—’‘”ˆBØ˜‘GÔ$ð Øð ×#Ò# C¨!¨A©#¡JÑ/Ô/ˆDØ×#Ò# C¨!¨A©#¡JÑ/Ô/ˆDØ˜D‘[¥A a¨¡d¡G¤GÑ+ˆEØÔ#ð ØØ�qŠyˆy˜E Q˜J˜JØØ�1Šuˆu˜a !§'¢'¨%¡.¤.Ñ0Ô9ˆuØØ�EŠE�%‰LŒLˆL‰Lñ+	ð. €Hó    c                 ód   — t          | |g|¢R i |¤Ž}|st          j        }nt          |¦  «        }|S )aÀ  Compute the *dispersion* of polynomials.

    For two polynomials `f(x)` and `g(x)` with `\deg f > 0`
    and `\deg g > 0` the dispersion `\operatorname{dis}(f, g)` is defined as:

    .. math::
        \operatorname{dis}(f, g)
        & := \max\{ J(f,g) \cup \{0\} \} \\
        &  = \max\{ \{a \in \mathbb{N} | \gcd(f(x), g(x+a)) \neq 1\} \cup \{0\} \}

    and for a single polynomial `\operatorname{dis}(f) := \operatorname{dis}(f, f)`.
    Note that we make the definition `\max\{\} := -\infty`.

    Examples
    ========

    >>> from sympy import poly
    >>> from sympy.polys.dispersion import dispersion, dispersionset
    >>> from sympy.abc import x

    Dispersion set and dispersion of a simple polynomial:

    >>> fp = poly((x - 3)*(x + 3), x)
    >>> sorted(dispersionset(fp))
    [0, 6]
    >>> dispersion(fp)
    6

    Note that the definition of the dispersion is not symmetric:

    >>> fp = poly(x**4 - 3*x**2 + 1, x)
    >>> gp = fp.shift(-3)
    >>> sorted(dispersionset(fp, gp))
    [2, 3, 4]
    >>> dispersion(fp, gp)
    4
    >>> sorted(dispersionset(gp, fp))
    []
    >>> dispersion(gp, fp)
    -oo

    The maximum of an empty set is defined to be `-\infty`
    as seen in this example.

    Computing the dispersion also works over field extensions:

    >>> from sympy import sqrt
    >>> fp = poly(x**2 + sqrt(5)*x - 1, x, domain='QQ<sqrt(5)>')
    >>> gp = poly(x**2 + (2 + sqrt(5))*x + sqrt(5), x, domain='QQ<sqrt(5)>')
    >>> sorted(dispersionset(fp, gp))
    [2]
    >>> sorted(dispersionset(gp, fp))
    [1, 4]

    We can even perform the computations for polynomials
    having symbolic coefficients:

    >>> from sympy.abc import a
    >>> fp = poly(4*x**4 + (4*a + 8)*x**3 + (a**2 + 6*a + 4)*x**2 + (a**2 + 2*a)*x, x)
    >>> sorted(dispersionset(fp))
    [0, 1]

    See Also
    ========

    dispersionset

    References
    ==========

    .. [1] [ManWright94]_
    .. [2] [Koepf98]_
    .. [3] [Abramov71]_
    .. [4] [Man93]_
    )r&   r   ÚNegativeInfinityÚmax)r   r   r   r   r   Újs         r%   Ú
dispersionr,   ‚   sF   € õX 	�a˜Ð*˜TÐ*Ð*Ð* TÐ*Ð*€AØð åÔˆˆå�‰FŒFˆØ€Hr'   )N)Ú
sympy.corer   Úsympy.polysr   r&   r,   © r'   r%   ú<module>r0      sf   ðØ Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ðzð zð zð zðzRð Rð Rð Rð Rð Rr'   