+
    ir                         R t ^ RIHt ^ RIHtHt ^ RIHt ^ RIt]	! R4      t
R tR t];tt];ttR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tRMR ltR tR t R t!R t"R t#R t$R t%R t&R t'R t(R  t)R! t*R" t+R# t,R$ t-R% t.R& t/R' t0R( t1R) t2R* t3R+ t4R, t5R- t6R. t7R/ t8R0 t9RNR1 lt:RNR2 lt;RNR3 lt<R4 t=R5 t>R6 t?R7 t@R8 tAR9 tBR: tCR; tDR< tER= tFR> tGR? tHR@ tIRORA ltJRORB ltKRC tLRD tMRE tNRMRF ltORG tPRH tQRI tRRJ tSRK tTRL tUR# )PzEBasic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. )igcd)monomial_minmonomial_div)monomial_keyNz-infc                <    V '       g   VP                   # V ^ ,          # )z
Return leading coefficient of ``f``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import poly_LC

>>> poly_LC([], ZZ)
0
>>> poly_LC([ZZ(1), ZZ(2), ZZ(3)], ZZ)
1

zerofKs   &&v/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/polys/densebasic.pypoly_LCr      s      vvt    c                <    V '       g   VP                   # V R,          # )z
Return trailing coefficient of ``f``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import poly_TC

>>> poly_TC([], ZZ)
0
>>> poly_TC([ZZ(1), ZZ(2), ZZ(3)], ZZ)
3

r   r	   s   &&r   poly_TCr   $   s      vvur   c                T    V'       d   \        W4      p V^,          pK  \        W4      # )z
Return the ground leading coefficient.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_ground_LC

>>> f = ZZ.map([[[1], [2, 3]]])

>>> dmp_ground_LC(f, 2, ZZ)
1

)dmp_LCdup_LCr
   ur   s   &&&r   dmp_ground_LCr   =   #      1L	Q!<r   c                T    V'       d   \        W4      p V^,          pK  \        W4      # )z
Return the ground trailing coefficient.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_ground_TC

>>> f = ZZ.map([[[1], [2, 3]]])

>>> dmp_ground_TC(f, 2, ZZ)
3

)dmp_TCdup_TCr   s   &&&r   dmp_ground_TCr   T   r   r   c                    . pV'       d5   VP                  \        V 4      ^,
          4       V ^ ,          V^,
          rK<  V '       g   VP                  ^ 4       M!VP                  \        V 4      ^,
          4       \        V4      \        W4      3# )z
Return the leading term ``c * x_1**n_1 ... x_k**n_k``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_true_LT

>>> f = ZZ.map([[4], [2, 0], [3, 0, 0]])

>>> dmp_true_LT(f, 1, ZZ)
((2, 0), 4)

)appendlentupler   )r
   r   r   monoms   &&& r   dmp_true_LTr"   k   sd      E
SVaZ tQU1QSVaZ <%%r   c                B    V '       g   \         # \        V 4      ^,
          # )a  
Return the leading degree of ``f`` in ``K[x]``.

Note that the degree of 0 is negative infinity (``float('-inf')``).

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_degree

>>> f = ZZ.map([1, 2, 0, 3])

>>> dup_degree(f)
3

)ninfr   r
   s   &r   
dup_degreer&      s    $ q6A:r   c                T    \        W4      '       d   \        # \        V 4      ^,
          # )aI  
Return the leading degree of ``f`` in ``x_0`` in ``K[X]``.

Note that the degree of 0 is negative infinity (``float('-inf')``).

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_degree

>>> dmp_degree([[[]]], 2)
-inf

>>> f = ZZ.map([[2], [1, 2, 3]])

>>> dmp_degree(f, 1)
1

)
dmp_zero_pr$   r   r
   r   s   &&r   
dmp_degreer*      s"    * !1vzr   c                   aaa SS8X  d   \        V S4      # S^,
          S^,           uoo\        VVV3R lV  4       4      # )z4Recursive helper function for :func:`dmp_degree_in`.c              3   @   <"   T F  p\        VSSS4      x  K  	  R # 5iN)_rec_degree_in).0cijvs   & r   	<genexpr>!_rec_degree_in.<locals>.<genexpr>   s     51a~aAq))1s   )r*   max)gr3   r1   r2   s   &fffr   r.   r.      s;    Av!Qq5!a%DAq51555r   c                    V'       g   \        W4      # V^ 8  g   W8  d   \        RV: RV: 24      h\        W^ V4      # )a
  
Return the leading degree of ``f`` in ``x_j`` in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_degree_in

>>> f = ZZ.map([[2], [1, 2, 3]])

>>> dmp_degree_in(f, 0, 1)
1
>>> dmp_degree_in(f, 1, 1)
2

z
0 <= j <=  expected, got )r*   
IndexErrorr.   )r
   r2   r   s   &&&r   dmp_degree_inr;      s<    $ !1uAqABB!1%%r   c                    \        W2,          \        W4      4      W2&   V^ 8  d)   V^,
          V^,           r!V  F  p\        WAW#4       K  	  R# R# )z-Recursive helper for :func:`dmp_degree_list`.N)r6   r*   _rec_degree_list)r7   r3   r1   degsr0   s   &&&& r   r=   r=      sF    $':a+,DG1u1ua!e1AQ1+  r   c                \    \         .V^,           ,          p\        W^ V4       \        V4      # )z
Return a list of degrees of ``f`` in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_degree_list

>>> f = ZZ.map([[1], [1, 2, 3]])

>>> dmp_degree_list(f, 1)
(1, 2)

)r$   r=   r    )r
   r   r>   s   && r   dmp_degree_listr@      s)      61q5>DQ1d#;r   c                x    V '       d   V ^ ,          '       d   V # ^ pV  F  pV'       d    MV^,          pK  	  WR # )z
Remove leading zeros from ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.densebasic import dup_strip

>>> dup_strip([0, 0, 1, 2, 3, 0])
[1, 2, 3, 0]

N )r
   r1   cfs   &  r   	dup_striprD      s=     !	AFA	  R5Lr   c                    V'       g   \        V 4      # \        W4      '       d   V # ^ V^,
          r2V  F  p\        WC4      '       g    MV^,          pK!  	  V\        V 4      8X  d   \        V4      # WR # )z
Remove leading zeros from ``f`` in ``K[X]``.

Examples
========

>>> from sympy.polys.densebasic import dmp_strip

>>> dmp_strip([[], [0, 1, 2], [1]], 1)
[[0, 1, 2], [1]]

N)rD   r(   r   dmp_zero)r
   r   r1   r3   r0   s   &&   r   	dmp_striprG     sm     |!a!eq!FA	  	CF{{ur   c                .   \        V\        4      '       gF   Ve8   VP                  V4      '       g!   \        V: RV : RVP                  : 24      hV^,
          0# V'       g   V0# \        4       pV F  pV\        WV^,           V4      ,          pK   	  V# )z*Recursive helper for :func:`dmp_validate`.z in z in not of type )
isinstancelistof_type	TypeErrordtypeset_rec_validate)r
   r7   r1   r   levelsr0   s   &&&&  r   rO   rO   ;  sz    a=1Aq!''JKKAws
AmA!a%33F  r   c           	         V'       g   \        V 4      # V^,
          p\        V  Uu. uF  p\        W24      NK  	  upV4      # u upi )z(Recursive helper for :func:`_rec_strip`.)rD   rG   
_rec_strip)r7   r3   wr0   s   &&  r   rR   rR   M  s<    |	AA4Az!'4a884s   Ac                |    \        W ^ V4      pVP                  4       pV'       g   \        W4      V3# \        R4      h)aH  
Return the number of levels in ``f`` and recursively strip it.

Examples
========

>>> from sympy.polys.densebasic import dmp_validate

>>> dmp_validate([[], [0, 1, 2], [1]])
([[1, 2], [1]], 1)

>>> dmp_validate([[1], 1])
Traceback (most recent call last):
...
ValueError: invalid data structure for a multivariate polynomial

z4invalid data structure for a multivariate polynomial)rO   poprR   
ValueError)r
   r   rP   r   s   &&  r   dmp_validaterW   W  sB    $ 1A&F

A!""BD 	Dr   c                <    \        \        \        V 4      4      4      # )z
Compute ``x**n * f(1/x)``, i.e.: reverse ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_reverse

>>> f = ZZ.map([1, 2, 3, 0])

>>> dup_reverse(f)
[3, 2, 1]

)rD   rJ   reversedr%   s   &r   dup_reverserZ   t  s      T(1+&''r   c                    \        V 4      # )z
Create a new copy of a polynomial ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_copy

>>> f = ZZ.map([1, 2, 3, 0])

>>> dup_copy([1, 2, 3, 0])
[1, 2, 3, 0]

)rJ   r%   s   &r   dup_copyr\     s      7Nr   c                z    V'       g   \        V 4      # V^,
          pV  Uu. uF  p\        W24      NK  	  up# u upi )z
Create a new copy of a polynomial ``f`` in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_copy

>>> f = ZZ.map([[1], [1, 2]])

>>> dmp_copy(f, 1)
[[1], [1, 2]]

)rJ   dmp_copy)r
   r   r3   r0   s   &&  r   r^   r^     s5      Aw	AA%&(QXa^Q(((s   8c                    \        V 4      # )a
  
Convert `f` into a tuple.

This is needed for hashing. This is similar to dup_copy().

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_copy

>>> f = ZZ.map([1, 2, 3, 0])

>>> dup_copy([1, 2, 3, 0])
[1, 2, 3, 0]

r    r%   s   &r   dup_to_tuplera     s    $ 8Or   c                   a V'       g   \        V 4      # V^,
          o\         ;QJ d    . V3R lV  4       F  NK  	  5# ! V3R lV  4       4      # )a  
Convert `f` into a nested tuple of tuples.

This is needed for hashing.  This is similar to dmp_copy().

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_to_tuple

>>> f = ZZ.map([[1], [1, 2]])

>>> dmp_to_tuple(f, 1)
((1,), (1, 2))

c              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir-   )dmp_to_tuple)r/   r0   r3   s   & r   r4   dmp_to_tuple.<locals>.<genexpr>  s     /Qa##Qs   r`   )r
   r   r3   s   &&@r   rd   rd     s<    $ Qx	AA5/Q/5/5/Q///r   c                ^    \        V  Uu. uF  q!P                  V4      NK  	  up4      # u upi )z
Normalize univariate polynomial in the given domain.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_normal

>>> dup_normal([0, 1, 2, 3], ZZ)
[1, 2, 3]

)rD   normalr
   r   r0   s   && r   
dup_normalri     s'     A/Aqxx{A/00/   *c           
         V'       g   \        W4      # V^,
          p\        V  Uu. uF  p\        WCV4      NK  	  upV4      # u upi )z
Normalize a multivariate polynomial in the given domain.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_normal

>>> dmp_normal([[], [0, 1, 2]], 1, ZZ)
[[1, 2]]

)ri   rG   
dmp_normalr
   r   r   r3   r0   s   &&&  r   rl   rl     sA     !	AAA7Aqz!*A7;;7   Ac           	     v    Ve	   W8X  d   V # \        V  Uu. uF  q2P                  W14      NK  	  up4      # u upi )a^  
Convert the ground domain of ``f`` from ``K0`` to ``K1``.

Examples
========

>>> from sympy.polys.rings import ring
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_convert

>>> R, x = ring("x", ZZ)

>>> dup_convert([R(1), R(2)], R.to_domain(), ZZ)
[1, 2]
>>> dup_convert([ZZ(1), ZZ(2)], ZZ, R.to_domain())
[1, 2]

)rD   convert)r
   K0K1r0   s   &&& r   dup_convertrs     s6    & 
~"(a9a::a,a9::9s   6c                    V'       g   \        WV4      # Ve	   W#8X  d   V # V^,
          p\        V  Uu. uF  p\        WTW#4      NK  	  upV4      # u upi )at  
Convert the ground domain of ``f`` from ``K0`` to ``K1``.

Examples
========

>>> from sympy.polys.rings import ring
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_convert

>>> R, x = ring("x", ZZ)

>>> dmp_convert([[R(1)], [R(2)]], 1, R.to_domain(), ZZ)
[[1], [2]]
>>> dmp_convert([[ZZ(1)], [ZZ(2)]], 1, ZZ, R.to_domain())
[[1], [2]]

)rs   rG   dmp_convert)r
   r   rq   rr   r3   r0   s   &&&&  r   ru   ru      sQ    & 1"%%	~"(	AA!=!Q{10!=qAA=s   Ac                ^    \        V  Uu. uF  q!P                  V4      NK  	  up4      # u upi )a   
Convert the ground domain of ``f`` from SymPy to ``K``.

Examples
========

>>> from sympy import S
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_from_sympy

>>> dup_from_sympy([S(1), S(2)], ZZ) == [ZZ(1), ZZ(2)]
True

)rD   
from_sympyrh   s   && r   dup_from_sympyrx   =  s'     31||A3443rj   c           
         V'       g   \        W4      # V^,
          p\        V  Uu. uF  p\        WCV4      NK  	  upV4      # u upi )a  
Convert the ground domain of ``f`` from SymPy to ``K``.

Examples
========

>>> from sympy import S
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_from_sympy

>>> dmp_from_sympy([[S(1)], [S(2)]], 1, ZZ) == [[ZZ(1)], [ZZ(2)]]
True

)rx   rG   dmp_from_sympyrm   s   &&&  r   rz   rz   O  sA     a##	AA;1~aA.;Q??;rn   c                    V^ 8  d   \        RV,          4      hV\        V 4      8  d   VP                  # V \        V 4      V,
          ,          # )z
Return the ``n``-th coefficient of ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_nth

>>> f = ZZ.map([1, 2, 3])

>>> dup_nth(f, 0, ZZ)
3
>>> dup_nth(f, 4, ZZ)
0

 'n' must be non-negative, got %i)r:   r   r   r&   )r
   nr   s   &&&r   dup_nthr~   f  sD    $ 	1u;a?@@	
c!fvvA"##r   c                    V^ 8  d   \        RV,          4      hV\        V 4      8  d   \        V^,
          4      # V \        W4      V,
          ,          # )z
Return the ``n``-th coefficient of ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_nth

>>> f = ZZ.map([[1], [2], [3]])

>>> dmp_nth(f, 0, 1, ZZ)
[3]
>>> dmp_nth(f, 4, 1, ZZ)
[]

r|   )r:   r   rF   r*   )r
   r}   r   r   s   &&&&r   dmp_nthr     sJ    $ 	1u;a?@@	
c!fAA!A%&&r   c                    TpV Fi  pV^ 8  d   \        RV,          4      hV\        V 4      8  d   VP                  u # \        W4      pV\        8X  d   RpWV,
          ,          V^,
          r@Kk  	  V # )z
Return the ground ``n``-th coefficient of ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_ground_nth

>>> f = ZZ.map([[1], [2, 3]])

>>> dmp_ground_nth(f, (0, 1), 1, ZZ)
2

z `n` must be non-negative, got %ir   )r:   r   r   r*   r$   )r
   Nr   r   r3   r}   ds   &&&&   r   dmp_ground_nthr     sm      	
Aq5?!CDD#a&[66M1 ADyU8QUq  Hr   c                l    V'       d'   \        V 4      ^8w  d   R# V ^ ,          p V^,          pK.  V '       * # )z
Return ``True`` if ``f`` is zero in ``K[X]``.

Examples
========

>>> from sympy.polys.densebasic import dmp_zero_p

>>> dmp_zero_p([[[[[]]]]], 4)
True
>>> dmp_zero_p([[[[[1]]]]], 4)
False

F)r   r)   s   &&r   r(   r(     s.     q6Q;aD	Q5Lr   c                4    . p\        V 4       F  pV.pK  	  V# )z~
Return a multivariate zero.

Examples
========

>>> from sympy.polys.densebasic import dmp_zero

>>> dmp_zero(4)
[[[[[]]]]]

)range)r   rr1   s   &  r   rF   rF     s%     	A1XC  Hr   c                .    \        WP                  V4      # )z
Return ``True`` if ``f`` is one in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_one_p

>>> dmp_one_p([[[ZZ(1)]]], 2, ZZ)
True

)dmp_ground_poner   s   &&&r   	dmp_one_pr     s     55!$$r   c                .    \        VP                  V 4      # )z
Return a multivariate one over ``K``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_one

>>> dmp_one(2, ZZ)
[[[1]]]

)
dmp_groundr   )r   r   s   &&r   dmp_oner     s     aeeQr   c                    Ve   V'       g   \        W4      # V'       d'   \        V 4      ^8w  d   R# V ^ ,          p V^,          pK.  Vf   \        V 4      ^8*  # W.8H  # )z
Return True if ``f`` is constant in ``K[X]``.

Examples
========

>>> from sympy.polys.densebasic import dmp_ground_p

>>> dmp_ground_p([[[3]]], 3, 2)
True
>>> dmp_ground_p([[[4]]], None, 2)
True

F)r(   r   )r
   r0   r   s   &&&r   r   r   
  sU     	}Q!
q6Q;aD	Qy1v{Cxr   c                d    V '       g   \        V4      # \        V^,           4       F  pV .p K  	  V # )z
Return a multivariate constant.

Examples
========

>>> from sympy.polys.densebasic import dmp_ground

>>> dmp_ground(3, 5)
[[[[[[3]]]]]]
>>> dmp_ground(1, -1)
1

)rF   r   )r0   r   r1   s   && r   r   r   (  s1     {1q5\C  Hr   c                    V '       g   . # V^ 8  d   VP                   .V ,          # \        V 4       Uu. uF  p\        V4      NK  	  up# u upi )z
Return a list of multivariate zeros.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_zeros

>>> dmp_zeros(3, 2, ZZ)
[[[[]]], [[[]]], [[[]]]]
>>> dmp_zeros(3, -1, ZZ)
[0, 0, 0]

)r   r   rF   )r}   r   r   r1   s   &&& r   	dmp_zerosr   @  sC      	1uxz&+Ah0h!h000s   A
c                    V'       g   . # V^ 8  d   V .V,          # \        V4       Uu. uF  p\        W4      NK  	  up# u upi )z
Return a list of multivariate constants.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_grounds

>>> dmp_grounds(ZZ(4), 3, 2)
[[[[4]]], [[[4]]], [[[4]]]]
>>> dmp_grounds(ZZ(4), 3, -1)
[4, 4, 4]

)r   r   )r0   r}   r   r1   s   &&& r   dmp_groundsr   Y  s?      	1us1u+0858aA!8555s   A c                8    VP                  \        WV4      4      # )a  
Return ``True`` if ``LC(f)`` is negative.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_negative_p

>>> dmp_negative_p([[ZZ(1)], [-ZZ(1)]], 1, ZZ)
False
>>> dmp_negative_p([[-ZZ(1)], [ZZ(1)]], 1, ZZ)
True

)is_negativer   r   s   &&&r   dmp_negative_pr   r        ==qQ/00r   c                8    VP                  \        WV4      4      # )a  
Return ``True`` if ``LC(f)`` is positive.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_positive_p

>>> dmp_positive_p([[ZZ(1)], [-ZZ(1)]], 1, ZZ)
True
>>> dmp_positive_p([[-ZZ(1)], [ZZ(1)]], 1, ZZ)
False

)is_positiver   r   s   &&&r   dmp_positive_pr     r   r   c                   V '       g   . # \        V P                  4       4      . r2\        V\        4      '       d@   \	        VRR4       F-  pVP                  V P                  WAP                  4      4       K/  	  MDVw  p\	        VRR4       F/  pVP                  V P                  V3VP                  4      4       K1  	  \        V4      # )a  
Create a ``K[x]`` polynomial from a ``dict``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_from_dict

>>> dup_from_dict({(0,): ZZ(7), (2,): ZZ(5), (4,): ZZ(1)}, ZZ)
[1, 0, 5, 0, 7]
>>> dup_from_dict({}, ZZ)
[]

r   )	r6   keysrI   intr   r   getr   rD   r
   r   r}   hks   &&   r   dup_from_dictr     s      	qvvx="q!Sq"b!AHHQUU1ff%& " q"b!AHHQUUA4() " Q<r   c                    V '       g   . # \        V P                  4       4      . r2\        VRR4       F-  pVP                  V P	                  WAP
                  4      4       K/  	  \        V4      # )z
Create a ``K[x]`` polynomial from a raw ``dict``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_from_raw_dict

>>> dup_from_raw_dict({0: ZZ(7), 2: ZZ(5), 4: ZZ(1)}, ZZ)
[1, 0, 5, 0, 7]

r   )r6   r   r   r   r   r   rD   r   s   &&   r   dup_from_raw_dictr     sU     	qvvx="q1b"	q&&!"  Q<r   c                   V'       g   \        W4      # V '       g   \        V4      # / pV P                  4        F.  w  rEV^ ,          VR,          rvWc9   d   WSV,          V&   K)  Wu/W6&   K0  	  \        VP	                  4       4      V^,
          . rp\        VRR4       FO  pVP                  V4      pVe   V
P                  \        WYV4      4       K5  V
P                  \        V	4      4       KQ  	  \        W4      # )a  
Create a ``K[X]`` polynomial from a ``dict``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_from_dict

>>> dmp_from_dict({(0, 0): ZZ(3), (0, 1): ZZ(2), (2, 1): ZZ(1)}, 1, ZZ)
[[1, 0], [], [2, 3]]
>>> dmp_from_dict({}, 0, ZZ)
[]

   NNr   )
r   rF   itemsr6   r   r   r   r   dmp_from_dictrG   )r
   r   r   coeffsr!   coeffheadtailr}   r3   r   r   s   &&&         r   r   r     s      Q""{F	1XuRyd>!&4L!?FL " &++- !a%!A1b"

1HH]5Q/0HHXa[!  Q?r   c                    V '       g   V'       d   RVP                   /# \        V 4      ^,
          / rC\        ^ V^,           4       F,  pWV,
          ,          '       g   K  WV,
          ,          WE3&   K.  	  V# )z
Convert ``K[x]`` polynomial to a ``dict``.

Examples
========

>>> from sympy.polys.densebasic import dup_to_dict

>>> dup_to_dict([1, 0, 5, 0, 7])
{(0,): 7, (2,): 5, (4,): 1}
>>> dup_to_dict([])
{}

    r   r   r   r
   r   r   r}   resultr   s   &&&   r   dup_to_dictr     s[     aff~A
Bv1a!e_U88U8F4L  Mr   c                    V '       g   V'       d   ^ VP                   /# \        V 4      ^,
          / rC\        ^ V^,           4       F+  pWV,
          ,          '       g   K  WV,
          ,          WE&   K-  	  V# )z
Convert a ``K[x]`` polynomial to a raw ``dict``.

Examples
========

>>> from sympy.polys.densebasic import dup_to_raw_dict

>>> dup_to_raw_dict([1, 0, 5, 0, 7])
{0: 7, 2: 5, 4: 1}

r   r   s   &&&   r   dup_to_raw_dictr     sY     166{A
Bv1a!e_U88a%FI  Mr   c                   V'       g   \        WVR7      # \        W4      '       d%   V'       d   RV^,           ,          VP                  /# \        W4      V^,
          / repV\        8X  d   Rp\        ^ V^,           4       FA  p\        WV,
          ,          V4      pVP                  4        F  w  rWV3V	,           &   K  	  KC  	  V# )z
Convert a ``K[X]`` polynomial to a ``dict````.

Examples
========

>>> from sympy.polys.densebasic import dmp_to_dict

>>> dmp_to_dict([[1, 0], [], [2, 3]], 1)
{(0, 0): 3, (0, 1): 2, (2, 1): 1}
>>> dmp_to_dict([], 0)
{}

r   r   r   )r   r(   r   r*   r$   r   dmp_to_dictr   )r
   r   r   r   r}   r3   r   r   r   expr   s   &&&&       r   r   r   2  s     1d++!Da!eaff%%a#QUB&ADy1a!e_a%!$'')JC!&A4#: $  Mr   c                R   V^ 8  g   V^ 8  g   W8  g   W#8  d   \        RV,          4      hW8X  d   V # \        W4      / reVP                  4        FH  w  rxVWgRV Wr,          3,           Wq^,           V ,           Wq,          3,           Wr^,           R ,           &   KJ  	  \        WcV4      # )ai  
Transform ``K[..x_i..x_j..]`` to ``K[..x_j..x_i..]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_swap

>>> f = ZZ.map([[[2], [1, 0]], []])

>>> dmp_swap(f, 0, 1, 2, ZZ)
[[[2], []], [[1, 0], []]]
>>> dmp_swap(f, 1, 2, 2, ZZ)
[[[1], [2, 0]], [[]]]
>>> dmp_swap(f, 0, 2, 2, ZZ)
[[[1, 0]], [[2, 0], []]]

z0 <= i < j <= %s expectedN)r:   r   r   r   )	r
   r1   r2   r   r   FHr   r   s	   &&&&&    r   dmp_swapr   U  s    ( 	1uA!%4q899	
qbqggi
 &+ 	
bq'SVI

!eA,6)a%&k" 	#  
 q!!r   c                    \        W4      / rTVP                  4        F=  w  rg^ .\        V4      ,          p\        Wa4       F	  w  rWV
&   K  	  Wu\	        V4      &   K?  	  \        WRV4      # )aH  
Return a polynomial in ``K[x_{P(1)},..,x_{P(n)}]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_permute

>>> f = ZZ.map([[[2], [1, 0]], []])

>>> dmp_permute(f, [1, 0, 2], 2, ZZ)
[[[2], []], [[1, 0], []]]
>>> dmp_permute(f, [1, 2, 0], 2, ZZ)
[[[1], []], [[2, 0], []]]

)r   r   r   zipr    r   )r
   Pr   r   r   r   r   r   new_expeps   &&&&       r   dmp_permuter   x  se    $ qbqggi
#c#h,KDAAJ   "%.   q!!r   c                r    \        V \        4      '       g   \        W4      # \        V4       F  pV .p K  	  V # )z
Return a multivariate value nested ``l``-levels.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_nest

>>> dmp_nest([[ZZ(1)]], 2, ZZ)
[[[[1]]]]

)rI   rJ   r   r   )r
   lr   r1   s   &&& r   dmp_nestr     s8     a!1XC  Hr   c           	         V'       g   V # V'       g8   V '       g   \        V4      # V^,
          pV  Uu. uF  p\        WT4      NK  	  up# V^,
          pV  Uu. uF  p\        WQWc4      NK  	  up# u upi u upi )z
Return a multivariate polynomial raised ``l``-levels.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_raise

>>> f = ZZ.map([[], [1, 2]])

>>> dmp_raise(f, 2, 1, ZZ)
[[[[]]], [[[1]], [[2]]]]

)rF   r   	dmp_raise)r
   r   r   r   r   r0   r3   s   &&&&   r   r   r     sn      A;E+,.1aA!1..	AA,-/AqYqQ"A//	 / 0s   A/A4c                    \        V 4      ^ 8:  d   ^V 3# ^ p\        \        V 4      4       F3  pW) ^,
          ,          '       g   K  \        W#4      pV^8X  g   K/  ^V 3u # 	  W RRV1,          3# )z
Map ``x**m`` to ``y`` in a polynomial in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_deflate

>>> f = ZZ.map([1, 0, 0, 1, 0, 0, 1])

>>> dup_deflate(f, ZZ)
(3, [1, 1, 1])

N)r&   r   r   r   )r
   r   r7   r1   s   &&  r   dup_deflater     sk      !}!t	A3q6]ayyJ6a4K  !f9r   c                   \        W4      '       d   RV^,           ,          V 3# \        W4      p^ .V^,           ,          pVP                  4        F+  p\        V4       F  w  rg\	        WF,          V4      WF&   K  	  K-  	  \        V4       F  w  rhV'       d   K  ^WF&   K  	  \        V4      p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   W@3# / p	VP                  4        F6  w  r\        W4       UUu. uF  w  rW,          NK  	  pppW\        V4      &   K8  	  V\        WV4      3# u uppi )a  
Map ``x_i**m_i`` to ``y_i`` in a polynomial in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_deflate

>>> f = ZZ.map([[1, 0, 0, 2], [], [3, 0, 0, 4]])

>>> dmp_deflate(f, 1, ZZ)
((2, 3), [[1, 2], [3, 4]])

c              3   *   "   T F	  q^8H  x  K  	  R# 5ir   NrB   r/   bs   & r   r4   dmp_deflate.<locals>.<genexpr>       
1a61   FT)r   )
r(   r   r   	enumerater   r    allr   r   r   )r
   r   r   r   BMr1   mr   r   Ar   ar   s   &&&           r   dmp_deflater     s     !QU|QAA	
QUAVVXaLDAa=AD !  !qAD  	aA
s
1
sss
1
t
AGGI!$Q,aff,%(  mA!$$$ -s   Ec           
     N   ^ pV  Fs  p\        V4      ^ 8:  d   ^V 3u # ^ p\        \        V4      4       F5  pW5) ^,
          ,          '       g   K  \        WE4      pV^8X  g   K/  ^V 3u u # 	  \        W$4      pKu  	  T\	        V  Uu. uF  q3RRV1,          NK  	  up4      3# u upi )a(  
Map ``x**m`` to ``y`` in a set of polynomials in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_multi_deflate

>>> f = ZZ.map([1, 0, 2, 0, 3])
>>> g = ZZ.map([4, 0, 0])

>>> dup_multi_deflate((f, g), ZZ)
(2, ([1, 2, 3], [4, 0]))

N)r&   r   r   r   r    )polysr   Gr   r7   r1   s   &&    r   dup_multi_deflater     s    " 	
Aa=Ae8Os1vAR!V99Q
AAv%x  J " ee-e!ffe-...-s   B"
c                "   V'       g   \        W4      w  r4V3V3# . ^ .V^,           ,          reV  Fo  p\        Wq4      p\        Wq4      '       g@   VP                  4        F+  p\	        V4       F  w  r\        Wi,          V
4      Wi&   K  	  K-  	  VP                  V4       Kq  	  \	        V4       F  w  rV'       d   K  ^Wi&   K  	  \        V4      p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   W`3# . pV Fj  p/ pVP                  4        F6  w  r\        W4       UUu. uF  w  rW,          NK  	  pppW\        V4      &   K8  	  VP                  \        WV4      4       Kl  	  V\        V4      3# u uppi )a{  
Map ``x_i**m_i`` to ``y_i`` in a set of polynomials in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_multi_deflate

>>> f = ZZ.map([[1, 0, 0, 2], [], [3, 0, 0, 4]])
>>> g = ZZ.map([[1, 0, 2], [], [3, 0, 4]])

>>> dmp_multi_deflate((f, g), 1, ZZ)
((2, 1), ([[1, 0, 0, 2], [3, 0, 0, 4]], [[1, 0, 2], [3, 0, 4]]))

c              3   *   "   T F	  q^8H  x  K  	  R# 5ir   rB   r   s   & r   r4   $dmp_multi_deflate.<locals>.<genexpr>i  r   r   FT)r   r   r(   r   r   r   r   r    r   r   r   r   )r   r   r   r   r   r   r   r   r
   r1   r   r   r   r   r   r   r   s   &&&              r   dmp_multi_deflater   B  sT   "  *tQwsAE{q!VVX%aLDAa=AD )  	
  !qAD  	aA
s
1
sss
1
x
A	HA%(Y0YTQ!&&YA0eAhK " 	
qQ'(  eAh; 1s   8F
c                   V^ 8:  d   \        RV,          4      hV^8X  g	   V '       g   V # V ^ ,          .pV R,           F>  pVP                  VP                  .V^,
          ,          4       VP                  V4       K@  	  V# )z
Map ``y`` to ``x**m`` in a polynomial in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_inflate

>>> f = ZZ.map([1, 1, 1])

>>> dup_inflate(f, 3, ZZ)
[1, 0, 0, 1, 0, 0, 1]

z'm' must be positive, got %sr   )r:   extendr   r   )r
   r   r   r   r   s   &&&  r   dup_inflater   z  ss      	Av7!;<<AvQdVF2qvvhA&'e  Mr   c           
        V'       g   \        WV,          V4      # W,          ^ 8:  d   \        RW,          ,          4      hV^,
          V^,           reV  Uu. uF  p\        WqWVV4      NK  	  p pV ^ ,          .pV R,           FG  p	\        ^W,          4       F  p
VP	                  \        V4      4       K  	  VP	                  V	4       KI  	  V# u upi )z)Recursive helper for :func:`dmp_inflate`.z!all M[i] must be positive, got %sr   )r   r:   _rec_inflater   r   rF   )r7   r   r3   r1   r   rS   r2   r0   r   r   _s   &&&&&      r   r   r     s    1dA&&tqy<qtCDDq5!a%q/02q!,qQ1
%qA2dVF2q!$AMM(1+&   	e	  M 	3s   Cc                    V'       g   \        W^ ,          V4      # \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   V # \        WV^ V4      # )a  
Map ``y_i`` to ``x_i**k_i`` in a polynomial in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_inflate

>>> f = ZZ.map([[1, 2], [3, 4]])

>>> dmp_inflate(f, (2, 3), 1, ZZ)
[[1, 0, 0, 2], [], [3, 0, 0, 4]]

c              3   *   "   T F	  q^8H  x  K  	  R# 5ir   rB   )r/   r   s   & r   r4   dmp_inflate.<locals>.<genexpr>  r   r   FT)r   r   r   )r
   r   r   r   s   &&&&r   dmp_inflater     sO      1dA&&
s
1
sss
1
A!Q**r   c                   V'       d   \        V RV4      '       d   . W3# . \        W4      rC\        ^ V^,           4       F<  pVP                  4        F  pWe,          '       g   K   K)  	  VP	                  V4       K>  	  V'       g   . W3# / p VP                  4        F1  w  rg\        V4      p\        V4       F  pWe K  	  Wp\        V4      &   K3  	  V\        V4      ,          pV\        WV4      V3# )a3  
Exclude useless levels from ``f``.

Return the levels excluded, the new excluded ``f``, and the new ``u``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_exclude

>>> f = ZZ.map([[[1]], [[1], [2]]])

>>> dmp_exclude(f, 2, ZZ)
([2], [[1], [1, 2]], 1)

N)r   r   r   r   r   r   rJ   rY   r    r   r   )r
   r   r   Jr   r2   r!   r   s   &&&     r   dmp_excluder     s    $ Qa((1x{1 q1a!e_VVXExx  HHQK  1x
A	U!A   %, " QKAmA!$a''r   c                   V'       g   V # \        W4      / rVP                  4        F8  w  rV\        V4      pV F  pVP                  V^ 4       K  	  W`\	        V4      &   K:  	  V\        V4      ,          p\        WV4      # )z
Include useless levels in ``f``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_include

>>> f = ZZ.map([[1], [1, 2]])

>>> dmp_include(f, [2], 1, ZZ)
[[[1]], [[1], [2]]]

)r   r   rJ   insertr    r   r   )r
   r   r   r   r   r!   r   r2   s   &&&&    r   dmp_includer     st      qbq	UALLA   %, " QKAq!!r   c                N   \        W4      / r@VP                  ^,
          pV P                  4        FL  w  rgVP                  4       pVP                  4        F#  w  rV'       d   WW,           &   K  WWh,           &   K%  	  KN  	  W,           ^,           p
\	        WJVP
                  4      V
3# )a  
Convert ``f`` from ``K[X][Y]`` to ``K[X,Y]``.

Examples
========

>>> from sympy.polys.rings import ring
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_inject

>>> R, x,y = ring("x,y", ZZ)

>>> dmp_inject([R(1), x + 2], 0, R.to_domain())
([[[1]], [[1], [2]]], 2)
>>> dmp_inject([R(1), x + 2], 0, R.to_domain(), front=True)
([[[1]], [[1, 2]]], 2)

)r   ngensr   to_dictr   dom)r
   r   r   frontr   r3   f_monomr7   g_monomr0   rS   s   &&&&       r   
dmp_injectr     s    & qbq	!Aggi
IIK'')JG'('#$'('#$	 $   	
	Aquu%q((r   c                h   \        W4      / r@VP                  pWP                  ,
          ^,           pV P                  4        F8  w  rxV'       d
   VRV WuR rM
Wu) R VRV)  rW9   d   WV
,          V	&   K3  W/WJ&   K:  	  VP                  4        F  w  rxV! V4      WG&   K  	  \        WF^,
          V4      # )z
Convert ``f`` from ``K[X,Y]`` to ``K[X][Y]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_eject

>>> dmp_eject([[[1]], [[1], [2]]], 2, ZZ['x', 'y'])
[1, x + 2]

N)r   r   r   r   )r
   r   r   r   r   r}   r3   r!   r0   r   r   s   &&&&       r   	dmp_ejectr   >  s     qbq	A	GGaAGGI$Ray%)W$RSz51":W<"#gJw!AJ  GGIQ4  E1%%r   c                    \        W4      '       g	   V '       g   ^ V 3# ^ p\        V 4       F  pV'       g   V^,          pK   M	  W RV)  3# )z
Remove GCD of terms from ``f`` in ``K[x]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_terms_gcd

>>> f = ZZ.map([1, 0, 1, 0, 0])

>>> dup_terms_gcd(f, ZZ)
(2, [1, 0, 1])

N)r   rY   )r
   r   r1   r0   s   &&  r   dup_terms_gcdr  b  sL      a||1!t	Aa[FA	  !f9r   c                   \        WV4      '       g   \        W4      '       d   RV^,           ,          V 3# \        W4      p\        \	        VP                  4       4      !  p\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   W@3# / p VP                  4        F  w  rVW`\        WT4      &   K  	  V\        WV4      3# )a   
Remove GCD of terms from ``f`` in ``K[X]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_terms_gcd

>>> f = ZZ.map([[1, 0], [1, 0, 0], [], []])

>>> dmp_terms_gcd(f, 1, ZZ)
((2, 1), [[1], [1, 0]])

c              3   *   "   T F	  q^ 8H  x  K  	  R# 5i)r   NrB   )r/   r7   s   & r   r4    dmp_terms_gcd.<locals>.<genexpr>  r   r   FTr   )
r   r(   r   r   rJ   r   r   r   r   r   )r
   r   r   r   r   r!   r   s   &&&    r   dmp_terms_gcdr    s      Q1A!1!1QU|QAAd1668n%A
s
1
sss
1
t
A	$),u
 ! " mA!$$$r   c           
     <   \        W4      . rCV'       gB   \        V 4       F0  w  rVV'       g   K  VP                  W#V,
          3,           V34       K2  	  V# V^,
          p\        V 4       F.  w  rVVP                  \	        WgW#V,
          3,           4      4       K0  	  V# )z,Recursive helper for :func:`dmp_list_terms`.)r*   r   r   r   _rec_list_terms)r7   r3   r!   r   termsr1   r0   rS   s   &&&     r   r  r    s    !uaLDALL%q5(*A./	 ! L EaLDALLuAx/?@A ! Lr   c                    R p\        WR4      pV'       g   RV^,           ,          VP                  3.# Vf   V# V! V\        V4      4      # )a  
List all non-zero terms from ``f`` in the given order ``order``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_list_terms

>>> f = ZZ.map([[1, 1], [2, 3]])

>>> dmp_list_terms(f, 1, ZZ)
[((1, 1), 1), ((1, 0), 1), ((0, 1), 2), ((0, 0), 3)]
>>> dmp_list_terms(f, 1, ZZ, order='grevlex')
[((1, 1), 1), ((1, 0), 1), ((0, 1), 2), ((0, 0), 3)]

c                 (   a \        V V3R  lRR7      # )c                 "   < S! V ^ ,          4      # r   rB   )termOs   &r   <lambda>.dmp_list_terms.<locals>.sort.<locals>.<lambda>  s    aQjr   T)keyreverse)sorted)r  r  s   &fr   sortdmp_list_terms.<locals>.sort  s    e!8$GGr   rB   r   )r  r   r   )r
   r   r   orderr  r  s   &&&&  r   dmp_list_termsr    sO    $H A"%Eq1uqvv&''}E<.//r   c                >   \        V 4      \        V4      reWV8w  dJ   WV8  d#   VP                  .WV,
          ,          V,           pM!VP                  .We,
          ,          V ,           p . p\        W4       F  w  rVP                  V! W.VO5!  4       K   	  \	        V4      # )a  
Apply ``h`` to pairs of coefficients of ``f`` and ``g``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_apply_pairs

>>> h = lambda x, y, z: 2*x + y - z

>>> dup_apply_pairs([1, 2, 3], [3, 2, 1], h, (1,), ZZ)
[4, 5, 6]

)r   r   r   r   rD   )
r
   r7   r   argsr   r}   r   r   r   r   s
   &&&&&     r   dup_apply_pairsr    s      q63q6qv5!% 1$A!% 1$AFA	antn%  Vr   c                `   V'       g   \        WW#V4      # \        V 4      \        V4      V^,
          rpWg8w  d:   Wg8  d   \        Wg,
          W4      V,           pM\        Wv,
          W4      V ,           p . p	\        W4       F!  w  rV	P	                  \        WW#W4      4       K#  	  \        W4      # )a#  
Apply ``h`` to pairs of coefficients of ``f`` and ``g``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dmp_apply_pairs

>>> h = lambda x, y, z: 2*x + y - z

>>> dmp_apply_pairs([[1], [2, 3]], [[3], [2, 1]], h, (1,), 1, ZZ)
[[4], [5, 6]]

)r  r   r   r   r   dmp_apply_pairsrG   )r
   r7   r   r  r   r   r}   r   r3   r   r   r   s   &&&&&&      r   r  r    s      qQa00!fc!fa!e!Av5!%&*A!%&*AFA	oaAQ:;  Vr   c                   \        V 4      pWA8  d
   WA,
          pM^ pWB8  d
   WB,
          pM^ pWV p V '       d,   V ^ ,          VP                  8X  d   V P                  ^ 4       K3  V '       g   . # WP                  .V,          ,           # )z=Take a continuous subsequence of terms of ``f`` in ``K[x]``. )r   r   rU   )r
   r   r}   r   r   r   r   s   &&&&   r   	dup_slicer    sl    AAvEvE	AA
!	a	FF8A:~r   c                    \        WV^ W44      # )z=Take a continuous subsequence of terms of ``f`` in ``K[X]``. )dmp_slice_in)r
   r   r}   r   r   s   &&&&&r   	dmp_slicer   /  s    aA))r   c                t   V^ 8  g   W48  d   \        RV: RV: RV: 24      hV'       g   \        WW%4      # \        W4      / r`V P                  4        FU  w  rxWs,          p	W8  g   W8  d   VRV R,           Ws^,           R ,           pWv9   d   Wg;;,          V,          uu&   KQ  WV&   KW  	  \	        WdV4      # )zHTake a continuous subsequence of terms of ``f`` in ``x_j`` in ``K[X]``. -z <= j < r9   Nr   )r:   r  r   r   r   )
r
   r   r}   r2   r   r   r7   r!   r   r   s
   &&&&&&    r   r  r  4  s    1uQ1EFFq$$qbq	H5AF"1I$uUV}4E:HHeH " q!!r   c           	     
   \        ^ V ^,           4       Uu. uF'  qCP                  \        P                  ! W4      4      NK)  	  ppV^ ,          '       g+   VP                  \        P                  ! W4      4      V^ &   K9  V# u upi )z
Return a polynomial of degree ``n`` with coefficients in ``[a, b]``.

Examples
========

>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densebasic import dup_random

>>> dup_random(3, -10, 10, ZZ) #doctest: +SKIP
[-2, -8, 9, -4]

)r   rp   randomrandint)r}   r   r   r   r   r
   s   &&&&  r   
dup_randomr&  L  sa     49AE?D?a))FNN1(
)?ADddyy-.!H 	Es   -B r-   )NF)F)V__doc__
sympy.corer   sympy.polys.monomialsr   r   sympy.polys.orderingsr   r$  floatr$   r   r   r   r   r   r   r   r   r"   r&   r*   r.   r;   r=   r@   rD   rG   rO   rR   rW   rZ   r\   r^   ra   rd   ri   rl   rs   ru   rx   rz   r~   r   r   r(   rF   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   r   r   r   r  r  r  r  r  r  r  r   r  r&  rB   r   r   <module>r,     s   K  < .  V},*   ..&<.66&4,*6B$9D:(&&)0*021"<,;2B:5$@.$4'4@2*%" "<012621&1&B2)X62 F "F">.0@B)%X$/N5p<,+2-(`"D")J!&H<%B&0@@  F0*
"0r   