o
    izl                    @   s  d dl Z d dlZd dlZd dlZd dlZd dl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mZmZmZmZmZmZmZmZ d dl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& d dl'm(Z( d dl)m(  m*Z+ d dl,m-Z-m.Z.m/Z/ d dl,m0Z0m1Z1m2Z2m3Z3m4Z4 d dl,m5Z5m6Z6 d d	l7m8Z8m9Z9 d d
l:m;Z;m<Z<m=Z= d dl>Z>G dd dZ?G dd dZ@G dd dZAG dd dZBG dd dZCG dd dZDG dd dZEG dd dZFG dd dZGG dd dZHG dd  d ZIG d!d" d"ZJG d#d$ d$ZKG d%d& d&ZLG d'd( d(ZMG d)d* d*ZNG d+d, d,ZOG d-d. d.ZPG d/d0 d0ZQG d1d2 d2ZRG d3d4 d4ZSG d5d6 d6ZTG d7d8 d8ZUG d9d: d:ZVG d;d< d<ZWG d=d> d>ZXG d?d@ d@ZYG dAdB dBZZG dCdD dDZ[G dEdF dFZ\G dGdH dHZ]G dIdJ dJZ^G dKdL dLZ_G dMdN dNZ`G dOdP dPZaG dQdR dRZbG dSdT dTZcdUdV ZddWdX ZeG dYdZ dZZfd[d\ Zgd]d^ Zhd_d` Zidadb Zjdcdd Zkdedf Zle;dgdh Zmdidj Zndkdl Zodmdn Zpdodp Zqdqdr Zrdsdt Zsdudv Ztdwdx Zudydz ZvdS ){    N)arrayisnanr_arangefinfopisincostanexplogzerossqrtasarrayinf
nan_to_numrealarctanfloat_)raises)	assert_equalassert_almost_equalassert_array_equalassert_array_almost_equalassert_approx_equalassert_assert_allcloseassert_array_almost_equal_nulpsuppress_warnings)special)ellipeellipkellipkm1)elliprcelliprdelliprfelliprgelliprj)mathieu_odd_coefmathieu_even_coef)_FACTORIALK_LIMITS_64BITS_FACTORIALK_LIMITS_32BITS)with_special_errorsassert_func_equalFuncDatac                   @   s  e Zd 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d 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#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;d< Z d=d> Z!d?d@ Z"dAdB Z#dCdD Z$dEdF Z%dGdH Z&dIdJ Z'dKdL Z(dMdN Z)dOdP Z*dQdR Z+dSdT Z,dUdV Z-dWdX Z.dYdZ Z/d[d\ Z0d]d^ Z1d_d` Z2dadb Z3dcdd Z4dedf Z5dgdh Z6e7j8j9didjdkdl Z:dmdn Z;dodp Z<dqdr Z=e7j8j9dsdjdtdu Z>dvdw Z?dxdy Z@dzd{ ZAd|d} ZBd~d ZCdd ZDdd ZEdd ZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdd ZUdd ZVdd ZWdd ZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_dd Z`dd Zadd Zbdd Zcdd ZdddÄ Zeddń ZfddǄ ZgddɄ Zhdd˄ Zidd̈́ Zjddτ Zkddф Zlddӄ ZmddՄ Znddׄ Zoddل Zpddۄ Zqdd݄ Zrdd߄ Zsdd Ztdd Zudd Zvdd Zwdd Zxdd Zydd Zzdd Z{dd Z|dd Z}dd Z~dd Zdd Zdd Zdd Zdd 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d 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"d# Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Zd4d5 Zd6d7 Zd8d9 Zd:d; Zd<d= Zd>d? Zd@dA ZdBdC ZdDdE ZdFdG ZdHdI ZdJdK ZdLdM ZdNdO ZdPdQ ZdRdS ZdTdU ZdVdW ZdXdY ZdZd[ Zd\d] Zd^d_ Zd`da Zdbdc Zddde Zdfdg Zdhdi Zdjdk Zdldm Zdndo Zdpdq Zdrds Zdtdu Zdvdw Zdxdy Zdzd{ Zd|d} Zd~S (  
TestCephesc                 C      t d d S Nr   )cephesairyself r6   m/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/scipy/special/tests/test_basic.py	test_airy4      zTestCephes.test_airyc                 C   r0   r1   )r2   airyer4   r6   r6   r7   
test_airye7   r9   zTestCephes.test_airyec              	   C   s6  t g d}t g d}t t |d d d f |d d d f ddj}t g dg dg dg dg}ttj| |d	d
 t j	
d t jt dddt j	d d f }t dd}t t |d d d f |d d d f ddj}ttjt|d d df |d d df d |ddd d S )N)gL7A`?   g@   )   皙?   gffffff
@r>   )g޸g	TշJ?g	7?geLF)   g*+ @r   gM{@)gףp=
%@gϔ>@g<wg$@)   g,y3@iK  g5@vIh%<=rtol  i       r   f           ?绽|=atolrF   )npr   broadcast_arraysreshapeTr-   r2   binomravelrandomseedr   r   Zrand)r5   nknkZrknownr6   r6   r7   
test_binom:   s,   (

&(
&
zTestCephes.test_binomc              	   C   s   t jd t jt ddd }t dd}t t |d d d f |d d d f ddj	}t
tjt|d d df |d d df d	 |d
d
d d S )NrG   rL   ,     r   rK   r>   rA   rM   rN   rO   )rQ   rW   rX   r   logspacer   r   rR   rS   rT   r-   r2   rU   )r5   rY   rZ   r[   r6   r6   r7   test_binom_2Q   s   (
&
zTestCephes.test_binom_2c              	   C   s   t jdd }t jd t dd}t dd}t t |d d d f |d d d f ddj}||d d df |d d df k }t	t
j||d d df |d d df |ddd	 d S )
Nc                 S   sX   t | } t |}t d}t d}td|d D ]}|||  | 9 }||9 }qt|| S NrL   )intrangefloat)rY   rZ   numZdenir6   r6   r7   	binom_int_   s   
z.TestCephes.test_binom_exact.<locals>.binom_intrG   rL      r   r>   rA   rO   )rQ   	vectorizerW   rX   r   r   rR   rS   rT   r-   r2   rU   )r5   rg   rY   rZ   r[   r6   r6   r7   test_binom_exact^   s   

(
$ 
zTestCephes.test_binom_exactc                 C   s.   g d}t |}ttj|dddd  d S )N))rI   rJ   gwP~)i  i  gii9~)i  i  gyhY~)i  i  gpvy~)i  i  gzN~)i  i  gGTɳ~)i  i  g@jH~)i  i  gF:aYͦ~)i  i  gɸV)i  i  g
{9)i  i  gyVxY)i  i  g*I y)i   i   gI)i  i  gW@N)i  i  g5y)r   rL   r>   -q=rE   )rQ   r   r.   r2   rU   check)r5   Zdatasetr6   r6   r7   test_binom_nooverflow_8346u   s   
z%TestCephes.test_binom_nooverflow_8346c                 C      t tdddd d S )NrL         ?      ?)r   r2   Zbdtrr4   r6   r6   r7   	test_bdtr      zTestCephes.test_bdtrc                 C      t tdddd d S NrL      ro   )r   r2   Zbdtrir4   r6   r6   r7   
test_bdtri   rr   zTestCephes.test_bdtric                 C   rs   rt   )r   r2   Zbdtrcr4   r6   r6   r7   
test_bdtrc   rr   zTestCephes.test_bdtrcc                 C      t tdddd d S NrL   r         @)r   r2   Zbdtrinr4   r6   r6   r7   test_bdtrin   rr   zTestCephes.test_bdtrinc                 C      t ddd d S rt   )r2   Zbdtrikr4   r6   r6   r7   test_bdtrik      zTestCephes.test_bdtrikc                 C      t tdd d S Nr           )r   r2   beir4   r6   r6   r7   test_bei      zTestCephes.test_beic                 C   r   r   )r   r2   beipr4   r6   r6   r7   	test_beip   r   zTestCephes.test_beipc                 C   r   Nr   rp   )r   r2   berr4   r6   r6   r7   test_ber   r   zTestCephes.test_berc                 C   r   r   )r   r2   berpr4   r6   r6   r7   	test_berp   r   zTestCephes.test_berpc                 C      t tdddd d S r   )r   r2   Z
besselpolyr4   r6   r6   r7   test_besselpoly   rr   zTestCephes.test_besselpolyc                 C   F   t tddd ttddtd ttddddd	d
 d S )NrL   rp   33333YN~h?   g6.8@rD   r   rF   rP   )r   r2   betar   gammar4   r6   r6   r7   	test_beta   
   
zTestCephes.test_betac                 C   s,   t tdddd ttdddd d S )NrL   rp   r   r   rN   g*?)r   r2   betaincr   r4   r6   r6   r7   test_betainc   s   zTestCephes.test_betaincc                 C   r   )NrL   r   r   r   r      gIs	@+=r   r   )r   r2   betalnr   gammalnr4   r6   r6   r7   test_betaln   r   zTestCephes.test_betalnc                 C   s2   t tdddd ttddddddd	 d S )
NrL   rp   r   r         ?g"
Yx;gAfc=r   r   )r   r2   
betaincinvr   r4   r6   r6   r7   test_betaincinv   s   
zTestCephes.test_betaincinvc                 C   s   t ttdd d S )NrA   r>   )r   rQ   isinfr   r   r4   r6   r6   r7   test_beta_inf      zTestCephes.test_beta_infc                 C   r   NrL   rp   )r   r2   Zbtdtrr4   r6   r6   r7   
test_btdtr   rr   zTestCephes.test_btdtrc                 C   r   r   )r   r2   Zbtdtrir4   r6   r6   r7   test_btdtri   rr   zTestCephes.test_btdtric                 C   r   NrL   rz   )r   r2   Zbtdtriar4   r6   r6   r7   test_btdtria   rr   zTestCephes.test_btdtriac                 C   r   r   )r   r2   Zbtdtribr4   r6   r6   r7   test_btdtrib   rr   zTestCephes.test_btdtribc                 C   r   r   )r   r2   cbrtr4   r6   r6   r7   	test_cbrt   r   zTestCephes.test_cbrtc                 C      t tddd d S NrL   r   r   )r   r2   chdtrr4   r6   r6   r7   
test_chdtr      zTestCephes.test_chdtrc                 C   r   NrL   r   rp   )r   r2   chdtrcr4   r6   r6   r7   test_chdtrc   r   zTestCephes.test_chdtrcc                 C      t tddd d S NrL   r   )r   r2   chdtrir4   r6   r6   r7   test_chdtri   r   zTestCephes.test_chdtric                 C   r   )Nr   rz   )r   r2   Zchdtrivr4   r6   r6   r7   test_chdtriv   r   zTestCephes.test_chdtrivc                 C   s8  t tdddd tg dg dg dg dg dg d	g d
g dg dg dg dg dg dg}t|d d df |d d df |d d df }t||d d df dd tttjtjdd ttddtjd tt	ttj
dd tt	tdtj
d tt	tddtj
 d S )Nr   rL   r   )      9@      4@  gL94)r          @   g7Fh9)MbP?r         D@ggåc;){Gz?r   r   g	;)r          @k   g8x@x>)g     6@r   r   gg1\>>)r   r   r   g`>)      @r   rp   gp!P?)g     u@g     r@      $@g j
?)      Y@      +@r   g]?)g     @r   r   g4ۙ?)g     b@r   r   g?)g      d@r   r   rp   r>   ru   rk   rE   r      )r   r2   ZchndtrrQ   r   r   r   r   r   r   nan)r5   valuesZcdfr6   r6   r7   test_chndtr   s.   2zTestCephes.test_chndtrc                 C   rn   Nr   rL   rz   )r   r2   Z	chndtridfr4   r6   r6   r7   test_chndtridf   rr   zTestCephes.test_chndtridfc                 C   rx   r   )r   r2   Z	chndtrincr4   r6   r6   r7   test_chndtrinc   rr   zTestCephes.test_chndtrincc                 C   rx   Nr   rL   r   )r   r2   Zchndtrixr4   r6   r6   r7   test_chndtrix   rr   zTestCephes.test_chndtrixc                 C   r   r   )r   r2   cosdgr4   r6   r6   r7   
test_cosdg  r   zTestCephes.test_cosdgc                 C   r   r   )r   r2   cosm1r4   r6   r6   r7   
test_cosm1  r   zTestCephes.test_cosm1c                 C   r   N-   rp   )r   r2   cotdgr4   r6   r6   r7   
test_cotdg	  r   zTestCephes.test_cotdgc                 C   s$   t tdd ttdd d S )Nr   r   gGz?gf?)r   r2   dawsnr   r4   r6   r6   r7   
test_dawsn  s   zTestCephes.test_dawsnc                 C   sV  g d}t dt j d t j}tt||ddd t dt j d t j}tt||ddd t dt j d	 t j}tt||ddd t	t d
rmt dt j d t j
}tt||ddd g d}t dt j d t j}tt||ddd t dt j dt j dt j }g d}tt|d|dd d S )N)rL   r      r>   g-C6
?rp   r@   decimal&.>rh   V瞯<float128rk      )r>   r<            皙?)gg?gsOB?gsaL?g
7I^ʿru   )rQ   r   r   astypeZfloat32r   r   diricfloat64hasattrr   r   )r5   Zn_oddxZn_evenZoctave_resultr6   r6   r7   
test_diric  s    
 zTestCephes.test_diricc                 C   sH   t d}t g d}tt|d d t jf |j|j|jfk d S )Nr   )rL   ru   r@   )	rQ   r   r   r   r   r   Znewaxisshapesize)r5   r   rY   r6   r6   r7   test_diric_broadcasting)  s   
0z"TestCephes.test_diric_broadcastingc                 C   r   r   )r   r2   r    r4   r6   r6   r7   test_ellipe.  r   zTestCephes.test_ellipec                 C   r   r   )r   r2   	ellipeincr4   r6   r6   r7   test_ellipeinc1  r   zTestCephes.test_ellipeincc                 C      t dd d S Nr   rL   )r2   ellipjr4   r6   r6   r7   test_ellipj4     zTestCephes.test_ellipjc                 C   s   t tdtd  d S )Nr   r>   )r   r!   r   r4   r6   r6   r7   test_ellipk7  r   zTestCephes.test_ellipkc                 C   r   r   )r   r2   	ellipkincr4   r6   r6   r7   test_ellipkinc:  r   zTestCephes.test_ellipkincc                 C   r   r   r   r2   erfr4   r6   r6   r7   test_erf=  r   zTestCephes.test_erfc                 C   s$   d}t t|t|  d d S )Ng#8x@r   r   r5   r   r6   r6   r7   test_erf_symmetry@  s    zTestCephes.test_erf_symmetryc                 C   r   r   )r   r2   erfcr4   r6   r6   r7   	test_erfcD  r   zTestCephes.test_erfcc                 C   r   )Nr>   r   )r   r2   exp10r4   r6   r6   r7   
test_exp10G  r   zTestCephes.test_exp10c                 C   r   )Nr>         @)r   r2   exp2r4   r6   r6   r7   	test_exp2J  r   zTestCephes.test_exp2c                 C   sP   t tdd t ttjtj t ttj d t ttjtj d S )Nr   r   rA   )r   r2   expm1rQ   r   r   r4   r6   r6   r7   
test_expm1M  s   zTestCephes.test_expm1c                 C   s  t j}t|dd t|ttjdttjd t|ttjdttjtj t|ttjdttj tj t|ttjdttj tj  t|ttjdttjtj  t|tdtjttjtj t|tdtjttjtj t|ttjtjttjtj t|ttj tjtdd t|ttj tjtdd t|ttjtjttjtj t|tdtjttjtj t|tdtjttjtj t|ttjdttjtj t|ttjtjttjtj d S )N                r   rL   r>   r<   r   rA   )r2   r  r   complexrQ   r   r   )r5   r  r6   r6   r7   test_expm1_complexS  s"    "$"  "  "   &zTestCephes.test_expm1_complexz-The real part of expm1(z) bad at these pointsreasonc                 C   sh   t g d}t t | }|d|  }t g d}t|}t|j|jd t|j|jd d S )N)皙?r   333333?r      r^                 ?)y=Cw?yC7gg)gF<Ug?yQ<D*?yg:><sKy>񸣼$	Um>ly;Vl <@ru   r^   )	rQ   r   r   r	   r2   r  r   imagr   )r5   yr   zexpectedfoundr6   r6   r7   test_expm1_complex_hardf  s   
z"TestCephes.test_expm1_complex_hardc                 C   0   t tdddd ttdddddd	 d S )
NrL   r   r   ư>r   
   g2?rk   rE   )r   r2   Zfdtrr   r4   r6   r6   r7   	test_fdtr{  s   
zTestCephes.test_fdtrc                 C   r  )
NrL   r   rp   r>   r  g    _BgDIXl?rk   rE   )r   r2   Zfdtrcr   r4   r6   r6   r7   
test_fdtrc  s   
zTestCephes.test_fdtrcc                 C   sD   t tddddgtddgdd d}t td	d|d
dd d S )NrL   gV-?gx&1?g
}?g<zO'?r  rE   g׀?r  ru   rk   )r   r2   fdtrir   )r5   pr6   r6   r7   
test_fdtri  s
   zTestCephes.test_fdtrizReturns nan on i686.c                 C   s   t tdddd d S )NrL   ro   )r   r2   r  r4   r6   r6   r7   test_fdtri_mysterious_failure  s   z(TestCephes.test_fdtri_mysterious_failurec                 C      t tdddd d S ry   )r   r2   Zfdtridfdr4   r6   r6   r7   test_fdtridfd  rr   zTestCephes.test_fdtridfdc                 C   r   Nr   r   r   )r   r2   fresnelr4   r6   r6   r7   test_fresnel  r   zTestCephes.test_fresnelc                 C   r   Nr         8@)r   r2   r   r4   r6   r6   r7   
test_gamma  r   zTestCephes.test_gammac                 C   r   )Nr   rL   r   )r   r2   gammainccinvr4   r6   r6   r7   test_gammainccinv  r   zTestCephes.test_gammainccinvc                 C   r0   )Nr  )r2   r   r4   r6   r6   r7   test_gammaln  r9   zTestCephes.test_gammalnc                 C   s2   t g dt j}tt|t t| d S )N)      gffffffrL   g@)rQ   r   r   r   r2   Zgammasgnsignrgamma)r5   valsr6   r6   r7   test_gammasgn  s    zTestCephes.test_gammasgnc                 C   rn   r   )r   r2   gdtrr4   r6   r6   r7   	test_gdtr  rr   zTestCephes.test_gdtrc                 C   s   t tddtjd d S r   )r   r2   r1  rQ   r   r4   r6   r6   r7   test_gdtr_inf  r   zTestCephes.test_gdtr_infc                 C   rn   r   )r   r2   Zgdtrcr4   r6   r6   r7   
test_gdtrc  rr   zTestCephes.test_gdtrcc                 C   r  r   )r   r2   Zgdtriar4   r6   r6   r7   test_gdtria  rr   zTestCephes.test_gdtriac                 C   s   t ddd d S NrL   r   )r2   Zgdtribr4   r6   r6   r7   test_gdtrib  r~   zTestCephes.test_gdtribc                 C   s   t ddd d S NrL   r  )r2   Zgdtrixr4   r6   r6   r7   test_gdtrix  r~   zTestCephes.test_gdtrixc                 C      t dd d S ra   )r2   hankel1r4   r6   r6   r7   test_hankel1  r   zTestCephes.test_hankel1c                 C   r:  ra   )r2   hankel1er4   r6   r6   r7   test_hankel1e  r   zTestCephes.test_hankel1ec                 C   r:  ra   )r2   hankel2r4   r6   r6   r7   test_hankel2  r   zTestCephes.test_hankel2c                 C   r:  ra   )r2   hankel2er4   r6   r6   r7   test_hankel2e  r   zTestCephes.test_hankel2ec                 C   s>   t tdddtd t tdddd tddd d S )NrL   rp   ru   r<   g㈮?)r   r2   hyp1f1r   r4   r6   r6   r7   test_hyp1f1  s   zTestCephes.test_hyp1f1c                 C      t tddddd d S r   )r   r2   hyp2f1r4   r6   r6   r7   test_hyp2f1  r   zTestCephes.test_hyp2f1c                 C   r   r   )r   r2   i0r4   r6   r6   r7   test_i0  r   zTestCephes.test_i0c                 C   r   r   )r   r2   i0er4   r6   r6   r7   test_i0e  r   zTestCephes.test_i0ec                 C   r   r   )r   r2   i1r4   r6   r6   r7   test_i1  r   zTestCephes.test_i1c                 C   r   r   )r   r2   i1er4   r6   r6   r7   test_i1e  r   zTestCephes.test_i1ec                 C   r0   ra   )r2   it2i0k0r4   r6   r6   r7   test_it2i0k0  r9   zTestCephes.test_it2i0k0c                 C   r0   ra   )r2   it2j0y0r4   r6   r6   r7   test_it2j0y0  r9   zTestCephes.test_it2j0y0c                 C   r0   ra   )r2   Z
it2struve0r4   r6   r6   r7   test_it2struve0  r9   zTestCephes.test_it2struve0c                 C   r0   ra   )r2   Zitairyr4   r6   r6   r7   test_itairy  r9   zTestCephes.test_itairyc                 C   r   r!  )r   r2   iti0k0r4   r6   r6   r7   test_iti0k0  r   zTestCephes.test_iti0k0c                 C   r   r!  )r   r2   itj0y0r4   r6   r6   r7   test_itj0y0  r   zTestCephes.test_itj0y0c                 C   r   r   )r   r2   Zitmodstruve0r4   r6   r6   r7   test_itmodstruve0  r   zTestCephes.test_itmodstruve0c                 C   r   r   )r   r2   Z	itstruve0r4   r6   r6   r7   test_itstruve0  r   zTestCephes.test_itstruve0c                 C   r   r   )r   r2   ivr4   r6   r6   r7   test_iv  r   zTestCephes.test_ivc                 C   r   r   )r   r2   iver4   r6   r6   r7   test_ive  r   zTestCephes.test_ivec                 C   r   r   )r   r2   j0r4   r6   r6   r7   test_j0  r   zTestCephes.test_j0c                 C   r   r   )r   r2   j1r4   r6   r6   r7   test_j1  r   zTestCephes.test_j1c                 C   r   r   )r   r2   jnr4   r6   r6   r7   test_jn  r   zTestCephes.test_jnc                 C   r   r   )r   r2   jvr4   r6   r6   r7   test_jv  r   zTestCephes.test_jvc                 C   r   r   )r   r2   jver4   r6   r6   r7   test_jve  r   zTestCephes.test_jvec                 C   r0   Nr>   )r2   k0r4   r6   r6   r7   test_k0  r9   zTestCephes.test_k0c                 C   r0   rk  )r2   k0er4   r6   r6   r7   test_k0e
  r9   zTestCephes.test_k0ec                 C   r0   rk  )r2   k1r4   r6   r6   r7   test_k1  r9   zTestCephes.test_k1c                 C   r0   rk  )r2   k1er4   r6   r6   r7   test_k1e  r9   zTestCephes.test_k1ec                 C   r0   rk  )r2   keir4   r6   r6   r7   test_kei  r9   zTestCephes.test_keic                 C   r   r   )r   r2   keipr4   r6   r6   r7   	test_keip  r   zTestCephes.test_keipc                 C   r0   rk  )r2   kerr4   r6   r6   r7   test_ker  r9   zTestCephes.test_kerc                 C   r0   rk  )r2   kerpr4   r6   r6   r7   	test_kerp  r9   zTestCephes.test_kerpc                 C   r0   rk  )r2   kelvinr4   r6   r6   r7   test_kelvin  r9   zTestCephes.test_kelvinc                 C   r:  ra   )r2   knr4   r6   r6   r7   test_kn"  r   zTestCephes.test_knc                 C   *   t tdd ttttj d S r   )r   r2   Zkolmogir   rQ   r   r   r4   r6   r6   r7   test_kolmogi%     zTestCephes.test_kolmogic                 C   r   r   )r   r2   Z
kolmogorovr4   r6   r6   r7   test_kolmogorov)  r   zTestCephes.test_kolmogorovc                 C   r   )Nr          )r   r2   Z_kolmogpr4   r6   r6   r7   test_kolmogp,  r   zTestCephes.test_kolmogpc                 C   r   r   )r   r2   Z_kolmogcr4   r6   r6   r7   test_kolmogc/  r   zTestCephes.test_kolmogcc                 C   r  r   )r   r2   Z	_kolmogcir   rQ   r   r   r4   r6   r6   r7   test_kolmogci2  r  zTestCephes.test_kolmogcic                 C   r:  ra   )r2   kvr4   r6   r6   r7   test_kv6  r   zTestCephes.test_kvc                 C   r:  ra   )r2   kver4   r6   r6   r7   test_kve9  r   zTestCephes.test_kvec                 C   sL   t j}t|dd t|dtj  t|dtj t|tjtj d S )Nr   r   rA   )r2   log1pr   rQ   r   r   )r5   r  r6   r6   r7   
test_log1p<  s
   zTestCephes.test_log1pc                 C   s  t j}t}t|dd t||dd|tj d t }|td t	||dtj|tjtj
d  t||dtj|tjtj t	||tj d|tjtj
 t||tjd|tjd t	||tj tj|tjdtj
 d  t	||tjtj|tjtj
d  t||tjtj|tjtj t||tj tj|tjtj t||tjtj|tjtj t||tjd|tjtj t||tjtj|tjtj W d    d S 1 sw   Y  d S )	Nr  rA   r   z%invalid value encountered in multiplyrL   r>   ru   r<   )r2   r  r  r   rQ   r   r   filterRuntimeWarningr   r   r   )r5   r  csupr6   r6   r7   test_log1p_complexC  s$   $ ",&"$" $"zTestCephes.test_log1p_complexc                 C   rn   )Nr   rL   rp   )r   r2   lpmvr4   r6   r6   r7   	test_lpmvV  rr   zTestCephes.test_lpmvc                 C   r   r   )r   r2   Z	mathieu_ar4   r6   r6   r7   test_mathieu_aY  r   zTestCephes.test_mathieu_ac                 C   r   r   )r   r2   Z	mathieu_br4   r6   r6   r7   test_mathieu_b\  r   zTestCephes.test_mathieu_bc                 C   s   t tdddd tjdd }tdd}tjdtddd	f }tt|d d d f |d d d f d
d ||d d d f |d d d f d
ddd d S )NrL   r   rp   r   c                 S   s   |t jd 9 }| dkrddd| td|    S | dkr+t||d td|   S | dkrAtd| |td	| d
 d   S t| | |t| d | d	| d   t| d | d	| d      S )N   r   g;f?rL   ro   r>      ru   r<      r   )rQ   r   r	   mqr  r6   r6   r7   	ce_smallqc  s   $Hz.TestCephes.test_mathieu_cem.<locals>.ce_smallqd   r  rh|?r   r   )	r   r2   mathieu_cemrQ   ri   r   r   r_   r   )r5   r  r  r  r6   r6   r7   test_mathieu_cem_  s   

*"
zTestCephes.test_mathieu_cemc                 C   s   t tdddd tjdd }tdd}tjdtddd	f }tt|d d d f |d d d f d
d ||d d d f |d d d f d
ddd d S )NrL   r   r   rp   c                 S   s   |t jd 9 }| dkrt||d td|   S | dkr-td| |td|  d  S t| | |t| d | d| d   t| d | d| d      S )Nr  rL   r  ru   r>   r<   r  )rQ   r   r   r  r6   r6   r7   	se_smallqx  s    Hz.TestCephes.test_mathieu_sem.<locals>.se_smallqr  r  r  r  r  r   r   )	r   r2   mathieu_semrQ   ri   r   r   r_   r   )r5   r  r  r  r6   r6   r7   test_mathieu_semt  s   
*"
zTestCephes.test_mathieu_semc                 C   r  NrL   r   r"  )r   r2   mathieu_modcem1r4   r6   r6   r7   test_mathieu_modcem1  rr   zTestCephes.test_mathieu_modcem1c                 C   s   t ddd tddd d d d f }tjtddd d d d d f }tdddd d d d f }t ||| d }t ||dd  t ||dd  }t |||d  d| t |||d   }t||dd	 d S )
NrL   r   r<   r  r>   r  r@   rN   rE   )	r2   mathieu_modcem2rQ   r   r   r_   linspacer  r   r5   r  r  r  y1fry2r6   r6   r7   test_mathieu_modcem2  s   "&.zTestCephes.test_mathieu_modcem2c                 C   r  r  )r   r2   mathieu_modsem1r4   r6   r6   r7   test_mathieu_modsem1  rr   zTestCephes.test_mathieu_modsem1c                 C   s   t ddd tddd d d d f }tjtddd d d d d f }tdddd d d d f }t ||| d }t ||dd t ||dd  }t |||d d| t |||d   }t||dd	 d S )
NrL   r<   r  r>   r  r   r@   rN   rE   )	r2   mathieu_modsem2rQ   r   r   r_   r  r  r   r  r6   r6   r7   test_mathieu_modsem2  s   "$,zTestCephes.test_mathieu_modsem2c                 C   s   t tdddtjtjf t tdddtjtjf t tdddtjtjf t tdddtjtjf t tdddtjtjf t tdddtjtjf t tdddtjtjf t t	dddtjtjf d S )N'  r   g?      ?)
r   r2   r  rQ   r   r  r  r  r  r  r4   r6   r6   r7   test_mathieu_overflow  s    z TestCephes.test_mathieu_overflowc                 C   sD   t dD ]}tddd}t|d ddd t|d	 d
dd qd S )N<   r>   r  rA   r   g.dS?rN   rE   rL   gGc?-C6?)rc   r2   r  r   )r5   rZ   vr6   r6   r7   test_mathieu_ticket_1847  s
   z#TestCephes.test_mathieu_ticket_1847c                 C   r0   r1   )r2   Zmodfresnelmr4   r6   r6   r7   test_modfresnelm  r9   zTestCephes.test_modfresnelmc                 C   r0   r1   )r2   Zmodfresnelpr4   r6   r6   r7   test_modfresnelp  r9   zTestCephes.test_modfresnelpc                 C   r   r   )r   r2   Z	modstruver4   r6   r6   r7   test_modstruve  r   zTestCephes.test_modstruvec                 C   r   r   )r   r2   nbdtrr4   r6   r6   r7   
test_nbdtr  rr   zTestCephes.test_nbdtrc                 C   r   r   )r   r2   nbdtrcr4   r6   r6   r7   test_nbdtrc  rr   zTestCephes.test_nbdtrcc                 C   r   r   )r   r2   nbdtrir4   r6   r6   r7   test_nbdtri  rr   zTestCephes.test_nbdtric                 C   r|   )NrL   r?   ro   )r2   Znbdtrikr4   r6   r6   r7   test_nbdtrik  r~   zTestCephes.test_nbdtrikc                 C   r  ry   )r   r2   Znbdtrinr4   r6   r6   r7   test_nbdtrin  rr   zTestCephes.test_nbdtrinc                 C   rF  r   )r   r2   ncfdtrr4   r6   r6   r7   test_ncfdtr  r   zTestCephes.test_ncfdtrc                 C   sH   t tddddd g d}tddd|}ttddd|| d S )NrL   r   r   )ro   rL   r  r>   ru   r  )r   r2   Zncfdtrir  r   )r5   fr  r6   r6   r7   test_ncfdtri  s   zTestCephes.test_ncfdtric                 C   s2   g d}t d|dd}tt d|dd| d S )NrL   r>   ru   r>   r   rh   )r2   r  r   Z
ncfdtridfd)r5   Zdfdr  r6   r6   r7   test_ncfdtridfd     zTestCephes.test_ncfdtridfdc                 C   s6   g d}t |ddd}tt |ddd|dd d S )N)r  rL   r>   ru   g     @r>   r   rh   gh㈵>rE   )r2   r  r   Z
ncfdtridfn)r5   dfnr  r6   r6   r7   test_ncfdtridfn  s   zTestCephes.test_ncfdtridfnc                 C   s2   g d}t dd|d}tt dd|d| d S )N)ro   r  r   r>   ru   rh   )r2   r  r   Z	ncfdtrinc)r5   ncr  r6   r6   r7   test_ncfdtrinc  r  zTestCephes.test_ncfdtrincc                 C   s   t tdddd t tdddd tttjdddd	 tttd
tjd ttd
dtjd ttttjdd tttd
tjd tttd
dtj d S )NrL   r   ro   	   i   r   r   rp   r   r   r   )	r   r2   Znctdtrr   rQ   r   r   r   r   r4   r6   r6   r7   test_nctdtr  s   zTestCephes.test_nctdtrc                 C   r|   )NrL   ro   r   )r2   Z	nctdtridfr4   r6   r6   r7   test_nctdtridf  r~   zTestCephes.test_nctdtridfc                 C   s   t ddd d S r6  )r2   Z	nctdtrincr4   r6   r6   r7   test_nctdtrinc  r~   zTestCephes.test_nctdtrincc                 C   r|   )Nr  r   ro   )r2   Znctdtritr4   r6   r6   r7   test_nctdtrit  r~   zTestCephes.test_nctdtritc                 C   r  )Nro   rL   rp   )r   r2   Znrdtrimnr4   r6   r6   r7   test_nrdtrimn  rr   zTestCephes.test_nrdtrimnc                 C   s   t tddddddd d S )Nro   r   r   rO   )r   r2   Znrdtrisdr4   r6   r6   r7   test_nrdtrisd  s   
zTestCephes.test_nrdtrisdc                 C      t dddd d S r6  )r2   Zobl_ang1r4   r6   r6   r7   test_obl_ang1	  r   zTestCephes.test_obl_ang1c                 C   s2   t ddddd}t|d d t|d d d S )NrL   r   rp   r   )r2   Zobl_ang1_cvr   )r5   resultr6   r6   r7   test_obl_ang1_cv  s   zTestCephes.test_obl_ang1_cvc                 C   rn   NrL   r   r   )r   r2   Zobl_cvr4   r6   r6   r7   test_obl_cv  rr   zTestCephes.test_obl_cvc                 C   r  r6  )r2   Zobl_rad1r4   r6   r6   r7   test_obl_rad1  r   zTestCephes.test_obl_rad1c                 C      t ddddd d S r6  )r2   Zobl_rad1_cvr4   r6   r6   r7   test_obl_rad1_cv  r   zTestCephes.test_obl_rad1_cvc                 C   r  r6  )r2   Zobl_rad2r4   r6   r6   r7   test_obl_rad2  r   zTestCephes.test_obl_rad2c                 C   r  r6  )r2   Zobl_rad2_cvr4   r6   r6   r7   test_obl_rad2_cv  r   zTestCephes.test_obl_rad2_cvc                 C   r   )NrL   r   r  )r   r2   pbdvr4   r6   r6   r7   	test_pbdv   r   zTestCephes.test_pbdvc                 C   r   r6  )r2   pbvvr4   r6   r6   r7   	test_pbvv#  r   zTestCephes.test_pbvvc                 C   r   r6  )r2   Zpbwar4   r6   r6   r7   	test_pbwa&  r   zTestCephes.test_pbwac                 C   s>   t dd}t|td t g dd}t|g d d S )Nr   rL   rA   r   rL   r>   )rL   rL   rL   )r2   Zpdtrr   rQ   r   r   r5   valr6   r6   r7   	test_pdtr)  s   zTestCephes.test_pdtrc                 C   sB   t dd}t|dtd  t g dd}t|g d d S )Nr   rL   rA   r  r   )r   r   r   )r2   Zpdtrcr   rQ   r   r   r  r6   r6   r7   
test_pdtrc0  s   zTestCephes.test_pdtrcc                 C   sD   t  }|td tdd W d    d S 1 sw   Y  d S )N-floating point number truncated to an integerro   )r   r  r  r2   pdtri)r5   r  r6   r6   r7   
test_pdtri7  s   "zTestCephes.test_pdtric                 C   sR   t dd}tt |d dd t dgdgdggg d}t|td d S )Nro   rL   r   r   ffffff?)r   #B;r  )ru   ru   )r2   Zpdtrikr   Z	gammainccr   rQ   r   r5   rZ   r6   r6   r7   test_pdtrik<  s   zTestCephes.test_pdtrikc                 C   r  r6  )r2   Zpro_ang1r4   r6   r6   r7   test_pro_ang1C  r   zTestCephes.test_pro_ang1c                 C   s    t tdddddtd d S )NrL   r   r  )r   r2   Zpro_ang1_cvr   r4   r6   r6   r7   test_pro_ang1_cvF  s   zTestCephes.test_pro_ang1_cvc                 C   rn   r  )r   r2   Zpro_cvr4   r6   r6   r7   test_pro_cvJ  rr   zTestCephes.test_pro_cvc                 C   r  r8  )r2   Zpro_rad1r4   r6   r6   r7   test_pro_rad1M  r   zTestCephes.test_pro_rad1c                 C   r  r6  )r2   Zpro_rad1_cvr4   r6   r6   r7   test_pro_rad1_cvP  r   zTestCephes.test_pro_rad1_cvc                 C   r  r6  )r2   Zpro_rad2r4   r6   r6   r7   test_pro_rad2S  r   zTestCephes.test_pro_rad2c                 C   r  r6  )r2   Zpro_rad2_cvr4   r6   r6   r7   test_pro_rad2_cvV  r   zTestCephes.test_pro_rad2_cvc                 C   r0   ra   )r2   psir4   r6   r6   r7   test_psiY  r9   zTestCephes.test_psic                 C   s   t tdddd d S r1   )r   r2   radianr4   r6   r6   r7   test_radian\  rr   zTestCephes.test_radianc                 C   r   r   )r   r2   r.  r4   r6   r6   r7   test_rgamma_  r   zTestCephes.test_rgammac                 C   sd   t tdd t tdd t tdd t tdd t td	d t td
d d S )N333333@r   333333      g@r  gg            @r,  )r   r2   roundr4   r6   r6   r7   
test_roundb  s   zTestCephes.test_roundc                 C   r0   ra   )r2   Zshichir4   r6   r6   r7   test_shichij  r9   zTestCephes.test_shichic                 C   sl   t d t tj\}}t|tjd  t|d t tj \}}t|tj d  tt|d d S )NrL   ro   r   z cosine integral(-inf) is not nan)r2   ZsicirQ   r   r   r   r   r   )r5   sr  r6   r6   r7   	test_sicim  s   

zTestCephes.test_sicic                 C   r   NZ   rp   )r   r2   sindgr4   r6   r6   r7   
test_sindgx  r   zTestCephes.test_sindgc                 C   s.   t tddd tttdtj d S )NrL   r  ?)r   r2   smirnovr   rQ   r   r   r4   r6   r6   r7   test_smirnov{  s   zTestCephes.test_smirnovc                 C   sR   t tddd t tddd t tddd tttdtj d S )	NrL   r  rA   r>         ?      ru   g      ȿ)r   r2   Z	_smirnovpr   rQ   r   r   r4   r6   r6   r7   test_smirnovp  s   zTestCephes.test_smirnovpc                 C   s   t tddd tttdtj tjddddd}ttd|dt	d|  tjddddd}ttd	|dt	d	|  d S )
NrL   r  r   r  TZendpointru   r   r<   )
r   r2   	_smirnovcr   rQ   r   r   r  r   r  )r5   x10Zx4r6   r6   r7   test_smirnovc  s   "zTestCephes.test_smirnovcc                 C   P   t tdtddd t tdtddd tttdtj d S NrL   r?   333333?)r   r2   r  smirnovir   rQ   r   r   r4   r6   r6   r7   test_smirnovi     zTestCephes.test_smirnovic                 C   r  r  )r   r2   r  Z
_smirnovcir   rQ   r   r   r4   r6   r6   r7   test_smirnovci  r   zTestCephes.test_smirnovcic                 C   r   r   )r   r2   Zspencer4   r6   r6   r7   test_spence  r   zTestCephes.test_spencec                 C   s:   t tddd ttddd ttddd d S )NrL   r   ro   r  r>   gMoF?)r   r2   Zstdtrr   r4   r6   r6   r7   
test_stdtr     zTestCephes.test_stdtrc                 C   r   )Nffffff?rL   )r2   Zstdtridfr4   r6   r6   r7   test_stdtridf  r   zTestCephes.test_stdtridfc                 C   r   )NrL   r%  )r2   Zstdtritr4   r6   r6   r7   test_stdtrit  r   zTestCephes.test_stdtritc                 C   r   r   )r   r2   struver4   r6   r6   r7   test_struve  r   zTestCephes.test_struvec                 C   r   r   )r   r2   tandgr4   r6   r6   r7   
test_tandg  r   zTestCephes.test_tandgc                 C   r   r   )r   r2   Ztklmbdar4   r6   r6   r7   test_tklmbda  r   zTestCephes.test_tklmbdac                 C   r0   ra   )r2   y0r4   r6   r6   r7   test_y0  r9   zTestCephes.test_y0c                 C   r0   ra   )r2   r  r4   r6   r6   r7   test_y1  r9   zTestCephes.test_y1c                 C   r:  ra   )r2   ynr4   r6   r6   r7   test_yn  r   zTestCephes.test_ync                 C   r:  ra   )r2   yvr4   r6   r6   r7   test_yv  r   zTestCephes.test_yvc                 C   r:  ra   )r2   yver4   r6   r6   r7   test_yve  r   zTestCephes.test_yvec                 C   s  t ddt ddt ddt ddt dd	t dd
t ddt ddt ddt ddt ddt ddt ddt ddt ddt ddg}t ddt dd t d!d"t d#d$t d%d&t d'd(t d)d*t d+d,t d-d.t d/dt d0d1t d2d3t d4d5t d6d7t d8d9t d:d:g}ttj||d;d< d S )=Ng@g+п皙ٿr   r  r   r   rp   g      "g      "@g4׵/Yg8EGr?r  gffffff@ig>@r   g|Pk?r  rL   ir  r  i   ig     j@  ļBg0"bgpتO#M?gMF>?g5-g`?g	S+?g6U?gǗʿgjD{?/,Gg` 0Gg!^?gnF5o{gI\Y?g7f8goC9	?gyhgEbr?g{g.
?ga~gT-s?gɤ,P&?g|bgޗY3g!ؑ-@gi$bghgy(V@^gһ>g>gx\h<rD   rE   )r  r-   r2   wofz)r5   r  wr6   r6   r7   	test_wofz  sr   "zTestCephes.test_wofzN)__name__
__module____qualname__r8   r;   r\   r`   rj   rm   rq   rv   rw   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   r   r   r   r   r  r  r  r	  pytestmarkxfailr  r  r  r  r  r   r$  r'  r)  r*  r0  r2  r3  r4  r5  r7  r9  r<  r>  r@  rB  rE  rH  rJ  rL  rN  rP  rR  rT  rU  rV  rX  rZ  r[  r\  r^  r`  rb  rd  rf  rh  rj  rm  ro  rq  rs  ru  rw  ry  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  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  r  r  r  r  r!  r"  r#  r&  r'  r)  r+  r,  r.  r/  r1  r3  r5  r;  r6   r6   r6   r7   r/   3   s   

	r/   c                   @   <   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestAiryc                 C   s^   t d}t|tg dd t d}t|tg dd t d}t|tg dd d S )NGz?)g*?gTk'kPĿge+?gyCyt?r  g=
ףp=?)g'$'?geοgL?g
HVV?g
ףp=
׿)gl@D|?gV~׭ͿgU?g3{ɔ?)r   r3   r   r   r   r6   r6   r7   r8     s   


zTestAiry.test_airyc                 C   s   t d}t d}d gd }tdD ]}|| tdtd  ||< qtddD ]}|| tttdtd   ||< q)t||d d S )Nr   r<   r>   gN贁N{?rB   )	r   r:   r3   rc   r   r   absr   r   )r5   abb1rY   r6   r6   r7   r;     s   


(zTestAiry.test_airyec                 C   s   t d}tddgtddgtddgtdd	gf}t||d
 t d}t|d tg dd t|d tg dd t|d tg dd t|d tg dd d S )Nr>   glgoe2+
g(0[g X*JgUfݿg˰zU`?g4c1=C?gCuTr<   r   r   )g&g(.2+
gRg}`g%́r  rL   )g7;1[ge*JgVwgL g<3r  )gNݿg3%IQ`?gZyΌ׿gʀ11^?g33tտru   )gqM0=C?g7uTg\G`?gp⍞vg$.m?)r   bi_zerosr   r   )r5   biZbiar6   r6   r7   test_bi_zeros  s(   





zTestAiry.test_bi_zerosc                 C   s:   t d}t|tdgtdgtdgtdgfd d S )NrL   gcqg!xLgMSt$?g ~:p?r<   )r   ai_zerosr   r   )r5   Zair6   r6   r7   test_ai_zeros   s   
zTestAiry.test_ai_zerosc                 C   s   t d\}}}}t |\}}}}t |\}}	}}dt|d  }
t|d }t||dd t||dd t||
 dddd t|	| dddd t|d d g d	dd t|d d g d
dd d S )NP  rL   r   rN   rE   r   rO   rB   )guqgqHkZg4g9Ζ%gB~gL")gLgQO	gMQnGg3:g)}g )r   rL  r3   rE  r   )r5   r  zpZai_zpxZaip_zxZai_zZaip_z_Zai_zpZaip_zpZai_envelopeZaip_enveloper6   r6   r7   test_ai_zeros_big'  "   
zTestAiry.test_ai_zeros_bigc                 C   s   t d\}}}}t |\}}}}t |\}}}}	dt|d  }
t|d }t||dd t||dd t||
 dddd t|	| dddd t|d d g d	dd t|d d g d
dd d S )NrN  rL   r   rN   rE   r   rO   rB   )gx&gg-2+
gRgg`gu%́g{ )g K;1[g*JgVwg<w gd
3g/{
")r   rI  r3   rE  r   )r5   r  rO  Zbi_zpxZbip_zxrP  Zbi_zZbip_zZbi_zpZbip_zpZbi_envelopeZbip_enveloper6   r6   r7   test_bi_zeros_big?  rR  zTestAiry.test_bi_zeros_bigN)	r<  r=  r>  r8   r;   rK  rM  rQ  rS  r6   r6   r6   r7   rC    s    

!rC  c                   @      e Zd Zdd ZdS )TestAssocLaguerrec                 C   sL   t dd}t ddd}t||dd t ddd}t||dd d S )Nr  rL   r   r  )r   genlaguerreZassoc_laguerrer   )r5   Za1Za2r6   r6   r7   test_assoc_laguerreY  s
   z%TestAssocLaguerre.test_assoc_laguerreN)r<  r=  r>  rW  r6   r6   r6   r7   rU  X      rU  c                   @   rT  )TestBesselpolyc                 C      d S Nr6   r4   r6   r6   r7   r   b     zTestBesselpoly.test_besselpolyN)r<  r=  r>  r   r6   r6   r6   r7   rY  a  rX  rY  c                   @   s   e Zd 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d 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#d$ Zd%S )&
TestKelvinc                 C      t d}t|dd d S )Nr>   gT?r   )r   r   r   )r5   Zmbeir6   r6   r7   r   g     
zTestKelvin.test_beic                 C   r^  )Nr>   gD,X?r   )r   r   r   )r5   Zmbeipr6   r6   r7   r   k  r_  zTestKelvin.test_beipc                 C   r^  )Nr>   gPA4?r   )r   r   r   )r5   Zmberr6   r6   r7   r   o  r_  zTestKelvin.test_berc                 C   r^  )Nr>   gii߿r   )r   r   r   )r5   Zmberpr6   r6   r7   r   s  r_  zTestKelvin.test_berpc                 C   "   t d}t|tg dd d S )Nr   g&jj@g+"@g(rw+@gU2@g`<6@r<   )r   Z	bei_zerosr   r   )r5   rJ  r6   r6   r7   test_bei_zerosw  s   
zTestKelvin.test_bei_zerosc                 C   r`  )Nr   )gyWo.@g╲ݏ @gנ{)@gK11@gWc"5@r  )r   Z
beip_zerosr   r   )r5   Zbipr6   r6   r7   test_beip_zeros     
zTestKelvin.test_beip_zerosc                 C   r`  )Nr   g\@g6ُ@gӟHY'@g>"D0@ggaO;4@r<   )r   Z	ber_zerosr   r   )r5   r   r6   r6   r7   test_ber_zeros  rd  zTestKelvin.test_ber_zerosc                 C   r`  )Nr   g '@gs%@gF ^-@gvۅj3@gB7@r<   )r   Z
berp_zerosr   r   )r5   Zbrpr6   r6   r7   test_berp_zeros  rd  zTestKelvin.test_berp_zerosc              	   C   sr   t d}t|t dt dd  t dt dd  t dt dd  t 	dt 
dd  fd d S )Nr>   r  r  )r   r|  r   r   r   rx  rt  r   r   rz  rv  )r5   Zmkelvr6   r6   r7   r}    s   
zTestKelvin.test_kelvinc                 C   r^  )Nr>   g>ɿr   )r   rt  r   )r5   Zmkeir6   r6   r7   ru    r_  zTestKelvin.test_keic                 C   r^  )Nr>   gr@d"?r   )r   rv  r   )r5   Zmkeipr6   r6   r7   rw    r_  zTestKelvin.test_keipc                 C   r^  )Nr>   gܙUr   )r   rx  r   )r5   Zmkerr6   r6   r7   ry    r_  zTestKelvin.test_kerc                 C   r^  )Nr>   g^.n3Jr   )r   rz  r   )r5   Zmkerpr6   r6   r7   r{    r_  zTestKelvin.test_kerpc                 C   r`  )Nr   gE>Q@gB= @gPN)@gm91@g
%5@r<   )r   Z	kei_zerosr   r   )r5   rt  r6   r6   r7   test_kei_zeros  rd  zTestKelvin.test_kei_zerosc                 C   r`  )Nr   gWf,@g?"@gFZ*o+@gOpN2@gEa6@r<   )r   Z
keip_zerosr   r   )r5   rv  r6   r6   r7   test_keip_zeros  rd  zTestKelvin.test_keip_zerosc           
      C   s   t d}|\}}}}}}}}	t|tg dd t|tg dd t|tg dd t|tg dd t|tg dd t|tg dd t|tg d	d t|	tg d
d d S )Nr   re  r<   ra  )#?Q5U@q89 %@ol`.@gO0q3@ri  rg  )gum.@gݏ @gs{)@g䠄11@gN(D!5@gS@g89@@g^C'@g1ZG0@g+ڇ4@rk  )r   Zkelvin_zerosr   r   )
r5   tmpZberzZbeizZkerzZkeizZberpzZbeipzZkerpzZkeipzr6   r6   r7   test_kelvin_zeros  s4   
zTestKelvin.test_kelvin_zerosc                 C   r`  )Nr   )rm  rn  ro  rp  gD;q3@r<   )r   Z	ker_zerosr   r   )r5   rx  r6   r6   r7   test_ker_zeros  rd  zTestKelvin.test_ker_zerosc                 C   r`  )Nr   rq  r<   )r   Z
kerp_zerosr   r   )r5   rz  r6   r6   r7   test_kerp_zeros  rd  zTestKelvin.test_kerp_zerosN)r<  r=  r>  r   r   r   r   rb  rc  rf  rh  r}  ru  rw  ry  r{  rj  rl  rs  rt  ru  r6   r6   r6   r7   r]  f  s&    		.r]  c                   @   rT  )TestBernoullic                 C   r`  )Nr   )rp   r  g-!lV?r   g镲r   r<   )r   Z	bernoullir   r   )r5   Zbrnr6   r6   r7   test_bernoulli   s   
zTestBernoulli.test_bernoulliN)r<  r=  r>  rw  r6   r6   r6   r7   rv    rX  rv  c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestBetac                 C   s:   t dd}t dt d t d }t||d d S )Nr>   r<   rB   r  )r   r   r   r   )r5   betZbetgr6   r6   r7   r     s   zTestBeta.test_betac                 C   s0   t dd}ttt dd}t||d d S )Nr>   r<   r  )r   r   r   rE  r   r   )r5   Zbetlnry  r6   r6   r7   r        zTestBeta.test_betalnc                 C   s   t ddd}t|dd d S )NrL   r   r  )r   r   r   )r5   Zbtincr6   r6   r7   r        zTestBeta.test_betaincc                 C   s,   t ddd}t dd|}t|dd d S )Nr>   r<   ro   r   )r   r   r   r   )r5   r  compr6   r6   r7   r        zTestBeta.test_betaincinvN)r<  r=  r>  r   r   r   r   r6   r6   r6   r7   rx  
  s
    rx  c                   @   s   e Zd Zdd Zejdddgejdg dejdd	d
gejdddgdd Zdd Zdd Z	dd Z
dd ZdS )TestCombinatoricsc                 C   s   t tddgddgddg ttddd ttjddddd ttjddddd	d
 tdd tdD tdttddd t	t
jd }ttj||d dd| d}tjdddd|kshJ d S )Nr  ru   r<         ^@g     @j@Texactx   )r  
repetition   c                 S   s   g | ]
}t jd |ddqS )r^   Tr  )r   comb).0rZ   r6   r6   r7   
<listcomp>&  s    z/TestCombinatorics.test_comb.<locals>.<listcomp>r7  r^   r   rP   rL   l   hU7`S?Q r  2   )r   r   r  r   r   r   rc   listrQ   iinforb   max)r5   iir  r6   r6   r7   	test_comb   s   zTestCombinatorics.test_combr  TFlegacy)TFNrZ   r  ru   N      @r<   c                 C   s   |d ur&t jtdd tj||d||d}W d    n1 s w   Y  n
tj||d||d}|rM|rDt|| d t|}}d}n	t|t|}}t }|d urZ|t tj||||d}W d    n1 smw   Y  t|| d S )Nz$Using 'legacy' keyword is deprecatedmatchT)r  r  r  rL   F)r  r  )	r?  warnsDeprecationWarningr   r  rb   r   r  r   )r5   r  rZ   r  r  r  r  r  r6   r6   r7   test_comb_legacy/  s0   
z"TestCombinatorics.test_comb_legacyc                 C   sL   d}d}t |}t |}tj||dd}tj||dd}||ks$J d S )NF   rH   Tr  )rQ   int64r   r  )r5   rY   rZ   Znp_nZnp_kZres_npZres_pyr6   r6   r7   test_comb_with_np_int64P  s   

z)TestCombinatorics.test_comb_with_np_int64c                 C   z   t tjddddd t tjddddd t tjddddd t tjddddd ttg dg d	g d
 d S )Nr>   ru   Tr  r   rA   Fr>   rA   r>   r  ru   ru   rA   ru   )r   r   r   r  )r   r   r  r   r4   r6   r6   r7   test_comb_zerosY     z!TestCombinatorics.test_comb_zerosc                 C   sJ   t tddgddgddg ttddd ttjddddd d S )	Nr  ru   r<        @g     @Tr  i  )r   r   permr   r   r4   r6   r6   r7   	test_perma  s   zTestCombinatorics.test_permc                 C   r  )Nr>   ru   Tr  r   rA   Fr  r  )r   r   r   r  )r   r   r  r   r4   r6   r6   r7   test_perm_zerosf  r  z!TestCombinatorics.test_perm_zerosN)r<  r=  r>  r  r?  r@  parametrizer  r  r  r  r  r6   r6   r6   r7   r~    s    	r~  c                   @   sd   e Zd 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d Zdd Zdd ZdS )TestTrigonometricc                 C      t d}d}t|| d S )N   r   )r   r   r   )r5   cbZcbrlr6   r6   r7   r   p     
zTestTrigonometric.test_cbrtc                 C      t d}d}t||d d S )Ngfffff;@g鎖C@r  )r   r   r   )r5   Zcb1Zcbrl1r6   r6   r7   test_cbrtmoreu     
zTestTrigonometric.test_cbrtmorec                 C   &   t d}ttd }t||d d S )Nr  r   r  r   r   r	   r   r   )r5   ZcdgZcdgrlr6   r6   r7   r   z     
zTestTrigonometric.test_cosdgc                 C   r  NrH         @r  r  )r5   ZcdgmZcdgmrlr6   r6   r7   test_cosdgmore  r  z TestTrigonometric.test_cosdgmorec                 C   sV   t dt dt td f}tdd tdd ttd d f}t||d d S )Nr   r  r  rL   r  )r   r   r   r	   r   )r5   csZcsrlr6   r6   r7   r     s    &zTestTrigonometric.test_cosm1c                 C   *   t d}ttd d }t||d d S )NrH   r  rA   r  r   r   r
   r   r   )r5   ctZctrlr6   r6   r7   r        
zTestTrigonometric.test_cotdgc                 C   r  )Nr   r  rA   r  r  )r5   Zct1Zctrl1r6   r6   r7   test_cotdgmore  r  z TestTrigonometric.test_cotdgmorec                 C   s   t tddd t tddd t tddd t tddd t td	dd t td
dd t tddd t tddd t tddd t tddd t tddd t tddd t tddd d S )Nr   rp      r   r  r   i   y   i  i;  i  )r   r   r   r4   r6   r6   r7   test_specialpoints  s   z$TestTrigonometric.test_specialpointsc                 C   s&   t tdgd ttdd d S )Nr   rL   r   rp   )r   r   Zsincr   r4   r6   r6   r7   	test_sinc  s   zTestTrigonometric.test_sincc                 C      t d}t|d d S r  )r   r  r   )r5   Zsnr6   r6   r7   r       
zTestTrigonometric.test_sindgc                 C   H   t d}ttd }t||d t d}ttd }t||d d S )NrH   r  r  r   r  )r   r  r   r   r   )r5   ZsnmZsnmrlZsnm1Zsnmrl1r6   r6   r7   test_sindgmore     

z TestTrigonometric.test_sindgmoreN)r<  r=  r>  r   r  r   r  r   r   r  r  r  r  r  r6   r6   r6   r7   r  o  s    r  c                   @   $   e Zd Zdd Zdd Zdd ZdS )	TestTandgc                 C   r  r  r   r*  r
   r   r   )r5   tnZtnrlr6   r6   r7   r+    r  zTestTandg.test_tandgc                 C   r  )Nr   r  r  r  r   r  )r5   ZtnmZtnmrlZtnm1Ztnmrl1r6   r6   r7   test_tandgmore  r  zTestTandg.test_tandgmorec                 C   s   t tddd t tddd t tddd t tddd t td	dd t td
dd t tddd t tddd t tddd t tddd t tddd d S )Nr   r   r  r   rp   r  r   r  r  r  iLr  r  r  r  )r   r   r*  r4   r6   r6   r7   r    s   zTestTandg.test_specialpointsN)r<  r=  r>  r+  r  r  r6   r6   r6   r7   r    s    r  c                   @   sT   e Zd 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d ZdS )	TestEllipc                 C   s   t dtj dS )zRegression test for #912.ro   N)r   r   rQ   r   r4   r6   r6   r7   test_ellipj_nan  s   zTestEllip.test_ellipj_nanc                 C   s0   t dd}tdtdddg}t||d d S )Nr   r   rp      )r   r   r   r	   r   )r5   elrelr6   r6   r7   r     rz  zTestEllip.test_ellipjc                 C   s   t d}t|dd tt dtj tt dtd  tt tjd tt tjtj tt dtj t	t dd	 d S )
Nr   g;{yэ?r  r   rp   r>   rA   gN?)
r   r!   r   r   r"   rQ   r   r   r   r   )r5   elkr6   r6   r7   r     s   
zTestEllip.test_ellipkc                 C   s  t td d}t d}t||d dt d }dt d }t|d }t ||}t|dd tt td d	td  tt td d
tj tt td tj d	 tt td tj	tj	 tt td dtj	 tt ddd	 tt tjdtj tt tj dtj  tt tjtjtj	 tt tjtj tj	 tt tj tj tj	 tt tj tjtj	 tt tj	dtj	 tt tj	tj	tj	 t
t ddddd t
t ddd d S )Nr>   r   rh   r^   r  r   gfoKh?r  r   rp   r   ro   gt?rL   r?   r   rE   6<R!?r  gfON?)r   r   r   r!   r   r   r   rQ   r   r   r   )r5   Zelkincr  alphaphir  r6   r6   r7   r     s0   
zTestEllip.test_ellipkincc                 C   s   d}d}t |d}g }tdD ]}|| t |d}qt||}t|t |dd t|t |}t|t |dd d S )	N    ?Pag?r   r  rL   gV^8j?g,j6Ƅ@r>   )	rQ   	nextafterrc   appendr   r   r   	full_liker   r5   Zmbadr  r  Zmvalsjr  f1r6   r6   r7   test_ellipkinc_2     
zTestEllip.test_ellipkinc_2c                 C   sD  t ddd}t ddd}t jdtd ddd}tt|d	t t |d
d tt|d	t t |d
d tt|d	t t |d
d t	tt jd d	t j
 tt| d	t t | d
d tt| d	t t | d
d tt| d	t t | d
d t	tt j d d	t j
 d S )Niir   gFFg<r  r>   Fr  rL   r8  rE   )rQ   r_   r  r   r   r   r   Zarcsinhr
   r   r   )r5   ZxlogZxlinZxlin2r6   r6   r7   test_ellipkinc_singular  s   """&&& z!TestEllip.test_ellipkinc_singularc                 C   s   t d}t|dd tt dtd  tt dd tt tj tj tt tjtj tt dtj tt dd d S )	Nr   gl?r  r   r>   rp   r  g?eg@)	r   r    r   r   r   rQ   r   r   r   )r5   eler6   r6   r7   r   "  s   
zTestEllip.test_ellipec                 C   s  t td d}t d}t||d dt d dt d }}t|d }t ||}t|dd tt td d	td  tt td d
d
 tt td tj tj tt td tj	tj	 tt td dtj	 tt ddd	 tt tjdtj tt tj dtj  tt tjtj tj tt tj tj tj  tt tjtjtj	 tt tj tjtj	 tt tj	dtj	 tt tj	tj	tj	 t
t ddd d S )Nr>   r   r  4   r  #   g'?r  r   rp   r   ro   r  r  gL@)r   r   r   r    r   r   r   rQ   r   r   r   )r5   Zeleincr  r  r  r  r6   r6   r7   r   -  s,   
zTestEllip.test_ellipeincc                 C   s   d}d}t |d}g }tdD ]}|| t |d}qt||}t|t |dd t|t |}t|t |dd	 d S )
Nr  r  r   r  rL   g%?r>   gXo
@r<   )	rQ   r  rc   r  r   r   r   r  r   r  r6   r6   r7   test_ellipeinc_2G  r  zTestEllip.test_ellipeinc_2N)r<  r=  r>  r  r   r   r   r  r  r   r   r  r6   r6   r6   r7   r    s    r  c                   @   sN   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Ze	j
jdddd ZdS )TestEllipCarlsonzTest for Carlson elliptic integrals ellipr[cdfgj].
    The special values used in these tests can be found in Sec. 3 of Carlson
    (1994), https://arxiv.org/abs/math/9409227
    c                 C   s   t tddd tdtdksJ ttddsJ tdtdtdks&J tddgddgddgddgdd	gdd
gg}ttjtdddtdd dg}t	|D ]\}}t t| ||  qSd S )NrL   r   r   r   g      @r   r                      r   y
c?
cy=B?CGֿr   y檠f?P9lb?)
r   r#   r   r   r  r   rQ   r   r   	enumerater5   argsZexpected_resultsrf   arrr6   r6   r7   test_elliprc]  s*   zTestEllipCarlson.test_elliprcc                 C   s(  t tdddd t tdddd d tddtdksJ ttddds)J ttddtdds7J ttddtddsEJ ttddttjj	 d sWJ ttddtddsdJ t
g d	g d
g dg dg dg dg}t
g d}t|D ]\}}t t| ||  qd S )NrL   r   r>   r   g`C+?r   r   rA   )r   r   rp   r   r   r  r  r  r   r   r  r  )r               ?r  )y             r  r  )gfe_?gi+"?gP$M?ytgFU?7?@yR<8*y{62?z)r   r$   r   rQ   r   r  r   r   doubletinyr   r  r  r6   r6   r7   test_elliprdq  s&   $zTestEllipCarlson.test_elliprdc              	   C   s   t tdddd t tdddd tdtddksJ ttddds'J ttddds1J tttdddks=J ttddtt dsKJ tg dg dg d	g d
g dg dg dg}tg d}t|D ]\}}t t| ||  qnd S )NrL   r   r>   gPO?r   rA   )rp   r   r   )r  r  r   )ro   rp   r   r  r  r   r  r  )r  r        ?      )geQO?ʞu5J?r  yp\y?kg2ΰ?gHwд?y|pF?-6Fj)	r   r%   r   rQ   r   r   r  r   r  r  r6   r6   r7   test_elliprf  s&   zTestEllipCarlson.test_elliprfc                 C   s   t tdddd t tdddd t tdddd ttdtds&J ttttdds3J tg dg dg dg dg dg d	g}ttjd
ddddg}t|D ]\}}t t| ||  qXd S )NrL   r   ro   )r         0@r  r  r  r  )r  r  r  )r   g8d`?r  gL+?g}^?y旮0?ʋW?yjN?^?gt?)	r   r&   rQ   r   r   r  r   r   r  r  r6   r6   r7   test_elliprg  s,   zTestEllipCarlson.test_elliprgc                 C   s   t tddddd tddtddksJ ttdddds J ttdddds+J tdddtdks6J tg dg dg dg dg d	g d
g dg dg dg	}tg d}t|D ]\}}t t| ||  q_d S )NrL   r   r   rA   )r   rp   r   r   )r   r   r  rz   )r   r   r  r  )r  r  r   r   )r              rp   r   )r  r  r   r  )r  r  rp   y            ?)r   r   r  r  )r   r   r        )	g @?gviM?ym?\Isؿg'4Ob?go0 ?yW7?xfOA?ybv㿘ܶ.gHQ?gjߡB7E)r   r'   r   r   r   r  r  r6   r6   r7   test_elliprj  s&   		zTestEllipCarlson.test_elliprjzInsufficient accuracy on 32-bitr
  c                 C   s8   t tdddddddd t td	d
dddddd d S )Ng   gq>g   `W:g    HBg   @ۘ?gRy|>g+<r  r   g   ,@g    x=g   @e:g   `ݽ>g(HR)A)r   r'   r4   r6   r6   r7   test_elliprj_hard  s    
z"TestEllipCarlson.test_elliprj_hardN)r<  r=  r>  __doc__r  r  r  r  r  r?  r@  rA  r  r6   r6   r6   r7   r  X  s    r  c                   @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )"TestEllipLegendreCarlsonIdentitieszTest identities expressing the Legendre elliptic integrals in terms
    of Carlson's symmetric integrals.  These identities can be found
    in the DLMF https://dlmf.nist.gov/19.25#i .
    c                 C   s^   t ddd| _ttj| _ddtdt | j  dd  | _t 	| jg| j| jf| _
d S )Nr   rp   r   r   rA   r   )rQ   r   Zm_n1_1r   r   minZmax_neglog2Z
very_neg_mZconcatenate
ms_up_to_1r4   r6   r6   r7   setup_class  s   

z.TestEllipLegendreCarlsonIdentities.setup_classc                 C   s$   | j }tt|tdd| d dS )z5Test identity:
        K(m) = R_F(0, 1-m, 1)
        r   rp   N)r  r   r!   r%   r5   r  r6   r6   r7   test_k  s   z)TestEllipLegendreCarlsonIdentities.test_kc                 C   s>   t tj}|dtdt|   }tt|td|d dS )z\Test identity:
        K(m) = R_F(0, 1-m, 1)
        But with the ellipkm1 function
        r   r   rp   N)	r   r   r  r   rQ   r  r   r"   r%   )r5   r  m1r6   r6   r7   test_km1  s   
z+TestEllipLegendreCarlsonIdentities.test_km1c                 C   s(   | j }tt|dtdd| d  dS )z9Test identity:
        E(m) = 2*R_G(0, 1-k^2, 1)
        r   r   rp   N)r  r   r    r&   r  r6   r6   r7   test_e  s   "z)TestEllipLegendreCarlsonIdentities.test_eN)r<  r=  r>  r  r  r  r  r  r6   r6   r6   r7   r    s    r  c                   @   sv   e Zd Zdd Zdd Zd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d Zdd Zdd ZdS )TestErfc                 C   r^  )Nr   g);T?r  )r   r   r   )r5   Zerr6   r6   r7   r     r_  zTestErf.test_erfc                 C   s&   t d}tg d}t||d d S )Nr   )yTcJ5?=W?yo@n@y'ʷ@g	@y"[

@,y]+@yld&@-;'j'>@r<   )r   Z	erf_zerosr   r   )r5   ZerzZerzrr6   r6   r7   test_erf_zeros  s   
zTestErf.test_erf_zerosr   c                 C   s  t jd d}t jd|dt jdd| d  }t jd|dt jdd| d  }|d|  }t jdd	> ||}	||j}
t |	}|	| }	|| }t |
}|
| }
|| }t||	|||d
 t||
|||d
 W d    d S 1 s{w   Y  d S )NrG   r  g{Gz?r>   r   rL   r  ignoreallr   )	rQ   rW   rX   paretorandinterrstater   isfiniter-   )r5   funcZ
other_funcrF   rP   rY   r   r  r  r:  Zw_realmaskr6   r6   r7   _check_variant_func  s"   &&


"zTestErf._check_variant_funcc                 C   s   | j tjdd ddd d S )Nc                 S   s   dt |  S ra   r2   r   r  r6   r6   r7   <lambda>6  s    z.TestErf.test_erfc_consistent.<locals>.<lambda>rk   r   r   )r  r2   r   r4   r6   r6   r7   test_erfc_consistent3  s   
zTestErf.test_erfc_consistentc                 C      | j tjdd dd d S )Nc                 S   s   t | |  t|  S r[  )rQ   r   r2   r   r  r6   r6   r7   r  >  s    z/TestErf.test_erfcx_consistent.<locals>.<lambda>rk   rE   )r  r2   erfcxr4   r6   r6   r7   test_erfcx_consistent;  
   
zTestErf.test_erfcx_consistentc                 C   r  )Nc                 S   s   dt d|   S )Nr  r  r  r  r6   r6   r7   r  E  s    z.TestErf.test_erfi_consistent.<locals>.<lambda>rk   rE   )r  r2   erfir4   r6   r6   r7   test_erfi_consistentB  r  zTestErf.test_erfi_consistentc                 C   r  )Nc                 S   s&   t td t|  |   t|  S rk  )r   r   rQ   r   r2   r  r  r6   r6   r7   r  L  s   & z/TestErf.test_dawsn_consistent.<locals>.<lambda>rk   rE   )r  r2   r   r4   r6   r6   r7   test_dawsn_consistentI  r  zTestErf.test_dawsn_consistentc                 C   6   t jt j t jg}t jddg}tt||dd d S )NrA   rL   r   rE   )rQ   r   r   r   r   r   r5   r/  r  r6   r6   r7   test_erf_nan_infP     zTestErf.test_erf_nan_infc                 C   r   )Nr>   r   r   rE   )rQ   r   r   r   r   r   r!  r6   r6   r7   test_erfc_nan_infU  r#  zTestErf.test_erfc_nan_infc                 C   s8   t jt j t jg}t jt jdg}tt||dd d S )Nr   r   rE   )rQ   r   r   r   r   r  r!  r6   r6   r7   test_erfcx_nan_infZ  s   zTestErf.test_erfcx_nan_infc                 C   s<   t jt j t jg}t jt j t jg}tt||dd d S )Nr   rE   )rQ   r   r   r   r   r  r!  r6   r6   r7   test_erfi_nan_inf_  s   zTestErf.test_erfi_nan_infc                 C   r   )Nr  r   r   rE   )rQ   r   r   r   r   r   r!  r6   r6   r7   test_dawsn_nan_infd  r#  zTestErf.test_dawsn_nan_infc                 C   s@   t jt j t jg}t jt jd  ddg}tt||dd d S )Nr  r  r   rE   )rQ   r   r   r   r   r9  r!  r6   r6   r7   test_wofz_nan_infi  s   zTestErf.test_wofz_nan_infN)r   )r<  r=  r>  r   r
  r  r  r  r  r  r"  r$  r%  r&  r'  r(  r6   r6   r6   r7   r	    s    
	r	  c                   @   rT  )	TestEulerc           
      C   s  t d}t d}t d}t|dgdd t|ddgdd t|g ddd t d}g d}td	d
}tddD ]}|d rNt||  |d| < q<t|| |d| < q<tjdd t|| | }t	|}	W d    n1 svw   Y  t
|	dd d S )Nr   rL   r>   r   rE   )rL   r   rA   r   )rL   rL   r   =   ii  iY  i=) il   Q~ l   10[l   $8gC
 l   2l   v}Ju: )r   dr  r  r  r   r  )r   Zeulerr   r   rc   rd   rQ   r  r   r  r   )
r5   Zeu0Zeu1Zeu2Zeu24Z	mathworldcorrectrZ   errZerrmaxr6   r6   r7   
test_eulerp  s$   





zTestEuler.test_eulerN)r<  r=  r>  r.  r6   r6   r6   r7   r)  o  rX  r)  c                   @   rB  )TestExpc                 C   r  )Nr>   r<   )r   r  r   r5   exZexrlr6   r6   r7   r    r  zTestExp.test_exp2c                 C   r  )N      @g;f@r  )r   r  r   r5   ZexmZexmrlr6   r6   r7   test_exp2more  r  zTestExp.test_exp2morec                 C   r  )Nr>   r  )r   r   r   r0  r6   r6   r7   r    r  zTestExp.test_exp10c                 C   r  )Nr2  gYs@r  )r   r   r   r3  r6   r6   r7   test_exp10more  r  zTestExp.test_exp10morec                 C   N   t dt dt df}tdd tdd tdd f}t||d d S )Nr>   ru   r<   rL   r  r   r  r   r   r0  r6   r6   r7   r       "zTestExp.test_expm1c                 C   r6  )Nr>    @皙@rL   r  r7  )r5   Zex1Zexrl1r6   r6   r7   test_expm1more  r8  zTestExp.test_expm1moreN)	r<  r=  r>  r  r4  r  r5  r  r;  r6   r6   r6   r7   r/    s    r/  c                   @   s  e Zd Zejdddgdd Zejdg dejdddgdd	 Zejdddgd
d Zejdddgejjde	j
de	dgg dddd Zejdeddejdddgdd Zejdddgejdedddd Zejdddgejdedddd Zejdedd d!d"d# Zejdeedd$eedd d! d%d& Zejdddgd'd( Zejd)e	je	je	jegejdddgejdeddejjdg dgd*ge	j
ge	j
dggg d+dd,d- Zejdddgejjddd*d.e	j
dgg d/dd0d1 Zejdedd d2d3d4 Zejdeedd$eedd d2 d5d6 Zejd)e	je	je	jegejdddgejdeddejjdg dge	j
ge	j
dggg d7dd8d9 Zejdddgejjddd*d.e	j
dgg d/dd:d; Zejd<eeddd!d=g ejdeedd$eed$d>d2 d?d@ Zejd)e	je	je	jegejdeddejjdg dge	j
ge	j
dggg d7ddAdB Z ejdddgejd<eddejjddd*d.e	j
dgg d/ddCdD Z!ejd<dd*e	j
dEgdFdG Z"ejd<eddHdIdJ Z#dKdL Z$dS )MTestFactorialFunctionsr  TFc                 C   sN   t tjd|dsJ t tjd|dsJ t tjdddds%J d S )NrL   r  ru   T)rQ   Zisscalarr   	factorial
factorial2
factorialk)r5   r  r6   r6   r7   "test_factorialx_scalar_return_type  s   z9TestFactorialFunctions.test_factorialx_scalar_return_typerY   )rA   r  c                 C   sB   t tj||dd t tj||dd t tj|dddd d S )Nr  r   ru   T)r   r   r=  r>  r?  )r5   r  rY   r6   r6   r7   test_factorialx_negative  s   z/TestFactorialFunctions.test_factorialx_negativec                 C   sf   |rt nt}|tjg d|dg d |tjg d|dg d |tjg ddddg d d S )N)r+  r   rL   r  )r   r   rL   rL   ru   T)r   r   r   r=  r>  r?  )r5   r  assert_funcr6   r6   r7   test_factorialx_negative_array  s   z5TestFactorialFunctions.test_factorialx_negative_arraycontentNZnat)NaNNoneZNaT)Zidsc                 C   s  t j||dtju sJ t j||dtju sJ t j|dddtju s%J |tjurJtjtdd t j|g|d W d    n1 sDw   Y  n8|rstj	t
dd tt j|g|dd scJ W d    n1 smw   Y  ntt j|g|dd sJ tjtdd t j|g|d W d    n1 sw   Y  tjtd	d t j|gddd W d    d S 1 sw   Y  d S )
Nr  ru   TzUnsupported datatype.*r  Non-integer array.*r   zfactorial2 does not support.*zfactorialk does not support.*)r   r=  rQ   r   r>  r?  r?  r   
ValueErrorr  r  r   )r5   rF  r  r6   r6   r7   test_factorialx_nan  s(   
 "z*TestFactorialFunctions.test_factorialx_nanlevelsrL   r   c                    s   d fdd	  fdd}t  ddgd}d	tdgd
tjdddgdtddgd}|tj||d|d  |tj||d|d  |tj|ddd|d  d S )NrL   c                    s   |dkr| S  | | g|d S )z
            Double x and nest it k times

            For example:
            >>> _nest_me([3, 4], 2)
            [[[3, 4], [3, 4]], [[3, 4], [3, 4]]]
            r   rL   r6   r   rZ   _nest_mer6   r7   rO    s   zDTestFactorialFunctions.test_factorialx_array_shape.<locals>._nest_mec                    s4   t j |dtd}t| t j|t j d S )NrZ   dtype)rQ   r   objectr   r   r   )resZnucleusr   rO  rL  r6   r7   _check  s   zBTestFactorialFunctions.test_factorialx_array_shape.<locals>._checkr   r   rP  r  rh   Tr  r  ru   r  r>   rL   )rQ   r   mathr=  r   r>  r?  )r5   rL  r  rV  rY   exp_nucleusr6   rU  r7   test_factorialx_array_shape  s   z2TestFactorialFunctions.test_factorialx_array_shapedimr   c                 C   s   t jd|d}dddd}ttj||dt j|d |d ttj||dt j|d	 |d ttj|d
ddt j|d
 |d d S )Nr   ndminr  rh   r  r  r  rL   r>   ru   T)rQ   r   r   r   r=  r>  r?  )r5   r[  r  rY   r   r6   r6   r7   test_factorialx_array_dimension  s   z6TestFactorialFunctions.test_factorialx_array_dimensionlevelc                    s   d fdd	  dg|d d}dddd	}|rt nt}|tj||d
tj|d |d |tj||d
tj|d |d |tj|ddd
tj|d |d d S )NrL   c                    s   |dkr| S  | g|d S r   r6   rM  rN  r6   r7   rO  
  s   zCTestFactorialFunctions.test_factorialx_array_like.<locals>._nest_mer   rP  r  rh   r  r  r  r\  r>   ru   TrW  )r   r   r   r=  rQ   r   r>  r?  )r5   r_  r  rY   rY  rD  r6   rN  r7   test_factorialx_array_like  s   z1TestFactorialFunctions.test_factorialx_array_likerH   r  r  c                 C   h   t jdkrdnd}tttj|ddtj|dd|d ttj|gddttj|gdd|d d S )Nwin32t0=r   Tr  FrE   )sysplatformr   rd   r   r=  r   r5   rY   rF   r6   r6   r7   test_factorial_accuracy     
z.TestFactorialFunctions.test_factorial_accuracy   c                 C   s   t |}t|t|d t|t|gdd  tjdkr!dnd}tt|t|d|d tt|t|gdd |d d S )NTr   rb  rc  r   FrE   )rX  r=  r   r   rd  re  r   rd   )r5   rY   r,  rF   r6   r6   r7   test_factorial_int_reference'  s   

z3TestFactorialFunctions.test_factorial_int_referencec                    sj    fdd}|dd |dd |dd |d	d
 |dd |dd |dd |dd |dd d S )Nc                    s.   t tj|  d| t t| gd | d S )Nr  r   )r   r   r=  )rY   r  r  r6   r7   rV  7  s   zETestFactorialFunctions.test_factorial_float_reference.<locals>._checkr   gr?g(\?gc?g333333@g4s@g333333&@gމOAgfffff@@g	²Gg     K@gC$JOglS@g }WgX@gX>%`g\CSe@gG=r6   )r5   r  rV  r6   r  r7   test_factorial_float_reference5  s   







z5TestFactorialFunctions.test_factorial_float_referencerR  皙?)[][1]z[1.1][NaN][NaN, 1]c                 C   s^  |t jkrtdd |D rtd |dkst|dkr|n|d }t j|||d}d }|s7tj||d}nt 	|j
t jsft 	|j
t jsftjtdd	 tj||d W d    n1 s`w   Y  n|rt 	|j
t js|jrt |t |  |t |  t jrtjtd
d	 tj||d}t t |rt jnt j}W d    n1 sw   Y  n0|rt 	|j
t jstjtdd	 tj||d W d    n1 sw   Y  ntj||d}dd }|d ur-t #}|t |jr| n|}	|jrtj|	|dng }
W d    n	1 sw   Y  t j|
||d}||| d S d S )Nc                 s       | ]}t |V  qd S r[  rQ   r   r  r   r6   r6   r7   	<genexpr>R      zKTestFactorialFunctions.test_factorial_array_corner_cases.<locals>.<genexpr>impossible combinationr   rL   r]  rR  r  Unsupported datatype*r  rI  zfactorial with exact=.*c                 S   s:   t | t |ksJ dt |  dt | t| | d S )Nztypes not equal: z, )typer   r   r  r6   r6   r7   assert_really_equaln  s   ,zUTestFactorialFunctions.test_factorial_array_corner_cases.<locals>.assert_really_equal)rQ   r  anyr?  skiplenr   r   r=  
issubdtyperR  integerfloatingr   rJ  r   Zallcloser   r   r  r  r   int_r   r  ndimrV   )r5   rF  r[  r  rR  rY   r  r{  r  Zn_flatrr  r6   r6   r7   !test_factorial_array_corner_casesI  sL   	
 *

z8TestFactorialFunctions.test_factorial_array_corner_casesy       @       @)1z1.1z2+2jrG  rH  c                 C   s   |d u s|t ju st t|t jst t|t jr:tj||d}|t ju s+|d u r.t jnt|}t|| d S t	j
tdd tj||d W d    d S 1 sTw   Y  d S )Nr  rx  r  )rQ   r   r  ry  r  r  r   r=  r   r?  r   rJ  r5   rY   r  r  r   r6   r6   r7   "test_factorial_scalar_corner_cases}  s   $""z9TestFactorialFunctions.test_factorial_scalar_corner_casesr  c                 C   ra  )Nrb  g+=r   Tr  FrE   )rd  re  r   rd   r   r>  r   rf  r6   r6   r7   test_factorial2_accuracy  rh  z/TestFactorialFunctions.test_factorial2_accuracyc                 C   s|   t tjtt|ddd}t|t|d t|t|gdd  t	t
|t|d t	t
|t|gdd  d S )Nr   r  rL   TF)	functoolsreduceoperatormulr  rc   r   r   r>  r   rd   )r5   rY   r,  r6   r6   r7   test_factorial2_int_reference  s
    z4TestFactorialFunctions.test_factorial2_int_reference)rm  rn  ro  rp  c                 C   s   |t jkrtdd |D rtd |dkst|dkr|n|d }t j|||d}t |jt j	s5|sKt
j||d}|s@|sBtnt}||| d S tjtdd	 t
|d
 W d    d S 1 sdw   Y  d S )Nc                 s   rq  r[  rr  rs  r6   r6   r7   rt    ru  zLTestFactorialFunctions.test_factorial2_array_corner_cases.<locals>.<genexpr>rv  r   rL   rw  r  factorial2 does not*r  ru   )rQ   r  r|  r?  r}  r~  r   r  rR  r  r   r>  r   r   r   rJ  )r5   rF  r[  r  rR  rY   r  r  r6   r6   r7   "test_factorial2_array_corner_cases  s   
 "z9TestFactorialFunctions.test_factorial2_array_corner_casesc                 C   s   |d u s|t ju st t|t jr1tj||d}|t ju s"|d u r%t jnt|}t|| d S t	j
tdd tj||d W d    d S 1 sKw   Y  d S )Nr  r  r  )rQ   r   r  ry  r  r   r>  r=  r   r?  r   rJ  r  r6   r6   r7   #test_factorial2_scalar_corner_cases  s   $""z:TestFactorialFunctions.test_factorial2_scalar_corner_casesrZ   r^   r  c                 C   sP   t tjtt|d| d}t|t||d t|t|g|dd  d S )Nr   rL   T)	r  r  r  r  r  rc   r   r   r?  )r5   rY   rZ   r,  r6   r6   r7   test_factorialk_int_reference  s   z4TestFactorialFunctions.test_factorialk_int_referencec                 C   s   |t jkrtdd |D rtd |dkst|dkr|n|d }t j|||d}t |jt j	s5|s@t
t|d| d S tjtdd	 t|d W d    d S 1 sYw   Y  d S )
Nc                 s   rq  r[  rr  rs  r6   r6   r7   rt    ru  zLTestFactorialFunctions.test_factorialk_array_corner_cases.<locals>.<genexpr>rv  r   rL   rw  ru   factorialk does not*r  )rQ   r  r|  r?  r}  r~  r   r  rR  r  r   r   r?  r   rJ  )r5   rF  r[  rR  rY   r6   r6   r7   "test_factorialk_array_corner_cases  s   
 "z9TestFactorialFunctions.test_factorialk_array_corner_casesc                 C   s   |s"t t tj|||d W d    d S 1 sw   Y  d S |d u s4|tju s4tt|tj	rWtj
||d}|tju pC|d u }|rItjntj||d}t|| d S t jtdd tj|||d W d    d S 1 srw   Y  d S )N)rZ   r  r  rP  r  r  )r?  r   NotImplementedErrorr   r?  rQ   r   r  ry  r  r>  r   rJ  )r5   rY   rZ   r  r  Znan_condr  r6   r6   r7   #test_factorialk_scalar_corner_cases  s   "$"z:TestFactorialFunctions.test_factorialk_scalar_corner_casesr  c                 C   s@   t jtdd td| W d    d S 1 sw   Y  d S )Nzk must be a positive integer*r  rL   )r?  r   rJ  r   r?  r  r6   r6   r7   test_factorialk_raises_k	  s   "z/TestFactorialFunctions.test_factorialk_raises_kr  c                 C   s   |t  v ritt| g}tt||jtj	 tt|d |jtj
 t|d |ttjjks7J tt | g}tt||jtj
 tt|d |jt t|d |ttj
jksgJ d S tttdg|jt d S ra   )r*   keysrQ   r   r+   r   r   r?  rR  r  r  r  Zint32r  rS  )r5   rZ   rY   r6   r6   r7   test_factorialk_dtype	  s   "& z,TestFactorialFunctions.test_factorialk_dtypec                 C   s   t t jdddt jg}t t jdddt jg}ttj|dd| tjtdd ttj|d	d| W d    d S 1 s?w   Y  d S )
NrL   r>   ru   rB   Fr  rI  r  T)	rQ   r   r   r   r   r=  r?  r  r  )r5   r   r  r6   r6   r7   test_factorial_mixed_nan_inputs	  s   "z6TestFactorialFunctions.test_factorial_mixed_nan_inputs)%r<  r=  r>  r?  r@  r  r@  rB  rE  rQ   r   Z
datetime64rK  rc   rZ  r^  r`  rg  r  rj  rk  r  r   
complex128rS  r  r  r  r  r  r  r  r  r  r  r  r  r6   r6   r6   r7   r<    s    






,




r<  c                   @   sb   e Zd Zejddddddddd	d
ejddfej ddfgdd Zdd Z	dd Z
dd ZdS )TestFresnelzz, s, c)ro   gN?ց[?)y      ?        r  r  )y       ?yn<ӿj<Cy)BR;߿ux7Q?)y      yھ|}-2?y/?!ۿ)r  GM?pBR?)y      @        r  r  )y              @y       GMܿy        pBR?)y              gGMܿgpBR߿)y             y        GM?y       pBR߿ro   r  c                 C   s&   t t|}t|t ||gd d S )Nr  )r   r   r#  r   )r5   r  r  r  frsr6   r6   r7   test_fresnel_values 	  s    zTestFresnel.test_fresnel_valuesc                 C   sn   t d\}}t|tg dd t|tg dd t |d }t |d }t|dd t|dd d S )Nr   )y @X9v?y^I@48E?y=
ףp@+?y@eX?yO@Ǻ?ru   )y.1?ǘ?yʡE6@:#J{/?yq-
@y&1?yh o@߾3?yW2q@qh?r   rL   r  )r   fresnel_zerosr   r   r#  )r5   szoczoZvals1Zvals2r6   r6   r7   test_fresnel_zerosE	  s   

zTestFresnel.test_fresnel_zerosc                 C   s(   t d\}}t d}t||d d S )NrB   r  )r   r  Zfresnelc_zerosr   )r5   r  r  Zfrcr6   r6   r7   test_fresnelc_zerosX	     
zTestFresnel.test_fresnelc_zerosc                 C   s(   t d\}}t d}t||d d S )Nr   r  )r   r  Zfresnels_zerosr   )r5   r  r  r  r6   r6   r7   test_fresnels_zeros]	  r  zTestFresnel.test_fresnels_zerosN)r<  r=  r>  r?  r@  r  rQ   r   r  r  r  r  r6   r6   r6   r7   r  	  s$    

r  c                   @   sL   e Zd Zdd Zdd Zdd Zedd Zed	d
 Zdd Z	dd Z
dS )	TestGammac                 C   r  r%  )r   r   r   )r5   Zgamr6   r6   r7   r'  d	  r  zTestGamma.test_gammac                 C   s(   t d}tt d}t||d d S )Nru   r  )r   r   r   r   r   )r5   ZgamlnZlngamr6   r6   r7   r*  h	     
zTestGamma.test_gammalnc                 C   s(   t dd}t dd}t||d d S )Nro   r  )r   r(  gammaincinvr   )r5   ZgccinvZgcinvr6   r6   r7   r)  m	     zTestGamma.test_gammainccinvc                 C   sv   t dd}t d|}t|dd t dd}t dd}td|dd t|ddd t dd}td	|dd d S )
Nr?   rL   r  g?g`	\;r   r  gmb<g      &@)r   r  gammaincr   r5   r  r   r6   r6   r7   test_gammaincinvr	  s   zTestGamma.test_gammaincinvc                 C   sR   dt dddt dddg}|D ]}td|}td|}t||dd qd S )	Nr   r   gCs?rL   g^F    ?r?   rk   rE   )rQ   r  r   r  r  r   )r5   ZptsZxpr  r   r6   r6   r7   test_975~	  s   zTestGamma.test_975c                 C   s(   t d}dt d }t||d d S )Nr  rL   )r   r.  r   r   )r5   ZrgamZrlgamr6   r6   r7   r  	  r  zTestGamma.test_rgammac                 C   s(   t ttd ttdd d S )NrA   r   )r   rQ   r   r   r   r   r.  r4   r6   r6   r7   test_infinity	  s   zTestGamma.test_infinityN)r<  r=  r>  r'  r*  r)  r,   r  r  r  r  r6   r6   r6   r7   r  c	  s    

r  c                   @   sL   e Zd 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 )
TestHankelc                 C   "   t tddtdd d d S NrA  r>   ru   r  )r   r   r;  r4   r6   r6   r7   
test_negv1	     "zTestHankel.test_negv1c                 C   8   t dd}t ddt ddd  }t||d d S NrL   r  r  r  )r   r;  rg  r2  r   )r5   Zhank1Zhankrlr6   r6   r7   r<  	     zTestHankel.test_hankel1c                 C   r  r  )r   r   r=  r4   r6   r6   r7   test_negv1e	  r  zTestHankel.test_negv1ec                 C   0   t dd}t ddtd }t||d d S )NrL   r  y       r  )r   r=  r;  r   r   )r5   Zhank1eZhankrler6   r6   r7   r>  	  rz  zTestHankel.test_hankel1ec                 C   r  r  )r   r   r?  r4   r6   r6   r7   
test_negv2	  r  zTestHankel.test_negv2c                 C   8   t dd}t ddt ddd  }t||d d S r  )r   r?  rg  r2  r   )r5   Zhank2Zhankrl2r6   r6   r7   r@  	  r  zTestHankel.test_hankel2c                 C   r  r  )r   r   rA  r4   r6   r6   r7   
test_neg2e	  r  zTestHankel.test_neg2ec                 C   s(   t dd}t dd}t||d d S )NrL   r  r  )r   rA  r   )r5   Zhank2eZhankrl2er6   r6   r7   test_hankl2e	  r  zTestHankel.test_hankl2eN)r<  r=  r>  r  r<  r  r>  r  r@  r  r  r6   r6   r6   r7   r  	  s    r  c                   @   s\   e Zd 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d Zdd ZdS )	TestHyperc                 C   r  r  )r   Zh1vpjvpyvpr   )r5   Zh1Zh1realr6   r6   r7   	test_h1vp	  r  zTestHyper.test_h1vpc                 C   r  r  )r   Zh2vpr  r  r   )r5   Zh2Zh2realr6   r6   r7   	test_h2vp	  r  zTestHyper.test_h2vpc                 C   s  t tddddd t tddddd td	g d
}tg d}t ||dd td	tg d
d }t ||tdd g d}g d}t||}g d}t ||dd tt|gd |}t |t|gd dd tt	tjt|gd ddg d S )Nr2  ro   Qvo?rk   rE   r   rp   r   r   )g      rA   r   rL   r  )g̷?g3|t-Ք?rp   go?g{h?r  ro   r  r2  )r   rL   ro   )rp   gc?r  r>   ru   rL   )
r   r   hyp0f1rQ   r   r   r  	row_stackassert_raisesrJ  )r5   r   r  x1Zx2r6   r6   r7   test_hyp0f1	  s"   zTestHyper.test_hyp0f1c                 C   s   t dd}t|d d S )N皙?      ?      ?y;EG?uM?)r   r  r   )r5   rT  r6   r6   r7   test_hyp0f1_gh5764	  s   zTestHyper.test_hyp0f1_gh5764c                 C   s  t ddd}t|dd tg g dg dg dg dg d	g d
g dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg dg d g d!g d"g d#g d$g d%g d&g d'g d(g d)g d*g d+g d,g d-g d.g d/g d0g d1g d2g d3g d4g d5g d6g d7g d8g d9g d:g d;g d<g d=g d>g d?g d@g dAg dBg dCg dDg dEg dFg dGg dHg dIg dJg dKg dLg dMg dNg dOg dPg dQg dRg dSg dTg dUg dVg dWg dXg dYg dZg d[g d\g d]g d^g d_g d`g dag dbg dcg ddg deg dfg dgg dh}|D ]\}}}}t |||}tt|| | dik  qd S )jNr  r  g?r@   )g{*= g˱a)g5=gvX@)g)AI@gDAhg$Pj)g~٭@)g,qUp,g@=&?gX 3@gZ@)g\@g88*@g\ֳ!=@g   ƞA)gAZ;gOFA'gxŝO<g_Dc D)g^g@g V*E7g4)3@g7-XtD)gΧU(@g2Tj8g$@g  LhB)ge;@gJgogr@g `屫B)g5'.@gqZ=g7߈Y.g8w)gB,@g"^#@grT[	R3@g  B)gYgN],*@g*!j,g1@)g#r @gq{874*gWs%o.@gMdD)g8|.2@g*!,g?I(#@gJ
r .)gu8g#=)@g*'1g)ψvA)g%0N:@gUx1@gx@gr),c@)g:M8@gGb+=@g3ҜV/@gX9ҙim@)g"dxz@gqKgv7##@g  >B)g kx-gD8L+8@g܈2g72LU@)gtd@Q4h6@g%@}gr3b @gu߯ѡ)g򋷺?g"p$`E2@gY|T3g\D?)gV-(+@g$[3@g;/@gEQwв@)g[fgLL4gQV@g0#.@)g;@g/?jvgx.<N&@g^I)g+9gX[?gbZSH%@g5/)@)g}RgŢ	@g},*@g6@g1w-@)gRA(g_@g5A} :=g   FA)gQz5@gq.#gTq&gc ?)gφ%#gZV@
g%@0@g   Syd)gB۽ܟ%@g*>8gV@'g	ʦ)g/H:gn@S g)bǙ9@g  9)gT쁹3!gD gkLFr%@g3333`4A)g:k
g\=)'gi,k9gbx?)giXwg-CwU5@g'jin9gX5@)gb@gTy4#/@g]pH=gIw?)g63@g2XxM:@g~?^0gW1?)g37g R{@gicx.4?gmm?)gv܏%7@g9Ma%=g}ygGr##@)gG8-xы.@gǂ@ghb(@g  A)gw1@gq2@gO],@g0ɷ-X@)g2@g́y#<@gͣx?g]?)g];˄f$@g1}0g_9g8ڃ@)g:!ω1g)q(@gg2gv%)A)gYN:+gn	Ȱ-?g>gZd|I.A)gr/K@g\}L9@g*gΙ?)gQq5V@g?)@g'@0@glۭ`@)gVn:gRQ0gT&g QC)gR4 8gi+gK @g{G)gtiq+g(O?3g	1=@g  8cB)g|>oϘg\!<@g"?4V?g%c\q?)g gpfP!gAO:@g,\)g=R8@g%;gz3@g~0G)g.CVl@ge< .@g9@gkq1A)g=~$gpR7@g 77g,ǆ@)g^g{)gRA2@g  dL)gf=4,R@gyO-g#ޕ~8@g)g|ݩ%P4g:<9@gKzs4g$(~O4@)g2y3@g1$6g&TpxA6gG!JA)gf^XH
^;@g7r:@g`,/@gi{dA)gihx@g!B8(@g7j*@gh@)glmF<gpO4@g`2"@g-)gnV3!2@g.mq1g!Z{.@grOE)gs`m@gzAUguC=V#@g  \)gPL-(@g,9$"9g6u7@geRF)gw8gv=5@gjRW+g(\-@)gyg~=@g4MVgwz:@)g^0g+7%g-@j81g5ׂ,j)gj4gz0g-</;gݽ]
D)gN43@g}W6@gLUS!9gɍF>)g Q4@g=}gȮ5@g]nhgF)gV9g9gf9,#gF|}fv?)g=^ee;@gy}2g'T> g#o@)g+5g;gN8Cg8@g   bkA)gSx+26@g@gI0gSMC)gT*0@g`<6gWy5@gǟRj)gӰk
g/:?gJLHR"@gxu-)gKu@g6gt8_x7@gd;=')g+:;@gBͤ10@g";gK$?)gp @g dg	=@g=6` F)gTbR.g9:g3@gUfgRbKZ@)g!g%P73;g]?gr	y?)g)Yv2gȹq@g/3g   A)g?j/|g7:@g#~oݽ?g8pE?)gPj/gS"X)gYgt0N?)ggo&	xT7@g-hT@#@g.;%r?)g'_@gɖ@7g:Kڞ$@g [B)gk5ں9gѼ:gk%tp;@g  .<^)gf:OI&gO/g#01|2gf`Y)gqv~@guFd9@gz+S7gF1/$?)gx3g~[6:g;s9@gKw*1@)gP@gv;K,gҬd&<@g!s)gֈ`|.gOwx=@g+MK<gUU@)gکI@g©jG1g4g؃66@g(4ν4E)gS>?gD-lgSL,c<gԉE4?)gd?A g3$)glx^?gs>|T?)g(%@g:ĉ$@g~^gv2gJHF&?)g}r":@g3\z;@go)@g+hA)g@')"gVv/@guQU-gfy2yt@)gM6y%$g/;R#@g):@gw%",6Կ)g%x'g$6g5gu$9?)glkC9g<tF8gp?g ?r  )r   rD  r   r   r   rE  )r5   hyp1Zref_datarF  rG  r  r  r  r6   r6   r7   rE  	  s  	
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcezTestHyper.test_hyp1f1c                 C   s,   t ddd}t ddd}t||d d S )Nro   r  g7B.g|:B.r  r   rD  r   )r5   r  Zhyp2r6   r6   r7   test_hyp1f1_gh2957V
  r}  zTestHyper.test_hyp1f1_gh2957c                 C   s   t ddd}t|dd d S )Nro   r  ig<`?r  r  )r5   Zhypr6   r6   r7   test_hyp1f1_gh2282[
  r{  zTestHyper.test_hyp1f1_gh2282c           	      C   s  dddddt d gdddddtd	 gddd
d	dt d gg ddddtd	d
 tdgddddtdtd td td gdd
d
ddtt td
 td td gdd
dddtt td td td gdddddtd td td td gg dg d g d!g d"g d#d$d%g}t|D ]\}\}}}}}t	||||}t
||dd&| d' qd S )(Nro   rL   r  |Gz?r2  g?g|Gzrz   r   r>   r  r  )ru   r  r  r  gYi2?rA  ru   g433333?r<   r  r   rA   g      ?r   g      ?r   r  g      gUUUUUUտg  @gUUUUUU?g)r  r  rp         $gEciH!@)r  ru   rL   r  gzG?)r>   rA  rL   r  gy&1|)rC  ru   rL   r  g"nN%@?)r>   rC  rL   r  g!J)r  |      %@rD  gzS;)r  r  g      %rD  g[B.VP<test #%derr_msg)r   r   r   r	   r   r   r   r   r  rG  r   )	r5   r   rf   rF  rG  r  r   r  cvr6   r6   r7   rH  _
  sN   0zTestHyper.test_hyp2f1c                 C   s   t ddd}t|dd g dg d}}t|t|}}d}t |||}ttt|  t |||t d| | t |  |d|  t d| | d	| | t |t d	|     }t||d
 d S )NrL   r  r  g D?r@   )r  r  333333?g)r  g	@r6  g	ro   r>   r  )	r   hyperur   r   r   r   rD  r   r   )r5   Zval1rF  rG  r  ZhypuZhprlr6   r6   r7   test_hyperu~
  s   $zTestHyper.test_hyperuc                 C   s   t tddddd d S )NrL   r  g3333334@g(¨?r  )r   r   r  r4   r6   r6   r7   test_hyperu_gh2287
  s   zTestHyper.test_hyperu_gh2287N)r<  r=  r>  r  r  r  r  rE  r  r  rH  r  r  r6   r6   r6   r7   r  	  s    rr  c                   @   s  e Zd 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d 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#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;d< Z d=d> Z!d?d@ Z"dAdB Z#dCdD Z$dEdF Z%dGdH Z&dIdJ Z'dKdL Z(dMdN Z)dOdP Z*dQdR Z+dSdT Z,dUdV Z-dWdX Z.dYdZ Z/d[d\ Z0d]d^ Z1d_d` Z2ddddeZ3e4j5j6e78 dfkdgdhdidj Z9e4j5j6e78 dfkdgdhdkdl Z:dmdn Z;dodp Z<e4j5j=dqdr Z>dsdt Z?dudv Z@dwdx ZAdydz ZBd{d| ZCd}d~ ZDdd ZEdddZFdd ZGdd ZHdd ZIdd ZJdd ZKdd ZLdd ZMdd ZNdd ZOdd ZPdd ZQdd ZRdd ZSdd ZTdcS )
TestBesselc                 C   &   t td}t|t ddgd d S )Nr   gbɃ?gΝJ ֿr  )r   r   rY  r   )r5   Zit0r6   r6   r7   rZ  
     zTestBessel.test_itj0y0c                 C   r  )Nr   gbqTtt?g/]ooۿr  )r   r   rS  r   )r5   Zit2r6   r6   r7   rT  
  r  zTestBessel.test_it2j0y0c                 C      t tddtdd d S Nru   r>   rA  )r   r   r]  r4   r6   r6   r7   test_negv_iv
     zTestBessel.test_negv_ivc                 C   &   t d}t dd}t||d d S Nr  r   r  )r   ra  re  r   r5   ZozZozrr6   r6   r7   rb  
  r  zTestBessel.test_j0c                 C   r  Nr  rL   r  )r   rc  re  r   r5   Zo1Zo1rr6   r6   r7   rd  
  r  zTestBessel.test_j1c                 C      t dd}t|dd d S )NrL   r   ;x?r  )r   re  r   )r5   Zjnnrr6   r6   r7   rf  
     zTestBessel.test_jnc                 C   r  r  )r   r   rg  r4   r6   r6   r7   test_negv_jv
  r  zTestBessel.test_negv_jvc                 C   s^   g dg dg dg dg dg}t |D ]\}\}}}t||}t||dd| d qd S )	N)r   r  g
Ye?)UUUUUU?:0yE>g˿+>)r  rN   g)%->)g@rN   g5c)!9)r  r  g%,Ϳr  r  r  )r  r   rg  r   )r5   r   rf   r  r   r  Zycr6   r6   r7   rh  
  s   zTestBessel.test_jvc                 C   r  r  )r   r   ri  r4   r6   r6   r7   test_negv_jve
  r  zTestBessel.test_negv_jvec                 C   sT   t dd}t|dd t dd}d}t d|tt|j  }t||d d S )NrL   r   r  r  ?      ?)r   ri  r   rg  r   rE  r  )r5   ZjvexpZjvexp1r  Zjvexprr6   r6   r7   rj  
  s   zTestBessel.test_jvec                 C   s   t dd}t dd}t|tg dd t|tg dd t dd}t|tg dd	d
 t dd}t|tg dd	d
 d S )Nr   r   rL   )go@.=@gzj,[@glN!@g5/ D'@gh>-@r<   gW@g0@gQX$@g*@g8*5{x0@rK   )gEk[@g~Cju]@gYrʝ^@g, `@gf	`@rD   rE   -  )gts@g&ǭr3t@gWt@g,$Y&u@gu@)r   jn_zerosr   r   r   )r5   jn0Zjn1Zjn102Zjn301r6   r6   r7   test_jn_zeros
  s    
zTestBessel.test_jn_zerosc                 C   s   t dd}t|d ddd t|d ddd t|d	 d
dd t dd}t|d ddd t|d ddd t|d	 ddd t dd}t|tg ddd d S )Nr   r]   i  g;@rD   rE   i  g8v@i+  gׂMm@r  gxi@g	,@gи{>@i  r   )gUDX@g!@g*HS@gz5 @g@2;@r  )r   r  r   r   )r5   r  Zjn10Zjn3010r6   r6   r7   test_jn_zeros_slow
  s   
zTestBessel.test_jn_zeros_slowc           
         s   t j  fdd}tddD ]:}t |\}}}}t|||D ](\}}}	|	dkr3t ||ddd q|	dkrBt|||ddd qtd| qd S )	Nc                    s     | d | | d | d S )NrL   r>   r6   )rY   r   re  r6   r7   jnp
      z(TestBessel.test_jnjnp_zeros.<locals>.jnprL   rH   r   r  r  zInvalid t return for nt=%d)r   re  rc   Zjnjnp_zeroszipr   AssertionError)
r5   r  ntr  rY   r  tzznnttr6   r  r7   test_jnjnp_zeros
  s   zTestBessel.test_jnjnp_zerosc                 C   sF   t dd}t|tg dd t dd}tt d|ddd d S )	NrL   r   g(yu?gOXeS@ga!@gxi'@g'Nw(-@r<     r   r   r  )r   Z	jnp_zerosr   r   r   r  )r5   r  r6   r6   r7   test_jnp_zeros   s   zTestBessel.test_jnp_zerosc                 C   sD   t dd}t|tg dtg dtg dtg dfd d S )NrL   r   r  r  )"@g+@g-9(1!@gȘ'@g>tA}-@)g0v@gjt@gH.?$@g}"O*@gGŧp0@)r   Z
jnyn_zerosr   r   )r5   Zjnzr6   r6   r7   test_jnyn_zeros
  s   


zTestBessel.test_jnyn_zerosc                 C   s8   t dd}t ddt dd d }t||d d S )Nr>   rL   ru   r  )r   r  rg  r   )r5   ZjvprimZjv0r6   r6   r7   test_jvp!  r  zTestBessel.test_jvpc                 C   r  r  )r   rl  r  r   )r5   ZozkZozkrr6   r6   r7   rm  &  r  zTestBessel.test_k0c                 C   r  r  )r   rn  r  r   )r5   ZozkeZozkerr6   r6   r7   ro  +  r  zTestBessel.test_k0ec                 C   r  r  )r   rp  r  r   )r5   Zo1kZo1krr6   r6   r7   rq  0  r  zTestBessel.test_k1c                 C   r  r  )r   rr  r  r   )r5   Zo1keZo1kerr6   r6   r7   rs  5  r  zTestBessel.test_k1ec           
      C   s  dt j  d }dt j  d }td||}td||}td||}td||}t|jdgd t|jt|| d || gd d || d || d  d|| d  |d  d|d  |d  g}|d |d d|d   |d |d  |d  g}t|jt|d	 d || d || d  || d
  d
|| d  || d  |d  d|| d  |d  |d  d|d  |d  |d  g}|d |d d|d   |d d|d   d|d   |d |d  |d  |d  g}	t|jt|	d d d S )Nr   rL   r   r>   ru   r  r   r<   r   rB   r  r  g      H@)rQ   rW   r   Zjacobir   r  r   )
r5   rF  rG  ZP0ZP1ZP2ZP3cpZp2cZp3cr6   r6   r7   test_jacobi:  s    &B2D8XzTestBessel.test_jacobic                 C   r  )Nr   r   _2?r  )r   r~  r   )r5   Zkn1r6   r6   r7   r  L  r  zTestBessel.test_knc                 C   r  Nr   r:  r  r   r   r  r4   r6   r6   r7   test_negv_kvP  r  zTestBessel.test_negv_kvc                 C   r  )Nr   r   r  r  r   r  r   )r5   Zkv0r6   r6   r7   test_kv0S  r  zTestBessel.test_kv0c                 C   r  )NrL   r   gKދ@r  r  )r5   kv1r6   r6   r7   test_kv1W  r  zTestBessel.test_kv1c                 C   r  )Nr>   r   g)lHH@r  r  )r5   kv2r6   r6   r7   test_kv2[  r  zTestBessel.test_kv2c                 C   r   )N    rL   g.Ք"H)r   r   r~  r4   r6   r6   r7   test_kn_largeorder_  r   zTestBessel.test_kn_largeorderc                 C   s   t tddd d S )Nr   g =`XCr  r4   r6   r6   r7   test_kv_largeargb  r   zTestBessel.test_kv_largeargc                 C   r  r  )r   r   r  r4   r6   r6   r7   test_negv_kvee  r  zTestBessel.test_negv_kvec                 C   s`   t dd}t ddtd }t||d d}t d|}t d|t| }t||d d S )Nr   r   r  r  )r   r  r  r   r   )r5   Zkve1r  r  Zkve2r  r6   r6   r7   r  h  s   zTestBessel.test_kvec                 C   s*   d}t td| tjd|ddd d S )Nr:  rL   r   rY   r  )r   r   r  kvp)r5   r  r6   r6   r7   test_kvp_v0n1q  s   &zTestBessel.test_kvp_v0n1c                 C   sN   d}d}t |d | || t ||  }t j||dd}t||d d S )Nr   r:  rL   r  r  r   r  r  r   r5   r  r  Zxcr   r6   r6   r7   test_kvp_n1u  s
   &zTestBessel.test_kvp_n1c                 C   sd   d}d}|d |d  | |d  t || t |d ||  }t j||dd}t||d d S )Nr   r:  r>   rL   r  r  r  r  r6   r6   r7   test_kvp_n2|  s
   <zTestBessel.test_kvp_n2c                 C   r  r  )r   r-  r0  r   r  r6   r6   r7   r.    r  zTestBessel.test_y0c                 C   r  r  )r   r  r0  r   r  r6   r6   r7   r/    r  zTestBessel.test_y1c                 C   sp   t d\}}t jddd\}}t||f }t||f }ttt d|dd ttt d|| dd d S )Nr>   rL   r  r   r  )r   Zy0_zerosr   r   rE  r2  )r5   ZyoZypoZzoZzpor  Zallvalr6   r6   r7   test_y0_zeros  s    zTestBessel.test_y0_zerosc                 C   s*   t d}t|tdgtdgfd d S )NrL   r  gѮBO?r   )r   Zy1_zerosr   r   )r5   r  r6   r6   r7   test_y1_zeros  s   
 zTestBessel.test_y1_zerosc                 C   s.   t jddd}t|tdgtdgfd d S )NrL   r"  yL
F%u?!rh?y;OnгY?ru   )r   Z	y1p_zerosr   r   )r5   Zy1pr6   r6   r7   test_y1p_zeros  s    zTestBessel.test_y1p_zerosc                 C   sB   t dd}t|tddgd t dd}t|g ddd	 d S )
Nr<   r>   g3@g(A&"@r   r  )g]E.+"|@gH(|@gff|}@g&b`~@gHO_~@r   rE   )r   Zyn_zerosr   r   r   )r5   Zanr6   r6   r7   test_yn_zeros  s   

zTestBessel.test_yn_zerosc                 C   sh   t dd}t|tddgd t dd}tt d|ddd	 t d
d}tt d
|ddd	 d S )Nr   r>   gQhվ@gzN@rB   +   r   r   r  r  r   )r   	ynp_zerosr   r   r   r  r5   Zaor6   r6   r7   test_ynp_zeros  s   zTestBessel.test_ynp_zerosc                 C   s&   t dd}tt d|ddd d S )Nr  r   r   r   r  )r   r(  r   r  r)  r6   r6   r7   test_ynp_zeros_large_order  s   z%TestBessel.test_ynp_zeros_large_orderc                 C   r  NrL   r   5,1
r  )r   r0  r   )r5   Zyn2nr6   r6   r7   r1    r  zTestBessel.test_ync                 C   r  r  )r   r   r2  r4   r6   r6   r7   test_negv_yv  r  zTestBessel.test_negv_yvc                 C   r  r,  )r   r2  r   )r5   Zyv2r6   r6   r7   r3    r  zTestBessel.test_yvc                 C   r  r  )r   r   r4  r4   r6   r6   r7   test_negv_yve  r  zTestBessel.test_negv_yvec                 C   sH   t dd}t|dd t ddtd }t dd}t||d d S )NrL   r   r-  r  r  rA   )r   r4  r   r2  r   )r5   Zyve2Zyve2rZyve22r6   r6   r7   r5    s
   zTestBessel.test_yvec                 C   s8   t ddt dd d }t dd}t||d d S )NrL   r   ru   r   r>   r  )r   r2  r  r   )r5   ZyvprZyvp1r6   r6   r7   test_yvp     zTestBessel.test_yvpc                 c   sF    g d}g d}t ||E dH  t dtdd dgE dH  dS )z>Yield points at which to compare Cephes implementation to AMOS)ir         4r  r   r  r   rp   {G(@r  r  )ir  rA   rp   r        i@g     y@g     Ă@g@  i'  Nro   ir  r  )	itertoolsproductr   )r5   r  r  r6   r6   r7   _cephes_vs_amos_points  s
   "z!TestBessel._cephes_vs_amos_pointsdy=r   Nc                 C   s   |   D ]a\}}|d ur|||rq||||||d |t||}}	}
t|r9tt|	dk||f qt|rIt|	jdk||f qt||	||f||d |t|kret|
|	||f||d qd S )Nr  u <7~r   )r  rF   rP   )	r9  rb   rQ   r   r   rE  r   r  r   )r5   r  f2rF   rP   r}  r  r  c1c2c3r6   r6   r7   check_cephes_vs_amos  s   *

zTestBessel.check_cephes_vs_amosppc64lezfails on ppc64ler
  c                 C      | j tjtjddd d S )NrN   u5% r   )r@  r   rg  re  r4   r6   r6   r7   test_jv_cephes_vs_amos     z!TestBessel.test_jv_cephes_vs_amosc                 C   rB  )Nr:  rC  r   r@  r   r2  r0  r4   r6   r6   r7   test_yv_cephes_vs_amos  rE  z!TestBessel.test_yv_cephes_vs_amosc                 C   s$   dd }| j tjtjdd|d d S )Nc                 S   s   t | dkS )Nr  )rE  )r  r  r6   r6   r7   skipper  s   zDTestBessel.test_yv_cephes_vs_amos_only_small_orders.<locals>.skipperr:  rC  )rF   rP   r}  rF  )r5   rH  r6   r6   r7   (test_yv_cephes_vs_amos_only_small_orders  s   z3TestBessel.test_yv_cephes_vs_amos_only_small_ordersc                 C   sH   t jdd | jtjtjddd W d    d S 1 sw   Y  d S )Nr  r  g:0y5>rC  r   )rQ   r  r@  r   r]  r4   r6   r6   r7   test_iv_cephes_vs_amos  s   "z!TestBessel.test_iv_cephes_vs_amosc           	   
   C   sx  d}t jd t jd|dt jjd|d  }t jd|dt jjd|d  }t jjd|dd	k}|| t||< t jd
dG t	||}t	||d }t j
|t|dk< t j
|t|dk< d	|t|dk < d	|t|dk < t|| d }d	|t |< W d    n1 sw   Y  t |}t|| dk || || t	|| || t	|| || d f d S )Ni@B rL   ro   rA   r>   )r   r   r  r   r  r  r  r;  gYngH׊>)rQ   rW   rX   r  r  r   rb   r  r   r]  r   rE  r   Zargmaxr   )	r5   r  r  r   Zimskr=  r>  ZdcrZ   r6   r6   r7    test_iv_cephes_vs_amos_mass_test  s$   ""
Jz+TestBessel.test_iv_cephes_vs_amos_mass_testc                 C   s0   | j tjtjddd | j tjtjddd d S )Nr   rC  r   )r@  r   r  r~  r4   r6   r6   r7   test_kv_cephes_vs_amos     z!TestBessel.test_kv_cephes_vs_amosc                 C   s:   t tddd t tddd t tddd d S )	Nru   r<   gP?r  r6  g~Omʒ?gY8E@@gKSn)r   r   rg  r4   r6   r6   r7   test_ticket_623  r$  zTestBessel.test_ticket_623c                 C   s  t tddd t tddd t tddd t tddd t tddd t tddd	 t tddd
 t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd	 t tddd
 t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddd t tddtddtd  t tddtddtd  t t	ddtddtd  t t
ddtddtd  t tddtdddtdd   t tddtdddtdd   dS )zNegative-order BesselsrA   rL   gl)ܿr  gPj?gk?g%E*2ig敋?gw--`?gÉB?gW?r  g޴?gz|?a?gpx%?y      ?              ?      ?yYD?`{1wy6x?B]#Ӯ?y ?b>?y.}9d?8kؿy      ?333333?g333333ӿy333333?      ?r  N)r   r   rg  r2  r]  r  ri  r   r4  r_  r  r;  r?  r4   r6   r6   r7   test_ticket_853  sD   """"*.zTestBessel.test_ticket_853c                 C   sB  t ttdd t ttdd t ttdd t ttdd t ttdd t ttdd t ttdd t ttdd t tt	dd t tt	dd t tt
dd t tt
dd t ttddd  td t ttddd   td dS )zReal-valued Bessel domainsro   rA   rL   r   r>   r<   N)r   r   r   rg  r]  r2  r  ri  r_  r4  r  r:   r  r|  r4   r6   r6   r7   test_ticket_854K  s   &,zTestBessel.test_ticket_854c                 C   s0   t tddtjk t tddtjk d S )Nr  r   )r   r   r  rQ   r   r  r4   r6   r6   r7   test_gh_7909\  rM  zTestBessel.test_gh_7909c                 C   s(   t tddd t tddd dS )zReal-valued Bessel I overflowrL   i  g~rI   i`  g ?los~Nr   r   r]  r4   r6   r6   r7   test_ticket_503`  s   zTestBessel.test_ticket_503c                 C   r   )Nr  rL   rO  rT  r4   r6   r6   r7   test_iv_hyperg_polese  r   zTestBessel.test_iv_hyperg_poles   c                 C   s   t d|t}|d|  td|  t|d  t|| d  }t|t|< t|}t	|
 ttj | t	|d d  }| |fS )Nr   r>   ro   rL   rA   r  )r   r   r   r   r   r   r   r   r   rE  r  r   epssumr5   r  r  rY   rZ   r  r-  r6   r6   r7   	iv_seriesh  s   8*zTestBessel.iv_seriesc                 C   4   dD ]}|  d|\}}tt||||d qd S )Nrp   r   r5  r   rP   r  )r[  r   r   rI  r5   r  valuer-  r6   r6   r7   test_i0_seriesp     zTestBessel.test_i0_seriesc                 C   r\  )Nr]  rL   r^  )r[  r   r   rM  r_  r6   r6   r7   test_i1_seriesu  rb  zTestBessel.test_i1_seriesc                 C   sD   dD ]}dD ]}|  ||\}}tt||||||fd qqd S )N)r2  r  r   r   rp   r3  r  )rp   r   r5  y             @r^  )r[  r   r   r]  r5   r  r  r`  r-  r6   r6   r7   test_iv_seriesz  s   zTestBessel.test_iv_seriesc              	   C   sv   ddgddgddgddgddgd	d
gddgddgg}t |D ]\}\}}t|t|  }t||dd| d qd S )Nr   rp   rN   r  g0oO?ro   g!?grb?r2  gpH?rz   gC~?r   ggo?r  r  r  )r  r   rI  r   r   r5   r   rf   r   r  r  r6   r6   r7   rJ    s   	zTestBessel.test_i0c                 C   r  r  )r   rK  r_  r   )r5   ZoizeZoizerr6   r6   r7   rL    r  zTestBessel.test_i0ec                 C   sp   ddgddgddgddgdd	gd
dgddgg}t |D ]\}\}}t|t|  }t||dd| d qd S )Nr   rN   gj|=r  gȕ![1?ro   g;͘?rp   gRΜ?rz   g|?r   g}f?r  r  r  )r  r   rM  r   r   rf  r6   r6   r7   rN    s   zTestBessel.test_i1c                 C   r  r  )r   rO  r_  r   )r5   Zoi1eZoi1err6   r6   r7   rP    r  zTestBessel.test_i1ec                 C   s&   t td}t|t ddgd d S )Nr   gїJB?@g*u?)r   r   rW  r   )r5   Ziti0r6   r6   r7   rX    r  zTestBessel.test_iti0k0c                 C   s"   t d}t|tddgd d S )Nr  gݳɄ|T?gVƥ
@rB   )r   rQ  r   r   )r5   Zit2kr6   r6   r7   rR    s   
zTestBessel.test_it2i0k0c                 C   s$   t ddtd }t|dd d S )Nr   r  皙gv M?r  )r   r]  r   r   )r5   iv1r6   r6   r7   r^    s   zTestBessel.test_ivc                 C   r  r  )r   r   r_  r4   r6   r6   r7   test_negv_ive  r  zTestBessel.test_negv_ivec                 C   r  )Nr   r  rg  r  )r   r_  r]  r   r   )r5   Zive1rh  r6   r6   r7   r`    rz  zTestBessel.test_ivec                 C   s    t tddtddd d S )NrL   r>   r   r  )r   r   r]  ivpr4   r6   r6   r7   	test_ivp0  r  zTestBessel.test_ivp0c                 C   s8   t ddt dd d }t dd}t||d d S )Nr   r>   rL   r  )r   r]  rj  r   r  r6   r6   r7   test_ivp  r1  zTestBessel.test_ivp)r:  r   N)rW  )Ur<  r=  r>  rZ  rT  r  rb  rd  rf  r  rh  r  rj  r  r  r  r  r	  r
  rm  ro  rq  rs  r  r  r  r  r  r  r  r  r  r  r  r   r!  r.  r/  r#  r$  r%  r&  r*  r+  r1  r.  r3  r/  r5  r0  r9  r@  r?  r@  rA  re  machinerD  rG  rI  rJ  ZslowrK  rL  rN  rQ  rR  rS  rU  rV  r[  ra  rc  re  rJ  rL  rN  rP  rX  rR  r^  ri  r`  rk  rl  r6   r6   r6   r7   r  
  s    
	



,
r  c                   @      e Zd Zdd Zdd ZdS )TestLaguerrec                 C   s   t d}t d}t d}t d}t d}t d}t|jdgd t|jddgd t|jtg d	d
 d t|jtg dd d t|jtg dd d t|jtg dd d d S )Nr   rL   r>   ru   r<   r   r  rA   )rL   r+  r>   r   )rA   r  irB   r  )rL   iH   ir   r&  )rA   r   i8iX  ir  r  )r   Zlaguerrer   r  r   )r5   lag0lag1lag2lag3Zlag4Zlag5r6   r6   r7   test_laguerre  s   





zTestLaguerre.test_laguerrec              	   C   s   dt j  d }td|}td|}td|}td|}t|jdg t|jd|d g t|jtdd|d  |d	 |d
  gd
  t|jtdd|d  d|d  |d  |d |d  |d  gd  d S )Nr   r  r   rL   r>   ru   rA   r  rp   r   rA  r  )rQ   rW   r   rV  r   r  r   r   )r5   rZ   rq  rr  rs  rt  r6   r6   r7   test_genlaguerre  s   .LzTestLaguerre.test_genlaguerreN)r<  r=  r>  ru  rv  r6   r6   r6   r7   ro    s    ro  c                   @   rT  )TestLegendrec                 C   s   t d}t d}t d}t d}t d}t d}t|jdg t|jddg t|jtg dd d	d
 t|jtg dd  t|jtg dd  t|jtg dd  d S )Nr   rL   r>   ru   r<   r   )ru   r   rA   r   r  r   )r   r   rA  r   )r  r   r  r   ru   r   )?   r   ir   rh   r   )r   Zlegendrer   r  r   r   )r5   Zleg0Zleg1Zleg2Zleg3Zleg4Zleg5r6   r6   r7   test_legendre  s   





zTestLegendre.test_legendreN)r<  r=  r>  ry  r6   r6   r6   r7   rw    rX  rw  c                   @   rT  )
TestLambdac              	   C   sx   t dd}tt dddt dd d gtt dddt dd d dt dd d  gf}t||d d S )NrL   r  r   r>   r  r   r  )r   Zlmbdar   re  r  rg  r   )r5   ZlamZlamrr6   r6   r7   
test_lmbda  s
   "6zTestLambda.test_lmbdaN)r<  r=  r>  r{  r6   r6   r6   r7   rz    rX  rz  c                   @   rn  )	TestLog1pc                 C   sB   t dt dt df}tdtdtdf}t||d d S )Nr  r  r  r  r  r   r  r   r   )r5   Zl1pZl1prlr6   r6   r7   r       zTestLog1p.test_log1pc                 C   sB   t dt dt df}tdtdtdf}t||d d S )NrL   rl  r  r>   r9  r:  r  r}  )r5   Zl1pmZl1pmrlr6   r6   r7   test_log1pmore  r~  zTestLog1p.test_log1pmoreN)r<  r=  r>  r  r  r6   r6   r6   r7   r|    s    r|  c                   @   st   e Zd 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d Zdd Zdd Zdd Zdd ZdS )TestLegendreFunctionsc                 C   s   d}t dd|d}t|td|dd| | d  gdt|| d d| t|| d  gddd|| d  ggtddd| gd|t|| d  dd| | d  t|| d  gddd| ggfd	 d S )
Ny      ?333333?r>   ru   rp   ro   rL   r   rB   r@   )r   clpmnr   r   r   )r5   r  Zclpr6   r6   r7   
test_clpmn  s   (8z TestLegendreFunctions.test_clpmnc              	   C   s   d}d}d}d}t |||d|  dd ||f }t |||d|  dd ||f }tt||gtt |||t |||gd d S )	NrN   rL   ru   ro   r  r>   r   r@   )r   r  r   r   r  r5   rX  r  rY   r   Zclp_plusZ	clp_minusr6   r6   r7   test_clpmn_close_to_real_2  s   $$z0TestLegendreFunctions.test_clpmn_close_to_real_2c              	   C   s   d}d}d}d}t |||d|  dd ||f }t |||d|  dd ||f }tt||gtt |||td| tj  t |||td| tj  gd	 d S )
NrN   rL   ru   ro   r  r   y             y              ?r@   )r   r  r   r   r  rQ   r   r   r  r6   r6   r7   test_clpmn_close_to_real_3  s   $$" z0TestLegendreFunctions.test_clpmn_close_to_real_3c              
   C   sj   d}d}d}d}dD ](}t t|||d|  |d ||f t|||d|  |d ||f d q
d S )NHz>rL   r  r>   ru   r   rB   )r   r   r  )r5   rX  r  rY   r   ry  r6   r6   r7   test_clpmn_across_unit_circle'  s   $$z3TestLegendreFunctions.test_clpmn_across_unit_circlec              
   C   s   dD ]A}t dD ]:}t d|D ]2}t|||}tt|d ddd f   t|||}tt|d ddd f   qqqd S )N)rL   rA   r<   rL   )rc   r   r  r   rQ   r   r  lpmn)r5   r  rY   r  lpr6   r6   r7   test_inf0  s   "$zTestLegendreFunctions.test_infc                 C   s   g d}d}d}dD ]9}|D ]4}dD ]/}t |||d|  |d t |||d|  |d  | }tt ||||d |d	d
 qqq
d S )N)r  y            ?y            y      ?      rP  r  r  r  r>   ru   r  )r   y        MbP?ro   r   rL   r  rE   )r   r  r   )r5   Zzvalsr  rY   ry  r  hZapprox_derivativer6   r6   r7   test_deriv_clpmn9  s$   z&TestLegendreFunctions.test_deriv_clpmnc                 C   s6   t ddd}t|tg dgtg dgfd d S )Nr   r>   ro   rp   ro         r   rp   r  r<   )r   r  r   r   r5   r  r6   r6   r7   	test_lpmnH  s   zTestLegendreFunctions.test_lpmnc                 C   0   t dd}t|tg dtg dfd d S )Nr>   ro   r  r  r<   )r   Zlpnr   r   )r5   Zlpnfr6   r6   r7   test_lpnQ  s   
zTestLegendreFunctions.test_lpnc                 C   s   t ddd}t|dd t ddd}t|dd tjd	d
 t ddd}W d    n1 s2w   Y  t|dkp@t| d S )Nr   r>   ro   r  r@   (   r   gI?r  r  rA   )r   r  r   rQ   r  r   r   r  r6   r6   r7   r  Z  s   zTestLegendreFunctions.test_lpmvc                 C   sN   t ddd}t dd}t|d d |d d t|d d |d d d S )Nr   r>   ro   r<   rL   )r   lqmnlqnr   )r5   Zlqmnflqfr6   r6   r7   	test_lqmnf  s   zTestLegendreFunctions.test_lqmnc                 C   sR   d}d}|| || fD ]}t dd|d d }d|| d  }t|| qdS )znalgorithm for real arguments changes at 1.0001
           test against analytical result for m=2, n=1
        gqh ?gh㈵>r>   rL   r   )rA   rA   N)r   r  r   )r5   Zx0deltar   Zlqr  r6   r6   r7   test_lqmn_gt1l  s   z#TestLegendreFunctions.test_lqmn_gt1c                 C   sX   t ddd\}}t|jd t|jd t ddd\}}t|jd t|jd d S )Nr<   rl  )r   r   r   )r   rL   )r   r  r   r   )r5   rF  rG  r6   r6   r7   test_lqmn_shapew  s   z%TestLegendreFunctions.test_lqmn_shapec                 C   r  )Nr>   ro   )gk+ݓ?g=yX5gW2)g|a2U?g~jt?gڊer<   )r   r  r   r   )r5   r  r6   r6   r7   test_lqn  s   
zTestLegendreFunctions.test_lqnN)r<  r=  r>  r  r  r  r  r  r  r  r  r  r  r  r  r  r6   r6   r6   r7   r    s    					r  c                   @   r  )TestMathieuc                 C   rZ  r[  r6   r4   r6   r6   r7   r    r\  zTestMathieu.test_mathieu_ac                 C   r   )Nr>   r   )r   r)   r4   r6   r6   r7   test_mathieu_even_coef  r   z"TestMathieu.test_mathieu_even_coefc                 C   rZ  r[  r6   r4   r6   r6   r7   test_mathieu_odd_coef  s   z!TestMathieu.test_mathieu_odd_coefN)r<  r=  r>  r  r  r  r6   r6   r6   r7   r    s    r  c                   @   rn  )TestFresnelIntegralc                 C   rZ  r[  r6   r4   r6   r6   r7   r    r\  z$TestFresnelIntegral.test_modfresnelpc                 C   rZ  r[  r6   r4   r6   r6   r7   r    r\  z$TestFresnelIntegral.test_modfresnelmN)r<  r=  r>  r  r  r6   r6   r6   r7   r    s    r  c                   @   rT  )TestOblCvSeqc                 C   &   t ddd}t|tg dd d S )Nr   ru   rL   )g~T~Oֿgt_J?gm{@g@j'&@r   )r   Z
obl_cv_seqr   r   )r5   Zoblr6   r6   r7   test_obl_cv_seq     zTestOblCvSeq.test_obl_cv_seqN)r<  r=  r>  r  r6   r6   r6   r7   r    rX  r  c                   @   rB  )TestParabolicCylinderc                 C   s0   t dd}t|tddgtddgfd d S )NrL   r  gQ?gx$(~?gx$(~g(\?r<   )r   pbdn_seqr   r   )r5   Zpbr6   r6   r7   test_pbdn_seq  s   z#TestParabolicCylinder.test_pbdn_seqc                 C   s4   t dd dt ddd  t ddd   d S )NrL   r   r  r   )r   r  r4   r6   r6   r7   r    s   (zTestParabolicCylinder.test_pbdvc                 C   s<   t dd}t dd}t|t|d t|d fd d S )NrL   r  r   r<   )r   r  Zpbdv_seqr   r   )r5   ZpbnZpbvr6   r6   r7   test_pbdv_seq  s   $z#TestParabolicCylinder.test_pbdv_seqc                 C   s   t ddd}d|d  t t j tdd|   }tt|dd |ddd	 ttd
dd ddd ttddd ddd d S )Nr  r  r   r>   ro   r   r   r   r   gGz$@gq=
ףp4@gHQ9rk   rE   g(\#gQ@gkS a>)rQ   r  r   r   r   r   r   r  )r5   etar  r6   r6   r7   test_pbdv_points  s
   *z&TestParabolicCylinder.test_pbdv_pointsc                 C      t dddd d d f }t dddd d d f }t||}ddt|  }t||| d t||| d  | d	 }t|d
 |ddd d S Nr+  r<   r  r  r  r   r  r   r   rL   r  r   )rQ   r  r   r  rE  r   r5   r   r  r  rX  Zdpr6   r6   r7   test_pbdv_gradient     0z(TestParabolicCylinder.test_pbdv_gradientc                 C   r  r  )rQ   r  r   r  rE  r   r  r6   r6   r7   test_pbvv_gradient  r  z(TestParabolicCylinder.test_pbvv_gradientN)	r<  r=  r>  r  r  r  r  r  r  r6   r6   r6   r7   r    s    
	r  c                   @   rT  )TestPolygammac                 C   s   t dd}t dd}t|dd t|dd g d}tt d|t | g d	}g d
}g d}tt ||| t|gd }tt |t|gd | tt t|gd || d S )Nr>   rL   ru   gX];r  gOV,@@)r>   ru   g  8Br   r  r  )g2}jg.M?g}2;ο)r   Z	polygammar   r  rQ   r  )r5   Zpoly2Zpoly3r   rY   r  r6   r6   r7   test_polygamma  s"   zTestPolygamma.test_polygammaN)r<  r=  r>  r  r6   r6   r6   r7   r    s    r  c                   @   rT  )TestProCvSeqc                 C   r  )Nr   ru   rL   )g"~j?g6?Ң@g)u8F"@g2g)@r   )r   Z
pro_cv_seqr   r   )r5   Zprolr6   r6   r7   test_pro_cv_seq  r  zTestProCvSeq.test_pro_cv_seqN)r<  r=  r>  r  r6   r6   r6   r7   r    rX  r  c                   @   rT  )TestPsic                 C   r^  )NrL   goxr  )r   r  r   )r5   Zpsr6   r6   r7   r     r_  zTestPsi.test_psiN)r<  r=  r>  r   r6   r6   r6   r7   r    rX  r  c                   @   rn  )
TestRadianc                 C   s"   t ddd}t|td d d S )Nr  r   r   r   r   r  r   r   )r5   Zradr6   r6   r7   r    s   zTestRadian.test_radianc                 C   s&   t ddd}t|td d d d S )Nr  rL   r  r>   gC?r   r  )r5   Zrad1r6   r6   r7   test_radianmore  r  zTestRadian.test_radianmoreN)r<  r=  r>  r  r  r6   r6   r6   r7   r    s    r  c                   @   rn  )TestRiccatic                 C   |   d\}}t ||f}t|D ]"}t||}tj||dd}|| |d|f< || | |d|f< qt|t||d d S N)r>   r   T)Z
derivativer   rL   r  )rQ   emptyrc   r   Zspherical_jnr   Z
riccati_jn)r5   r  r   SrY   r  jpr6   r6   r7   test_riccati_jn     zTestRiccati.test_riccati_jnc                 C   r  r  )rQ   r  rc   r   Zspherical_ynr   Z
riccati_yn)r5   r  r   CrY   r  Zypr6   r6   r7   test_riccati_yn  r  zTestRiccati.test_riccati_ynN)r<  r=  r>  r  r  r6   r6   r6   r7   r    s    
r  c                   @   rT  )	TestRoundc              	   C   s@   t tttdtdtdtdf}d}t|| d S )Ng333333$@g$@r  g333333%@)r  r  r  r  )r  maprb   r   r  r   )r5   ZrndZrndrlr6   r6   r7   r	    s   .zTestRound.test_roundN)r<  r=  r>  r	  r6   r6   r6   r7   r    rX  r  c                  C   s  t j} tj}tj}tj}tj}tj}t| ddddd||  t| ddd|d d|dd	|   ||d d	   t| ddd|d d|dd	|    t| dd||d d|d
d	|   |dd	| d   ||d	 d	   t| dd|d |d d|dd	|   |dd	| d d   ||d d	  d||d d	  d   t| dd|d |d d|dd	|   |dd| d d   ||d d   d S )Nr   ro   r  r>   r   r<   r   g      .@r   rh   r  r  r   g      ?rz   g      @rL   r   r  g      ?g     A@)	r   sph_harmrQ   r   r   r   r   r	   r   )shr   r   r   r   r	   r6   r6   r7   test_sph_harm)  sP   
r  c                  C   s   t t j} ttddddj|  ttdgdddj|  ttddgddj|  ttdddgdj|  ttddddgj|  ttdgdgdgdgj|  d S r1   )rQ   rR  r  r   r   r  )dtr6   r6   r7   "test_sph_harm_ufunc_loop_selectionF  s   $r  c                   @   s.   e Zd ZdddZdd Zdd Zdd	 Zd
S )
TestStruver  c                 C   sp   t d|}d| d| d| | d   t|d  t|| d  }t| ttj | }| |fS )z?Compute Struve function & error estimate from its power series.r   rA   ro   r>   rL   r  )	r   r   r   rE  r  r   r   rX  rY  rZ  r6   r6   r7   _seriesR  s   
@zTestStruve._seriesc                 C   sH   dD ]}dD ]}|  ||\}}tt|||d|d||ff qqdS )z-Check Struve function versus its power series)
ir  (\r  rA   r   rL   r  r3     )rL   r  r   r7  rH   r   r   N)r  r   r   r(  rd  r6   r6   r7   test_vs_seriesY  s   "zTestStruve.test_vs_seriesc                 C   s   t tddddd t tddddd t td	d
ddd t tddddd ttddtdd  ttddtdd  ttddtdd
  ttddtdd
  tttdd tttdd d S )Nr  r7  g;cv=?r  rE   gQ g< j?r  r  rW  g?rk   g       igzz?r:  i)   r  r4  r  gffffffrA   g333333$)r   r   r(  r   r   r   r4   r6   r6   r7   test_some_values`  s   zTestStruve.test_some_valuesc                 C   sR   t tddtdd t tddtdd t tddtdd dS )zRegression test for #679r   g3@g*   4@r  g333333N)r   r   r(  r4   r6   r6   r7   test_regression_679m  s   zTestStruve.test_regression_679N)r  )r<  r=  r>  r  r  r  r  r6   r6   r6   r7   r  Q  s
    
r  c                   C   r   )Nr  ru   gdX	
?)r   r   r   r6   r6   r6   r7   test_chi2_smalldft  r   r  c                   C   s   t tdtjd d S )Nr%  rp   )r   r   r   rQ   r   r6   r6   r6   r7   test_ch2_infx  rr   r  c                   C   r   )Nr  ru   yj_?)r   r   r   r6   r6   r6   r7   test_chi2c_smalldf|  r   r  c                   C   r   )Nr  r  ru   )r   r   r   r6   r6   r6   r7   test_chi2_inv_smalldf  r   r  c                  C   s  d} t dtdtd d| d d}d}d}t tdgd	ggg d
d||g|d	|gg| d d}t tdd|| d t tdd|| d t tdd| | d t tddd| d t tddd| d t tddd| d t tddd| d t tddd| d t tddd| d t tddd| d td}t t|j|jd | d t td!|j |jd"| d t t|jd	|j d#| d ttd$d$d$ ttd%d$d$ ttdd&tj	 ttd$tj
tj	 tttj
d$tj	 ttd$tj
 tj	 tttj
 d$tj	 tttj
tj
 tj	 tttj
 tj
tj	 ttdtj	tj	 tttj	dtj	 ttdtj
tj
 tttj
dtj
 ttdtj
 tj
  tttj
 dtj
  d S )'NrD   rL   r>   gDSYC?rE   gQ_?g?@g>;,
i}@ru   )rL   ru   r   g=O?rA   r  r   rB   gXs*@r  g   V4oAgO1eAgꌠ9Y>)FgEg^ 9^;gd-?gP.5_gsTNNeg6dgu?j/ g]XC}KdgѧRg"!x{{ rp   g][#!Rr  gٍS1gN_ r   c   r  )r   r   ZagmrQ   r   r   r  r  r   r   r   )rF   Zagm13Zagm15Zagm35Zagm12fir6   r6   r7   test_agm_simple  sr   
r  c                  C   s.  t  } | td ttddtdd ttdddtddd ttdddtddd ttdddtddd tt	ddt	dd tt
ddt
dd ttddtdd ttddtdd ttddtdd W d    d S 1 sw   Y  d S )Nr  rL   r  g?r>   gffffff@)r   r  r  r   r   Zexpnr  r  r  r  r~  r0  r  r  )r  r6   r6   r7   test_legacy  s   "r  c                   C   s   t tjtjdd d S )NrL   y        .B}T)r  r   ZSpecialFunctionErrorr]  r6   r6   r6   r7   test_error_raising  s   r  c                  C   s   dd } t jddt jfdt jfdgtd}t j|ddgf }t | |d d df |d d d	f }ttj	||d
d
d t | |d d df |d d d	f }ttj	||d
d
d d S )Nc                 S   b   t jdd! | dkrt |s| W  d    S | t | W  d    S 1 s*w   Y  d S Nr  )invalidr   )rQ   r  r   r   rz  r6   r6   r7   xfunc     $ztest_xlogy.<locals>.xfuncr   r   r   rp   r   rQ  )r   r  )rL   r  rL   rD   r   )
rQ   r   r   r   rd   r   ri   r-   r   xlogy)r  z1Zz2w1Zw2r6   r6   r7   
test_xlogy  s   "((r  c                  C   sl   dd } t jddt jfdt jfddgtd}t | |d d df |d d df }ttj||d	d	d
 d S )Nc                 S   r  r  )rQ   r  r   r  rz  r6   r6   r7   r    r  ztest_xlog1py.<locals>.xfuncr  r   r  )rL   gKH9rQ  rL   rD   r   )	rQ   r   r   r   rd   ri   r-   r   Zxlog1py)r  r  r  r6   r6   r7   test_xlog1py  s   (r  c                  C   s   dd } dddt jf}ddg}g }t||D ]\}}|||  qt j|td}t j| t jgd	|}t	t
j||d
d
d d S )Nc                 S   s   | dk rt j S t| |  S r1   )rQ   r   r   r  )r   r6   r6   r7   r    s   ztest_entr.<locals>.xfuncr   ro   rp   rA   rL   rQ  ZotypesrD   r   )rQ   r   r7  r8  r  r   rd   ri   r   r-   r   Zentr)r  r   signsr  Zsgnr  r  r:  r6   r6   r7   	test_entr  s   r  c            
      C      dd } d}ddg}g }t ||||D ]\}}}}||| || f qtj|td}tj| tjgd|d d df |d d df }	tt	j
|	|d	d	d
 d S )Nc                 S   sd   | dk s|dk s|dkr| dkrt jS t | st |r t jS | dkr&|S t| | | |  | S r1   )rQ   r   Zisposinfr   r  rz  r6   r6   r7   r    s    ztest_kl_div.<locals>.xfuncr   ro   rp   rA   rL   rQ  r  r   rD   r   )r7  r8  r  rQ   r   rd   ri   r   r-   r   Zkl_div
r  r   r  r  ZsgnavaZsgnbZvbr  r:  r6   r6   r7   test_kl_div  s   0r  c            
      C   r  )Nc                 S   s:   | dkr|dkrt | | | S | dkr|dkrdS tjS r1   )r   r  rQ   r   rz  r6   r6   r7   r    s
   ztest_rel_entr.<locals>.xfuncr  rA   rL   rQ  r  r   rD   r   )r7  r8  r  rQ   r   rd   ri   r   r-   r   Zrel_entrr  r6   r6   r7   test_rel_entr  s   0r  c                  C   s   t tddtj ttdddtd  ttddd dd } tjd	d}tj	| tj
gd
|d d df |d d df }ttj||ddd d S )NrA   r  r>   ro   r2  r   c                 S   s@   | dk rt jS t || k rdt | S | t |d|    S )Nr   ro   )rQ   r   rE  squarer  r  r6   r6   r7   r  1  s
   ztest_huber.<locals>.xfuncr  r  r   rL   rD   r   )r   r   ZhuberrQ   r   r   r  rW   randnri   r   r-   r  r  r:  r6   r6   r7   
test_huber,  s   0r  c                  C   sx   dd } t t jdd ddgddgg }t j| t jgd|d d df |d d df }ttj	||d	d	d
 d S )Nc                 S   s<   | dk rt jS | r|sdS | d t d||  d  d  S )Nr   r>   rL   )rQ   r   r   r  r6   r6   r7   r  ?  s
   "z test_pseudo_huber.<locals>.xfuncr  r>   r   ro   r  rL   rD   r   )
rQ   r   rW   r  tolistri   r   r-   r   pseudo_huberr  r6   r6   r7   test_pseudo_huber>  s   (0r  c                  C   s*   d} d}t | |}d}t||dd d S )Nrp   gC]r2<gs.-De8rD   rE   )r   r  r   )r  r  r  r  r6   r6   r7   test_pseudo_huber_small_rL  s
   r  c                   C   sv   t jtdd tdd W d    n1 sw   Y  t jtdd tdd W d    d S 1 s4w   Y  d S )NzToo many predicted coefficientsr  rI   )r?  r  r  r(   r)   r6   r6   r6   r7   test_runtime_warningY  s   "r  )wr  r7  r  re  rd  numpyrQ   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r?  r   r  Znumpy.testingr   r   r   r   r   r   r   r   r   Zscipyr   Zscipy.special._ufuncsZ_ufuncsr2   Zscipy.specialr    r!   r"   r#   r$   r%   r&   r'   r(   r)   Zscipy.special._basicr*   r+   Zscipy.special._testutilsr,   r-   r.   rX  r/   rC  rU  rY  r]  rv  rx  r~  r  r  r  r  r  r	  r)  r/  r<  r  r  r  r  r  ro  rw  rz  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  r6   r6   r6   r7   <module>   s   T,       >n	 PE  +b   yD2# Y    6 		.	
#=
