
    >qj2                     6   d dl Zd dlmZmZ d dlZd dlmZmZ d dl	m
c mZ d dlmZ d Zd Zd Zd Z G d	 d
      Z G d d      Zd Zej,                  j/                  dg d      ej,                  j/                  dd dej0                  g      d               Zej,                  j/                  dg d      ej,                  j/                  ddej0                  g      ej,                  j/                  ddej0                  g      d                      Zej,                  j/                  dg d      ej,                  j/                  dddej0                  g      ej,                  j/                  dddej0                  g      d                      Zej,                  j/                  d ej8                  d            ej,                  j/                  dg d      ej,                  j/                  dej:                   ej:                  g      d                      Zej,                  j/                  dd g dfdg dfdg d fd!g d"fd#g d$fd%g d&fg      d'        Zej,                  j/                  dd g dfdg d(fdg d)fd!g d*fd#g d+fd%g d,fg      d-        Z y).    N)assert_assert_allclose)_ufuncsgammasgn)FuncDatac                  h   t        j                  dddt        j                  d            } dt         j                  j	                         z  dz
  }t        j
                  | t        j                  |      z        }t        j                  | |      }t        t        j                  ||d	             y )
Nr   i'     long)dtype      gV瞯<rtol)nparanger   randomrandcosarccosr   eval_chebytr   allclose)nxv1v2s       g/opt/rentech/trading_bot/.venv/lib/python3.12/site-packages/scipy/special/tests/test_orthogonal_eval.pytest_eval_chebytr   
   sz    
		!UARXXf%56A	"))..
QA	"))A,	B			Q	"BBKKBU+,    c                  :    t        j                  dd      dk(  sJ y )Nr	   y       @        g     @)r   r    r   r   test_eval_chebyt_gh20129r!      s    q&)V333r   c            	          t        t        j                  t        j                  ddd                   t        t        j                  t        j                  ddd                   y )Nr   g?)r   r   isnanr   eval_genlaguerrer    r   r   !test_eval_genlaguerre_restrictionr&      sB    BHHW--aQ789BHHW--c2q9:;r   c                      t        j                  d      5  t        j                  dd       t        j                  dd       t        j
                  ddd       d d d        y # 1 sw Y   y xY w)Nraiseallr   r   )r   errstater   eval_legendreeval_laguerreeval_gegenbauerr    r   r   test_warningsr/      sU    		! )a#a#1a(	) ) )s   AA$$A-c                   v    e Zd ZdZ	 	 ddZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zy)	TestPolyszQ
    Check that the eval_* functions agree with the constructed polynomials

    c	                    t         j                  j                  d      }	g }
t        j                  |      D ]  }|D cg c]  \  }}|||z
  |	j	                  |      z  z   ! }}}t        j
                  |      j                  }|sdg}|D ]  }|r|ft        |      z   }n|f}|d   |d   |d   z
  |	j	                  |      z  z   }|d   |d<   |d   |d<   t        j                   || j                        }t         j                  t        j                  ||df      | ||      f   }|
j                  |        
 t        j                  |
d      }
fd}t        j                  d      5  t        ||
t!        t#        t%        |      dz               d	|
      }|j'                          d d d        y c c}}w # 1 sw Y   y xY w)N  r   r   axisc                  j    | d   j                  t        j                  d            f| dd  z   }  |  S )Nr   r
   r   )astyper   r   )pfuncs    r   polyfuncz&TestPolys.check_poly.<locals>.polyfuncD   s5    1RXXf-.01QR58A8Or   r(   r)   r   r#   r   )r   r   RandomStater   r   asarrayTtuplepoly1dcoefc_tileappendconcatenater+   r   listrangelencheck)selfr9   clsparam_rangesx_rangennnparamnxr   rngdatasetr   abparamsr8   r   polyzr:   dss    `                   r   
check_polyzTestPolys.check_poly,   s   ii##D)2 	"A<HISQqa1Q3 000IFIZZ'))F 
"uQxAAAJ'!*wqz"9388B<!GGqz!qz!yya.EE"''!bV,aa89q!
"	"" ..q1	 [[W% 	(GT%L8I!8K2L-Mr#%BHHJ	 	- J,	 	   $F=5?GGc                 p    | j                  t        j                  t        j                  ddgddgd       y )NgGz
   r#   r   h㈵>rK   rL   r   )rX   r   eval_jacobiorthjacobirI   s    r   test_jacobizTestPolys.test_jacobiM   s2    ++T[[&1;%?!#Qd 	 	4r   c                 p    | j                  t        j                  t        j                  ddgddgd       y )Nr   r\   r   r   r   r   r]   r^   )rX   r   eval_sh_jacobir`   	sh_jacobirb   s    r   test_sh_jacobizTestPolys.test_sh_jacobiR   s2    ..&-v%6A! 	 	#r   c                 n    | j                  t        j                  t        j                  dgddgd       y )NgV-߿r\   r#   r   gHz>r^   )rX   r   r.   r`   
gegenbauerrb   s    r   test_gegenbauerzTestPolys.test_gegenbauerW   s/    //&2^b!W! 	 	#r   c                 j    | j                  t        j                  t        j                  g ddg       y Nr#   r   rK   rL   )rX   r   r   r`   chebytrb   s    r   test_chebytzTestPolys.test_chebyt\   *    ++T[[%'"a 	 	:r   c                 j    | j                  t        j                  t        j                  g ddg       y ro   )rX   r   eval_chebyur`   chebyurb   s    r   test_chebyuzTestPolys.test_chebyu`   rs   r   c                 j    | j                  t        j                  t        j                  g ddg       y Nr   rp   )rX   r   eval_chebysr`   chebysrb   s    r   test_chebyszTestPolys.test_chebysd   rs   r   c                 j    | j                  t        j                  t        j                  g ddg       y ry   )rX   r   eval_chebycr`   chebycrb   s    r   test_chebyczTestPolys.test_chebych   rs   r   c                     t        j                  d      5  | j                  t        j                  t
        j                  g ddg       d d d        y # 1 sw Y   y xY wNignorer)   r   r   rp   )r   r+   rX   r   eval_sh_chebytr`   	sh_chebytrb   s    r   test_sh_chebytzTestPolys.test_sh_chebytl   sK    [[X& 	=OOG22DNN)+aV  =	= 	= 	=   4AAc                 j    | j                  t        j                  t        j                  g ddg       y Nr   r   rp   )rX   r   eval_sh_chebyur`   	sh_chebyurb   s    r   test_sh_chebyuzTestPolys.test_sh_chebyuq   s*    ..%'!Q 	 	9r   c                 j    | j                  t        j                  t        j                  g ddg       y ro   )rX   r   r,   r`   legendrerb   s    r   test_legendrezTestPolys.test_legendreu   s*    --t}}%'"a 	 	:r   c                     t        j                  d      5  | j                  t        j                  t
        j                  g ddg       d d d        y # 1 sw Y   y xY wr   )r   r+   rX   r   eval_sh_legendrer`   sh_legendrerb   s    r   test_sh_legendrezTestPolys.test_sh_legendrey   sM    [[X& 	=OOG44d6F6F)+aV  =	= 	= 	=r   c                 l    | j                  t        j                  t        j                  dgddg       y Nr[   r   d   rp   )rX   r   r%   r`   genlaguerrerb   s    r   test_genlaguerrezTestPolys.test_genlaguerre~   s/    00$2B2B&1]QH 	 	Fr   c                 j    | j                  t        j                  t        j                  g ddg       y Nr   r   rp   )rX   r   r-   r`   laguerrerb   s    r   test_laguerrezTestPolys.test_laguerre   s*    --t}}%'!S 	 	;r   c                 j    | j                  t        j                  t        j                  g ddg       y Nir   rp   )rX   r   eval_hermiter`   hermiterb   s    r   test_hermitezTestPolys.test_hermite   s*    ,,dll%'$ 	 	>r   c                 j    | j                  t        j                  t        j                  g ddg       y r   )rX   r   eval_hermitenormr`   hermitenormrb   s    r   test_hermitenormzTestPolys.test_hermitenorm   s,    00$2B2B%'$ 	 	>r   Nr    r    r\   r\   r\   g:0yE>)__name__
__module____qualname____doc__rX   rc   ri   rm   rr   rw   r}   r   r   r   r   r   r   r   r   r   r    r   r   r1   r1   &   sc    
 EG*.B4
#
#
::::=
9:=
F;>>r   r1   c                   p    e Zd ZdZ	 	 ddZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zy)TestRecurrencezI
    Check that the eval_* functions sig='ld->d' and 'dd->d' agree.

    c                    t         j                  j                  d      }g }	t        j                  |      D ]  }
|D cg c]  \  }}|||z
  |j                  |      z  z   ! }}}t        j                  |      j
                  }|sdg}|D ]  }|r|
ft        |      z   }n|
f}|d   |d   |d   z
  |j                  |      z  z   }|d   |d<   |d   |d<   t        t        |      dz   dz  dz         }t         j                  t        j                  ||df      | ||fz   i |f   }|	j                  |        
 t        j                  |	d      }	fd}t        j                  d	
      5  t        ||	t        t!        t        |      dz               d|      }|j#                          d d d        y c c}}w # 1 sw Y   y xY w)Nr3   r   r   d->dsigr4   c                      | d   j                  t        j                        }|f| dd  z   } |j                  j                  }t        |t        |       dz
  dz  z   dz         } | i |S )Nr   r   r   r   r   )r7   r   intpr   chardictrG   )r8   p0p0_type_charkwr9   s       r   r:   z+TestRecurrence.check_poly.<locals>.polyfunc   se    1RWW%B!"A88==L,#a&(C7%?@B>b>!r   r(   r)   r   r#   r   )r   r   default_rngr   r<   r=   r>   r   rG   rA   rB   rC   rD   r+   r   rE   rF   rH   )rI   r9   rK   rL   rM   rN   rO   r   rP   rQ   r   rR   rS   rT   r8   r   r   rV   r:   rW   s    `                  r   rX   zTestRecurrence.check_poly   s   ii##D)2 	"A>JKsqa1Q3

6 222KFKZZ'))F 
"uQxAAAJ'!*wqz"93::b>!IIqz!qz!s1vaxnU23EE"''!bV,aQD1HR1HHIq!
"	"" ..q1	" [[W% 	(GT%L8I!8K2L-Mr#%BHHJ	 	3 L2	 	rY   c                 P    | j                  t        j                  ddgddg       y )Nr[   r#   r   rp   )rX   r   r_   rb   s    r   rc   zTestRecurrence.test_jacobi   s*    ++&1;%?!#Q 	 	)r   c                 P    | j                  t        j                  ddgddg       y )Nre   rf   r   r   rp   )rX   r   rg   rb   s    r   ri   zTestRecurrence.test_sh_jacobi   s*    ..&-v%6A 	 	Hr   c                 N    | j                  t        j                  dgddg       y )Nrk   r#   r   rp   )rX   r   r.   rb   s    r   rm   zTestRecurrence.test_gegenbauer   s'    //&2^b!W 	 	Fr   c                 L    | j                  t        j                  g ddg       y ro   )rX   r   r   rb   s    r   rr   zTestRecurrence.test_chebyt   $    ++%'"a 	 	:r   c                 L    | j                  t        j                  g ddg       y ro   )rX   r   ru   rb   s    r   rw   zTestRecurrence.test_chebyu   r   r   c                 L    | j                  t        j                  g ddg       y ry   )rX   r   r{   rb   s    r   r}   zTestRecurrence.test_chebys   r   r   c                 L    | j                  t        j                  g ddg       y ry   )rX   r   r   rb   s    r   r   zTestRecurrence.test_chebyc   r   r   c                 L    | j                  t        j                  g ddg       y r   )rX   r   r   rb   s    r   r   zTestRecurrence.test_sh_chebyt   $    ..%'!Q 	 	9r   c                 L    | j                  t        j                  g ddg       y r   )rX   r   r   rb   s    r   r   zTestRecurrence.test_sh_chebyu   r   r   c                 L    | j                  t        j                  g ddg       y ro   )rX   r   r,   rb   s    r   r   zTestRecurrence.test_legendre   s$    --%'"a 	 	:r   c                 L    | j                  t        j                  g ddg       y r   )rX   r   r   rb   s    r   r   zTestRecurrence.test_sh_legendre   s$    00%'!Q 	 	9r   c                 N    | j                  t        j                  dgddg       y r   )rX   r   r%   rb   s    r   r   zTestRecurrence.test_genlaguerre   s'    00&1]QH 	 	Fr   c                 L    | j                  t        j                  g ddg       y r   )rX   r   r-   rb   s    r   r   zTestRecurrence.test_laguerre   s$    --%'!S 	 	;r   c                 L    t        j                  dd      }d}t        ||       y )NF         ?gi\m)r   r   r   )rI   vrR   s      r   r   zTestRecurrence.test_hermite   s#      S)!1r   Nr   )r   r   r   r   rX   rc   ri   rm   rr   rw   r}   r   r   r   r   r   r   r   r   r    r   r   r   r      s`    
 @B*."H)
HF::::99:9F;r   r   c                      t        j                  t        j                  dd            sJ t        j                  t        j                  dd            sJ y )Nr#   r   )r   r$   r   r   r   r    r   r   test_hermite_domainr      s@    88G((S122288G,,R5666r   r   )r   r   r   r   r   c                 \   t        j                  t        j                  | |            t        j                  t        j                  | |g            k(  sJ t        j                  t        j
                  | |            t        j                  t        j                  | |g            k(  sJ y N)r   r$   r   r   anyr   )r   r   s     r   test_hermite_nanr      sx     88G((A./266"((Aq6:J3KKKK88G,,Q23rvvbhh1v>N7OOOOr   )r   r   r   g	@alphar   c                     t        j                  t        j                  | ||            }t        j                  t        j                  | ||g            }||k(  sJ y r   )r   r$   r   r%   r   )r   r   r   nan_laguerrenan_args        r   test_genlaguerre_nanr     sL    
 88G44QqABLffRXXq%m,-G7"""r           gư>c                     t        j                  t        j                  | ||            }t        j                  t        j                  | ||g            }||k(  sJ y r   )r   r$   r   r.   r   )r   r   r   nan_gegenbauerr   s        r   test_gegenbauer_nanr     sL    
 XXg55aBCNffRXXq%m,-GW$$$r   r\   )gܿ      пg      r   g      ?r   g       @c                 `   |dk(  rd}nN| dk(  rd}nFt        | |z         t        |      z  }|t        j                  |      | z  z  t        j                  z  }t	        t        j                  t        |       ||      |d       t	        t        j                  t        |       ||      |d       y )Nr   r   绽|=r   )	r   r   signinfr   r   r.   intfloat)r   r   r   expected	lead_signs        r   test_gegenbauer_infinityr     s    
 |	
c QY'(5/9	
a02669G++CFE1=xeTG++E!HeQ?PUVr   zn, expected)r   r   r   r   r   r   r   r   r   r   r   )g       gggffffffg333333      gg333333gٿgɿr   )g      @gHzG@g
ףp=
?gzG?g
ףp=
?r   Qο
ףp=
׿r   r   r      )g      gGzg{GzgQ?gQ?g      ?g{Gz?gQ?{GzĿg)\(̿r      )g      @gZd;O?g;OnҿguVg&1ڿr   g rh?g?5^I?g;On?gl¿r      )g      gN#-ۿg}:3P?g`Ù?g#G˿g      ؿg5l/¿g
ܺ:?g}:3P?g)D/r   c                     t        j                  ddd      }d\  }}t        t        j                  | |||      |dd       t        t        j                  t        |       |||      |dd       y )Nr   r      )r#   r   r   +=r   atolr   linspacer   r   r_   r   r   r   r   rR   rS   s        r   )test_jacobi_alpha_minus_one_beta_plus_oner   %  se    > 	D#r"ADAqG''1a3XEPUVE!HaA.u5r   )r   r   r   r   r   r   r   r   r   r   r   )r   
ףp=
r   zGʿr   r   r   r   r   r   r   )r   ;On?g~jt?g/$?g~jt?r   ~jtg/$ſg~jtȿg;On¿r   )r   5^Iÿr   T㥛 ?r   g      ?r   r   r   r   r   )r   g#G?g9̗gf16Ŀg70r   g70?gf16?g9̗?g#Gr   c                     t        j                  ddd      }d\  }}t        t        j                  | |||      |dd       t        t        j                  t        |       |||      |dd       y )Nr   r   r   )r#   r#   r   r   r   r   r   s        r   *test_jacobi_alpha_minus_one_beta_minus_oner   L  sf    \ 	D#r"ADAqG''1a3XEPUVE!HaA.u5r   )!numpyr   numpy.testingr   r   pytestscipy.specialr   r   scipy.special._orthogonalspecial_orthogonalr`   scipy.special._testutilsr   r   r!   r&   r/   r1   r   r   markparametrizenanr   r   r   r   r   r   r   r   r    r   r   <module>r
     s    2  + ( ( --4
<)f> f>Rb bJ7 i(q!RVVn-P . )P n-1bff+.q"&&k*# + / .# n-3266"23tQ/0% 1 4 .% ibiim,"MNw/0W 1 O -W 	
CD	
MN	
OP	
PQW	

 	
:;: 	
CD	
CD	
UVW	

 	
" 	
1(+XY+Xr   