o
    *ήc                     @   sh   d dl mZ d dlmZ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 d dlmZ dd Zd	S )
    )GoldenRatio)Rationalpi)S)sqrt)continued_fraction_periodiccontinued_fraction_iteratorcontinued_fraction_convergentscontinued_fraction_reducecontinued_fraction)raisesc                  C   s4  t ddddt ddddksJ t ddddt ddddks J td} td|  d|   tdks4J ddtddtddtd ddtd d  ddtd  d dtd d	td
 d f	D ]}tt||  dksrJ tt| |  dksJ qbttdd  ttdd  ttdd  ttdd  ttdd  ttdd  t dddddgksJ t dddddg dgksJ t ddddgksJ t dddg dksJ t dddg dksJ t dddg dksJ t dddg dksJ t dddg dksJ t dddg d ksJ t ddddggks*J t dddddggks8J t ddd!g d"ksEJ t d#d$dg d%ksRJ t d&d'g d(ks^J t d)d*g d+ksjJ t d,d-g d.ksvJ dDd/d0}|tg d1ksJ |t	g d2ksJ t
ttd
d3g d4ksJ t
ttd5d3g d6ksJ t
tg d7tjtddtd8dtd9d:gksJ t
tdgtdgksJ t
tg d1tjtdtddtddtd8dtdd8td;dgksJ t
tddtdddgtjtddtddtddgks!J tg d7td9d:ks/J tdgtdks;J tg d<td=d>ksIJ tddddd?d8ggtdd d   dkscJ tg d@tdAdBksqJ tdggtdd d   dksJ tdCdddggdtd ksJ d S )EN   
   r                     c                   S   s   t tdtd S Nr   r   cfr    r   r   R/tmp/pip-target-vg8gfxp4/lib/python/sympy/ntheory/tests/test_continued_fraction.py<lambda>       z)test_continued_fraction.<locals>.<lambda>c                   S   s   t tdtd S r   r   r   r   r   r   r      r   c                   S   s   t tS N)r   r   r   r   r   r   r          c                   S   s   t dS )Ng?)r   r   r   r   r   r      r   c                   S   s   t dddS )Nr   r   cf_pr   r   r   r   r          c                   S   s   t dddS )Nr   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   1   )r   r   r$   i  ik  )r   r   r   r   r   i  i'  )r   r   r#   r   r&   i  i
  )r   r   r      r   i  i	
  )	r   r   r   r   r   r   r   r      c                 S   s6   g }t t| D ]\}}||kr |S || q|S r   )	enumeratecf_iappend)iteratornresitr   r   r   take/   s   z%test_continued_fraction.<locals>.take)r   r   r   r   r   r   r   )r   r      r   i$  r   r   r#   )r   r   r   r   i)r   r   r   r   )r   r$   r      r9   G   >      )r   r   r   r   i      )r   r   	   7   .   )r   )r!   r   r   r   cf_rexpandr   
ValueErrorphir   listr/   cf_cr   One)r5   r2   r6   r   r   r   test_continued_fraction   sb      .* 
  6(@4*(rJ   N)
sympy.corer   rF   sympy.core.numbersr   r   sympy.core.singletonr   (sympy.functions.elementary.miscellaneousr    sympy.ntheory.continued_fractionr   r!   r   r/   r	   rH   r
   rC   r   r   sympy.testing.pytestr   rJ   r   r   r   r   <module>   s    