o
    GZh                     @   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   R/var/www/auris/lib/python3.10/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*   )       c                 S   s   g | ]	}t | d qS r,   )r   r-   r'   r   r   r   r*   +   s    )
r	   
ValueErrorr
   r   r   rangestrZ	all_rootssortedr   )pr   r   r   test_swinnerton_dyer_poly   s   "&.r4   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	   r/   r   r   r   r   r   r   r   test_cyclotomic_poly.   s   ."r5   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   r6   )Nr+   r8   r   r   r   r   r   =   r9   r   Tr   r   r    r#   )r	   r/   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(   Zcoeffr   r   r   	<genexpr>L      & z#test_random_poly.<locals>.<genexpr>Tc                 s   r=   r>   r   r?   r   r   r   r@   Q   rA   )r   r   r   ZdegreeallZcoeffs)Zpolyr   r   r   test_random_polyH   s   ""rC   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 rD   r   r   r   r   r   r   r   r   j      c                   S   s   t dtt tdfdS rD   rE   r   r   r   r   r   l   rF   c                   S      t ddddS )Nr    r#   r!   r+   )r&      r   r   r   r   r   r   n      c                   S   rG   )Nr    r#   rH   )r&   rI   r$   rJ   r   r   r   r   r   p   rK   )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 rO   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   repZto_listr(   tr   r   r   r*   {   r.   z)test_fateman_poly_F_1.<locals>.<listcomp>r#   c                 S   rQ   r   rR   rT   r   r   r   r*      r.   )r   r   r   fghFGHr   r   r   test_fateman_poly_F_1w      "&r]   c                  C   rP   )Nr   c                 S   rQ   r   rR   rT   r   r   r   r*      r.   z)test_fateman_poly_F_2.<locals>.<listcomp>r#   c                 S   rQ   r   rR   rT   r   r   r   r*      r.   )r   r   r   rV   r   r   r   test_fateman_poly_F_2   r^   r_   c                  C   rP   )Nr   c                 S   rQ   r   rR   rT   r   r   r   r*      r.   z)test_fateman_poly_F_3.<locals>.<listcomp>r#   c                 S   rQ   r   rR   rT   r   r   r   r*      r.   )r   r   r   rV   r   r   r   test_fateman_poly_F_3   r^   r`   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   r4   r5   r:   rC   rO   r]   r_   r`   r   r   r   r   <module>   s&    4#