o
    i:3                    @   s  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*m.Z.m/Z/m0Z0m1Z1m2Z2 d dl*m3Z3m4Z4 d d	l5m6Z6m7Z7m8Z8 d dl9Z9G d
d dZ:G dd dZ;G dd dZ<G dd dZ=G dd d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!eEZFG d"d# d#eE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 d0d1 d1ZNG d2d3 d3ZOG d4d5 d5ZPG d6d7 d7ZQG d8d9 d9ZRG d:d; d;ZSG d<d= d=ZTG d>d? d?ZUG d@dA dAZVG dBdC dCZWG dDdE dEZXG dFdG dGZYG dHdI dIZZG dJdK dKZ[G dLdM dMZ\G dNdO dOZ]G dPdQ dQZ^G dRdS dSZ_dTdU Z`dVdW ZaG dXdY dYZbdZd[ Zcd\d] Zdd^d_ Zed`da Zfdbdc Zgddde Zhe6dfdg Zidhdi Zjdjdk Zkdldm Zldndo Zmdpdq Zndrds Zodtdu Zpdvdw Zqdxdy ZrdS )z    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)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 r4   Y/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/scipy/special/tests/test_basic.py	test_airy0      zTestCephes.test_airyc                 C   r.   r/   )r0   airyer2   r4   r4   r5   
test_airye3   r7   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           ?绽|=atolrD   )npr   broadcast_arraysreshapeTr+   r0   binomravelrandomseedr   r   rand)r3   nknkrknownr4   r4   r5   
test_binom6   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 )NrE   rJ   ,     r   rI   r<   r?   rK   rL   rM   )rO   rU   rV   r   logspacer   r   rP   rQ   rR   r+   r0   rS   )r3   rX   rY   rZ   r4   r4   r5   test_binom_2M   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 NrJ   )intrangefloat)rX   rY   numdenir4   r4   r5   	binom_int[   s   
z.TestCephes.test_binom_exact.<locals>.binom_intrE   rJ      r   r<   r?   rM   )rO   	vectorizerU   rV   r   r   rP   rQ   rR   r+   r0   rS   )r3   rh   rX   rY   rZ   r4   r4   r5   test_binom_exactZ   s   

(
$ 
zTestCephes.test_binom_exactc                 C   s.   g d}t |}ttj|dddd  d S )N))rG   rH   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   rJ   r<   -q=rC   )rO   r   r,   r0   rS   check)r3   datasetr4   r4   r5   test_binom_nooverflow_8346q   s   
z%TestCephes.test_binom_nooverflow_8346c                 C      t tdddd d S )NrJ         ?      ?)r   r0   bdtrr2   r4   r4   r5   	test_bdtr      zTestCephes.test_bdtrc                 C      t tdddd d S NrJ      rq   )r   r0   bdtrir2   r4   r4   r5   
test_bdtri   ru   zTestCephes.test_bdtric                 C   rv   rw   )r   r0   bdtrcr2   r4   r4   r5   
test_bdtrc   ru   zTestCephes.test_bdtrcc                 C      t tdddd d S NrJ   r         @)r   r0   bdtrinr2   r4   r4   r5   test_bdtrin   ru   zTestCephes.test_bdtrinc                 C      t ddd d S rw   )r0   bdtrikr2   r4   r4   r5   test_bdtrik      zTestCephes.test_bdtrikc                 C      t tdd d S Nr           )r   r0   beir2   r4   r4   r5   test_bei      zTestCephes.test_beic                 C   r   r   )r   r0   beipr2   r4   r4   r5   	test_beip   r   zTestCephes.test_beipc                 C   r   Nr   rr   )r   r0   berr2   r4   r4   r5   test_ber   r   zTestCephes.test_berc                 C   r   r   )r   r0   berpr2   r4   r4   r5   	test_berp   r   zTestCephes.test_berpc                 C      t tdddd d S r   )r   r0   
besselpolyr2   r4   r4   r5   test_besselpoly   ru   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 )NrJ   rr   33333YN~h?   g6.8@rB   r   rD   rN   )r   r0   betar   gammar2   r4   r4   r5   	test_beta   
   
zTestCephes.test_betac                 C   s,   t tdddd ttdddd d S )NrJ   rr   r   r   rL   g*?)r   r0   betaincr   r2   r4   r4   r5   test_betainc   s   zTestCephes.test_betaincc                 C   r   )NrJ   r   r   r   r      gIs	@+=r   r   )r   r0   betalnr   gammalnr2   r4   r4   r5   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 )
NrJ   rr   r   r         ?g"
Yx;gAfc=r   r   )r   r0   
betaincinvr   r2   r4   r4   r5   test_betaincinv   s   
zTestCephes.test_betaincinvc                 C   s   t ttdd d S )Nr?   r<   )r   rO   isinfr   r   r2   r4   r4   r5   test_beta_inf      zTestCephes.test_beta_infc                 C   r   NrJ   rr   )r   r0   btdtrr2   r4   r4   r5   
test_btdtr   ru   zTestCephes.test_btdtrc                 C   r   r   )r   r0   btdtrir2   r4   r4   r5   test_btdtri   ru   zTestCephes.test_btdtric                 C   r   NrJ   r   )r   r0   btdtriar2   r4   r4   r5   test_btdtria   ru   zTestCephes.test_btdtriac                 C   r   r   )r   r0   btdtribr2   r4   r4   r5   test_btdtrib   ru   zTestCephes.test_btdtribc                 C   r   r   )r   r0   cbrtr2   r4   r4   r5   	test_cbrt   r   zTestCephes.test_cbrtc                 C      t tddd d S NrJ   r   r   )r   r0   chdtrr2   r4   r4   r5   
test_chdtr      zTestCephes.test_chdtrc                 C   r   NrJ   r   rr   )r   r0   chdtrcr2   r4   r4   r5   test_chdtrc   r   zTestCephes.test_chdtrcc                 C      t tddd d S NrJ   r   )r   r0   chdtrir2   r4   r4   r5   test_chdtri   r   zTestCephes.test_chdtric                 C   r   )Nr   r   )r   r0   chdtrivr2   r4   r4   r5   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   rJ   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   rr   gp!P?)g     u@g     r@      $@g j
?)      Y@      +@r   g]?)g     @r   r   g4ۙ?)g     b@r   r   g?)g      d@r   r   rr   r<   rx   rl   rC   r      )r   r0   chndtrrO   r   r   r   r   r   r   nan)r3   valuescdfr4   r4   r5   test_chndtr   s.   2zTestCephes.test_chndtrc                 C   rp   Nr   rJ   r   )r   r0   	chndtridfr2   r4   r4   r5   test_chndtridf   ru   zTestCephes.test_chndtridfc                 C   r}   r   )r   r0   	chndtrincr2   r4   r4   r5   test_chndtrinc   ru   zTestCephes.test_chndtrincc                 C   r}   Nr   rJ   r   )r   r0   chndtrixr2   r4   r4   r5   test_chndtrix   ru   zTestCephes.test_chndtrixc                 C   r   r   )r   r0   cosdgr2   r4   r4   r5   
test_cosdg   r   zTestCephes.test_cosdgc                 C   r   r   )r   r0   cosm1r2   r4   r4   r5   
test_cosm1  r   zTestCephes.test_cosm1c                 C   r   N-   rr   )r   r0   cotdgr2   r4   r4   r5   
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   r0   dawsnr   r2   r4   r4   r5   
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)rJ   r      r<   g-C6
?rr   r>   decimal&.>ri   V瞯<float128rl      )r<   r:            皙?)gg?gsOB?gsaL?g
7I^ʿrx   )rO   r   r   astypefloat32r   r   diricfloat64hasattrr   r   )r3   n_oddxn_evenoctave_resultr4   r4   r5   
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   )rJ   rx   r>   )	rO   r   r   r   r   r   newaxisshapesize)r3   r   rX   r4   r4   r5   test_diric_broadcasting%  s   
0z"TestCephes.test_diric_broadcastingc                 C   r   r   )r   r0   r    r2   r4   r4   r5   test_ellipe*  r   zTestCephes.test_ellipec                 C   r   r   )r   r0   	ellipeincr2   r4   r4   r5   test_ellipeinc-  r   zTestCephes.test_ellipeincc                 C      t dd d S )Nr   rJ   )r0   ellipjr2   r4   r4   r5   test_ellipj0     zTestCephes.test_ellipjc                 C   s   t tdtd  d S )Nr   r<   )r   r!   r   r2   r4   r4   r5   test_ellipk3  r   zTestCephes.test_ellipkc                 C   r   r   )r   r0   	ellipkincr2   r4   r4   r5   test_ellipkinc6  r   zTestCephes.test_ellipkincc                 C   r   r   r   r0   erfr2   r4   r4   r5   test_erf9  r   zTestCephes.test_erfc                 C   s$   d}t t|t|  d d S )Ng#8x@r   r  r3   r   r4   r4   r5   test_erf_symmetry<  s    zTestCephes.test_erf_symmetryc                 C   r   r   )r   r0   erfcr2   r4   r4   r5   	test_erfc@  r   zTestCephes.test_erfcc                 C   r   )Nr<   r   )r   r0   exp10r2   r4   r4   r5   
test_exp10C  r   zTestCephes.test_exp10c                 C   r   )Nr<         @)r   r0   exp2r2   r4   r4   r5   	test_exp2F  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   r?   )r   r0   expm1rO   r   r   r2   r4   r4   r5   
test_expm1I  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   rJ   r<   r:   r   r?   )r0   r  r   complexrO   r   r   )r3   r  r4   r4   r5   test_expm1_complexO  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 <@rx   r^   )	rO   r   r   r	   r0   r  r   imagr   )r3   yr   zexpectedfoundr4   r4   r5   test_expm1_complex_hardb  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 )
NrJ   r   r   ư>r   
   g2?rl   rC   )r   r0   fdtrr   r2   r4   r4   r5   	test_fdtrw  s   
zTestCephes.test_fdtrc                 C   r,  )
NrJ   r   rr   r<   r"  g    _BgDIXl?rl   rC   )r   r0   fdtrcr   r2   r4   r4   r5   
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 )NrJ   gV-?gx&1?g
}?g<zO'?r-  rC   g׀?r"  rx   rl   )r   r0   fdtrir   )r3   pr4   r4   r5   
test_fdtri  s
   zTestCephes.test_fdtrizReturns nan on i686.c                 C   s   t tdddd d S )NrJ   rq   )r   r0   r3  r2   r4   r4   r5   test_fdtri_mysterious_failure  s   z(TestCephes.test_fdtri_mysterious_failurec                 C      t tdddd d S r~   )r   r0   fdtridfdr2   r4   r4   r5   test_fdtridfd  ru   zTestCephes.test_fdtridfdc                 C   r   Nr   r   r   )r   r0   fresnelr2   r4   r4   r5   test_fresnel  r   zTestCephes.test_fresnelc                 C   r   Nr         8@)r   r0   r   r2   r4   r4   r5   
test_gamma  r   zTestCephes.test_gammac                 C   r   )Nr   rJ   r   )r   r0   gammainccinvr2   r4   r4   r5   test_gammainccinv  r   zTestCephes.test_gammainccinvc                 C   r.   )Nr.  )r0   r   r2   r4   r4   r5   test_gammaln  r7   zTestCephes.test_gammalnc                 C   s2   t g dt j}tt|t t| d S )N)      gffffffrJ   g@)rO   r   r   r   r0   gammasgnsignrgamma)r3   valsr4   r4   r5   test_gammasgn  s    zTestCephes.test_gammasgnc                 C   rp   r   )r   r0   gdtrr2   r4   r4   r5   	test_gdtr  ru   zTestCephes.test_gdtrc                 C   s   t tddtjd d S r   )r   r0   rK  rO   r   r2   r4   r4   r5   test_gdtr_inf  r   zTestCephes.test_gdtr_infc                 C   rp   r   )r   r0   gdtrcr2   r4   r4   r5   
test_gdtrc  ru   zTestCephes.test_gdtrcc                 C   r7  r   )r   r0   gdtriar2   r4   r4   r5   test_gdtria  ru   zTestCephes.test_gdtriac                 C   s   t ddd d S NrJ   r   )r0   gdtribr2   r4   r4   r5   test_gdtrib  r   zTestCephes.test_gdtribc                 C   s   t ddd d S NrJ   r"  )r0   gdtrixr2   r4   r4   r5   test_gdtrix  r   zTestCephes.test_gdtrixc                 C      t dd d S ra   )r0   hankel1r2   r4   r4   r5   test_hankel1  r  zTestCephes.test_hankel1c                 C   rX  ra   )r0   hankel1er2   r4   r4   r5   test_hankel1e  r  zTestCephes.test_hankel1ec                 C   rX  ra   )r0   hankel2r2   r4   r4   r5   test_hankel2  r  zTestCephes.test_hankel2c                 C   rX  ra   )r0   hankel2er2   r4   r4   r5   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 )NrJ   rr   rx   r:   g㈮?)r   r0   hyp1f1r   r2   r4   r4   r5   test_hyp1f1  s   zTestCephes.test_hyp1f1c                 C      t tddddd d S r   )r   r0   hyp2f1r2   r4   r4   r5   test_hyp2f1  r   zTestCephes.test_hyp2f1c                 C   r   r   )r   r0   i0r2   r4   r4   r5   test_i0  r   zTestCephes.test_i0c                 C   r   r   )r   r0   i0er2   r4   r4   r5   test_i0e  r   zTestCephes.test_i0ec                 C   r   r   )r   r0   i1r2   r4   r4   r5   test_i1  r   zTestCephes.test_i1c                 C   r   r   )r   r0   i1er2   r4   r4   r5   test_i1e  r   zTestCephes.test_i1ec                 C   r.   ra   )r0   it2i0k0r2   r4   r4   r5   test_it2i0k0  r7   zTestCephes.test_it2i0k0c                 C   r.   ra   )r0   it2j0y0r2   r4   r4   r5   test_it2j0y0  r7   zTestCephes.test_it2j0y0c                 C   r.   ra   )r0   
it2struve0r2   r4   r4   r5   test_it2struve0  r7   zTestCephes.test_it2struve0c                 C   r.   ra   )r0   itairyr2   r4   r4   r5   test_itairy  r7   zTestCephes.test_itairyc                 C   r   r:  )r   r0   iti0k0r2   r4   r4   r5   test_iti0k0  r   zTestCephes.test_iti0k0c                 C   r   r:  )r   r0   itj0y0r2   r4   r4   r5   test_itj0y0  r   zTestCephes.test_itj0y0c                 C   r   r   )r   r0   itmodstruve0r2   r4   r4   r5   test_itmodstruve0  r   zTestCephes.test_itmodstruve0c                 C   r   r   )r   r0   	itstruve0r2   r4   r4   r5   test_itstruve0  r   zTestCephes.test_itstruve0c                 C   r   r   )r   r0   ivr2   r4   r4   r5   test_iv  r   zTestCephes.test_ivc                 C   r   r   )r   r0   iver2   r4   r4   r5   
_check_ive  r   zTestCephes._check_ivec                 C   r   r   )r   r0   j0r2   r4   r4   r5   test_j0  r   zTestCephes.test_j0c                 C   r   r   )r   r0   j1r2   r4   r4   r5   test_j1  r   zTestCephes.test_j1c                 C   r   r   )r   r0   jnr2   r4   r4   r5   test_jn  r   zTestCephes.test_jnc                 C   r   r   )r   r0   jvr2   r4   r4   r5   test_jv  r   zTestCephes.test_jvc                 C   r   r   )r   r0   jver2   r4   r4   r5   
_check_jve   r   zTestCephes._check_jvec                 C   r.   Nr<   )r0   k0r2   r4   r4   r5   test_k0  r7   zTestCephes.test_k0c                 C   r.   r  )r0   k0er2   r4   r4   r5   test_k0e  r7   zTestCephes.test_k0ec                 C   r.   r  )r0   k1r2   r4   r4   r5   test_k1	  r7   zTestCephes.test_k1c                 C   r.   r  )r0   k1er2   r4   r4   r5   test_k1e  r7   zTestCephes.test_k1ec                 C   r.   r  )r0   keir2   r4   r4   r5   test_kei  r7   zTestCephes.test_keic                 C   r   r   )r   r0   keipr2   r4   r4   r5   	test_keip  r   zTestCephes.test_keipc                 C   r.   r  )r0   kerr2   r4   r4   r5   test_ker  r7   zTestCephes.test_kerc                 C   r.   r  )r0   kerpr2   r4   r4   r5   	test_kerp  r7   zTestCephes.test_kerpc                 C   r.   r  )r0   kelvinr2   r4   r4   r5   _check_kelvin  r7   zTestCephes._check_kelvinc                 C   rX  ra   )r0   knr2   r4   r4   r5   test_kn  r  zTestCephes.test_knc                 C   *   t tdd ttttj d S r   )r   r0   kolmogir   rO   r   r   r2   r4   r4   r5   test_kolmogi!     zTestCephes.test_kolmogic                 C   r   r   )r   r0   
kolmogorovr2   r4   r4   r5   test_kolmogorov%  r   zTestCephes.test_kolmogorovc                 C   r   )Nr          )r   r0   _kolmogpr2   r4   r4   r5   test_kolmogp(  r   zTestCephes.test_kolmogpc                 C   r   r   )r   r0   _kolmogcr2   r4   r4   r5   test_kolmogc+  r   zTestCephes.test_kolmogcc                 C   r  r   )r   r0   	_kolmogcir   rO   r   r   r2   r4   r4   r5   test_kolmogci.  r  zTestCephes.test_kolmogcic                 C   rX  ra   )r0   kvr2   r4   r4   r5   	_check_kv2  r  zTestCephes._check_kvc                 C   rX  ra   )r0   kver2   r4   r4   r5   
_check_kve5  r  zTestCephes._check_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   r?   )r0   log1pr   rO   r   r   )r3   r  r4   r4   r5   
test_log1p8  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  r?   r   z%invalid value encountered in multiplyrJ   r<   rx   r:   )r0   r  r  r   rO   r   r   filterRuntimeWarningr   r   r   )r3   r  csupr4   r4   r5   test_log1p_complex?  s$   $ ",&"$" $"zTestCephes.test_log1p_complexc                 C   rp   )Nr   rJ   rr   )r   r0   lpmvr2   r4   r4   r5   	test_lpmvR  ru   zTestCephes.test_lpmvc                 C   r   r   )r   r0   	mathieu_ar2   r4   r4   r5   test_mathieu_aU  r   zTestCephes.test_mathieu_ac                 C   r   r   )r   r0   	mathieu_br2   r4   r4   r5   test_mathieu_bX  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 )NrJ   r   rr   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?rJ   rq   r<      rx   r:      r   )rO   r   r	   mqr(  r4   r4   r5   	ce_smallq_  s   $Hz.TestCephes.test_mathieu_cem.<locals>.ce_smallqd   r.  rh|?r   r   )	r   r0   mathieu_cemrO   rj   r   r   r_   r   )r3   r  r  r  r4   r4   r5   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 )NrJ   r   r   rr   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  rJ   r  rx   r<   r:   r  )rO   r   r   r  r4   r4   r5   	se_smallqt  s    Hz.TestCephes.test_mathieu_sem.<locals>.se_smallqr  r  r  r.  r  r   r   )	r   r0   mathieu_semrO   rj   r   r   r_   r   )r3   r  r  r  r4   r4   r5   test_mathieu_semp  s   
*"
zTestCephes.test_mathieu_semc                 C   r7  NrJ   r   r;  )r   r0   mathieu_modcem1r2   r4   r4   r5   test_mathieu_modcem1  ru   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 )
NrJ   r   r:   r  r<   r.  r>   rL   rC   )	r0   mathieu_modcem2rO   r   r   r_   linspacer  r   r3   r  r  r(  y1fry2r4   r4   r5   test_mathieu_modcem2  s   "&.zTestCephes.test_mathieu_modcem2c                 C   r7  r  )r   r0   mathieu_modsem1r2   r4   r4   r5   test_mathieu_modsem1  ru   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 )
NrJ   r:   r  r<   r.  r   r>   rL   rC   )	r0   mathieu_modsem2rO   r   r   r_   r  r  r   r  r4   r4   r5   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   r0   r  rO   r   r  r  r  r  r  r2   r4   r4   r5   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  r?   r   g.dS?rL   rC   rJ   gGc?-C6?)rc   r0   r  r   )r3   rY   vr4   r4   r5   test_mathieu_ticket_1847  s
   z#TestCephes.test_mathieu_ticket_1847c                 C   r.   r/   )r0   modfresnelmr2   r4   r4   r5   test_modfresnelm  r7   zTestCephes.test_modfresnelmc                 C   r.   r/   )r0   modfresnelpr2   r4   r4   r5   test_modfresnelp  r7   zTestCephes.test_modfresnelpc                 C   r   r   )r   r0   	modstruver2   r4   r4   r5   _check_modstruve  r   zTestCephes._check_modstruvec                 C   r   r   )r   r0   nbdtrr2   r4   r4   r5   
test_nbdtr  ru   zTestCephes.test_nbdtrc                 C   r   r   )r   r0   nbdtrcr2   r4   r4   r5   test_nbdtrc  ru   zTestCephes.test_nbdtrcc                 C   r   r   )r   r0   nbdtrir2   r4   r4   r5   test_nbdtri  ru   zTestCephes.test_nbdtric                 C   r   )NrJ   r=   rq   )r0   nbdtrikr2   r4   r4   r5   __check_nbdtrik  r   zTestCephes.__check_nbdtrikc                 C   r7  r~   )r   r0   nbdtrinr2   r4   r4   r5   test_nbdtrin  ru   zTestCephes.test_nbdtrinc                 C   rd  r   )r   r0   ncfdtrr2   r4   r4   r5   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 )NrJ   r   r   )rq   rJ   r  r<   rx   r  )r   r0   ncfdtrir  r   )r3   fr4  r4   r4   r5   test_ncfdtri  s   zTestCephes.test_ncfdtric                 C   s2   g d}t d|dd}tt d|dd| d S )N)rJ   r<   rx   r<   r   ri   )r0   r  r   
ncfdtridfd)r3   dfdr4  r4   r4   r5   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"  rJ   r<   rx   g     @r<   r   ri   gh㈵>rC   )r0   r  r   
ncfdtridfn)r3   dfnr4  r4   r4   r5   test_ncfdtridfn  s   zTestCephes.test_ncfdtridfnc                 C   s2   g d}t dd|d}tt dd|d| d S )N)rq   r  r   r<   rx   ri   )r0   r  r   	ncfdtrinc)r3   ncr4  r4   r4   r5   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 )NrJ   r   rq   	   i   r   r   rr   r   r   r   )	r   r0   nctdtrr   rO   r   r   r   r   r2   r4   r4   r5   test_nctdtr  s   zTestCephes.test_nctdtrc                 C   r   )NrJ   rq   r   )r0   	nctdtridfr2   r4   r4   r5   __check_nctdtridf  r   zTestCephes.__check_nctdtridfc                 C   s   t ddd d S rR  )r0   	nctdtrincr2   r4   r4   r5   test_nctdtrinc  r   zTestCephes.test_nctdtrincc                 C   r   )Nr"  r   rq   )r0   nctdtritr2   r4   r4   r5   test_nctdtrit  r   zTestCephes.test_nctdtritc                 C   r7  )Nrq   rJ   rr   )r   r0   nrdtrimnr2   r4   r4   r5   test_nrdtrimn  ru   zTestCephes.test_nrdtrimnc                 C   s   t tddddddd d S )Nrq   r   r   rM   )r   r0   nrdtrisdr2   r4   r4   r5   test_nrdtrisd  s   
zTestCephes.test_nrdtrisdc                 C      t dddd d S rR  )r0   obl_ang1r2   r4   r4   r5   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 )NrJ   r   rr   r   )r0   obl_ang1_cvr   )r3   resultr4   r4   r5   test_obl_ang1_cv  s   zTestCephes.test_obl_ang1_cvc                 C   rp   NrJ   r   r   )r   r0   obl_cvr2   r4   r4   r5   _check_obl_cv  ru   zTestCephes._check_obl_cvc                 C   r  rR  )r0   obl_rad1r2   r4   r4   r5   test_obl_rad1  r   zTestCephes.test_obl_rad1c                 C      t ddddd d S rR  )r0   obl_rad1_cvr2   r4   r4   r5   test_obl_rad1_cv  r   zTestCephes.test_obl_rad1_cvc                 C   r  rR  )r0   obl_rad2r2   r4   r4   r5   test_obl_rad2  r   zTestCephes.test_obl_rad2c                 C   r  rR  )r0   obl_rad2_cvr2   r4   r4   r5   test_obl_rad2_cv  r   zTestCephes.test_obl_rad2_cvc                 C   r   )NrJ   r   r  )r   r0   pbdvr2   r4   r4   r5   	test_pbdv  r   zTestCephes.test_pbdvc                 C   r  rR  )r0   pbvvr2   r4   r4   r5   	test_pbvv  r  zTestCephes.test_pbvvc                 C   r  rR  )r0   pbwar2   r4   r4   r5   	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   rJ   r?   r   rJ   r<   )rJ   rJ   rJ   )r0   pdtrr   rO   r   r   r3   valr4   r4   r5   	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   rJ   r?   r,  r   )r   r   r   )r0   pdtrcr   rO   r   r   r.  r4   r4   r5   
test_pdtrc,  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 integerrq   )r   r  r  r0   pdtri)r3   r  r4   r4   r5   
test_pdtri3  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 )Nrq   rJ   r   r   ffffff?)r   #B;r-  )rx   rx   )r0   pdtrikr   	gammainccr   rO   r   )r3   rY   r4   r4   r5   test_pdtrik8  s   zTestCephes.test_pdtrikc                 C   r  rR  )r0   pro_ang1r2   r4   r4   r5   test_pro_ang1?  r   zTestCephes.test_pro_ang1c                 C   s    t tdddddtd d S )NrJ   r   r  )r   r0   pro_ang1_cvr   r2   r4   r4   r5   test_pro_ang1_cvB  s   zTestCephes.test_pro_ang1_cvc                 C   rp   r  )r   r0   pro_cvr2   r4   r4   r5   _check_pro_cvF  ru   zTestCephes._check_pro_cvc                 C   r  rU  )r0   pro_rad1r2   r4   r4   r5   test_pro_rad1I  r   zTestCephes.test_pro_rad1c                 C   r  rR  )r0   pro_rad1_cvr2   r4   r4   r5   test_pro_rad1_cvL  r   zTestCephes.test_pro_rad1_cvc                 C   r  rR  )r0   pro_rad2r2   r4   r4   r5   test_pro_rad2O  r   zTestCephes.test_pro_rad2c                 C   r  rR  )r0   pro_rad2_cvr2   r4   r4   r5   test_pro_rad2_cvR  r   zTestCephes.test_pro_rad2_cvc                 C   r.   ra   )r0   psir2   r4   r4   r5   test_psiU  r7   zTestCephes.test_psic                 C   s   t tdddd d S r/   )r   r0   radianr2   r4   r4   r5   test_radianX  ru   zTestCephes.test_radianc                 C   r   r   )r   r0   rH  r2   r4   r4   r5   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            @rE  )r   r0   roundr2   r4   r4   r5   
test_round^  s   zTestCephes.test_roundc                 C   r.   ra   )r0   shichir2   r4   r4   r5   test_shichif  r7   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 )NrJ   rq   r   z cosine integral(-inf) is not nan)r0   sicirO   r   r   r   r   r   )r3   sr  r4   r4   r5   	test_sicii  s   

zTestCephes.test_sicic                 C   r   NZ   rr   )r   r0   sindgr2   r4   r4   r5   
test_sindgt  r   zTestCephes.test_sindgc                 C   s.   t tddd tttdtj d S )NrJ   r"  ?)r   r0   smirnovr   rO   r   r   r2   r4   r4   r5   test_smirnovw  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 )	NrJ   r"  r?   r<         ?      rx   g      ȿ)r   r0   	_smirnovpr   rO   r   r   r2   r4   r4   r5   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 )
NrJ   r"  r   r$  Tendpointrx   r   r:   )
r   r0   	_smirnovcr   rO   r   r   r  r   r^  )r3   x10x4r4   r4   r5   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 NrJ   r=   333333?)r   r0   r^  smirnovir   rO   r   r   r2   r4   r4   r5   test_smirnovi     zTestCephes.test_smirnovic                 C   rj  rk  )r   r0   rf  
_smirnovcir   rO   r   r   r2   r4   r4   r5   test_smirnovci  ro  zTestCephes.test_smirnovcic                 C   r   r   )r   r0   spencer2   r4   r4   r5   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 )NrJ   r   rq   r`  r<   gMoF?)r   r0   stdtrr   r2   r4   r4   r5   
test_stdtr     zTestCephes.test_stdtrc                 C   r  )Nffffff?rJ   )r0   stdtridfr2   r4   r4   r5   test_stdtridf  r  zTestCephes.test_stdtridfc                 C   r  )NrJ   rw  )r0   stdtritr2   r4   r4   r5   test_stdtrit  r  zTestCephes.test_stdtritc                 C   r   r   )r   r0   struver2   r4   r4   r5   test_struve  r   zTestCephes.test_struvec                 C   r   r   )r   r0   tandgr2   r4   r4   r5   
test_tandg  r   zTestCephes.test_tandgc                 C   r   r   )r   r0   tklmbdar2   r4   r4   r5   test_tklmbda  r   zTestCephes.test_tklmbdac                 C   r.   ra   )r0   y0r2   r4   r4   r5   test_y0  r7   zTestCephes.test_y0c                 C   r.   ra   )r0   r  r2   r4   r4   r5   test_y1  r7   zTestCephes.test_y1c                 C   rX  ra   )r0   ynr2   r4   r4   r5   test_yn  r  zTestCephes.test_ync                 C   rX  ra   )r0   yvr2   r4   r4   r5   test_yv  r  zTestCephes.test_yvc                 C   rX  ra   )r0   yver2   r4   r4   r5   
_check_yve  r  zTestCephes._check_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   rl  r   r   rr   g      "g      "@g4׵/Yg8EGr?rP  gffffff@ig>@r   g|Pk?r$  rJ   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<rB   rC   )r  r+   r0   wofz)r3   r(  wr4   r4   r5   	test_wofz  sr   "zTestCephes.test_wofzN)__name__
__module____qualname__r6   r9   r\   r`   rk   ro   rt   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   r  r  r  r
  r  r  r  r  r  r  r  r  r  pytestmarkxfailr+  r0  r2  r5  r6  r9  r=  r@  rB  rC  rJ  rL  rM  rO  rQ  rT  rW  rZ  r\  r^  r`  rc  rf  rh  rj  rl  rn  rp  rr  rt  rv  rx  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  r  r  r  r  r  r  r  r  r  r  r  r  r  r  _TestCephes__check_nbdtrikr  r  r  r  r  r  r	  _TestCephes__check_nctdtridfr  r  r  r  r  r  r  r  r!  r#  r%  r'  r)  r+  r0  r2  r5  r:  r<  r>  r@  rB  rD  rF  rH  rJ  rL  rM  rS  rU  rX  r\  r_  rc  ri  rn  rq  rs  ru  ry  r{  r}  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r-   /   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   r1   r   r   r  r4   r4   r5   r6     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{?r@   )	r   r8   r1   rc   r   r   absr   r   )r3   abb1rX   r4   r4   r5   r9     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$  rJ   )g7;1[ge*JgVwgL g<3r.  )gNݿg3%IQ`?gZyΌ׿gʀ11^?g33tտrx   )gqM0=C?g7uTg\G`?gp⍞vg$.m?)r   bi_zerosr   r   )r3   bibiar4   r4   r5   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 )NrJ   gcqg!xLgMSt$?g ~:p?r:   )r   ai_zerosr   r   )r3   air4   r4   r5   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  rJ   r   rL   rC   r   rM   r@   )guqgqHkZg4g9Ζ%gB~gL")gLgQO	gMQnGg3:g)}g )r   r  r1   r  r   )r3   r(  zpai_zpxaip_zxai_zaip_z_ai_zpaip_zpai_envelopeaip_enveloper4   r4   r5   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 )Nr  rJ   r   rL   rC   r   rM   r@   )gx&gg-2+
gRgg`gu%́g{ )g K;1[g*JgVwg<w gd
3g/{
")r   r  r1   r  r   )r3   r(  r  bi_zpxbip_zxr  bi_zbip_zbi_zpbip_zpbi_envelopebip_enveloper4   r4   r5   test_bi_zeros_big;  r  zTestAiry.test_bi_zeros_bigN)	r  r  r  r6   r9   r  r  r  r  r4   r4   r4   r5   r    s    

!r  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$  rJ   r   r  )r   genlaguerreassoc_laguerrer   )r3   a1a2r4   r4   r5   test_assoc_laguerreU  s
   z%TestAssocLaguerre.test_assoc_laguerreN)r  r  r  r  r4   r4   r4   r5   r  T      r  c                   @   r  )TestBesselpolyc                 C      d S Nr4   r2   r4   r4   r5   r   ^     zTestBesselpoly.test_besselpolyN)r  r  r  r   r4   r4   r4   r5   r  ]  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%S )&
TestKelvinc                 C      t d}t|dd d S )Nr<   gT?r   )r   r   r   )r3   mbeir4   r4   r5   r   c     
zTestKelvin.test_beic                 C   r  )Nr<   gD,X?r   )r   r   r   )r3   mbeipr4   r4   r5   r   g  r  zTestKelvin.test_beipc                 C   r  )Nr<   gPA4?r   )r   r   r   )r3   mberr4   r4   r5   r   k  r  zTestKelvin.test_berc                 C   r  )Nr<   gii߿r   )r   r   r   )r3   mberpr4   r4   r5   r   o  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   	bei_zerosr   r   )r3   r  r4   r4   r5   test_bei_zeross  s   
zTestKelvin.test_bei_zerosc                 C   r  )Nr   )gyWo.@g╲ݏ @gנ{)@gK11@gWc"5@r  )r   
beip_zerosr   r   )r3   bipr4   r4   r5   test_beip_zeros|     
zTestKelvin.test_beip_zerosc                 C   r  )Nr   g\@g6ُ@gӟHY'@g>"D0@ggaO;4@r:   )r   	ber_zerosr   r   )r3   r   r4   r4   r5   test_ber_zeros  r  zTestKelvin.test_ber_zerosc                 C   r  )Nr   g '@gs%@gF ^-@gvۅj3@gB7@r:   )r   
berp_zerosr   r   )r3   brpr4   r4   r5   test_berp_zeros  r  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   r  r  r   r   r  r  )r3   mkelvr4   r4   r5   test_kelvin  s   
zTestKelvin.test_kelvinc                 C   r  )Nr<   g>ɿr   )r   r  r   )r3   mkeir4   r4   r5   r    r  zTestKelvin.test_keic                 C   r  )Nr<   gr@d"?r   )r   r  r   )r3   mkeipr4   r4   r5   r    r  zTestKelvin.test_keipc                 C   r  )Nr<   gܙUr   )r   r  r   )r3   mkerr4   r4   r5   r    r  zTestKelvin.test_kerc                 C   r  )Nr<   g^.n3Jr   )r   r  r   )r3   mkerpr4   r4   r5   r    r  zTestKelvin.test_kerpc                 C   r  )Nr   gE>Q@gB= @gPN)@gm91@g
%5@r:   )r   	kei_zerosr   r   )r3   r  r4   r4   r5   test_kei_zeros  r  zTestKelvin.test_kei_zerosc                 C   r  )Nr   gWf,@g?"@gFZ*o+@gOpN2@gEa6@r:   )r   
keip_zerosr   r   )r3   r  r4   r4   r5   test_keip_zeros  r  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   r  r:   r  )#?Q5U@q89 %@ol`.@gO0q3@r  r  )gum.@gݏ @gs{)@g䠄11@gN(D!5@gS@g89@@g^C'@g1ZG0@g+ڇ4@r  )r   kelvin_zerosr   r   )
r3   tmpberzbeizkerzkeizberpzbeipzkerpzkeipzr4   r4   r5   test_kelvin_zeros  s4   
zTestKelvin.test_kelvin_zerosc                 C   r  )Nr   )r  r  r  r  gD;q3@r:   )r   	ker_zerosr   r   )r3   r  r4   r4   r5   test_ker_zeros  r  zTestKelvin.test_ker_zerosc                 C   r  )Nr   r  r:   )r   
kerp_zerosr   r   )r3   r  r4   r4   r5   test_kerp_zeros  r  zTestKelvin.test_kerp_zerosN)r  r  r  r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r  b  s&    		.r  c                   @   r  )TestBernoullic                 C   r  )Nr   )rr   ra  g-!lV?r   g镲r   r:   )r   	bernoullir   r   )r3   brnr4   r4   r5   test_bernoulli  s   
zTestBernoulli.test_bernoulliN)r  r  r  r  r4   r4   r4   r5   r    r  r  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:   r@   r  )r   r   r   r   )r3   betbetgr4   r4   r5   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   r  r   r   )r3   betlnr  r4   r4   r5   r        zTestBeta.test_betalnc                 C   s   t ddd}t|dd d S )NrJ   r   r  )r   r   r   )r3   btincr4   r4   r5   r        zTestBeta.test_betaincc                 C   s,   t ddd}t dd|}t|dd d S )Nr<   r:   rq   r   )r   r   r   r   )r3   r'  compr4   r4   r5   r        zTestBeta.test_betaincinvN)r  r  r  r   r   r   r   r4   r4   r4   r5   r    s
    r  c                   @   s   e Zd Zdd Zejdddgejdddg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.  rx   r:         ^@g     @j@Texactx   )r  
repetition   c                 S   s   g | ]
}t jd |ddqS )r^   Tr  )r   comb).0rY   r4   r4   r5   
<listcomp>"  s    z/TestCombinatorics.test_comb.<locals>.<listcomp>r  r^   r   rN   rJ   l   hU7`S?Q r  2   )r   r   r  r   r   r   rc   listrO   iinforb   max)r3   iir)  r4   r4   r5   	test_comb  s   zTestCombinatorics.test_combr  TFlegacyrY   rQ  rx   N      @r:   c                 C   s   |r0|t |ks|t |kr0tjtdd tj||d||d}W d    n1 s*w   Y  n
tj||d||d}|rW|rNt || d t |}}d}n	t |t |}}tj||||d}t|| d S )Nz1Non-integer arguments are currently being cast tomatchT)r  r  r  rJ   F)r  r  )rb   r  warnsDeprecationWarningr   r  r   )r3   r  rY   r  r  r  r)  r4   r4   r5   test_comb_legacy+  s(   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   rF   Tr  )rO   int64r   r  )r3   rX   rY   np_nnp_kres_npres_pyr4   r4   r5   test_comb_with_np_int64I  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<   rx   Tr  r   r?   Fr<   r?   r<   r.  rx   rx   r?   rx   )r   r   r   r  )r   r   r  r   r2   r4   r4   r5   test_comb_zerosR     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.  rx   r:        @g     @Tr  i  )r   r   permr   r   r2   r4   r4   r5   	test_permZ  s   zTestCombinatorics.test_permc                 C   r,  )Nr<   rx   Tr  r   r?   Fr-  r.  )r   r   r   r1  )r   r   r2  r   r2   r4   r4   r5   test_perm_zeros_  r0  z!TestCombinatorics.test_perm_zerosN)r  r  r  r  r  r  parametrizer$  r+  r/  r3  r4  r4   r4   r4   r5   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   )r3   cbcbrlr4   r4   r5   r   i     
zTestTrigonometric.test_cbrtc                 C      t d}d}t||d d S )Ngfffff;@g鎖C@r  )r   r   r   )r3   cb1cbrl1r4   r4   r5   test_cbrtmoren     
zTestTrigonometric.test_cbrtmorec                 C   &   t d}ttd }t||d d S )NrZ  r   r  r   r   r	   r   r   )r3   cdgcdgrlr4   r4   r5   r   s     
zTestTrigonometric.test_cosdgc                 C   rA  NrF         @r  rB  )r3   cdgmcdgmrlr4   r4   r5   test_cosdgmorex  rE  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.  rJ   r  )r   r   r   r	   r   )r3   cscsrlr4   r4   r5   r   }  s    &zTestTrigonometric.test_cosm1c                 C   *   t d}ttd d }t||d d S )NrF   rG  r?   r  r   r   r
   r   r   )r3   ctctrlr4   r4   r5   r        
zTestTrigonometric.test_cotdgc                 C   rM  )Nr   r  r?   r  rN  )r3   ct1ctrl1r4   r4   r5   test_cotdgmore  rQ  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   rr      r   rZ  r   i   y   i  i;  i  )r   r   r   r2   r4   r4   r5   test_specialpoints  s   z$TestTrigonometric.test_specialpointsc                 C   s&   t tdgd ttdd d S )Nr   rJ   r   rr   )r   r   sincr   r2   r4   r4   r5   	test_sinc  s   zTestTrigonometric.test_sincc                 C      t d}t|d d S rY  )r   r[  r   )r3   snr4   r4   r5   r\       
zTestTrigonometric.test_sindgc                 C   H   t d}ttd }t||d t d}ttd }t||d d S )NrF   rG  r  r   r  )r   r[  r   r   r   )r3   snmsnmrlsnm1snmrl1r4   r4   r5   test_sindgmore     

z TestTrigonometric.test_sindgmoreN)r  r  r  r   r?  r   rJ  r   r   rT  r]  r_  r\  rh  r4   r4   r4   r5   r6  h  s    r6  c                   @   $   e Zd Zdd Zdd Zdd ZdS )	TestTandgc                 C   rA  rF  r   r~  r
   r   r   )r3   tntnrlr4   r4   r5   r    rE  zTestTandg.test_tandgc                 C   rc  )Nr   r  r  r  r   rl  )r3   tnmtnmrltnm1tnmrl1r4   r4   r5   test_tandgmore  ri  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   rU  r   rr   rV  r   rW  rX  r  iLrY  rZ  r[  r\  )r   r   r~  r2   r4   r4   r5   r]    s   zTestTandg.test_specialpointsN)r  r  r  r  rs  r]  r4   r4   r4   r5   rk    s    rk  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.rq   N)r   r	  rO   r   r2   r4   r4   r5   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   rr      )r   r	  r   r	   r   )r3   elrelr4   r4   r5   r
    r  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   rr   r<   r?   gN?)
r   r!   r   r   r"   rO   r   r   r   r   )r3   elkr4   r4   r5   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   ri   r^   r  r   gfoKh?r  r   rr   r   rq   gt?rJ   r=   r   rC   6<R!?ry  gfON?)r   r  r   r!   r   r   r   rO   r   r   r   )r3   elkincrz  alphaphir  r4   r4   r5   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.  rJ   gV^8j?g,j6Ƅ@r<   )	rO   	nextafterrc   appendr   r  r   	full_liker   r3   mbadr~  r  mvalsjr  f1r4   r4   r5   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<   Frd  rJ   r  rC   )rO   r_   r  r   r   r   r  arcsinhr
   r   r   )r3   xlogxlinxlin2r4   r4   r5   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<   rr   ry  g?eg@)	r   r    r   r   r   rO   r   r   r   )r3   eler4   r4   r5   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   rU  4   r  #   g'?r  r   rr   r   rq   r{  ry  gL@)r   r  r   r    r   r   r   rO   r   r   r   )r3   eleincr  r}  r~  r  r4   r4   r5   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.  rJ   g%?r<   gXo
@r:   )	rO   r  rc   r  r   r  r   r  r   r  r4   r4   r5   test_ellipeinc_2@  r  zTestEllip.test_ellipeinc_2N)r  r  r  ru  r
  r  r  r  r  r  r  r  r4   r4   r4   r5   rt    s    rt  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 )NrJ   r   r   r   g      @r   r%                      r   y
c?
cy=B?CGֿr   y檠f?P9lb?)
r   r#   r   r   r  r   rO   r   r   	enumerater3   argsexpected_resultsrg   arrr4   r4   r5   test_elliprcV  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 )NrJ   r   r<   r   g`C+?r   r   r?   )r   r   rr   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   rO   r   r  r   r   doubletinyr   r  r  r4   r4   r5   test_elliprdj  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 )NrJ   r   r<   gPO?r   r?   )rr   r   r   )r%  r  r   )rq   rr   r   r  r%  r   r  r  )r  r%        ?      )geQO?ʞu5J?r  yp\y?kg2ΰ?gHwд?y|pF?-6Fj)	r   r%   r   rO   r   r   r  r   r  r  r4   r4   r5   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 )NrJ   r   rq   )r         0@r  r  r  r  )r  r  r%  )r   g8d`?r  gL+?g}^?y旮0?ʋW?yjN?^?gt?)	r   r&   rO   r   r   r  r   r   r  r  r4   r4   r5   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 )NrJ   r   r   r?   )r   rr   r   r   )r   r   r  r   )r   r   r  r  )r%  r  r   r   )r              rr   r   )r%  r  r   r  )r  r  rr   y            ?)r   r   r  ra  )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  r4   r4   r5   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+<r7  r   g   ,@g    x=g   @e:g   `ݽ>g(HR)A)r   r'   r2   r4   r4   r5   test_elliprj_hard  s    
z"TestEllipCarlson.test_elliprj_hardN)r  r  r  __doc__r  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r  Q  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   rr   r   r   r?   r   )rO   r   m_n1_1r   r   minmax_neglog2
very_neg_mconcatenate
ms_up_to_1r2   r4   r4   r5   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   rr   N)r  r   r!   r%   r3   r  r4   r4   r5   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   rr   N)	r   r   r  r   rO   r  r   r"   r%   )r3   r  m1r4   r4   r5   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   rr   N)r  r   r    r&   r  r4   r4   r5   test_e  s   "z)TestEllipLegendreCarlsonIdentities.test_eN)r  r  r  r  r  r  r  r  r4   r4   r4   r5   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   )r3   err4   r4   r5   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   	erf_zerosr   r   )r3   erzerzrr4   r4   r5   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 )NrE   r  g{Gz?r<   r   rJ   r%  ignoreallr   )	rO   rU   rV   paretorandinterrstater   isfiniter+   )r3   func
other_funcrD   rN   rX   r   r'  r(  r  w_realmaskr4   r4   r5   _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   r0   r  r(  r4   r4   r5   <lambda>/  s    z.TestErf.test_erfc_consistent.<locals>.<lambda>rl   r   r   )r  r0   r  r2   r4   r4   r5   test_erfc_consistent,  s   
zTestErf.test_erfc_consistentc                 C      | j tjdd dd d S )Nc                 S   s   t | |  t|  S r  )rO   r   r0   r  r  r4   r4   r5   r  7  s    z/TestErf.test_erfcx_consistent.<locals>.<lambda>rl   rC   )r  r0   erfcxr2   r4   r4   r5   test_erfcx_consistent4  
   
zTestErf.test_erfcx_consistentc                 C   r  )Nc                 S   s   dt d|   S )Nr  r%  r  r  r4   r4   r5   r  >  s    z.TestErf.test_erfi_consistent.<locals>.<lambda>rl   rC   )r  r0   erfir2   r4   r4   r5   test_erfi_consistent;  r  zTestErf.test_erfi_consistentc                 C   r  )Nc                 S   s&   t td t|  |   t|  S r  )r   r   rO   r   r0   r  r  r4   r4   r5   r  E  s   & z/TestErf.test_dawsn_consistent.<locals>.<lambda>rl   rC   )r  r0   r   r2   r4   r4   r5   test_dawsn_consistentB  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 )Nr?   rJ   r   rC   )rO   r   r   r   r   r  r3   rI  r)  r4   r4   r5   test_erf_nan_infI     zTestErf.test_erf_nan_infc                 C   r  )Nr<   r   r   rC   )rO   r   r   r   r   r  r  r4   r4   r5   test_erfc_nan_infN  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   rC   )rO   r   r   r   r   r  r  r4   r4   r5   test_erfcx_nan_infS  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   rC   )rO   r   r   r   r   r  r  r4   r4   r5   test_erfi_nan_infX  s   zTestErf.test_erfi_nan_infc                 C   r  )Nr  r   r   rC   )rO   r   r   r   r   r   r  r4   r4   r5   test_dawsn_nan_inf]  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   rC   )rO   r   r   r   r   r  r  r4   r4   r5   test_wofz_nan_infb  s   zTestErf.test_wofz_nan_infN)r   )r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r    s    
	r  c                   @   r  )	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   rJ   r<   r   rC   )rJ   r   r?   r   )rJ   rJ   r   =   ii  iY  i=) il   Q~ l   10[l   $8gC
 l   2l   v}Ju: )r   drv  r  r  r   rU  )r   eulerr   r   rc   rd   rO   r  r   r  r   )
r3   eu0eu1eu2eu24	mathworldcorrectrY   errerrmaxr4   r4   r5   
test_euleri  s$   





zTestEuler.test_eulerN)r  r  r  r  r4   r4   r4   r5   r  h  r  r  c                   @   r  )TestExpc                 C   r7  )Nr<   r:   )r   r  r   r3   exexrlr4   r4   r5   r    r;  zTestExp.test_exp2c                 C   r<  )N      @g;f@r  )r   r  r   r3   exmexmrlr4   r4   r5   test_exp2more  r@  zTestExp.test_exp2morec                 C   r7  )Nr<   r  )r   r  r   r  r4   r4   r5   r    r;  zTestExp.test_exp10c                 C   r<  )Nr  gYs@r  )r   r  r   r  r4   r4   r5   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<   rx   r:   rJ   r  r   r  r   r   r  r4   r4   r5   r       "zTestExp.test_expm1c                 C   r  )Nr<    @皙@rJ   r  r  )r3   ex1exrl1r4   r4   r5   test_expm1more  r  zTestExp.test_expm1moreN)	r  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r    s    r  c                	   @   s   e Zd Zdd Zejdddeddfeddfgd	d
 Z	dd Z
dd Zejdejdfejdfeejgdfeejgdfgdd Zejjejdkdddd ZdS )TestFactorialFunctionsc                 C   s  t tdd t tdd t tdd t g dtjg ddd t tdd	gd
d	ggddgddgg ttjdddd ttjdddd ttjdddd ttjdddd ttjdddd ttjg dddg d ttdd	gd
d	ggdddgddgg tttdddttddd tttdddttddd tttdddttddd dD ]}tdtd| tg dtg d| qtddD ]Q}t|}t|t|d t|t|gdd  t	t
|t|d t	t
|t|gdd  tt|dt|d tt|gdt|gd qd S )Nr   rJ   r<   )rG  r?  r  )rx   r:   r   Fr  r   rx   r:   r  r@   r   Tri       Xn)r>   r:   ri   r.  )i  r   r  i _7    )TF)rJ   r<   r   r   )rJ   r<   rD  )r   r   	factorialr   rO   r   r   rc   mathr   rd   )r3   r  rX   r  r4   r4   r5   test_factorial  s^   

z%TestFactorialFunctions.test_factorialzx, exact)rJ   T)rJ   FrJ   TFc                 C   s   t tj||dsJ d S Nr  )rO   isscalarr   r  )r3   r   r  r4   r4   r5   test_factorial_0d_return_type  s   z4TestFactorialFunctions.test_factorial_0d_return_typec                 C   s4   t g dtjg ddd ttjdddd d S )N)g     @Z@g      x@g     @)r>   r  r  Fr  r>   Ti   )r   r   
factorial2r   r2   r4   r4   r5   test_factorial2  s   z&TestFactorialFunctions.test_factorial2c                 C   s0   t tjddddd t tjddddd d S )Nr   rJ   Tr  r  rx   r.  )r   r   
factorialkr2   r4   r4   r5   test_factorialk     z&TestFactorialFunctions.test_factorialkc                 C   s    t j||d}tt| d S r  )r   r  r   rO   r   )r3   r   r  r  r4   r4   r5   test_nan_inputs  s   z&TestFactorialFunctions.test_nan_inputs)rx   r.  z*Python 3.10+ math.factorial() requires intr   c              	   C   s   t t jdddt jg}t ;}|td tj|dd}tt t jdddt jg| tj|dd}tt t jdddt jg| W d    d S 1 sMw   Y  d S )	NrJ   r<   rx   z-Using factorial\(\) with floats is deprecatedTr  r@   F)	rO   r   r   r   r  r#  r   r  r   )r3   r   r  r  r4   r4   r5   test_mixed_nan_inputs  s    "z,TestFactorialFunctions.test_mixed_nan_inputsN)r  r  r  r
  r  r  r5  rO   r   r  r  r  r   r  skipifsysversion_infor  r4   r4   r4   r5   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)rq   gN?ց[?)y      ?        r  r  )y       ?yn<ӿj<Cy)BR;߿ux7Q?)y      yھ|}-2?y/?!ۿ)rG  GM?pBR?)y      @        r  r  )y              @y       GMܿy        pBR?)y              gGMܿgpBR߿)y             y        GM?y       pBR߿rq   ra  c                 C   s&   t t|}t|t ||gd d S )Nr  )r   r   r<  r   )r3   r(  rW  r  frsr4   r4   r5   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@Ǻ?rx   )y.1?ǘ?yʡE6@:#J{/?yq-
@y&1?yh o@߾3?yW2q@qh?r   rJ   rU  )r   fresnel_zerosr   r   r<  )r3   szoczovals1vals2r4   r4   r5   test_fresnel_zeros/  s   

zTestFresnel.test_fresnel_zerosc                 C   s(   t d\}}t d}t||d d S )Nr@   r  )r   r   fresnelc_zerosr   )r3   r!  r"  frcr4   r4   r5   test_fresnelc_zerosB     
zTestFresnel.test_fresnelc_zerosc                 C   s(   t d\}}t d}t||d d S )Nr   r  )r   r   fresnels_zerosr   )r3   r!  r"  r  r4   r4   r5   test_fresnels_zerosG  r)  zTestFresnel.test_fresnels_zerosN)r  r  r  r  r  r5  rO   r   r  r%  r(  r+  r4   r4   r4   r5   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   )r3   gamr4   r4   r5   r@  N  rb  zTestGamma.test_gammac                 C   s(   t d}tt d}t||d d S )Nrx   r  )r   r   r   r   r   )r3   gamlnlngamr4   r4   r5   rC  R     
zTestGamma.test_gammalnc                 C   s(   t dd}t dd}t||d d S )Nrq   r  )r   rA  gammaincinvr   )r3   gccinvgcinvr4   r4   r5   rB  W     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=   rJ   r.  g?g`	\;r   r  gmb<g      &@)r   r1  gammaincr   r3   r'  r   r4   r4   r5   test_gammaincinv\  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?rJ   g^F    ?r=   rl   rC   )rO   r  r   r1  r5  r   )r3   ptsxpr'  r   r4   r4   r5   test_975h  s   zTestGamma.test_975c                 C   s(   t d}dt d }t||d d S )Nr  rJ   )r   rH  r   r   )r3   rgamrlgamr4   r4   r5   rM  u  r0  zTestGamma.test_rgammac                 C   s(   t ttd ttdd d S )Nr?   r   )r   rO   r   r   r   r   rH  r2   r4   r4   r5   test_infinityz  s   zTestGamma.test_infinityN)r  r  r  r@  rC  rB  r*   r7  r:  rM  r=  r4   r4   r4   r5   r,  M  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 Nr  r<   rx   rU  )r   r   rY  r2   r4   r4   r5   
test_negv1     "zTestHankel.test_negv1c                 C   8   t dd}t ddt ddd  }t||d d S NrJ   r"  r%  r  )r   rY  r  r  r   )r3   hank1hankrlr4   r4   r5   rZ       zTestHankel.test_hankel1c                 C   r?  r@  )r   r   r[  r2   r4   r4   r5   test_negv1e  rB  zTestHankel.test_negv1ec                 C   0   t dd}t ddtd }t||d d S )NrJ   r"  y       r  )r   r[  rY  r   r   )r3   hank1ehankrler4   r4   r5   r\    r  zTestHankel.test_hankel1ec                 C   r?  r@  )r   r   r]  r2   r4   r4   r5   
test_negv2  rB  zTestHankel.test_negv2c                 C   8   t dd}t ddt ddd  }t||d d S rD  )r   r]  r  r  r   )r3   hank2hankrl2r4   r4   r5   r^    rG  zTestHankel.test_hankel2c                 C   r?  r@  )r   r   r_  r2   r4   r4   r5   
test_neg2e  rB  zTestHankel.test_neg2ec                 C   s(   t dd}t dd}t||d d S )NrJ   r"  r  )r   r_  r   )r3   hank2ehankrl2er4   r4   r5   test_hankl2e  r4  zTestHankel.test_hankl2eN)r  r  r  rA  rZ  rH  r\  rL  r^  rP  rS  r4   r4   r4   r5   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   rC  rD  )r   h1vpjvpyvpr   )r3   h1h1realr4   r4   r5   	test_h1vp  rG  zTestHyper.test_h1vpc                 C   rM  rD  )r   h2vprV  rW  r   )r3   h2h2realr4   r4   r5   	test_h2vp  rG  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 )Nr  rq   Qvo?rl   rC   r   rr   r   r   )g      r?   r   rJ   r  )g̷?g3|t-Ք?rr   go?g{h?r  rq   r  r  )r   rJ   rq   )rr   gc?r_  r<   rx   rJ   )
r   r   hyp0f1rO   r   r   r  	row_stackassert_raises
ValueError)r3   r   r)  x1x2r4   r4   r5   test_hyp0f1  s"   zTestHyper.test_hyp0f1c                 C   s   t dd}t|d d S )N皙?      ?      ?y;EG?uM?)r   ra  r   )r3   resr4   r4   r5   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   rb  r   r   r   r  )r3   hyp1ref_datar  r  r  r)  r  r4   r4   r5   rc    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 )Nrq   r  g7B.g|:B.r  r   rb  r   )r3   rl  hyp2r4   r4   r5   test_hyp1f1_gh2957@	  r  zTestHyper.test_hyp1f1_gh2957c                 C   s   t ddd}t|dd d S )Nrq   r  ig<`?r  rn  )r3   hypr4   r4   r5   test_hyp1f1_gh2282E	  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 )(Nrq   rJ   r  |Gz?r  g?g|Gzr   r   r<   r  rh  )rx   rQ  r  rs  gYi2?r  rx   g433333?r:   r  r   r?   g      ?r   g      ?r   r  g      gUUUUUUտg  @gUUUUUU?g)r  ra  rr         $gEciH!@)r  rx   rJ   r6  gzG?)r<   r  rJ   r6  gy&1|)ra  rx   rJ   r6  g"nN%@?)r<   r  rJ   r6  g!J)r.  |      %@r  gzS;)r.  ru  g      %r  g[B.VP<test #%derr_msg)r   r   r   r	   r   r   r   r   r  re  r   )	r3   r   rg   r  r  r  r   r  cvr4   r4   r5   rf  I	  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 )NrJ   r"  r  g D?r>   )r#  rl  333333?g)r  g	@r  g	rq   r<   r  )	r   hyperur   r   r   r   rb  r   r   )r3   val1r  r  r(  hypuhprlr4   r4   r5   test_hyperuh	  s   $zTestHyper.test_hyperuc                 C   s   t tddddd d S )NrJ   r  g3333334@g(¨?r  )r   r   r|  r2   r4   r4   r5   test_hyperu_gh2287u	  s   zTestHyper.test_hyperu_gh2287N)r  r  r  rZ  r^  rg  rk  rc  rp  rr  rf  r  r  r4   r4   r4   r5   rT    s    rrT  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   )r3   it0r4   r4   r5   rz  {	     zTestBessel.test_itj0y0c                 C   r  )Nr   gbqTtt?g/]ooۿr  )r   r   rq  r   )r3   it2r4   r4   r5   rr  	  r  zTestBessel.test_it2j0y0c                 C      t tddtdd d S Nrx   r<   r  )r   r   r  r2   r4   r4   r5   test_negv_iv	     zTestBessel.test_negv_ivc                 C   &   t d}t dd}t||d d S Nr"  r   r  )r   r  r  r   r3   ozozrr4   r4   r5   r  	  rE  zTestBessel.test_j0c                 C   r  Nr"  rJ   r  )r   r  r  r   r3   o1o1rr4   r4   r5   r  	  rE  zTestBessel.test_j1c                 C      t dd}t|dd d S )NrJ   r   ;x?r  )r   r  r   )r3   jnnrr4   r4   r5   r  	     zTestBessel.test_jnc                 C   r?  r@  )r   r   r  r2   r4   r4   r5   test_negv_jv	  rB  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  rL   g)%->)g@rL   g5c)!9)r  r  g%,Ϳr  rw  rx  )r  r   r  r   )r3   r   rg   r  r   r'  ycr4   r4   r5   r  	  s   zTestBessel.test_jvc                 C   r?  r@  )r   r   r  r2   r4   r4   r5   test_negv_jve	  rB  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 )NrJ   r   r  r  ?      ?)r   r  r   r  r   r  r&  )r3   jvexpjvexp1r(  jvexprr4   r4   r5   test_jve	  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   rJ   )go@.=@gzj,[@glN!@g5/ D'@gh>-@r:   gW@g0@gQX$@g*@g8*5{x0@rI   )gEk[@g~Cju]@gYrʝ^@g, `@gf	`@rB   rC   -  )gts@g&ǭr3t@gWt@g,$Y&u@gu@)r   jn_zerosr   r   r   )r3   jn0jn1jn102jn301r4   r4   r5   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;@rB   rC   i  g8v@i+  gׂMm@r.  gxi@g	,@gи{>@i  r   )gUDX@g!@g*HS@gz5 @g@2;@r  )r   r  r   r   )r3   r  jn10jn3010r4   r4   r5   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 )NrJ   r<   r4   )rX   r   r  r4   r5   jnp	      z(TestBessel.test_jnjnp_zeros.<locals>.jnprJ   rF   r   r-  r  zInvalid t return for nt=%d)r   r  rc   jnjnp_zeroszipr   AssertionError)
r3   r  ntr(  rX   r  tzznnttr4   r  r5   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 )	NrJ   r   g(yu?gOXeS@ga!@gxi'@g'Nw(-@r:     r   r   r  )r   	jnp_zerosr   r   r   rV  )r3   r  r4   r4   r5   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 )NrJ   r   r  r  )"@g+@g-9(1!@gȘ'@g>tA}-@)g0v@gjt@gH.?$@g}"O*@gGŧp0@)r   
jnyn_zerosr   r   )r3   jnzr4   r4   r5   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<   rJ   rx   r.  )r   rV  r  r   )r3   jvprimjv0r4   r4   r5   test_jvp
  rG  zTestBessel.test_jvpc                 C   r  r  )r   r  r  r   )r3   ozkozkrr4   r4   r5   r  
  rE  zTestBessel.test_k0c                 C   r  r  )r   r  r  r   )r3   ozkeozkerr4   r4   r5   r  
  rE  zTestBessel.test_k0ec                 C   r  r  )r   r  r  r   )r3   o1ko1krr4   r4   r5   r  
  rE  zTestBessel.test_k1c                 C   r  r  )r   r  r  r   )r3   o1keo1kerr4   r4   r5   r  
  rE  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   rJ   r   r<   rx   rv  r   r:   r   r@   r  r  g      H@)rO   rU   r   jacobir   r  r   )
r3   r  r  P0P1P2P3cpp2cp3cr4   r4   r5   test_jacobi$
  s    &B2D8XzTestBessel.test_jacobic                 C   r  )Nr   r   _2?r  )r   r  r   )r3   kn1r4   r4   r5   r  6
  r  zTestBessel.test_knc                 C   r  Nr   r  rP  r   r   r  r2   r4   r4   r5   test_negv_kv:
  r  zTestBessel.test_negv_kvc                 C   r  )Nr   r   r  r.  r   r  r   )r3   kv0r4   r4   r5   test_kv0=
  r  zTestBessel.test_kv0c                 C   r  )NrJ   r   gKދ@r.  r  )r3   kv1r4   r4   r5   test_kv1A
  r  zTestBessel.test_kv1c                 C   r  )Nr<   r   g)lHH@r.  r  )r3   kv2r4   r4   r5   test_kv2E
  r  zTestBessel.test_kv2c                 C   r   )N    rJ   g.Ք"H)r   r   r  r2   r4   r4   r5   test_kn_largeorderI
  r   zTestBessel.test_kn_largeorderc                 C   s   t tddd d S )Nr   g =`XCr  r2   r4   r4   r5   test_kv_largeargL
  r   zTestBessel.test_kv_largeargc                 C   r  r  )r   r   r  r2   r4   r4   r5   test_negv_kveO
  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   )r3   kve1r  r(  kve2r  r4   r4   r5   test_kveR
  s   zTestBessel.test_kvec                 C   s*   d}t td| tjd|ddd d S )Nr  rJ   r   rX   r.  )r   r   r  kvp)r3   r(  r4   r4   r5   test_kvp_v0n1[
  s   &zTestBessel.test_kvp_v0n1c                 C   sN   d}d}t |d | || t ||  }t j||dd}t||d d S )Nr   r  rJ   r  r.  r   r  r  r   r3   r  r(  xcr   r4   r4   r5   test_kvp_n1_
  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<   rJ   r  r.  r  r  r4   r4   r5   test_kvp_n2f
  s
   <zTestBessel.test_kvp_n2c                 C   r  r  )r   r  r  r   r  r4   r4   r5   r  m
  rE  zTestBessel.test_y0c                 C   r  r  )r   r  r  r   r  r4   r4   r5   r  r
  rE  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<   rJ   r  r   r$  )r   y0_zerosr   r   r  r  )r3   yoypozozpor  allvalr4   r4   r5   test_y0_zerosw
  s    zTestBessel.test_y0_zerosc                 C   s*   t d}t|tdgtdgfd d S )NrJ   r  gѮBO?r   )r   y1_zerosr   r   )r3   r  r4   r4   r5   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 )NrJ   r  yL
F%u?!rh?y;OnгY?rx   )r   	y1p_zerosr   r   )r3   y1pr4   r4   r5   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   rC   )r   yn_zerosr   r   r   )r3   anr4   r4   r5   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@r@   +   r   r   r  r  r   )r   	ynp_zerosr   r   r   rW  r3   aor4   r4   r5   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   rW  r  r4   r4   r5   test_ynp_zeros_large_order
  s   z%TestBessel.test_ynp_zeros_large_orderc                 C   r  NrJ   r   5,1
r  )r   r  r   )r3   yn2nr4   r4   r5   r  
  r  zTestBessel.test_ync                 C   r?  r@  )r   r   r  r2   r4   r4   r5   test_negv_yv
  rB  zTestBessel.test_negv_yvc                 C   r  r  )r   r  r   )r3   yv2r4   r4   r5   r  
  r  zTestBessel.test_yvc                 C   r?  r@  )r   r   r  r2   r4   r4   r5   test_negv_yve
  rB  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 )NrJ   r   r  r  r  r?   )r   r  r   r  r   )r3   yve2yve2ryve22r4   r4   r5   test_yve
  s
   zTestBessel.test_yvec                 C   s8   t ddt dd d }t dd}t||d d S )NrJ   r   rx   r   r<   r.  )r   r  rW  r   )r3   yvpryvp1r4   r4   r5   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         4rt  r   ra  r   rr   {G(@r  r  )iry  r?   rr   r        i@g     y@g     Ă@g@  i'  Nrq   ir  rQ  )	itertoolsproductr   )r3   r  r(  r4   r4   r5   _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   )ry  rD   rN   )	r  rb   rO   r   r   r  r   r&  r   )r3   r  f2rD   rN   skipr  r(  c1c2c3r4   r4   r5   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 )NrL   u5% r   )r#  r   r  r  r2   r4   r4   r5   test_jv_cephes_vs_amos
     z!TestBessel.test_jv_cephes_vs_amosc                 C   r%  )Nr  r&  r   r#  r   r  r  r2   r4   r4   r5   test_yv_cephes_vs_amos
  r(  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  )r  )r  r(  r4   r4   r5   r  
  s    zETestBessel.test_yv_cephes_vs_amos_only_small_orders.<locals>.<lambda>r  r&  )rD   rN   r  r)  )r3   skipperr4   r4   r5   (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>r&  r   )rO   r  r#  r   r  r2   r4   r4   r5   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 rJ   rq   r?   r<   )r  r   r  r   r  r  r  r  gYngH׊>)rO   rU   rV   r  r  r   rb   r  r   r  r   r  r   argmaxr   )	r3   r  r  r   imskr   r!  dcrY   r4   r4   r5    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   r&  r   )r#  r   r  r  r2   r4   r4   r5   test_kv_cephes_vs_amos
  r  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 )	Nrx   r:   gP?r  r  g~Omʒ?gY8E@@gKSn)r   r   r  r2   r4   r4   r5   test_ticket_623  rv  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 Besselsr?   rJ   gl)ܿr  gPj?gk?g%E*2ig敋?gw--`?gÉB?gW?ra  g޴?gz|?a?gpx%?y      ?              ?      ?yYD?`{1wy6x?B]#Ӯ?y ?b>?y.}9d?8kؿy      ?333333?g333333ӿy333333?      ?r%  N)r   r   r  r  r  r  r  r   r  r  r  rY  r]  r2   r4   r4   r5   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 domainsrq   r?   rJ   r   r<   r:   N)r   r   r   r  r  r  r  r  r  r  r  r8   r  anyr2   r4   r4   r5   test_ticket_8544  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  rO   r   r  r2   r4   r4   r5   test_gh_7909E  r  zTestBessel.test_gh_7909c                 C   s(   t tddd t tddd dS )zReal-valued Bessel I overflowrJ   i  g~rG   i`  g ?los~Nr   r   r  r2   r4   r4   r5   test_ticket_503I  s   zTestBessel.test_ticket_503c                 C   r   )Nra  rJ   r4  r:  r2   r4   r4   r5   test_iv_hyperg_polesN  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<   rq   rJ   r?   r.  )r   r   r   r   r   r   r   r   r   r  r  r   epssumr3   r  r(  rX   rY   rr  r4   r4   r5   	iv_seriesQ  s   8*zTestBessel.iv_seriesc                 C   4   dD ]}|  d|\}}tt||||d qd S )Nrr   r   r  r   rN   ry  )rB  r   r   rg  r3   r(  valuer  r4   r4   r5   test_i0_seriesY     zTestBessel.test_i0_seriesc                 C   rC  )NrD  rJ   rE  )rB  r   r   rk  rF  r4   r4   r5   test_i1_series^  rI  zTestBessel.test_i1_seriesc                 C   sD   dD ]}dD ]}|  ||\}}tt||||||fd qqd S )N)r  rt  r   r   rr   r  r  )rr   r   r  y             @rE  )rB  r   r   r  r3   r  r(  rG  r  r4   r4   r5   test_iv_seriesc  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   rr   rL   r"  g0oO?rq   g!?grb?r  gpH?r   gC~?r   ggo?r  rw  rx  )r  r   rg  r   r   r3   r   rg   r   r  rz  r4   r4   r5   rh  i  s   	zTestBessel.test_i0c                 C   r  r  )r   ri  r  r   )r3   oizeoizerr4   r4   r5   rj  w  rE  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   rL   gj|=r"  gȕ![1?rq   g;͘?rr   gRΜ?r   g|?r   g}f?r  rw  rx  )r  r   rk  r   r   rM  r4   r4   r5   rl  |  s   zTestBessel.test_i1c                 C   r  r  )r   rm  r  r   )r3   oi1eoi1err4   r4   r5   rn    rE  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   )r3   iti0r4   r4   r5   rx    r  zTestBessel.test_iti0k0c                 C   s"   t d}t|tddgd d S )Nr"  gݳɄ|T?gVƥ
@r@   )r   ro  r   r   )r3   it2kr4   r4   r5   rp    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   )r3   iv1r4   r4   r5   r    s   zTestBessel.test_ivc                 C   r  r  )r   r   r  r2   r4   r4   r5   test_negv_ive  r  zTestBessel.test_negv_ivec                 C   rI  )Nr   r"  rT  r.  )r   r  r  r   r   )r3   ive1rU  r4   r4   r5   test_ive  r  zTestBessel.test_ivec                 C   s    t tddtddd d S )NrJ   r<   r   r.  )r   r   r  ivpr2   r4   r4   r5   	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<   rJ   r.  )r   r  rY  r   r6  r4   r4   r5   test_ivp  r  zTestBessel.test_ivp)r  r   N)r=  )Ur  r  r  rz  rr  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  platformmachiner'  r*  r,  r-  slowr1  r2  r3  r6  r8  r9  r;  r<  rB  rH  rJ  rL  rh  rj  rl  rn  rx  rp  r  rV  rX  rZ  r[  r4   r4   r4   r5   r  z	  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   rJ   r<   rx   r:   r   rv  r?   )rJ   rD  r<   r   )r?   r  ir@   rG  )rJ   iH   ir   r?  )r?   r   i8iX  ir  r  )r   laguerrer   r  r   )r3   lag0lag1lag2lag3lag4lag5r4   r4   r5   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   rJ   r<   rx   r?   r  rr   r   r  rG  )rO   rU   r   r  r   r  r   r   )r3   rY   rc  rd  re  rf  r4   r4   r5   test_genlaguerre  s   .LzTestLaguerre.test_genlaguerreN)r  r  r  ri  rj  r4   r4   r4   r5   r`    s    r`  c                   @   r  )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   rJ   r<   rx   r:   r   )rx   r   r?   r   rv  r   )r   r   r  r   )r  r   r  r   rx   r   )?   r   ir   ri   r   )r   legendrer   r  r   r   )r3   leg0leg1leg2leg3leg4leg5r4   r4   r5   test_legendre  s   





zTestLegendre.test_legendreN)r  r  r  rt  r4   r4   r4   r5   rk    r  rk  c                   @   r  )
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 )NrJ   r"  r   r<   r  r   r  )r   lmbdar   r  rV  r  r   )r3   lamlamrr4   r4   r5   
test_lmbda  s
   "6zTestLambda.test_lmbdaN)r  r  r  ry  r4   r4   r4   r5   ru    r  ru  c                   @   r_  )	TestLog1pc                 C   sB   t dt dt df}tdtdtdf}t||d d S )Nr.  r$  r  rv  r  r   r  r   r   )r3   l1pl1prlr4   r4   r5   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 )NrJ   皙?r{  r<   r  r  r  r{  )r3   l1pml1pmrlr4   r4   r5   test_log1pmore  r~  zTestLog1p.test_log1pmoreN)r  r  r  r  r  r4   r4   r4   r5   rz    s    rz  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<   rx   rr   rq   rJ   r   r@   r>   )r   clpmnr   r   r   )r3   r(  clpr4   r4   r5   
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 )	NrL   rJ   rx   rq   r%  r<   r   r>   )r   r  r   r   r  r3   r>  r  rX   r   clp_plus	clp_minusr4   r4   r5   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 )
NrL   rJ   rx   rq   r%  r   y             y              ?r>   )r   r  r   r   r  rO   r   r   r  r4   r4   r5   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>rJ   r%  r<   rx   r   r@   )r   r   r  )r3   r>  r  rX   r   typer4   r4   r5   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)rJ   r?   r:   rJ   )rc   r   r  r   rO   r   r  lpmn)r3   r(  rX   r  lpr4   r4   r5   test_inf  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)ri  y            ?y            y      ?      r5  r  r  r  r<   rx   r  )r   y        MbP?rq   r   rJ   r  rC   )r   r  r   )r3   zvalsr  rX   r  r(  happrox_derivativer4   r4   r5   test_deriv_clpmn"  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<   rq   rr   rq         r   rr   r  r:   )r   r  r   r   r3   r  r4   r4   r5   	test_lpmn1  s   zTestLegendreFunctions.test_lpmnc                 C   0   t dd}t|tg dtg dfd d S )Nr<   rq   r  r  r:   )r   lpnr   r   )r3   lpnfr4   r4   r5   test_lpn:  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<   rq   r  r>   (   r   gI?r  r  r?   )r   r  r   rO   r  r   r   r  r4   r4   r5   r  C  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<   rq   r:   rJ   )r   lqmnlqnr   )r3   lqmnflqfr4   r4   r5   	test_lqmnO  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<   rJ   r   )r?   r?   N)r   r  r   )r3   x0deltar   lqr)  r4   r4   r5   test_lqmn_gt1U  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:   r  )r   r   r   )r   rJ   )r   r  r   r  )r3   r  r  r4   r4   r5   test_lqmn_shape`  s   z%TestLegendreFunctions.test_lqmn_shapec                 C   r  )Nr<   rq   )gk+ݓ?g=yX5gW2)g|a2U?g~jt?gڊer:   )r   r  r   r   )r3   r  r4   r4   r5   test_lqni  s   
zTestLegendreFunctions.test_lqnN)r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r4   r4   r4   r5   r    s    					r  c                   @   rj  )TestMathieuc                 C   r  r  r4   r2   r4   r4   r5   r  q  r  zTestMathieu.test_mathieu_ac                 C   r  )Nr<   r   )r   r)   r2   r4   r4   r5   test_mathieu_even_coeft  r  z"TestMathieu.test_mathieu_even_coefc                 C   r  r  r4   r2   r4   r4   r5   test_mathieu_odd_coefx  s   z!TestMathieu.test_mathieu_odd_coefN)r  r  r  r  r  r  r4   r4   r4   r5   r  o  s    r  c                   @   r_  )TestFresnelIntegralc                 C   r  r  r4   r2   r4   r4   r5   r    r  z$TestFresnelIntegral.test_modfresnelpc                 C   r  r  r4   r2   r4   r4   r5   r    r  z$TestFresnelIntegral.test_modfresnelmN)r  r  r  r  r  r4   r4   r4   r5   r  }  s    r  c                   @   r  )TestOblCvSeqc                 C   &   t ddd}t|tg dd d S )Nr   rx   rJ   )g~T~Oֿgt_J?gm{@g@j'&@r   )r   
obl_cv_seqr   r   )r3   oblr4   r4   r5   test_obl_cv_seq     zTestOblCvSeq.test_obl_cv_seqN)r  r  r  r  r4   r4   r4   r5   r    r  r  c                   @   r  )TestParabolicCylinderc                 C   s0   t dd}t|tddgtddgfd d S )NrJ   r"  gQ?gx$(~?gx$(~g(\?r:   )r   pbdn_seqr   r   )r3   pbr4   r4   r5   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 )NrJ   r   r"  r   )r   r&  r2   r4   r4   r5   r'    s   (zTestParabolicCylinder.test_pbdvc                 C   s<   t dd}t dd}t|t|d t|d fd d S )NrJ   r"  r   r:   )r   r  pbdv_seqr   r   )r3   pbnpbvr4   r4   r5   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 )Nry  r.  r   r<   rq   r   r   r   r   gGz$@gq=
ףp4@gHQ9rl   rC   g(\#gQ@gkS a>)rO   r  r   r   r   r   r   r&  )r3   etar(  r4   r4   r5   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 NrD  r:   r  ry  r.  r   r  r   r   rJ   r-  r   )rO   r  r   r&  r  r   r3   r   r  r4  r>  dpr4   r4   r5   test_pbdv_gradient     0z(TestParabolicCylinder.test_pbdv_gradientc                 C   r  r  )rO   r  r   r(  r  r   r  r4   r4   r5   test_pbvv_gradient  r  z(TestParabolicCylinder.test_pbvv_gradientN)	r  r  r  r  r'  r  r  r  r  r4   r4   r4   r5   r    s    
	r  c                   @   r  )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<   rJ   rx   gX];r.  gOV,@@)r<   rx   g  8Br   r,  r`  )g2}jg.M?g}2;ο)r   	polygammar   rI  rO   rb  )r3   poly2poly3r   rX   r)  r4   r4   r5   test_polygamma  s"   zTestPolygamma.test_polygammaN)r  r  r  r  r4   r4   r4   r5   r    s    r  c                   @   r  )TestProCvSeqc                 C   r  )Nr   rx   rJ   )g"~j?g6?Ң@g)u8F"@g2g)@r   )r   
pro_cv_seqr   r   )r3   prolr4   r4   r5   test_pro_cv_seq  r  zTestProCvSeq.test_pro_cv_seqN)r  r  r  r  r4   r4   r4   r5   r    r  r  c                   @   r  )TestPsic                 C   r  )NrJ   goxr  )r   rI  r   )r3   psr4   r4   r5   rJ    r  zTestPsi.test_psiN)r  r  r  rJ  r4   r4   r4   r5   r    r  r  c                   @   r_  )
TestRadianc                 C   s"   t ddd}t|td d d S )NrZ  r   r   r   r   rK  r   r   )r3   radr4   r4   r5   rL    s   zTestRadian.test_radianc                 C   s&   t ddd}t|td d d d S )NrZ  rJ   r  r<   gC?r   r  )r3   rad1r4   r4   r5   test_radianmore  r  zTestRadian.test_radianmoreN)r  r  r  rL  r  r4   r4   r4   r5   r    s    r  c                   @   r_  )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)
derivativer   rJ   r  )rO   emptyrc   r   spherical_jnr   
riccati_jn)r3   r  r   SrX   r  jpr4   r4   r5   test_riccati_jn     zTestRiccati.test_riccati_jnc                 C   r  r  )rO   r  rc   r   spherical_ynr   
riccati_yn)r3   r  r   CrX   r'  ypr4   r4   r5   test_riccati_yn  r  zTestRiccati.test_riccati_ynN)r  r  r  r  r  r4   r4   r4   r5   r    s    
r  c                   @   r  )	TestRoundc              	   C   s@   t tttdtdtdtdf}d}t|| d S )Ng333333$@g$@rv  g333333%@)r.  r.  r.  r$  )r  maprb   r   rR  r   )r3   rndrndrlr4   r4   r5   rS    s   .zTestRound.test_roundN)r  r  r  rS  r4   r4   r4   r5   r    r  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   rq   r  r<   r   r:   r   g      .@r   ri   r%  r  r   g      ?r   g      @rJ   r   rG  g      ?g     A@)	r   sph_harmrO   r   r   r   r   r	   r   )shr   r   r   r   r	   r4   r4   r5   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 r/   )rO   dtype
complex128r   r   r  )dtr4   r4   r5   "test_sph_harm_ufunc_loop_selection/  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   r?   rq   r<   rJ   r  )	r   r   r   r  r  r   r   r>  r?  r@  r4   r4   r5   _series;  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)
iry  (\rO  r?   r   rJ   rN  r     )rJ   r.  r   r  rF   r   r   N)r  r   r   r|  rK  r4   r4   r5   test_vs_seriesB  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  r  g;cv=?r  rC   gQ g< j?r  rP  r=  g?rl   g       igzz?r  i)   r  r  r$  gffffffr?   g333333$)r   r   r|  r   r   r   r2   r4   r4   r5   test_some_valuesI  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|  r2   r4   r4   r5   test_regression_679V  s   zTestStruve.test_regression_679N)r  )r  r  r  r  r  r  r  r4   r4   r4   r5   r  :  s
    
r  c                   C   r   )Nrl  rx   gdX	
?)r   r   r   r4   r4   r4   r5   test_chi2_smalldf]  r   r  c                   C   s   t tdtjd d S )Nrw  rr   )r   r   r   rO   r   r4   r4   r4   r5   test_ch2_infa  ru   r  c                   C   r   )Nrl  rx   yj_?)r   r   r   r4   r4   r4   r5   test_chi2c_smalldfe  r   r  c                   C   r   )Nrl  r  rx   )r   r   r   r4   r4   r4   r5   test_chi2_inv_smalldfi  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 )'NrB   rJ   r<   gDSYC?rC   gQ_?g?@g>;,
i}@rx   )rJ   rx   r   g=O?r?   r  r   r@   gXs*@rv  g   V4oAgO1eAgꌠ9Y>)FgEg^ 9^;gd-?gP.5_gsTNNeg6dgu?j/ g]XC}KdgѧRg"!x{{ rr   g][#!Rr`  gٍS1gN_ r   c   r.  )r   r   agmrO   r   r   r  r  r   r   r   )rD   agm13agm15agm35agm12fir4   r4   r5   test_agm_simplem  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 )Nr3  rJ   r#  g?r<   gffffff@)r   r  r  r   r   expnr  r  r  r4  r  r  r^  rm  )r  r4   r4   r5   test_legacy  s   "r  c                   C   s   t tjtjdd d S )NrJ   y        .B}T)rc  r   SpecialFunctionErrorr  r4   r4   r4   r5   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   )rO   r  r   r   r   r'  r4   r4   r5   xfunc     $ztest_xlogy.<locals>.xfuncr   r   r   rr   r   r  )r   r%  )rJ   r%  rJ   rB   r   )
rO   r   r   r   rd   r   rj   r+   r   xlogy)r  z1z2w1w2r4   r4   r5   
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  )rO   r  r   r  r  r4   r4   r5   r    r  ztest_xlog1py.<locals>.xfuncr  r   r  )rJ   gKH9r  rJ   rB   r   )	rO   r   r   r   rd   rj   r+   r   xlog1py)r  r  r  r4   r4   r5   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 r/   )rO   r   r   r  )r   r4   r4   r5   r    s   ztest_entr.<locals>.xfuncr   rq   rr   r?   rJ   r  otypesrB   r   )rO   r   r  r  r  r   rd   rj   r   r+   r   entr)r  r   signsr  sgnr  r(  r  r4   r4   r5   	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 r/   )rO   r   isposinfr   r  r  r4   r4   r5   r    s    ztest_kl_div.<locals>.xfuncr   rq   rr   r?   rJ   r  r  r   rB   r   )r  r  r  rO   r   rd   rj   r   r+   r   kl_div
r  r   r  r  sgnavasgnbvbr(  r  r4   r4   r5   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 r/   )r   r  rO   r   r  r4   r4   r5   r    s
   ztest_rel_entr.<locals>.xfuncr$  r?   rJ   r  r  r   rB   r   )r  r  r  rO   r   rd   rj   r   r+   r   rel_entrr&  r4   r4   r5   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 )Nr?   r  r<   rq   r  r   c                 S   s@   | dk rt jS t || k rdt | S | t |d|    S )Nr   rq   )rO   r   r  squarer  rA  r4   r4   r5   r    s
   ztest_huber.<locals>.xfuncr.  r  r   rJ   rB   r   )r   r   huberrO   r   r   r.  rU   randnrj   r   r+   r  r(  r  r4   r4   r5   
test_huber  s   0r3  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<   rJ   )rO   r   r   r/  r4   r4   r5   r  (  s
   "z test_pseudo_huber.<locals>.xfuncr.  r<   r   rq   r  rJ   rB   r   )
rO   r   rU   r1  tolistrj   r   r+   r   pseudo_huberr2  r4   r4   r5   test_pseudo_huber'  s   (0r6  c                  C   s*   d} d}t | |}d}t||dd d S )Nrr   gC]r2<gs.-De8rB   rC   )r   r5  r   )r  rA  r'  r)  r4   r4   r5   test_pseudo_huber_small_r5  s
   r7  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   rG   )r  r"  r  r(   r)   r4   r4   r4   r5   test_runtime_warningB  s   "r8  )sr  r\  r  numpyrO   r   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r  r   rc  numpy.testingr   r   r   r   r   r   r   r   r   scipyr   scipy.special._ufuncs_ufuncsr0   scipy.specialr    r!   r"   r#   r$   r%   r&   r'   r(   r)   scipy.special._testutilsr*   r+   r,   r	  r-   r  r  r  r  r  r  r  r6  rk  rt  objectr  r  r  r  r  r  r  r,  r>  rT  r  r`  rk  ru  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-  r3  r6  r7  r8  r4   r4   r4   r5   <module>   s   T,       >n	 ME  +b hD2# Y    5 		.	
#=
