U
    	-e                     @   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s0ttdttd d ksJttdttd dtd   d kspttd	ttd
 dtd   dtd   dtd   d kstdd tddD } tdd tddd D tt	dd t
| D kstd S )Nc                   S   s
   t dtS Nr   )r
   r    r   r   d/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/sympy/polys/tests/test_specialpolys.py<lambda>       z+test_swinnerton_dyer_poly.<locals>.<lambda>   TZ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)   )   s     c                 S   s   g | ]}t | d qS r+   )r   r,   r&   r   r   r   r)   +   s     )r	   
ValueErrorr
   r   r   AssertionErrorrangestrZ	all_rootssortedr   )pr   r   r   test_swinnerton_dyer_poly   s     "& .r3   c                   C   s   t tdd  tdtddttd ks,ttdttd ksBttdttd ksXttdttd t d ksvttdttd d ksttd	ttd td  td  t d ksttd
ttd t d kstd S )Nc                   S   s
   t dtS r   )r   r   r   r   r   r   r   /   r   z&test_cyclotomic_poly.<locals>.<lambda>r   Tr   r   r"   r    r*   r%   )r	   r-   r   r   r   r.   r   r   r   r   test_cyclotomic_poly.   s    .r4   c                   C   s   t tdd  t tdd  tdtttddttt t ksBttdtttfddttt t ksjttdtttdksttdttttt t ksttdttttt tt  tt  ksttd	ttttt t kstd S )
Nc                   S   s   t dtttS )Nr   r   r   r   r   r   r   r   r   <   r   z%test_symmetric_poly.<locals>.<lambda>c                   S   s   t dtttS )Nr*   r6   r   r   r   r   r   =   r   r   Tr   r   r   r"   )r	   r-   r   r   r   r   r   r.   r   r   r   r   test_symmetric_poly;   s    &(*r7   c                  C   s   t tddddd} t|  dks&ttdd t|  D dksHtt tddddd} |  dksjttd	d |  D dkstd S )
Nr!   d   Fr   c                 s   s&   | ]}d |  kodkn  V  qdS r8   r9   Nr   r'   Zcoeffr   r   r   	<genexpr>L   s     z#test_random_poly.<locals>.<genexpr>Tc                 s   s&   | ]}d |  kodkn  V  qdS r:   r   r;   r   r   r   r<   Q   s     )r   r   r   Zdegreer.   allZcoeffs)Zpolyr   r   r   test_random_polyH   s    "r>   c                  C   sb  t d\} }}}}}}}tdtdks*ttdt|ks<ttdt|t|  | |  |t|   ||    ksrttdt|t|  t|  | | | |   |t|   t|  ||  ||    |t|   t|  ||  ||    ksttdt|t|  t|  t|  | | | |  | |   |t|   t|  t|  ||  ||  ||    |t|   t|  t|  ||  ||  ||    |t|   t|  t|  ||  ||  ||    kst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*ttdtdddksBttdtddtd ks^t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 r?   r   r   r   r   r   r   r   r   j   s    c                   S   s   t dtt tdfdS r?   r@   r   r   r   r   r   l   s    c                   S   s   t ddddS )Nr   r"   r    r*   )r%      r   r   r   r   r   r   n   s    c                   S   s   t ddddS )Nr   r"   rA   )r%   rB   r#   rC   r   r   r   r   r   p   s    )r   r   )r"   r    )r   r   r   r.   r	   r-   )Zx0x1Zx2Zx3Zy0y1y2Zy3r   r   r   test_interpolating_polyT   s<    &"""2222
rG   c                  C   s   t d\} }}tdt\}}}dd | ||fD |||gks@tt d\} }}tdt\}}}dd | ||fD |||gkstd S )Nr   c                 S   s   g | ]}|j j qS r   repr'   tr   r   r   r)   {   s     z)test_fateman_poly_F_1.<locals>.<listcomp>r"   c                 S   s   g | ]}|j j qS r   rH   rJ   r   r   r   r)      s     )r   r   r   r.   fghFGHr   r   r   test_fateman_poly_F_1w   s    "rS   c                  C   s   t d\} }}tdt\}}}dd | ||fD |||gks@tt d\} }}tdt\}}}dd | ||fD |||gkstd S )Nr   c                 S   s   g | ]}|j j qS r   rH   rJ   r   r   r   r)      s     z)test_fateman_poly_F_2.<locals>.<listcomp>r"   c                 S   s   g | ]}|j j qS r   rH   rJ   r   r   r   r)      s     )r   r   r   r.   rL   r   r   r   test_fateman_poly_F_2   s    "rT   c                  C   s   t d\} }}tdt\}}}dd | ||fD |||gks@tt d\} }}tdt\}}}dd | ||fD |||gkstd S )Nr   c                 S   s   g | ]}|j j qS r   rH   rJ   r   r   r   r)      s     z)test_fateman_poly_F_3.<locals>.<listcomp>r"   c                 S   s   g | ]}|j j qS r   rH   rJ   r   r   r   r)      s     )r   r   r   r.   rL   r   r   r   test_fateman_poly_F_3   s    "rU   N))__doc__Zsympy.core.addr   Zsympy.core.symbolr   Z(sympy.functions.elementary.miscellaneousr   Zsympy.ntheory.generater   Zsympy.polys.domains.integerringr   Zsympy.polys.polytoolsr   Zsympy.utilities.iterablesr   Zsympy.testing.pytestr	   Zsympy.polys.specialpolysr
   r   r   r   r   r   r   r   r   r   r   Z	sympy.abcr   r   r   r3   r4   r7   r>   rG   rS   rT   rU   r   r   r   r   <module>   s$   4#