o
    ôj¨  ã                   @   s@  d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZD ddlEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZT ddlUmVZVmWZWmXZX dd	lYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z` dd
lambZb ddlcmdZd ddlemfZfmgZgmhZhmiZi ddljmkZk ddllmmZnmoZpmqZr edk�rddlsmtZt ndZtdd„ Zudd„ Zvdd„ Zwdd„ Zxdd„ Zydd„ Zzdd„ Z{d d!„ Z|d"d#„ Z}d]d%d&„Z~d'd(„ Zd)d*„ Z€d+d,„ Z�d-d.„ Z‚d/d0„ Zƒd1d2„ Z„d3d4„ Z…d5d6„ Z†d7d8„ Z‡d9d:„ Zˆd;d<„ Z‰d^d=d>„ZŠd?d@„ Z‹dAdB„ ZŒdCdD„ Z�dEdF„ ZŽdGdH„ Z�dIdJ„ Z�dKdL„ Z‘dMdN„ Z’dOdP„ Z“dQdR„ Z”dSdT„ Z•dUdV„ Z–dWdX„ Z—dYdZ„ Z˜d[d\„ Z™dS )_z:Polynomial factorization routines in characteristic zero. é    )ÚGROUND_TYPES)Ú_randint)Úgf_from_int_polyÚgf_to_int_polyÚ	gf_lshiftÚ
gf_add_mulÚgf_mulÚgf_divÚgf_remÚgf_gcdexÚgf_sqf_pÚgf_factor_sqfÚ	gf_factor)Údup_LCÚdmp_LCÚdmp_ground_LCÚdup_TCÚdup_convertÚdmp_convertÚ
dup_degreeÚ
dmp_degreeÚdmp_degree_inÚdmp_degree_listÚdmp_from_dictÚ
dmp_zero_pÚdmp_oneÚdmp_nestÚ	dmp_raiseÚ	dup_stripÚ
dmp_groundÚdup_inflateÚdmp_excludeÚdmp_includeÚ
dmp_injectÚ	dmp_ejectÚdup_terms_gcdÚdmp_terms_gcd)Údup_negÚdmp_negÚdup_addÚdmp_addÚdup_subÚdmp_subÚdup_mulÚdmp_mulÚdup_sqrÚdmp_powÚdup_divÚdmp_divÚdup_quoÚdmp_quoÚ
dmp_expandÚdmp_add_mulÚdup_sub_mulÚdmp_sub_mulÚ
dup_lshiftÚdup_max_normÚdmp_max_normÚdup_l1_normÚdup_mul_groundÚdmp_mul_groundÚdup_quo_groundÚdmp_quo_ground)Údup_clear_denomsÚdmp_clear_denomsÚ	dup_truncÚdmp_ground_truncÚdup_contentÚ	dup_monicÚdmp_ground_monicÚdup_primitiveÚdmp_ground_primitiveÚdmp_eval_tailÚdmp_eval_inÚdmp_diff_eval_inÚ	dup_shiftÚ	dmp_shiftÚ
dup_mirror)Údmp_primitiveÚdup_inner_gcdÚdmp_inner_gcd)Ú	dup_sqf_pÚdup_sqf_normÚdmp_sqf_normÚdup_sqf_partÚdmp_sqf_partÚ_dup_check_degreesÚ_dmp_check_degrees)Ú_sort_factors)Úquery)ÚExtraneousFactorsÚDomainErrorÚCoercionFailedÚEvaluationFailed)Úsubsets)ÚceilÚlogÚlog2Úflint)Ú	fmpz_polyNc                 C   sb   g }|D ](}d}	 t | ||ƒ\}}|s||d } }nnq	|dkr%tdƒ‚| ||f¡ qt|ƒS )z¥
    Determine multiplicities of factors for a univariate polynomial
    using trial division.

    An error will be raised if any factor does not divide ``f``.
    r   Té   útrial division failed)r1   ÚRuntimeErrorÚappendrZ   )ÚfÚfactorsÚKÚresultÚfactorÚkÚqÚr© rr   úh/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/sympy/polys/factortools.pyÚdup_trial_divisionX   s   úrt   c           	      C   sj   g }|D ],}d}	 t | |||ƒ\}}t||ƒr||d } }nnq	|dkr)tdƒ‚| ||f¡ qt|ƒS )z§
    Determine multiplicities of factors for a multivariate polynomial
    using trial division.

    An error will be raised if any factor does not divide ``f``.
    r   Trf   rg   )r2   r   rh   ri   rZ   )	rj   rk   Úurl   rm   rn   ro   rp   rq   rr   rr   rs   Údmp_trial_divisiont   s   
úrv   c                 C   s¦   ddl m} t| ƒ}t|d ƒ}t|d ƒ}| tdd„ | D ƒƒ¡}||d |ƒ}||d |d ƒ}| t| |ƒ¡}	|| ||	  }
|
t| |ƒ7 }
t|
d ƒd }
|
S )aÍ  
    The Knuth-Cohen variant of Mignotte bound for
    univariate polynomials in ``K[x]``.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x = ring("x", ZZ)

    >>> f = x**3 + 14*x**2 + 56*x + 64
    >>> R.dup_zz_mignotte_bound(f)
    152

    By checking ``factor(f)`` we can see that max coeff is 8

    Also consider a case that ``f`` is irreducible for example
    ``f = 2*x**2 + 3*x + 4``. To avoid a bug for these cases, we return the
    bound plus the max coefficient of ``f``

    >>> f = 2*x**2 + 3*x + 4
    >>> R.dup_zz_mignotte_bound(f)
    6

    Lastly, to see the difference between the new and the old Mignotte bound
    consider the irreducible polynomial:

    >>> f = 87*x**7 + 4*x**6 + 80*x**5 + 17*x**4 + 9*x**3 + 12*x**2 + 49*x + 26
    >>> R.dup_zz_mignotte_bound(f)
    744

    The new Mignotte bound is 744 whereas the old one (SymPy 1.5.1) is 1937664.


    References
    ==========

    ..[1] [Abbott13]_

    r   )Úbinomialé   c                 s   s   � | ]}|d  V  qdS )rx   Nrr   ©Ú.0Úcfrr   rr   rs   Ú	<genexpr>¿   ó   € z(dup_zz_mignotte_bound.<locals>.<genexpr>rf   )	Ú(sympy.functions.combinatorial.factorialsrw   r   Ú_ceilÚsqrtÚsumÚabsr   r:   )rj   rl   rw   ÚdÚdeltaZdelta2Z	eucl_normÚt1Út2ÚlcÚboundrr   rr   rs   Údup_zz_mignotte_bound�   s   )r‰   c                 C   sL   t | ||ƒ}tt| ||ƒƒ}tt| |ƒƒ}| ||d ƒ¡d|  | | S )z7Mignotte bound for multivariate polynomials in `K[X]`. rf   rx   )r;   r‚   r   r�   r   r€   )rj   ru   rl   ÚaÚbÚnrr   rr   rs   Údmp_zz_mignotte_boundÌ   s   "r�   c                 C   sJ  | d }t ||||ƒ}t|||ƒ}tt|||ƒ||ƒ\}	}
t|	||ƒ}	t|
||ƒ}
tt|||ƒt|	||ƒ|ƒ}tt|||ƒ||ƒ}tt||
|ƒ||ƒ}tt|||ƒt|||ƒ|ƒ}tt||jg|ƒ||ƒ}tt|||ƒ||ƒ\}}t|||ƒ}t|||ƒ}tt|||ƒt|||ƒ|ƒ}tt|||ƒ||ƒ}tt|||ƒ||ƒ}||||fS )a
  
    One step in Hensel lifting in `Z[x]`.

    Given positive integer `m` and `Z[x]` polynomials `f`, `g`, `h`, `s`
    and `t` such that::

        f = g*h (mod m)
        s*g + t*h = 1 (mod m)

        lc(f) is not a zero divisor (mod m)
        lc(h) = 1

        deg(f) = deg(g) + deg(h)
        deg(s) < deg(h)
        deg(t) < deg(g)

    returns polynomials `G`, `H`, `S` and `T`, such that::

        f = G*H (mod m**2)
        S*G + T*H = 1 (mod m**2)

    References
    ==========

    .. [1] [Gathen99]_

    rx   )r7   rC   r1   r-   r)   r+   Úone)Úmrj   ÚgÚhÚsÚtrl   ÚMÚerp   rq   ru   ÚGÚHr‹   Úcrƒ   ÚSÚTrr   rr   rs   Údup_zz_hensel_stepÕ   s$   r›   c              	   C   st  t |ƒ}t||ƒ}|dkr$t|| || | ¡d |ƒ}t|| | |ƒgS | }|d }	ttt|ƒƒƒ}
t|g| ƒ}|d|	… D ]}t	|t|| ƒ| |ƒ}q>t||	 | ƒ}||	d d… D ]}t	|t|| ƒ| |ƒ}qZt
||| |ƒ\}}}t|| ƒ}t|| ƒ}t|| ƒ}t|| ƒ}td|
d ƒD ]}t|||||||ƒ|d \}}}}}qŒt| ||d|	… ||ƒt| |||	d… ||ƒ S )añ  
    Multifactor Hensel lifting in `Z[x]`.

    Given a prime `p`, polynomial `f` over `Z[x]` such that `lc(f)`
    is a unit modulo `p`, monic pair-wise coprime polynomials `f_i`
    over `Z[x]` satisfying::

        f = lc(f) f_1 ... f_r (mod p)

    and a positive integer `l`, returns a list of monic polynomials
    `F_1,\ F_2,\ \dots,\ F_r` satisfying::

       f = lc(f) F_1 ... F_r (mod p**l)

       F_i = f_i (mod p), i = 1..r

    References
    ==========

    .. [1] [Gathen99]_

    rf   r   rx   N)Úlenr   r=   ÚgcdexrC   Úintr   Ú_log2r   r   r   r   Úranger›   Údup_zz_hensel_lift)Úprj   Úf_listÚlrl   rq   r‡   ÚFr�   ro   rƒ   r�   Zf_ir‘   r’   r“   Ú_rr   rr   rs   r¡     s0   




(ÿr¡   c                 C   s(   ||d kr
|| }|sdS | | dkS )Nrx   Tr   rr   )Úfcrp   Úplrr   rr   rs   Ú_test_plG  s
   r©   c                    sv  t | ƒ}|dkr| gS ddlm} | d }t| |ƒ}t| |ƒ}tt| ||d ƒ¡d|  | | ƒƒ}t|d d|  |d| d   ƒ}ttdt	|ƒ ƒƒ}	td|	 t
|	ƒ ƒ}
g }td|
d ƒD ];}||ƒro|| dkrpqc| |¡}t| |ƒ}t|||ƒs�qct|||ƒd }| ||f¡ t|ƒdk sœt|ƒdkrž nqct|d	d
„ d�\‰}ttt
d| d ˆƒƒƒ}‡fdd„|D ƒ}tˆ| |||ƒ}tt|ƒƒ}t|ƒ}g d}}ˆ| }d| t|ƒk�r¶t||ƒD ]Á‰ |dk�rd}ˆ D ]
}||| d  }qó|| }t|||ƒ�s
qèn-|g}ˆ D ]}t||| |ƒ}�qt|||ƒ}t||ƒd }|d }|�r8|| dk�r8qè|g}tˆ ƒ‰ |ˆ  }|dk�r_|g}ˆ D ]}t||| |ƒ}�qMt|||ƒ}|D ]}t||| |ƒ}�qat|||ƒ}t||ƒ}t||ƒ}|| |k�r©|}‡ fdd„|D ƒ}t||ƒd }t||ƒd } | |¡ t| |ƒ} nqè|d7 }d| t|ƒksã|| g S )z4Factor primitive square-free polynomials in `Z[x]`. rf   r   )Úisprimeéÿÿÿÿrx   é   é   é   c                 S   s   t | d ƒS )Nrf   )rœ   )Úxrr   rr   rs   Ú<lambda>p  s    z#dup_zz_zassenhaus.<locals>.<lambda>)Úkeyc                    s   g | ]}t |ˆ ƒ‘qS rr   )r   )rz   Úff)r¢   rr   rs   Ú
<listcomp>t  ó    z%dup_zz_zassenhaus.<locals>.<listcomp>c                    s   g | ]}|ˆ vr|‘qS rr   rr   )rz   Úi)r™   rr   rs   r³   ¨  ó    )r   Úsympy.ntheoryrª   r:   r   rž   r‚   r€   r   rŸ   Ú_logr    Úconvertr   r   r   ri   rœ   Úminr¡   Úsetr`   r©   r-   rC   rH   r<   )rj   rl   rŒ   rª   r§   ÚAr‹   ÚBÚCÚgammarˆ   rŠ   Úpxr¥   ZfsqfxZfsqfr¤   Úmodularr�   Zsorted_Trš   rk   r’   r¨   rp   rµ   r–   r—   ZT_SZG_normZH_normrr   )r™   r¢   rs   Údup_zz_zassenhausN  s–   

*$

ÿ

ÿ




öË
7rÂ   c                 C   sr   t | |ƒ}t| |ƒ}t| dd… |ƒ}|r5ddlm} |t|ƒƒ}| ¡ D ]}|| r4||d  r4 dS q%dS dS )z2Test irreducibility using Eisenstein's criterion. rf   Nr   ©Ú	factorintrx   T)r   r   rE   r·   rÄ   rž   Úkeys)rj   rl   r‡   ÚtcZe_fcrÄ   Ze_ffr¢   rr   rr   rs   Údup_zz_irreducible_p·  s   

€úrÇ   Fc                 C   s¶  |j rz|| ¡ }}t| ||ƒ} W n ty   Y dS w |js"dS t| |ƒ}t| |ƒ}|dks8|dkr:|dkr:dS |sQt| |ƒ\}}||jksO|| dfgkrQdS t	| ƒ}g g }	}
t
|ddƒD ]
}|	 d| | ¡ q`t
|d ddƒD ]
}|
 d| | ¡ qstt|	ƒ|ƒ}	tt|
ƒ|ƒ}
t|	t|
d|ƒ|ƒ}| t||ƒ¡r£t||ƒ}|| kr©dS t| |ƒ}	| t|	|ƒ¡r»t|	|ƒ}	||	krÆt|	|ƒrÆdS t||ƒ}t||ƒ|krÙt||ƒrÙdS dS )ad  
    Efficiently test if ``f`` is a cyclotomic polynomial.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x = ring("x", ZZ)

    >>> f = x**16 + x**14 - x**10 + x**8 - x**6 + x**2 + 1
    >>> R.dup_cyclotomic_p(f)
    False

    >>> g = x**16 + x**14 - x**10 - x**8 - x**6 + x**2 + 1
    >>> R.dup_cyclotomic_p(g)
    True

    References
    ==========

    Bradford, Russell J., and James H. Davenport. "Effective tests for
    cyclotomic polynomials." In International Symposium on Symbolic and
    Algebraic Computation, pp. 244-251. Springer, Berlin, Heidelberg, 1988.

    Frf   r«   éþÿÿÿr   T)Úis_QQÚget_ringr   r^   Úis_ZZr   r   Údup_factor_listrŽ   r   r    Úinsertr/   r   r+   r9   Úis_negativer'   rO   Údup_cyclotomic_prV   )rj   rl   ZirreducibleÚK0r‡   rÆ   Úcoeffrk   rŒ   r�   r‘   rµ   r¥   r–   rr   rr   rs   rÏ   Ç  sN   ÿ






rÏ   c                 C   s\   ddl m} |j|j g}|| ƒ ¡ D ]\}}tt|||ƒ||ƒ}t|||d  |ƒ}q|S )z1Efficiently generate n-th cyclotomic polynomial. r   rÃ   rf   )r·   rÄ   rŽ   Úitemsr3   r    )rŒ   rl   rÄ   r‘   r¢   ro   rr   rr   rs   Údup_zz_cyclotomic_poly  s   rÓ   c                    s‚   ddl m} ˆ jˆ j gg}|| ƒ ¡ D ]*\‰}‡ ‡fdd„|D ƒ}| |¡ td|ƒD ]}‡ ‡fdd„|D ƒ}| |¡ q,q|S )Nr   rÃ   c                    s    g | ]}t t|ˆˆ ƒ|ˆ ƒ‘qS rr   )r3   r    )rz   r‘   ©rl   r¢   rr   rs   r³   ,  ó     z-_dup_cyclotomic_decompose.<locals>.<listcomp>rf   c                    s   g | ]}t |ˆˆ ƒ‘qS rr   )r    )rz   rp   rÔ   rr   rs   r³   0  r¶   )r·   rÄ   rŽ   rÒ   Úextendr    )rŒ   rl   rÄ   r—   ro   ÚQrµ   rr   rÔ   rs   Ú_dup_cyclotomic_decompose&  s   
þrØ   c                 C   s¦   t | |ƒt| |ƒ}}t| ƒdkrdS |dks|dvrdS tdd„ | dd… D ƒƒr,dS t| ƒ}t||ƒ}| |¡s<|S g }td| |ƒD ]}||vrP| |¡ qE|S )	aø  
    Efficiently factor polynomials `x**n - 1` and `x**n + 1` in `Z[x]`.

    Given a univariate polynomial `f` in `Z[x]` returns a list of factors
    of `f`, provided that `f` is in the form `x**n - 1` or `x**n + 1` for
    `n >= 1`. Otherwise returns None.

    Factorization is performed using cyclotomic decomposition of `f`,
    which makes this method much faster that any other direct factorization
    approach (e.g. Zassenhaus's).

    References
    ==========

    .. [1] [Weisstein09]_

    r   Nrf   )r«   rf   c                 s   s   � | ]}t |ƒV  qd S )N)Úboolry   rr   rr   rs   r|   P  r}   z+dup_zz_cyclotomic_factor.<locals>.<genexpr>r«   rx   )r   r   r   ÚanyrØ   Úis_oneri   )rj   rl   Zlc_fZtc_frŒ   r¥   r—   r‘   rr   rr   rs   Údup_zz_cyclotomic_factor6  s"   


€rÜ   c                 C   s¬   t | |ƒ\}}t|ƒ}t||ƒdk r| t||ƒ}}|dkr#|g fS |dkr,||gfS tdƒr:t||ƒr:||gfS d}tdƒrEt||ƒ}|du rNt||ƒ}|t|dd�fS )z:Factor square-free (non-primitive) polynomials in `Z[x]`. r   rf   ÚUSE_IRREDUCIBLE_IN_FACTORNÚUSE_CYCLOTOMIC_FACTORF)Úmultiple)	rH   r   r   r'   r[   rÇ   rÜ   rÂ   rZ   )rj   rl   Úcontr�   rŒ   rk   rr   rr   rs   Údup_zz_factor_sqfb  s"   




rá   c                 C   s  t dkr t| ddd… ƒ}| ¡ \}}dd„ |D ƒ}|t|ƒfS t| |ƒ\}}t|ƒ}t||ƒdk r;| t||ƒ}}|dkrC|g fS |dkrN||dfgfS tdƒr^t	||ƒr^||dfgfS t
||ƒ}d}td	ƒrnt||ƒ}|du rwt||ƒ}t| ||ƒ}t| |ƒ ||fS )
a  
    Factor (non square-free) polynomials in `Z[x]`.

    Given a univariate polynomial `f` in `Z[x]` computes its complete
    factorization `f_1, ..., f_n` into irreducibles over integers::

                f = content(f) f_1**k_1 ... f_n**k_n

    The factorization is computed by reducing the input polynomial
    into a primitive square-free polynomial and factoring it using
    Zassenhaus algorithm. Trial division is used to recover the
    multiplicities of factors.

    The result is returned as a tuple consisting of::

              (content(f), [(f_1, k_1), ..., (f_n, k_n))

    Examples
    ========

    Consider the polynomial `f = 2*x**4 - 2`::

        >>> from sympy.polys import ring, ZZ
        >>> R, x = ring("x", ZZ)

        >>> R.dup_zz_factor(2*x**4 - 2)
        (2, [(x - 1, 1), (x + 1, 1), (x**2 + 1, 1)])

    In result we got the following factorization::

                 f = 2 (x - 1) (x + 1) (x**2 + 1)

    Note that this is a complete factorization over integers,
    however over Gaussian integers we can factor the last term.

    By default, polynomials `x**n - 1` and `x**n + 1` are factored
    using cyclotomic decomposition to speedup computations. To
    disable this behaviour set cyclotomic=False.

    References
    ==========

    .. [1] [Gathen99]_

    rd   Nr«   c                 S   s&   g | ]\}}|  ¡ d d d… |f‘qS )Nr«   )Úcoeffs)rz   ÚfacÚexprr   rr   rs   r³   °  s   & z!dup_zz_factor.<locals>.<listcomp>r   rf   rÝ   rÞ   )r   re   rn   rZ   rH   r   r   r'   r[   rÇ   rV   rÜ   rÂ   rt   rX   )rj   rl   Zf_flintrà   rk   r�   rŒ   r—   rr   rr   rs   Údup_zz_factor  s2   .




rå   c                 C   sv   || g}| D ]-}t |ƒ}t|ƒD ]}|dkr%| ||¡}|| }|dks| |¡r.  dS q| |¡ q|dd… S )z,Wang/EEZ: Compute a set of valid divisors.  rf   N)r‚   ÚreversedÚgcdrÛ   ri   )ÚEÚcsÚctrl   rm   rp   rq   rr   rr   rs   Údmp_zz_wang_non_divisorsÓ  s   
þ
ÿrë   c                    s¶   t t| ˆƒˆ |d ˆƒstdƒ‚t | ˆ |ˆƒ}t|ˆƒs tdƒ‚t|ˆƒ\}}ˆ t|ˆƒ¡r8| t|ˆƒ}}|d ‰‡ ‡‡fdd„|D ƒ}	t|	||ˆƒ}
|
durW|||	fS tdƒ‚)z2Wang/EEZ: Test evaluation points for suitability. rf   zno luckc                    s   g | ]\}}t |ˆ ˆˆƒ‘qS rr   )rJ   )rz   r“   r¦   ©r¼   rl   Úvrr   rs   r³   ø  s    z+dmp_zz_wang_test_points.<locals>.<listcomp>N)	rJ   r   r_   rS   rH   rÎ   r   r'   rë   )rj   rš   rê   r¼   ru   rl   r�   r˜   r‘   rè   ÚDrr   rì   rs   Údmp_zz_wang_test_pointsç  s   

rï   c              	   C   sò  g dgt |ƒ |d }}	}
|D ]R}t|
|ƒ}t||ƒ| }ttt |ƒƒƒD ]6}d|| || }}\}}|| sH|| |d }}|| r;|dkr]t|t|||
|ƒ|
|ƒd}|	|< q'| |¡ qt|	ƒsjt	‚g g }}t
||ƒD ]E\}}t|||
|ƒ}t||ƒ}| |¡rŽ|| }n| ||¡}|| || }}t|||ƒ|| }}t|||
|ƒ}| |¡ | |¡ qt| |¡rÄ| ||fS g g }}t
||ƒD ]\}}| t|||
|ƒ¡ | t||d|ƒ¡ qÎt| |t |ƒd  ||ƒ} | ||fS )z0Wang/EEZ: Compute correct leading coefficients. r   rf   )rœ   r   r   ræ   r    r.   r0   ri   Úallr\   ÚziprJ   rÛ   rç   r=   r>   )rj   rš   ré   rè   r—   r¼   ru   rl   r¾   ÚJrí   r‘   r˜   rƒ   rµ   ro   r•   r“   r¦   ÚCCÚHHr‡   Úccr�   ZCCCZHHHrr   rr   rs   Údmp_zz_wang_lead_coeffs  sF   
ÿ"€








rö   c              	   C   sŽ  t | ƒdkrK| \}}t||ƒ}t||ƒ}t||||ƒ\}}	}
t|||ƒ}t|	||ƒ}	t||||ƒ\}}t|	||||ƒ}	t||ƒ}t|	|ƒ}	||	g}|S | d g}
t| dd… ƒD ]}|
 dt	||
d |ƒ¡ qXg dgg}}t
| |
ƒD ]\}}t||g|d g d|d|ƒ\}	}| |	¡ | |¡ qsg ||d g }}t
|| ƒD ]#\}}t||ƒ}t||ƒ}tt|||ƒ|||ƒ}t||ƒ}| |¡ q¡|S )z2Wang/EEZ: Solve univariate Diophantine equations. rx   r«   rf   r   )rœ   r   r   r   r	   r   r   ræ   rÍ   r-   rñ   Údmp_zz_diophantineri   r
   )r¥   r�   r¢   rl   rŠ   r‹   rj   r�   r’   r“   r–   rp   rm   r™   rš   rq   rr   rr   rs   Údup_zz_diophantine7  s:   




é 



rø   c              	      s¬  |sDdd„ | D ƒ}t |ƒ}t|ƒD ]0\}	}
|
sqt| ||	 ˆˆ ƒ}tt||ƒƒD ]\}\}}t||
ˆ ƒ}tt||ˆ ƒˆˆ ƒ||< q(q|S t|ƒ}t| ˆˆ ƒ}|d |dd… }}g g }}| D ]}| 	t
||ˆˆ ƒ¡ | 	t|||ˆˆ ƒ¡ q`t|||ˆˆ ƒ}ˆd ‰t||||ˆˆˆ ƒ}‡ ‡fdd„|D ƒ}t||ƒD ]\}}t|||ˆˆ ƒ}q�t|ˆˆˆ ƒ}tˆ j| g|ˆ ƒ}t|ˆ ƒ}td|ƒD ]ƒ}t|ˆƒrÎ n{t||ˆˆ ƒ}t||d ||ˆˆ ƒ}t|ˆƒ�sHt|ˆ  ˆ |ƒd ¡ˆˆ ƒ}t||||ˆˆˆ ƒ}t|ƒD ]\}	}tt|dˆˆ ƒ|ˆˆ ƒ||	< �qtt||ƒƒD ]\}	\}}t||ˆˆ ƒ||	< �qt||ƒD ]\}}t|||ˆˆ ƒ}�q3t|ˆˆˆ ƒ}qÅ‡ ‡‡fdd„|D ƒ}|S )	z4Wang/EEZ: Solve multivariate Diophantine equations. c                 S   s   g | ]}g ‘qS rr   rr   ©rz   r¦   rr   rr   rs   r³   j  s    z&dmp_zz_diophantine.<locals>.<listcomp>r«   Nrf   c                    s   g | ]	}t |d ˆˆ ƒ‘qS ©rf   )r   ©rz   r’   )rl   rí   rr   rs   r³   †  ó    r   c                    s   g | ]	}t |ˆˆˆ ƒ‘qS rr   )rD   rû   )rl   r¢   ru   rr   rs   r³   ¦  rü   )r   Ú	enumeraterø   rñ   r=   rC   r)   rœ   r5   ri   r4   rK   r÷   r8   rD   r   rŽ   r   r    r   r.   rL   r@   Ú	factorialr   r*   )r¥   r˜   r¼   rƒ   r¢   ru   rl   r™   rŒ   rµ   rÑ   rš   Újr’   r“   r•   rŠ   r½   r–   rj   r¾   r‹   r�   r”   ro   rr   )rl   r¢   ru   rí   rs   r÷   g  s\   þ5Ï


 €r÷   c              
   C   s”  | gt |ƒ|d }}}	t|ƒ}tt|dd… ƒƒD ]\}
}t|d |||
 ||
 |ƒ}| dt|||	|
 |ƒ¡ qtt| |ƒdd… ƒ}t	t
d|d ƒ||ƒD ]ë\}}}t|ƒ|d }}|d|d … ||d d… }}tt	||ƒƒD ]&\}
\}}tt|||	|ƒ||d |ƒ}|gt|dd… d|d |ƒ ||
< qwt|j| g||ƒ}t||ƒ}t|t|||ƒ||ƒ}t|||ƒ}t
d|ƒD ]x}t||ƒrÌ npt||||ƒ}t||d ||||ƒ}t||d ƒ�s;t|| ||ƒd ¡|d |ƒ}t||||||d |ƒ}tt	||ƒƒD ]\}
\}}t|t|d|d |ƒ|||ƒ}t||||ƒ||
< �q	t|t|||ƒ||ƒ}t||||ƒ}qÃqQt|||ƒ| k�rHt‚|S )z-Wang/EEZ: Parallel Hensel lifting algorithm. rf   Nr   rx   )rœ   Úlistrý   ræ   rK   rÍ   rD   Úmaxr   rñ   r    rJ   r   r   rŽ   r   r,   r5   r   r   r.   rL   r@   rþ   r÷   r6   r\   )rj   r—   ÚLCr¼   r¢   ru   rl   r™   rŒ   rí   rµ   rŠ   r’   rƒ   rÿ   r–   ÚwÚIrò   r‘   r‡   r�   r”   r˜   Zdjro   r¾   rš   r“   rr   rr   rs   Údmp_zz_wang_hensel_lifting«  sB    "&

 €r  c              	      s2  ddl m} t|ƒ‰tt| ˆ ƒ|d ˆ ƒ\}}t| |ˆ ƒ}ˆ ||ƒƒ}	ˆdu r0|dkr.d‰nd‰tƒ g ˆ jg| df\}
}}}z)t| ||||ˆ ƒ\}}}t	|ˆ ƒ\}}t
|ƒ}|dkr_| gW S |||||fg}W n	 tyq   Y nw tdƒ}tdƒ}tdƒ}t
|ƒ|k �rt|ƒD ]r}‡ ‡‡fd	d
„t|ƒD ƒ}t|ƒ|
vr¦|
 t|ƒ¡ nq‰zt| ||||ˆ ƒ\}}}W n	 ty¾   Y q‰w t	|ˆ ƒ\}}t
|ƒ}|durÞ||krÝ||k rÜg |}}nq‰n|}|dkré| g  S | |||||f¡ t
|ƒ|krû nq‰ˆ|7 ‰t
|ƒ|k s…d\}}}|D ]"\}}}}}t|ˆ ƒ}|du�r(||k �r'|}|}n|}|d7 }�q|| \}}}}}| }zt| ||||||ˆ ƒ\} }}t| ||||	|ˆ ƒ}W n t�yq   tdƒ�rmt||ˆ ˆd ƒ Y S tdƒ‚w g }|D ] } t| |ˆ ƒ\}} ˆ  t| |ˆ ƒ¡�r�t| |ˆ ƒ} | | ¡ �qv|S )a`  
    Factor primitive square-free polynomials in `Z[X]`.

    Given a multivariate polynomial `f` in `Z[x_1,...,x_n]`, which is
    primitive and square-free in `x_1`, computes factorization of `f` into
    irreducibles over integers.

    The procedure is based on Wang's Enhanced Extended Zassenhaus
    algorithm. The algorithm works by viewing `f` as a univariate polynomial
    in `Z[x_2,...,x_n][x_1]`, for which an evaluation mapping is computed::

                      x_2 -> a_2, ..., x_n -> a_n

    where `a_i`, for `i = 2, \dots, n`, are carefully chosen integers.  The
    mapping is used to transform `f` into a univariate polynomial in `Z[x_1]`,
    which can be factored efficiently using Zassenhaus algorithm. The last
    step is to lift univariate factors to obtain true multivariate
    factors. For this purpose a parallel Hensel lifting procedure is used.

    The parameter ``seed`` is passed to _randint and can be used to seed randint
    (when an integer) or (for testing purposes) can be a sequence of numbers.

    References
    ==========

    .. [1] [Wang78]_
    .. [2] [Geddes92]_

    r   )Ú	nextprimerf   Nrx   ÚEEZ_NUMBER_OF_CONFIGSÚEEZ_NUMBER_OF_TRIESÚEEZ_MODULUS_STEPc                    s   g | ]
}ˆ ˆˆ ˆƒƒ‘qS rr   rr   rù   ©rl   ÚmodÚrandintrr   rs   r³   "  s    zdmp_zz_wang.<locals>.<listcomp>)Nr   r   ÚEEZ_RESTART_IF_NEEDEDz3we need to restart algorithm with better parameters)r·   r  r   Údmp_zz_factorr   r�   r»   Úzerorï   rá   rœ   r_   r[   r    ÚtupleÚaddri   r:   rö   r  r\   Údmp_zz_wangrI   rÎ   r   r(   )rj   ru   rl   r  Úseedr  rê   rš   r‹   r¢   ÚhistoryZconfigsr¼   rq   ré   r’   rè   r¦   r—   Zeez_num_configsZeez_num_triesZeez_mod_stepÚrrZs_normZs_argrµ   Z_s_normÚorig_fr  rk   rm   rr   r
  rs   r  ß  s    ÿÿü
ÿÝ
%


€
ÿür  c           	      C   s  |st | |ƒS t| |ƒr|jg fS t| ||ƒ\}}t|||ƒdk r+| t|||ƒ}}tdd„ t||ƒD ƒƒr;|g fS t|||ƒ\}}g }t	||ƒdkr_t
|||ƒ}t|||ƒ}t| |||ƒ}t||d |ƒd D ]\}}| d|g|f¡ qit| ||ƒ |t|ƒfS )aÜ  
    Factor (non square-free) polynomials in `Z[X]`.

    Given a multivariate polynomial `f` in `Z[x]` computes its complete
    factorization `f_1, \dots, f_n` into irreducibles over integers::

                 f = content(f) f_1**k_1 ... f_n**k_n

    The factorization is computed by reducing the input polynomial
    into a primitive square-free polynomial and factoring it using
    Enhanced Extended Zassenhaus (EEZ) algorithm. Trial division
    is used to recover the multiplicities of factors.

    The result is returned as a tuple consisting of::

             (content(f), [(f_1, k_1), ..., (f_n, k_n))

    Consider polynomial `f = 2*(x**2 - y**2)`::

        >>> from sympy.polys import ring, ZZ
        >>> R, x,y = ring("x,y", ZZ)

        >>> R.dmp_zz_factor(2*x**2 - 2*y**2)
        (2, [(x - y, 1), (x + y, 1)])

    In result we got the following factorization::

                    f = 2 (x - y) (x + y)

    References
    ==========

    .. [1] [Gathen99]_

    r   c                 s   ó   � | ]}|d kV  qdS ©r   Nrr   ©rz   rƒ   rr   rr   rs   r|   œ  r}   z dmp_zz_factor.<locals>.<genexpr>rf   )rå   r   r  rI   r   r(   rð   r   rP   r   rW   r  rv   r  rÍ   rY   rZ   )	rj   ru   rl   rà   r�   r–   rk   r—   ro   rr   rr   rs   r  m  s&   $


r  c                    sJ   ˆ   ¡ ‰t| ˆ ˆƒ} t| ˆƒ\}}‡ ‡fdd„|D ƒ}ˆ  |ˆ¡}||fS )z>Factor univariate polynomials into irreducibles in `QQ_I[x]`. c                    s    g | ]\}}t |ˆˆ ƒ|f‘qS rr   )r   ©rz   rã   rµ   ©rÐ   ÚK1rr   rs   r³   ¶  rÕ   z#dup_qq_i_factor.<locals>.<listcomp>)Úas_AlgebraicFieldr   rÌ   r¹   )rj   rÐ   rÑ   rk   rr   r  rs   Údup_qq_i_factor°  s   r  c                 C   s˜   |  ¡ }t| ||ƒ} t| |ƒ\}}g }|D ]*\}}t||ƒ\}}	t|	||ƒ}
t|
d|ƒ\}}|||  ||  }| ||f¡ q|}| ||¡}||fS )z>Factor univariate polynomials into irreducibles in `ZZ_I[x]`. r   )Ú	get_fieldr   r  rA   rI   ri   r¹   )rj   rÐ   r  rÑ   rk   Únew_factorsrã   rµ   Ú	fac_denomÚfac_numÚfac_num_ZZ_IÚcontentÚfac_primrr   rr   rs   Údup_zz_i_factor»  s   r&  c                    sP   ˆ   ¡ ‰t| ˆˆ ˆƒ} t| ˆˆƒ\}}‡ ‡‡fdd„|D ƒ}ˆ  |ˆ¡}||fS )z@Factor multivariate polynomials into irreducibles in `QQ_I[X]`. c                    s"   g | ]\}}t |ˆˆˆ ƒ|f‘qS rr   )r   r  ©rÐ   r  ru   rr   rs   r³   ×  s   " z#dmp_qq_i_factor.<locals>.<listcomp>)r  r   Údmp_factor_listr¹   )rj   ru   rÐ   rÑ   rk   rr   r'  rs   Údmp_qq_i_factorÑ  s   r)  c                 C   s    |  ¡ }t| |||ƒ} t| ||ƒ\}}g }|D ],\}}t|||ƒ\}	}
t|
|||ƒ}t|||ƒ\}}|||  |	|  }| ||f¡ q|}| ||¡}||fS )z@Factor multivariate polynomials into irreducibles in `ZZ_I[X]`. )r  r   r)  rB   rI   ri   r¹   )rj   ru   rÐ   r  rÑ   rk   r   rã   rµ   r!  r"  r#  r$  r%  rr   rr   rs   Údmp_zz_i_factorÜ  s   r*  c                 C   s  t | ƒt| |ƒ}}t| |ƒ} |dkr|g fS |dkr"|| dfgfS t| |ƒ| } }t| |ƒ\}}}t||jƒ}t|ƒdkrI|| |t | ƒ fgfS ||j }	t	|ƒD ] \}
\}}t
||j|ƒ}t|||ƒ\}}}t||	|ƒ}|||
< qRt|||ƒ}t||ƒ ||fS )aN	  Factor univariate polynomials over algebraic number fields.

    The domain `K` must be an algebraic number field `k(a)` (see :ref:`QQ(a)`).

    Examples
    ========

    First define the algebraic number field `K = \mathbb{Q}(\sqrt{2})`:

    >>> from sympy import QQ, sqrt
    >>> from sympy.polys.factortools import dup_ext_factor
    >>> K = QQ.algebraic_field(sqrt(2))

    We can now factorise the polynomial `x^2 - 2` over `K`:

    >>> p = [K(1), K(0), K(-2)] # x^2 - 2
    >>> p1 = [K(1), -K.unit]    # x - sqrt(2)
    >>> p2 = [K(1), +K.unit]    # x + sqrt(2)
    >>> dup_ext_factor(p, K) == (K.one, [(p1, 1), (p2, 1)])
    True

    Usually this would be done at a higher level:

    >>> from sympy import factor
    >>> from sympy.abc import x
    >>> factor(x**2 - 2, extension=sqrt(2))
    (x - sqrt(2))*(x + sqrt(2))

    Explanation
    ===========

    Uses Trager's algorithm. In particular this function is algorithm
    ``alg_factor`` from [Trager76]_.

    If `f` is a polynomial in `k(a)[x]` then its norm `g(x)` is a polynomial in
    `k[x]`. If `g(x)` is square-free and has irreducible factors `g_1(x)`,
    `g_2(x)`, `\cdots` then the irreducible factors of `f` in `k(a)[x]` are
    given by `f_i(x) = \gcd(f(x), g_i(x))` where the GCD is computed in
    `k(a)[x]`.

    The first step in Trager's algorithm is to find an integer shift `s` so
    that `f(x-sa)` has square-free norm. Then the norm is factorized in `k[x]`
    and the GCD of (shifted) `f` with each factor gives the shifted factors of
    `f`. At the end the shift is undone to recover the unshifted factors of `f`
    in `k(a)[x]`.

    The algorithm reduces the problem of factorization in `k(a)[x]` to
    factorization in `k[x]` with the main additional steps being to compute the
    norm (a resultant calculation in `k[x,y]`) and some polynomial GCDs in
    `k(a)[x]`.

    In practice in SymPy the base field `k` will be the rationals :ref:`QQ` and
    this function factorizes a polynomial with coefficients in an algebraic
    number field  like `\mathbb{Q}(\sqrt{2})`.

    See Also
    ========

    dmp_ext_factor:
        Analogous function for multivariate polynomials over ``k(a)``.
    dup_sqf_norm:
        Subroutine ``sqfr_norm`` also from [Trager76]_.
    sympy.polys.polytools.factor:
        The high-level function that ultimately uses this function as needed.
    r   rf   )r   r   rF   rV   rT   Údup_factor_list_includeÚdomrœ   Úunitrý   r   rQ   rM   rt   rX   )rj   rl   rŒ   r‡   r¥   r’   r�   rq   rk   r—   rµ   rn   r¦   r‘   rr   rr   rs   Údup_ext_factorò  s(   B



r.  c                    s  |st | ˆ ƒS t| |ˆ ƒ}t| |ˆ ƒ} tdd„ t| |ƒD ƒƒr#|g fS t| |ˆ ƒ| } }t| |ˆ ƒ\}}}t||ˆ jƒ}t	|ƒdkrF| g}n1t
|ƒD ],\}	\}
}t|
|ˆ jˆ ƒ}t|||ˆ ƒ\}}}‡ fdd„|D ƒ}t|||ˆ ƒ}|||	< qJt|||ˆ ƒ}t|||ƒ ||fS )a®  Factor multivariate polynomials over algebraic number fields.

    The domain `K` must be an algebraic number field `k(a)` (see :ref:`QQ(a)`).

    Examples
    ========

    First define the algebraic number field `K = \mathbb{Q}(\sqrt{2})`:

    >>> from sympy import QQ, sqrt
    >>> from sympy.polys.factortools import dmp_ext_factor
    >>> K = QQ.algebraic_field(sqrt(2))

    We can now factorise the polynomial `x^2 y^2 - 2` over `K`:

    >>> p = [[K(1),K(0),K(0)], [], [K(-2)]] # x**2*y**2 - 2
    >>> p1 = [[K(1),K(0)], [-K.unit]]       # x*y - sqrt(2)
    >>> p2 = [[K(1),K(0)], [+K.unit]]       # x*y + sqrt(2)
    >>> dmp_ext_factor(p, 1, K) == (K.one, [(p1, 1), (p2, 1)])
    True

    Usually this would be done at a higher level:

    >>> from sympy import factor
    >>> from sympy.abc import x, y
    >>> factor(x**2*y**2 - 2, extension=sqrt(2))
    (x*y - sqrt(2))*(x*y + sqrt(2))

    Explanation
    ===========

    This is Trager's algorithm for multivariate polynomials. In particular this
    function is algorithm ``alg_factor`` from [Trager76]_.

    See :func:`dup_ext_factor` for explanation.

    See Also
    ========

    dup_ext_factor:
        Analogous function for univariate polynomials over ``k(a)``.
    dmp_sqf_norm:
        Multivariate version of subroutine ``sqfr_norm`` also from [Trager76]_.
    sympy.polys.polytools.factor:
        The high-level function that ultimately uses this function as needed.
    c                 s   r  r  rr   r  rr   rr   rs   r|   ‰  r}   z!dmp_ext_factor.<locals>.<genexpr>rf   c                    s   g | ]}|ˆ j  ‘qS rr   )r-  )rz   Úsi©rl   rr   rs   r³   —  r´   z"dmp_ext_factor.<locals>.<listcomp>)r.  r   rG   rð   r   rW   rU   Údmp_factor_list_includer,  rœ   rý   r   rR   rN   rv   rY   )rj   ru   rl   r‡   r¥   r’   r�   rq   rk   rµ   rn   r¦   r‘   rŠ   rm   rr   r0  rs   Údmp_ext_factorT  s(   /

r2  c                 C   s`   t | ||jƒ} t| |j|jƒ\}}t|ƒD ]\}\} }t | |j|ƒ|f||< q| ||j¡|fS )z2Factor univariate polynomials over finite fields. )r   r,  r   r  rý   r¹   )rj   rl   rÑ   rk   rµ   ro   rr   rr   rs   Údup_gf_factor¢  s
   r3  c                 C   s   t dƒ‚)z4Factor multivariate polynomials over finite fields. z+multivariate polynomials over finite fields)ÚNotImplementedError)rj   ru   rl   rr   rr   rs   Údmp_gf_factor®  s   r5  c                 C   s4  t | |ƒ\}} t| |ƒ\}} |jrt| |ƒ\}}nê|jr$t| |ƒ\}}nß|jr/t| |ƒ\}}nÔ|jr:t	| |ƒ\}}nÉ|j
sK|| ¡ }}t| ||ƒ} nd}|jrc| ¡ }t| ||ƒ\}} t| ||ƒ} n|}|jrpt| |ƒ\}}n7|jr¡t| d|ƒ\} }	t| |	|jƒ\}}t|ƒD ]\}
\} }t| |	|ƒ|f||
< qˆ| ||j¡}ntd| ƒ‚|j�rt|ƒD ]\}
\} }t| ||ƒ|f||
< q¯| ||¡}| ||¡}|�rt|ƒD ]'\}
\} }t| |ƒ}t| ||ƒ} t| ||ƒ} | |f||
< | || ||¡¡}qÓ| ||¡}|}|�r| d|j |j!g|f¡ || t"|ƒfS )ú;Factor univariate polynomials into irreducibles in `K[x]`. Nr   ú#factorization not supported over %s)#r%   rH   Úis_FiniteFieldr3  Úis_Algebraicr.  Úis_GaussianRingr&  Úis_GaussianFieldr  Úis_ExactÚ	get_exactr   Úis_FieldrÊ   rA   rË   rå   Úis_Polyr#   r(  r,  rý   r$   r¹   r]   Úquor:   r?   ÚmulÚpowrÍ   rŽ   r  rZ   )rj   rÐ   rÿ   rà   rÑ   rk   Ú
K0_inexactrl   Údenomru   rµ   ro   Úmax_normrr   rr   rs   rÌ   ³  sZ   
rÌ   c                 C   sT   t | |ƒ\}}|st|gƒdfgS t|d d ||ƒ}||d d fg|dd…  S )r6  rf   r   N)rÌ   r   r=   )rj   rl   rÑ   rk   r�   rr   rr   rs   r+  õ  s
   r+  c                 C   sÜ  |st | |ƒS t| ||ƒ\}} t| ||ƒ\}} |jr$t| ||ƒ\}}�n|jr1t| ||ƒ\}}�n	|jr=t| ||ƒ\}}ný|j	rIt
| ||ƒ\}}nñ|js[|| ¡ }}t| |||ƒ} nd}|jru| ¡ }t| |||ƒ\}	} t| |||ƒ} n|}|jr¢t| ||ƒ\}
} }t| ||ƒ\}}t|ƒD ]\}\} }t| |
||ƒ|f||< q�n7|jrÓt| ||ƒ\} }t| ||jƒ\}}t|ƒD ]\}\} }t| ||ƒ|f||< qº| ||j¡}ntd| ƒ‚|j�r:t|ƒD ]\}\} }t| |||ƒ|f||< qá| ||¡}| ||	¡}|�r:t|ƒD ]+\}\} }t| ||ƒ}t| |||ƒ} t| |||ƒ} | |f||< |  || !||¡¡}�q| ||¡}|}tt"|ƒƒD ]%\}}|�sI�q@d||  d d|  |j#i}| $dt%|||ƒ|f¡ �q@|| t&|ƒfS )ú=Factor multivariate polynomials into irreducibles in `K[X]`. Nr7  )r   rú   r   )'rÌ   r&   rI   r8  r5  r9  r2  r:  r*  r;  r)  r<  r=  r   r>  rÊ   rB   rË   r!   r  rý   r"   r?  r#   r(  r,  r$   r¹   r]   r@  r;   r@   rA  rB  ræ   rŽ   rÍ   r   rZ   )rj   ru   rÐ   rò   rà   rÑ   rk   rC  rl   rD  Úlevelsrí   rµ   ro   rE  rÿ   Útermrr   rr   rs   r(     sl   
ÿr(  c                 C   sf   |st | |ƒS t| ||ƒ\}}|st||ƒdfgS t|d d |||ƒ}||d d fg|dd…  S )rF  rf   r   N)r+  r(  r   r>   )rj   ru   rl   rÑ   rk   r�   rr   rr   rs   r1  M  s   
r1  c                 C   s   t | d|ƒS )z_
    Returns ``True`` if a univariate polynomial ``f`` has no factors
    over its domain.
    r   )Údmp_irreducible_p)rj   rl   rr   rr   rs   Údup_irreducible_p[  s   rJ  c                 C   s<   t | ||ƒ\}}|sdS t|ƒdkrdS |d \}}|dkS )za
    Returns ``True`` if a multivariate polynomial ``f`` has no factors
    over its domain.
    Trf   Fr   )r(  rœ   )rj   ru   rl   r¦   rk   ro   rr   rr   rs   rI  c  s   rI  )F)NN)šÚ__doc__Úsympy.external.gmpyr   Úsympy.core.randomr   Úsympy.polys.galoistoolsr   r   r   r   r   r	   r
   r   r   r   r   Úsympy.polys.densebasicr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   Úsympy.polys.densearithr'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   Úsympy.polys.densetoolsrA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   Úsympy.polys.euclidtoolsrP   rQ   rR   Úsympy.polys.sqfreetoolsrS   rT   rU   rV   rW   rX   rY   Úsympy.polys.polyutilsrZ   Úsympy.polys.polyconfigr[   Úsympy.polys.polyerrorsr\   r]   r^   r_   Úsympy.utilitiesr`   Úmathra   r   rb   r¸   rc   rŸ   rd   re   rt   rv   r‰   r�   r›   r¡   r©   rÂ   rÇ   rÏ   rÓ   rØ   rÜ   rá   rå   rë   rï   rö   rø   r÷   r  r  r  r  r&  r)  r*  r.  r2  r3  r5  rÌ   r+  r(  r1  rJ  rI  rr   rr   rr   rs   Ú<module>   sn    4hpD
$
<	99i
S,T60D
4 CbNBM