
    ^Mh|                         d dl Z d dlZd dlmZmZ d dlmZmZ d dl	m
Z
 d Z e j        d          d             Z G d	 d
          ZdS )    N)assert_equalassert_allcloselog_ndtr	ndtri_exp)assert_func_equalc                 :    t          t          |                     S Nr   ys    b/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/special/tests/test_ndtri_exp.pylog_ndtr_ndtri_expr      s    IaLL!!!    class)scopec                  n    t           j                            d          } |                     d          }|S )Ni  i  )nprandomRandomStaterandom_sample)random_statepointss     r   uniform_random_pointsr      s/    9((..L''--FMr   c            
           e Zd ZdZej                            ddddd ej        e	          j
         g          d             Zej                            dg d	          d
             Zd Zd Zd ZdS )TestNdtriExpa  Tests that ndtri_exp is sufficiently close to an inverse of log_ndtr.

    We have separate tests for the five intervals (-inf, -10),
    [-10, -2), [-2, -0.14542), [-0.14542, -1e-6), and [-1e-6, 0).
    ndtri_exp(y) is computed in three different ways depending on if y
    is in (-inf, -2), [-2, log(1 - exp(-2))], or [log(1 - exp(-2), 0).
    Each of these intervals is given its own test with two additional tests
    for handling very small values and values very close to zero.
    
test_inputg      $g      Yg    _g@xc                 T    |}|d|z  dz   z  }t          t          d |dd           d S )Ng      ?c                     | S r
    r   s    r   <lambda>z2TestNdtriExp.test_very_small_arg.<locals>.<lambda>&       a r   +=Trtolnan_okr   r   )selfr   r   scaler   s        r   test_very_small_argz TestNdtriExp.test_very_small_arg   sO     # 55;<K		
 	
 	
 	
 	
 	
r   zinterval,expected_rtol)))ir"   ))r*   ̗`¿-q=))r+   ưg|=))r-   r   gư>c                 Z    |\  }}||z
  |z  |z   }t          t          d ||d           d S )Nc                     | S r
   r   r   s    r   r    z/TestNdtriExp.test_in_interval.<locals>.<lambda>9   r!   r   Tr#   r&   )r'   intervalexpected_rtolr   leftrightr   s          r   test_in_intervalzTestNdtriExp.test_in_interval+   sR     e$,"77$>K		
 	
 	
 	
 	
 	
r   c                 2   t           j                            t          j        t                    j        ddddg          }t          j        t                    j         }t          j        ||g          }t          |          }t          ||d           d S )Nr   r,   )r$   )
r   	nextafterreducefinfofloatmintinyarrayr   r   )r'   bignegtinynegxresults        r   test_extremezTestNdtriExp.test_extreme>   s~    * $$bhuoo&91aA%FGG8E??''Hgv&''#A&&......r   c                     t          t          t          j         dg          t          j         t          j        g           d S )Ng        )r   r   r   infr'   s    r   test_asymptoteszTestNdtriExp.test_asymptotesZ   s3    Y~.."&"&0ABBBBBr   c                 L    t          j        t          d                    sJ d S )Ng      ?)r   isnanr   rD   s    r   test_outside_domainz TestNdtriExp.test_outside_domain]   s$    x	#'''''''r   N)__name__
__module____qualname____doc__pytestmarkparametrizer   r8   r9   maxr)   r4   rA   rE   rH   r   r   r   r   r      s          [tT5%("(5//2E1EF 
 
 
 [ 	
 	
 	
 
 
 
/ / /8C C C( ( ( ( (r   r   )rM   numpyr   numpy.testingr   r   scipy.specialr   r   scipy.special._testutilsr   r   fixturer   r   r   r   r   <module>rV      s         7 7 7 7 7 7 7 7 - - - - - - - - 6 6 6 6 6 6" " " g  K( K( K( K( K( K( K( K( K( K(r   