o
    oh                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlm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  dd Z!dd Z"dd Z#dd Z$dd Z%dd Z&dd Z'dd Z(dS )z<Tests for functions for generating interesting polynomials.     )Add)symbols)sqrt)prime)ZZ)Poly)permute_signs)raises)swinnerton_dyer_polycyclotomic_polysymmetric_polyrandom_polyinterpolating_polyfateman_poly_F_1dmp_fateman_poly_F_1fateman_poly_F_2dmp_fateman_poly_F_2fateman_poly_F_3dmp_fateman_poly_F_3)xyzc                  C   s  t tdd  tdtddttd d ksJ tdttd d ks%J tdttd dtd   d ks8J td	ttd
 dtd   dtd   dtd   d ksWJ dd tddD } tdd tddd D ttdd t	| D ksJ d S )Nc                   S   
   t dtS Nr   )r
   r    r   r   w/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/sympy/polys/tests/test_specialpolys.py<lambda>      
 z+test_swinnerton_dyer_poly.<locals>.<lambda>   Tpolys      
         (      i`  i  i@  c                 S   s   g | ]}t t|qS r   )r   r   .0ir   r   r   
<listcomp>(   s    z-test_swinnerton_dyer_poly.<locals>.<listcomp>   c                 S   s   g | ]}| d qS r$   )nr(   r   r   r   r+   )       c                 S   s   g | ]	}t | d qS r-   )r   r.   r(   r   r   r   r+   +   s    )
r	   
ValueErrorr
   r   r   rangestr	all_rootssortedr   )pr   r   r   test_swinnerton_dyer_poly   s   "&.r6   c                   C   s   t tdd  tdtddttd ksJ tdttd ks!J tdttd ks,J tdttd t d ks;J tdttd d ksHJ td	ttd td  td  t d ks_J td
ttd t d ksnJ d S )Nc                   S   r   r   )r   r   r   r   r   r   r   /   r   z&test_cyclotomic_poly.<locals>.<lambda>r   Tr   r!   r$   r"   r,   r'   )r	   r0   r   r   r   r   r   r   r   test_cyclotomic_poly.   s   ."r7   c                   C   s   t tdd  t tdd  tdtttddttt t ks!J tdtttfddttt t ks5J tdtttdks@J tdttttt t ksOJ tdttttt tt  tt  ksdJ td	ttttt t kssJ d S )
Nc                   S      t dtttS )Nr   r   r   r   r   r   r   r   r   <       z%test_symmetric_poly.<locals>.<lambda>c                   S   r8   )Nr,   r:   r   r   r   r   r   =   r;   r   Tr   r   r!   r$   )r	   r0   r   r   r   r   r   r   r   r   r   test_symmetric_poly;   s   &(*"r<   c                  C   s   t tddddd} t|  dksJ tdd t|  D du s$J t tddddd} |  dks5J td	d |  D du sDJ d S )
Nr#   d   Fr   c                 s   (    | ]}d |  kodkn  V  qdS r=   r>   Nr   r)   coeffr   r   r   	<genexpr>L      & z#test_random_poly.<locals>.<genexpr>Tc                 s   r?   r@   r   rA   r   r   r   rC   Q   rD   )r   r   r   degreeallcoeffs)polyr   r   r   test_random_polyH   s   ""rI   c                  C   s`  t d\} }}}}}}}tdtdksJ tdt|ksJ tdt|t|  | |  |t|   ||    ks9J tdt|t|  t|  | | | |   |t|   t|  ||  ||    |t|   t|  ||  ||    ksvJ tdt|t|  t|  t|  | | | |  | |   |t|   t|  t|  ||  ||  ||    |t|   t|  t|  ||  ||  ||    |t|   t|  t|  ||  ||  ||    ksJ ttdd  ttd	d  ttd
d  ttdd  ttdd  tdtdddksJ tdtdddks J tdtddtd ks.J d S )Nzx:4, y:4r   r   r!   r$   r"   c                   S   s   t dttdfdS Nr!   )r   r$   )r   r   r   r   r   r   r   h   s   z)test_interpolating_poly.<locals>.<lambda>c                   S   s   t dttt dfdS rJ   r   r   r   r   r   r   r   r   j      c                   S   s   t dtt tdfdS rJ   rK   r   r   r   r   r   l   rL   c                   S      t ddddS )Nr!   r$   r"   r,   )r'      r   r   r   r   r   r   n      c                   S   rM   )Nr!   r$   rN   )r'   rO   r%   rP   r   r   r   r   r   p   rQ   )r   r!   )r$   r"   )r   r   r   r	   r0   )x0x1x2x3y0y1y2y3r   r   r   test_interpolating_polyT   s<   &"""2222 rZ   c                  C      t d\} }}tdt\}}}dd | ||fD |||gks J t d\} }}tdt\}}}dd | ||fD |||gks@J d S )Nr   c                 S      g | ]}|j  qS r   repto_listr)   tr   r   r   r+   {   r/   z)test_fateman_poly_F_1.<locals>.<listcomp>r$   c                 S   r\   r   r]   r`   r   r   r   r+      r/   )r   r   r   fghFGHr   r   r   test_fateman_poly_F_1w      "&ri   c                  C   r[   )Nr   c                 S   r\   r   r]   r`   r   r   r   r+      r/   z)test_fateman_poly_F_2.<locals>.<listcomp>r$   c                 S   r\   r   r]   r`   r   r   r   r+      r/   )r   r   r   rb   r   r   r   test_fateman_poly_F_2   rj   rk   c                  C   r[   )Nr   c                 S   r\   r   r]   r`   r   r   r   r+      r/   z)test_fateman_poly_F_3.<locals>.<listcomp>r$   c                 S   r\   r   r]   r`   r   r   r   r+      r/   )r   r   r   rb   r   r   r   test_fateman_poly_F_3   rj   rl   N))__doc__sympy.core.addr   sympy.core.symbolr   (sympy.functions.elementary.miscellaneousr   sympy.ntheory.generater   sympy.polys.domains.integerringr   sympy.polys.polytoolsr   sympy.utilities.iterablesr   sympy.testing.pytestr	   sympy.polys.specialpolysr
   r   r   r   r   r   r   r   r   r   r   	sympy.abcr   r   r   r6   r7   r<   rI   rZ   ri   rk   rl   r   r   r   r   <module>   s&    4#