+
    /i3                        ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHu H	t
 ^ RIHtHt ^ RIHtHtHtHtHtHt ^ RIHtHt ^ RIHtHtHt ^ RIHt ^ RIH t  RR	 lt!RR
 lt"R t#]! ]4       ! R R4      4       t$]! ]4       ! R R4      4       t%R# )    N)assert_allclose)xp_assert_closexp_assert_equal)array_namespacexp_sizexp_ravelxp_copyis_numpymake_xp_test_case)specialstats)quad_vecnsumtanhsinh)_pair_cache)_gen_harmonicc                     Vf   \        V 4      MTp^^VP                  ,          R,          ,          VP                  V ^,          ) ^,          4      ,          # )N      ?)r   piexpxxps   &&a/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/integrate/tests/test_tanhsinh.pynorm_pdfr      s@    !z	rBag^bffadU1Wo--    c                     Vf   \        V 4      MTpR\        P                  ! ^VP                  ,          4      ,          V ^,          ^,          ,
          # )Ng      )r   mathlogr   r   s   &&r   norm_logpdfr       s;    !z	rB255!!AqDF**r   c                     R  pV# )c                    a  V 3R  lpV# )c                    < V ^ ,          P                   pV  Uu. uF  p\        V4      NK  	  p p. p\        \        P                  ! V4      4       F/  pV  Uu. uF  q"V,          NK  	  ppVP                  S! V!  4       K1  	  V# u upi u upi r   )shaper   ranger   prodappend)
arg_arraysr%   	arg_arrayresiarg_scalarsfs   *     r   wrapped._vectorize.<locals>.decorator.<locals>.wrapped!   s    qM''E?IJz)(9-zJJC499U+,=GHZ	||ZH

1k?+ - J K Is   BB
 )r.   r/   s   f r   	decorator_vectorize.<locals>.decorator    s    	 r   r1   )r   r2   s   & r   
_vectorizer4      s    
 r   c                   ^  a  ] tR t^/t o R tR]n        ^]n        R t]P                  ^,
          ^]P                  ! ^4      ,          ,           ^,          ]n        ^]n        R t]P                  ! ]P                  ^,          4      ^,
          ^,          ]n        ]P                  ^,          ]n        R t^]P                  ^,          ,          ^`,          ]n        ^]n        R tR?]n        ^]n        R t]P                  ^,          ]n        ^]n        R t^]P"                  ! ]P                  4      ,          ]P&                  ! R@4      ,          ]P&                  ! R4      ,          ]n        ^]n        R	 t^]n        ^]n        R
 t]P                  ) ]P                  ! ^4      ,          ^,          ]n        ]P                  ^,          ]n        R t]P                  ]P"                  ! ^4      ,          ^,          ]n        ]P                  ^,          ]n        R t]P                  ^,          ]n        ]P0                  ]n        R t]P"                  ! ]P                  4      ]n        ]P0                  ]n        R t]P"                  ! ]P                  ^,          4      ]n        ]P0                  ]n        R tR]n        ]P0                  ]n        R t]P                  ^,          ]n        ]P0                  ]n        RAR ltR t]P@                  PC                  R^ ]"P0                  3R.]"P0                  ) ^ 3R.]"P0                  ) ]"P0                  3R.]"P0                  ]"P0                  ) 3RB.RC]#PH                  PK                  RB4      ]#PH                  PK                  R4      ,
          ..4      R 4       t&]P@                  PO                  RRR7      ]P@                  PC                  R](! ^^4      4      R 4       4       t)]P@                  PO                  RRR7      ]P@                  PC                  RRRR .34      ]P@                  PC                  R!]#PT                  PV                  4      R" 4       4       4       t,]P@                  PC                  R#]-! 4       RDRERF.4      R$ 4       t.R% t/R& t0R' t1R( t2R) t3]P@                  PO                  R*R+R,7      ]P@                  PC                  R-R.R/.4      R0 4       4       t4R1 t5]P@                  PC                  R2](! ^4      4      R3 4       t6R4 t7]P@                  PC                  R5RG]"P0                  ) ^ .^^.334      ]P@                  PC                  R6RH4      R7 4       4       t8R8 t9R9 t:R: t;]P@                  PO                  RR;7      R< 4       t<R= t=R>t>V t?R# )ITestTanhSinhc                J    V\         P                  ! ^V,           4      ,          #    npr   selfts   &&r   f1TestTanhSinh.f13   s    266!a%=  r         ?c                J    V^,          \         P                  ! V4      ,          #    )r;   arctanr<   s   &&r   f2TestTanhSinh.f29   s    Av		!$$r   c                d    \         P                  ! V4      \         P                  ! V4      ,          # Nr;   r   cosr<   s   &&r   f3TestTanhSinh.f3?   s    vvay266!9$$r   c                    \         P                  ! ^V^,          ,           4      p\         P                  ! V4      ^V^,          ,           V,          ,          # rC   )r;   sqrtrE   )r=   r>   as   && r   f4TestTanhSinh.f4E   s8    GGAQJyy|AF
a/00r   c                d    \         P                  ! V4      \         P                  ! V4      ,          # rI   )r;   rO   r   r<   s   &&r   f5TestTanhSinh.f5L   s    wwqzBFF1I%%r   c                J    \         P                  ! ^V^,          ,
          4      # r8   r;   rO   r<   s   &&r   f6TestTanhSinh.f6R   s    wwq16z""r   c                    \         P                  ! V4      \         P                  ! ^V^,          ,
          4      ,          # r8   rW   r<   s   &&r   f7TestTanhSinh.f7X   s&    wwqzBGGAQJ///r   c                <    \         P                  ! V4      ^,          # rC   r:   r<   s   &&r   f8TestTanhSinh.f8^   s    vvayA~r   c                V    \         P                  ! \         P                  ! V4      4      # rI   )r;   r   rK   r<   s   &&r   f9TestTanhSinh.f9d   s    vvbffQi  r   c                V    \         P                  ! \         P                  ! V4      4      # rI   )r;   rO   tanr<   s   &&r   f10TestTanhSinh.f10j   s    wwrvvay!!r   c                0    ^^V^,          ,           ,          # r8   r1   r<   s   &&r   f11TestTanhSinh.f11p   s    AQJr   c                f    \         P                  ! V) 4      \         P                  ! V4      ,          # rI   )r;   r   rO   r<   s   &&r   f12TestTanhSinh.f12v   s    vvqbzBGGAJ&&r   c                L    \         P                  ! V^,          ) ^,          4      # rC   )r;   r   r<   s   &&r   f13TestTanhSinh.f13|   s    vvqAvgk""r   c                f    \         P                  ! V) 4      \         P                  ! V4      ,          # rI   rJ   r<   s   &&r   f14TestTanhSinh.f14   s    vvqbzBFF1I%%r   r   c                <    \         P                  ! V4      V,          # rI   )r;   sinr<   s   &&r   f15TestTanhSinh.f15   s    vvay1}r   Nc                    Vf   \        W4      MTp\        W,
          4      pV'       g   V# \        P                  ! RR7      ;_uu_ 4        VP	                  V4      uuR R R 4       #   + '       g   i     R # ; i)Nignoredivide)r   absr;   errstatelog10)r=   r+   refr   r   errs   &&&&& r   errorTestTanhSinh.error   sN    *,*_S&"#)nJ[[))88C= *)))s   A((A9	c           
     D
   V P                   pVP                  ^ 4      pVP                  VP                  4      pRp\        P                  ! \
        VR7      ;_uu_ 4        \        ^*W44       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#V^R7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W!P                  R4      V4       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#V\        R	7       RRR4       R
p\        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR	7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#WAP                  R7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#WAP                  RR7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#WAP                  RR7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#V\        4       R7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR7       RRR4       \        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#V^R7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \        W#VRR7       RRR4       R#   + '       g   i     EL; i  + '       g   i     ELj; i  + '       g   i     EL4; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELV; i  + '       g   i     EL%; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL}; i  + '       g   i     ELT; i  + '       g   i     R# ; i)r   `f` must be callable.matchN...must be True or False.r   ...must be real numbers.ekkiatolrtol#...must be non-negative and finite. ...may not be positive infinity.T)r   r   )r   r   z...must be integers.maxlevelzmigratory coconut)minlevelz...must be non-negative.preserve_shapez...must be callable.
elderberry)callback      ?      ?)	r?   asarraybpytestraises
ValueError	_tanhsinhinfobject)r=   r   r.   zerof_bmessages   &&    r   test_input_validation"TestTanhSinh.test_input_validation   s*   GGzz!}jjo)]]:W55b$$ 6 .]]:W55as* 6 -]]:W55aD)3/ 6]]:W55as0 6]]:W55as0 6 8]]:W55as, 6]]:W55as0 6 5]]:W55asT: 6]]:W55asT: 6 )]]:W55asVX6 6 ]]:W55as-@A 6 -]]:W55asR0 6 ]]:W55asR0 6 .]]:W55as15 6 )]]:W55as\: 65a 655 655 655555555 655555 655555 655 655 655 655 655 655s   O6P
PP2QQQ.R!R(R*+R>(S#S& S:T6P	
P	P/	2Q	Q	Q+	.Q?	R	R'	*R;	>S	S#	&S7	:T	T	zlimits, ref      ?c                    V Uu. uF  qCP                  V4      NK  	  ppVP                  \        V^ ,          4      4      P                  pVP                  W%R7      p\        \        .VO5!  p\        VP                  V4       \        \        .VO5RR/ p\        VP                  VP                  4      VRR7       V^ 8  d/   VP                  VP                  P                  R4      '       g1   Q hVP                  VP                  P                  R4      '       g   Q h^VP                  VP                  P                  4      P                  ,          p\        VP                  VP                  4      VP                  VRR7       R	# u upi )
r   dtyper   TF)check_dtypereal floatingzcomplex floating)r   r   N)r   floatr   r   r   r   integralr    r   isdtypefinfor   eps)	r=   limitsr~   r   limitr   r+   logresr   s	   &&&&     r   test_integral_transforms%TestTanhSinh.test_integral_transforms   s3    288**U#8

5+,22jjj**6*c*;::T:v/%HFIAg

6??00/BB 	L KZZ 5 57IJJ	L K 288CIIOO,000v||,ciidPUV 9s   FTz!Cumbersome to convert everything.np_onlyreasonf_numberc                   \        V R V 24      pRp\        V^ VP                  VR7      p\        VP                  VP
                  VR7       VR9  dS   \        V P                  VP                  VP
                  4      VP                  ,          4      pWeP                  8  g   Q hVR9   d   R# VP                  '       g   Q hVP                  ^ 8X  g   Q hR# )r.   g:0yU>r   N>            >   r   
   r   )
getattrr   r   r   r   r~   r{   r   successstatus)r=   r   r   r.   r   r+   
true_errors   &&&    r   
test_basicTestTanhSinh.test_basic   s     DAhZ.)1acc-aee$7;&TZZaee<S\\IJJ		))){"{{{{zzQr   z#Distributions aren't xp-compatible.r~   g?g333333?casec                r   Vw  rEVR9   d   \         P                  ! R4       VR9   d=   \        \        P                  ! R^ 4      4      '       g   \         P                  ! R4       \        \        V4      ! V!  pVP                  V4      p\        VP                  .VO5!  p\        VP                  V4       R# )dgammaz0tanh-sinh is not great for non-smooth integrandsSCIPY_XSLOWz%This case passes, but it is too slow.N>   kstwor   laplacedweibull>   levy_stablestudentized_range)r   skipintosgetenvr   r   intervalr   pdfr   r   )	r=   r~   r   r   distnameparamsdistr   r+   s	   &&&&     r   test_accuracyTestTanhSinh.test_accuracy   s    
  AAKKJK<<BIImQ788KK?@uh'0MM#%1%c*r   r%   c           
       aa \         P                  P                  R 4      pVP                  VP                  V4      4      pVP                  VP                  V4      4      pVP                  VP                  V4      4      p\        P
                  ! V4      oVV3R lo^ Sn        ^ Sn        \        V4      R 4       p\        SWEV3R7      pV! WEV4      p	. R	Op
V
 Fj  pTP                  V	 Uu. uF  p\        W4      NK  	  up4      p\        \        W4      4      p\        WRR7       \        W4      P                  V8X  d   Kj  Q h	  VP                  VP                   P"                  R4      '       g   Q hVP                  VP$                  P"                  R4      '       g   Q hVP                  VP&                  P"                  R4      '       g   Q hVP                  VP(                  P"                  R4      '       g   Q hVP+                  VP&                  4      SP                  8X  g   Q hVP+                  VP(                  4      ^8  g   Q hVP+                  VP(                  4      SP                  8X  g   Q hR# u upi )
   F*BG c                    < S;P                   ^,          un         S;P                  \        V 4      S8X  g   V P                  ^8:  d   ^MV P                  R,          ,          un        W,          # r9   r   )ncallfevalr   ndimr%   r   pr.   ns   &&r   r.   *TestTanhSinh.test_vectorization.<locals>.f  sC    GGqLGGGWQZ1_!q!''"+MG4Kr   c                 $   a \        V3R  lW4      # )c                    < V S,          # rI   r1   r   r   s   &r   <lambda>KTestTanhSinh.test_vectorization.<locals>._tanhsinh_single.<locals>.<lambda>#  s	    q!tr   )r   )rP   r   r   s   &&fr   _tanhsinh_single9TestTanhSinh.test_vectorization.<locals>._tanhsinh_single!  s    ^Q22r   argsr   V瞯<r   boolNr   r   r   r   nfevr   )r;   randomdefault_rngr   r   r'   r   r   r4   r   stackr   r   r   r%   r   r   r   r   r   r   max)r=   r%   r   rngrP   r   r   r   r+   refsattrsattrr~   ref_attrres_attrr.   r   s   &&&            @@r   test_vectorizationTestTanhSinh.test_vectorization  s    ii##$89JJszz%()JJszz%()JJszz%()IIe	 	B	3 
	3 1qd+a(NDxxt Dt!3t DEH 23HHU;3%++u444	  zz#++++V4444zz#****J7777zz#((..*5555zz#,,,,j9999vvchh177***vvcll#q(((vvcll#qww... !Es   .I>
c                x  aa VV3R  lo^ Sn         SP                  ^SP                  R7      3pSP                  SP                  .^,          4      pSP                  SP                  ) .^,          4      p\        SW4^VR7      pSP                  . ROSP                  R7      p\        VP                  V4       R# )c                 8  < S;P                   ^,          un         V3R lV3R lV3R l.p. p\        \        V4      4       FE  pWR3,          p\        \	        V4      V,          4      pVP                  W&,          ! V4      4       KG  	  SP                  V4      # )r9   c                 6   < SP                  V ^,          ) 4      # rC   r   r   s   &r   r   4TestTanhSinh.test_flags.<locals>.f.<locals>.<lambda>=  s    rvvq!te}r   c                 &   < SP                  V 4      # rI   r   r   s   &r   r   r  >  s    rvvayr   c                 <   < SP                  V SP                  4      # rI   )	full_likenanr   s   &r   r   r  ?  s    r||Arvv6r   .)nitr&   r   r   r   r(   r   )	xsjsfuncsr+   r,   r   jr.   r   s	   &&     r   r.   "TestTanhSinh.test_flags.<locals>.f;  sy    EEQJE,(68E C72;'#vJQ(

58A;' ( 88C= r   r   )r   r   Nr   )	r  arangeint64r   r   r   int32r   r   )r=   r   r   rP   r   r+   	ref_flagsr.   s   &f     @r   
test_flagsTestTanhSinh.test_flags8  s    
	! 		!288	,.JJxz"JJy1}%1!$7JJ{"((J;	

I.r   c                *  a V3R  lpSP                  SP                  .^,          4      pSP                  SP                  ) .^,          4      p\        W#V^RR7      pSP                  . ROSP                  R7      p\	        VP
                  V4       R# )c                    < SP                  V ^ ,          ^,          ) 4      SP                  V ^,          4      SP                  V ^,          SP                  4      .pSP                  V4      # r$   )r   r  r  r   )r   r+   r   s   & r   r.   1TestTanhSinh.test_flags_preserve_shape.<locals>.fQ  sU    661Q47(#66!A$<<<!bff-/C 88C= r   T)r   r   r   Nr  )r   r   r   r  r   r   )r=   r   r.   rP   r   r+   r  s   &f     r   test_flags_preserve_shape&TestTanhSinh.test_flags_preserve_shapeO  sp    	! JJx!|$JJy1}%a!DAJJ{"((J;	

I.r   c                (  aa R  o\        V3R l^ ^4      p\        VV3R lSP                  ^ 4      SP                  ^4      RR7      pSP                  R4      P                  p\	        VP
                  SP                  V^ ,          VR7      4       R# )c                     VP                  VP                  WP                  ^
V ,          4      .4      VP                  VP                  ^V ,          4      WP                  ^dV ,          4      ,          .4      .4      # )r   )r   rt   rK   r   s   &&r   r.   +TestTanhSinh.test_preserve_shape.<locals>.f_  sa    88RXXq&&a.&9:XXrvvb1f~q66#'?7J&KLN O Or   c                    < S! V \         4      # rI   )r;   r   r.   s   &r   r   2TestTanhSinh.test_preserve_shape.<locals>.<lambda>c  s    1br   c                    < S! V S4      # rI   r1   r   r.   r   s   &r   r   r  d  s    !Ar(r   Tr           r   N)r   r   r   r   r   r   )r=   r   r~   r+   r   r.   s   &f   @r   test_preserve_shape TestTanhSinh.test_preserve_shape]  sp    	O )1a0*BJJqM2::a='+-

2$$bjjQuj&EFr   c           	     P  a SP                   pV3R  lpSP                  RVR7      pSP                  RVR7      SP                  RVR7      re^ p\        ^4       FI  p\        W5V^ VR7      p	V P	                  V	P
                  VRSR7      p
W^,          8  g
   V
R	8  g   Q hT
pKK  	  R# )
c                 B   < V SP                  ^V ,           4      ,          # r8   r   )r>   r   s   &r   r.   (TestTanhSinh.test_convergence.<locals>.fl  s    rvva!e}$$r   rA   r   r"  r   r   r   T)r   r   Ng      /)float64r   r&   r   r   r   )r=   r   r   r.   r~   rP   r   last_logerrr,   r+   logerrs   &f         r   test_convergenceTestTanhSinh.test_convergencei  s    

	%jjUj+zz"Ez*BJJrJ,G1qAA!a!<CZZctZCF1_,?> K	 r   c                f  aa VV3R  loSP                  \        P                  ^,
          ^\        P                  ! ^4      ,          ,           ^,          SP                  R7      Sn        RpSP
                  V,          pSP                  RSP                  R7      pSP                  RSP                  R7      p^ ^ uSn        Sn        \        SWE4      pV P                  VP                  SP
                  4      VP                  u;8  d	   V8  g   Q h Q hVP                  SP                  8X  g   Q hSP                  Vn        VP                  '       g   Q hVP                  ^ 8X  g   Q h^ ^ uSn        Sn        \        VP                  4      p\        SWEVR7      pSP                  Vn        W8X  g   Q h^ ^ uSn        Sn        V^,          pV^8  g   Q h\        SWEVR7      pV P                  VP                  SP
                  4      VP                  u;8  d	   V8  g   Q h Q hVP                  SP                  u;8X  d   VP                  8  g   Q h Q hSP                  VP                  ^,
          8X  g   Q hVP                  '       d   Q hVP                  \         P"                  8X  g   Q hTpSP                  Vn        ^ ^ uSn        Sn        \$        P&                  ! \)        VP                  4      \$        P*                  4      p	\        SWE^ V	R7      pVP                  VP                  8X  g   Q hVP                  VP                  8X  g   Q hVP                  SP                  u;8X  d   VP                  8X  g   Q h Q hSP                  VP                  8X  g   Q hVP                  '       g   Q hVP                  ^ 8X  g   Q h^ ^ uSn        Sn        \$        P&                  ! \)        VP                  4      \$        P*                  ) 4      p	\        SWE^ V	R7      pV P                  VP                  SP
                  4      VP                  u;8  d	   V	8  g   Q h Q hVP                  SP                  u;8X  d   VP                  8  g   Q h Q hSP                  VP                  8  g   Q hVP                  '       g   Q hVP                  ^ 8X  g   Q h^ ^ uSn        Sn        \$        P&                  ! \)        VP                  VP                  ,          4      \$        P*                  4      p
\        SWEV
R7      pVP                  VP                  8X  g   Q hVP                  VP                  8X  g   Q hVP                  SP                  u;8X  d   VP                  8X  g   Q h Q hSP                  VP                  8X  g   Q hVP                  '       g   Q hVP                  ^ 8X  g   Q h^ ^ uSn        Sn        \$        P&                  ! \)        VP                  VP                  ,          4      \$        P*                  ) 4      p
\        SWEV
R7      pV P                  VP                  SP
                  4      SP
                  ,          VP                  VP                  ,          u;8  d	   V
8  g   Q h Q hVP                  SP                  u;8X  d   VP                  8  g   Q h Q hSP                  VP                  8  g   Q hVP                  '       g   Q hVP                  ^ 8X  g   Q hR# )	c                    < S;P                   ^,          un         S;P                  \        SP                  V 4      4      ,          un        V ^,          SP	                  V 4      ,          # r8   )callsr   r   r   atanr!  s   &r   r.   :TestTanhSinh.test_options_and_result_attributes.<locals>.f{  sB    GGqLGGGwrzz!}--Ga4"''!*$$r   r   -q=r"  r   r   r   r   r   N)r   r   r   r   r)  r~   r   r0  r   r   r   r   r   r   r   r   eim	_ECONVERRr;   	nextafterr   r   )r=   r   default_rtoldefault_atolrP   r   r~   r   r+   r   r   r.   s   &f         @r   "test_options_and_result_attributes/TestTanhSinh.test_options_and_result_attributesx  sd   	%
 

DGGaK!dhhqk/9R?rzz
Ruu|+ JJrJ,JJrJ, a1 zz#,,.I\IIIIIxx177"""GG	{{{{zzQ as||$1(3GG	zz aA1}}1(3zz#,,.I\IIIIIxx177-SXX-----ww#))a-''';;;zzS]]***, GG	 a||E#)),bff51ad3||s||+++yyCII%%%xx177.chh.....ww#))###{{{{zzQa||E#)),rvvg61ad3zz#,,.ATAAAAAxx177-SXX-----ww"""{{{{zzQ a||E#))CLL"89266B1d+||s||+++yyCII%%%xx177.chh.....ww#))###{{{{zzQa||E#))CLL"89BFF7C1d+zz#,,.quu4syy7MTPTTTTTTxx177-SXX-----ww"""{{{{zzQr   torchzAhttps://github.com/scipy/scipy/pull/21149#issuecomment-2330477359)r   r   g-C6?+=c           	     f  a \        R RR7      pSP                  RSP                  R7      pSP                  RSP                  R7      p\        \        WER\
        P                  ! V4      R7      p\        \        WEVR7      p\        SP                  VP                  4      VP                  3/ VB  \        SP                  VP                  4      VP                  3/ VB  VP                  VP                  8X  g   Q hR pV3R	 lp	SP                  SP                  ) SP                  R7      pSP                  SP                  SP                  R7      p\        WVRR
7      p\        WV4      p\        P                  ! RR7      ;_uu_ 4        \        SP                  VP                  4      VP                  3/ VBRR/B  \        SP                  VP                  4      VP                  3/ VBRR/B  RRR4       VP                  VP                  8X  g   Q hR#   + '       g   i     L/; i)gC]r2<r   )r   r   r   g       @T)r   r   r   c                 :    \        V 4      ) \        V 4      ,          # rI   )r    r   r   s   &r   r.    TestTanhSinh.test_log.<locals>.f  s    N?8A;..r   c                    < SP                  \        V 4      R ,           4      \        V 4      ,           SP                  R,          ,           # )y                              ?)r   r    r   r   s   &r   logf#TestTanhSinh.test_log.<locals>.logf   s1    66+a.2-.Q?"%%"*LLr   r   rx   allr   FN      )dictr   r)  r   r    r   r   r   r   r   r   r   r   r   r;   r|   )
r=   r   r   	test_tolsrP   r   r+   r~   r.   rD  s
   &&f       r   test_logTestTanhSinh.test_log  s    e%0	 JJs"**J-JJrJ,Qt$((4.I!T2s||,cllHiHsyy)399B	Bxx388###	/	M JJwbjjJ1JJrvvRZZJ0-a  [[X&&BFF3<<0#,, /) /(-/BFF399-syy /I /(-/ '
 xx388### '&s   A)H  H0	c                H  a V3R  lpSP                  R4      SP                  SP                  ^,          4      rC\        W#V4      p\        P                  ! ^4      ^,          ^\        P                  ! ^4      ^,          ,
          R,          ,           p\        VP                  SP                  V4      4       R pSP                  SP                  4      SP                  SP                  ) 4      rC\        W#V4      p\        VP                  SP                  R4      4       R# )c                 4   < SP                  R V ,          4      # rC  r   r   s   &r   r.   $TestTanhSinh.test_complex.<locals>.f  s    66"q&>!r   r"  rC  c                 T    \        V 4      R\        V ^,          4      ,          ,           # )rC                ?)r   r@  s   &r   r.   rP    s    A;hqsm!333r   Ny            )r   r   r   r   rO   r   r   r   r=   r   r.   rP   r   r+   r~   s   &f     r   test_complexTestTanhSinh.test_complex  s    	" zz"~rzz"%%'21a iil1n$))A,q. 0"44bjjo6	4 zz"&&!2::rvvg#61a bjj&9:r   r   c                  aa
 V
V3R  lo
^ ^ SP                  . 4      uS
n        S
n        S
n        SP                  ^ SP                  R7      pSP                  ^SP                  R7      p\        S
W4^ VR7      pSP                  S
P                  4      p\        ^ V^,           4       EFC  p^ ^ SP                  . 4      uS
n        S
n        S
n        \        WqR7      p\        S
W43/ VB p	\        V	P                  VP                  RR7       \        V	P                  VP                  RVP                  ,          R7       V	P                  S
P                  u;8X  d$   S
P                  P                  ^ ,          8X  g   Q h Q hS
P                  W,
          ^,           ^,           8X  g   Q hV	P                  VP                  8X  g   Q h\        VSP                  S
P                  4      4       EKF  	  R# )c                 ,  < S;P                   ^,          un         S;P                  \        SP                  V 4      4      ,          un        SP	                  SP
                  \        V 4      34      Sn        V ^,          SP                  V 4      ,          # r8   )r0  r   r   r   concatr   r   r1  r!  s   &r   r.   %TestTanhSinh.test_minlevel.<locals>.f*  s_    GGqLGGGwrzz!}--G))QSS(1+./ACa4"''!*$$r   r   r(  gؗҼ<r   r   N)r   r   r0  r   r)  r   sortr&   rI  r   r   r   r   r%   r   r   )r=   r   r   rP   r   r~   ref_xr   optionsr+   r.   s   &&f       @r   test_minlevelTestTanhSinh.test_minlevel$  sl   	% !"1bjjn!#JJq

J+JJq

J+1!h?aA.H$%q"**R.!AGQWacH@GAq/w/CCLL#,,UCCIIsyyus||7KL88qww6!##))A,6666677h1A59999::+++E277133<0 /r   c           	       a V3R  lpSP                  SP                  ) ^ SP                  ) SP                  RSP                  ) R.4      pSP                  SP                  SP                  ^ SP                  ) ^^SP                  .4      p\        P                  ! \        P                  4      pSP                  WU^,          V^,          V) WUV.4      p\        W#V4      p\        VP                  V4       R# )c                 r   < SP                   V SP                  V 4      &   SP                  V ^,          ) 4      # rC   )r  isinfr   r   s   &r   r.   /TestTanhSinh.test_improper_integrals.<locals>.fF  s,    VVAbhhqkN661a4%= r   Ni)r   r   r   rO   r   r   r   r   )r=   r   r.   rP   r   r~   r+   s   &f     r   test_improper_integrals$TestTanhSinh.test_improper_integralsD  s    	! JJRVVGRVVS266'3GHJJBFF7BBFFCDii jj#1uc!ecT3SABa c*r   r   r   c                  aa \        SS4      oSP                  VSR 7      w  rEVV3R lpSSP                  8X  d   RMRp\        WdWWR7      pVP                  P
                  S8X  g   Q hVP                  P
                  S8X  g   Q hSP                  VP                  4      '       g   Q h\        VP                  SP                  V4      SP                  V4      ,
          4       R# )r   c                 L   < V P                   S8X  g   Q hSP                  V 4      # rI   )r   r   )r   r   r   s   &r   r.   "TestTanhSinh.test_dtype.<locals>.fW  s#    77e###66!9r   r3  h㈵>r   N)r   r   r)  r   r   r   r   rG  r   r   r   )	r=   r   r   r   rP   r   r.   r   r+   s	   &&ff     r   
test_dtypeTestTanhSinh.test_dtypeP  s     E"zz&z.	 +ua+||!!U***yy%'''vvckk""""bffQiq	&9:r   c                Z  aaa SP                  SP                  ) 4      SP                  SP                  4      r2V3R  lp^ ^reWe,
          ^,           o\        WVRR7      p\        WBV3/ VB pVP                  '       d   Q hVP
                  V8X  g   Q hVV3R loRSn        RSn        VR \        WBV3/ VBRS/B p	VP                  4        F[  p
V
R8X  d!   W,          R	8X  g   Q hW,          R
8X  g   Q hK*  W,          SP                  V
,          u;8X  d   W,          8X  d   KX  Q h Q h	  R# )c                 6   < SP                  V ) V ,          4      # rI   r   r   s   &r   r.   -TestTanhSinh.test_maxiter_callback.<locals>.fe      661"Q$<r   r   )r   r   r   c                    < S;P                   ^,          un         V Sn        \        V R4      '       g   Q hV P                  ^8X  g   Q hSP                   S8X  d   \        hR# )r9   r   N)iterr+   hasattrr   StopIteration)r+   r   maxiters   &r   r   4TestTanhSinh.test_maxiter_callback.<locals>.callbacko  sR    MMQMHL3
++++::?"?}}'## (r   Nr   r   r   r   r  )	r   r   rI  r   r   r   rp  r+   keys)r=   r   rP   r   r.   r   r   kwargsr+   res2keyr   rs  s   &f         @@r   test_maxiter_callback"TestTanhSinh.test_maxiter_callbackb  s   zz266'"BJJrvv$61	  (%)xGa*6*;;;||x'''	$ :q>F>X> 88:Chx2~%~yB&yHLL$5AAAAAA r   c           	       aa SP                  SP                  ) SP                  R 7      pSP                  SP                  SP                  R 7      pV3R lpV3R lo. Sn        . Sn        ^p\        WBV^ VSR7       \        V^,           4       Fr  p\        WBW6VR7      p\        SP                  ^V,           ,          VP                  RR7       \        SP                  ^V,           ,          VP                  RRR7       Kt  	  R	# )
r   c                 6   < SP                  V ) V ,          4      # rI   r   r   s   &r   r.   &TestTanhSinh.test_jumpstart.<locals>.f  rn  r   c                    < SP                   P                  \        V P                  4      R,          4       SP                  P                  \        V P
                  4      R,          4       R # )Nr1   )	integralsr(   r	   r   errorsr   )r+   r   s   &r   r   -TestTanhSinh.test_jumpstart.<locals>.callback  sE    %%gcll&;B&?@OO""7399#5b#9:r   )r   r   r   r(  r   r   gؗҜ<r4  N)
r   r   r)  r  r  r   r&   r   r   r   )	r=   r   rP   r   r.   r   r,   r+   r   s	   &f      @r   test_jumpstartTestTanhSinh.test_jumpstart  s     JJwbjjJ1JJrvvRZZJ0	 	;  !A8Lx!|$AA!!<CH..qs3S\\NHOOAaC0#))%eT %r   c           	       a SP                  ^ 4      SP                  ^4      r2V3R lp\        WBV4      pVP                  '       g   Q h\        VP                  SP                  R4      4       \        WBV^ R7      pVP                  ^ 8  g   Q h\        VP                  SP                  SP                  4      4       \        WBV^R7      pVP                  ^ 8  g   Q h\        VP                  SP                  SP                  4      4       \        WCV4      pVP                  '       g   Q hVP                  R8X  g   Q h\        VP                  SP                  R4      4       R p\        WBV^R7      p\        VP                  SP                  R4      4       SP                  SP                  ^ ^ ^ .4      pSP                  ^SP                  ^^.4      pSP                  ^^SP                  ^.4      p\        WBW63R7      p\        VP                  SP                  SP                  SP                  SP                  R.4      4       \        VP                  R,          SP                  RSP                  4      4       \        VP                  SP                  . ROSP                  R7      4       \        VP                  SP                  . RO4      4       \        VP                  R,          SP                  R^SP                  R7      4       SP                  ^ 4      \        n        SP                  ^ 4      \        n        ^ .\        n        R	\        n        SP                  ^ 4      SP                  ^4      r2\        V3R
 lW#4      p\        VP                  SP                  R4      4       \        R W#4      p\        VP                  SP                  R4      4       Rp\        R SP                  ^ 4      SP'                  V4      4      p. ROpV F  p	WY,          P(                  V8X  d   K  Q h	  R	# )r   c                 P   < SP                  V P                  R 4      '       g   Q hV # )r   )r   r   r   s   &r   r.   *TestTanhSinh.test_special_cases.<locals>.f  s#    ::agg7777Hr   r   r   r"  c                     W,          # rI   r1   )r   cs   &&r   r.   r    s	    4Kr   r   N   Nr   Nc                 4   < SP                  V R ,          4      # rO  r   r   s   &r   r   1TestTanhSinh.test_special_cases.<locals>.<lambda>  s    "**QrT"2r   c                     V # rI   r1   r@  s   &r   r   r        !r   c                     V # rI   r1   r@  s   &r   r   r    r  r   r   g?r  )r  r  r  r   FFFTrR  r   r  r   )r   r   r   r   r   r   r   r  r   fullr   r  r   emptyr   xjcwjindicesh0zerosr%   )
r=   r   rP   r   r.   r+   r  r%   r   r   s
   &f        r   test_special_casesTestTanhSinh.test_special_cases  s   zz!}bjjm1	 a {{{{bjjo6 a!,||a		2::bff#56a!,||a		2::bff#56 a {{{{||r!!!bjjn5	 ab)bjj&67 JJ1a()JJ2661a()JJ1bffa()ad+bjj"&&"&&"&&#1N&OP		"rwwtRVV'<=

BJJbhhJ$OPRZZ0K%LMbggdARXXg&FG ((1+! czz!}bjjm12A9bjj&89Q*bjjo6 RZZ]BHHUODND9??e+++ r   )r   c                t    \         P                  ! ^A^4      pRVR&   \        \         P                  ^V4       R# )A     Nr   )r;   r  r   rt   )r=   r   r   s   && r   #test_compress_nodes_weights_gh214960TestTanhSinh.test_compress_nodes_weights_gh21496  s,     GGBN""&&!Qr   c           	       aaa \        ^R
4      o\        ^^'4      oVVV3R lpSP                  RSP                  R7      SP                  RSP                  R7      rC\        W#V^ ^ ^
R7      pSP	                  VP
                  4      '       g   Q h\        W#VRR7      pVP                  '       g   Q hVP                  ^8  g   Q h\        VP                  VP                  RR7       R	# )r   c                 ^   < SP                  S^V ,
          ,          SV ,          ,           4      # r8   )rt   )r>   c1c2r   s   &r   r.   2TestTanhSinh.test_gh_22681_finite_error.<locals>.f  s#    66"A,a/00r   r"  r   r   )r   r   r   r=  r   r   Ni)
complexr   r)  r   isfiniter   r   r   r   r   )	r=   r   r.   rP   r   r~   r+   r  r  s	   &f     @@r   test_gh_22681_finite_error'TestTanhSinh.test_gh_22681_finite_error  s     RR_	1zz"BJJz/Bbjj1Q1aaa"={{399%%%%ae,{{{{||acll?r   r1   gqqܿg      ?)FNrH  r   r   r     r  rD   rD   r  )float32r)  )@__name__
__module____qualname____firstlineno__r?   r~   r   rF   r;   r   r   rL   r   rQ   rT   rX   r[   rO   r   gammar^   ra   re   rh   r   rk   rn   rq   ru   r   r   r   markparametrizer   r   normcdfr   skip_xp_backendsr&   r   _distr_paramsdistcontr   tupler   r  r  r#  r,  r:  rK  rT  r]  rc  ri  rz  r  r  r  r  __static_attributes____classdictcell____classdict__s   @r   r6   r6   /   s%    ! BFBD% eeai!bffQi-'2-BFBD% ffRUUQY!#q(BF5519BD1 !^b BFBD& BFBD# UUQYBFBD0 '--"66u9MMBFBD BFBD! eeVbffQi!#BF5519BD" eebggaj 1$CGEEAICE  eeaiCGFFCE' ggbeenCGFFCE# ggbeeai CGFFCE& CGFFCE eeaiCGFFCE!8;t [[]
TXX88)Q88)TXX	#
((TXXI	$	%**..%);;<- WW( [[!!$)L " N[[Zq"6 7N [[!!$)N " P[[US3*$56[[VU%8%8%A%AB+ C 7P+ [[Wuwvy&IJ%/ K%/N/./
G!qf [[!!'O "  [[VdE]3 $ 4 $D;& [[Zq21 31>
+ [[X488)Q!Q0H'IJ[[W&<=; > K;  BDU.@,D [[!!$!/  0 @ @r   r6   c                   T  a  ] tR tRt o ]P
                  P                  R4      t]P                  ^^
^
R7      P                  4       t
R t]P                  ^,          ^,          ]n        ^]n        ]P                  ]n        ]! 4       ]n        R t]P*                  ! ]
^4      ]n        R]n        ]P                  ]n        ]
3]n        R t^]n        ]P/                  ^^R#R7      ]n        ]! ]P                   ]
4      ]n        ]
3]n        R t]P6                  P9                  R	]! ^^4      4      R
 4       t]P6                  P9                  R. R$O4      R 4       t]P6                  P9                  R]! 4       R%R&R'.4      R 4       t R t!R t"R t#]P6                  P9                  RRR.4      R 4       t$R t%R t&]P6                  P9                  RRR.4      R 4       t']P6                  P9                  RR(R).4      R 4       t(]P6                  PS                  RRR7      R  4       t*R!t+V t,R"# )*TestNSumi  l   Q [ sizec                    VR,          # rD   r  r1   )r=   ks   &&r   r?   TestNSum.f1  s     2wr   c                     ^W,          ,          # r8   r1   r=   r  r   s   &&&r   rF   TestNSum.f2      14xr   r   c                     ^W,          ,          # r8   r1   r  s   &&&r   rL   TestNSum.f3  r  r   c                ^   V P                   pVP                  VP                  4      VP                  VP                  4      rCR p\        P
                  ! \        VR7      ;_uu_ 4        \        ^*W44       RRR4       Rp\        P
                  ! \        VR7      ;_uu_ 4        \        W#V^R7       RRR4       Rp\        P
                  ! \        VR7      ;_uu_ 4        \        W!P                  R4      V4       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#VP                  R4      4       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#WAP                  R4      R7       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        RR7      R	7       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        \        R
7      R	7       RRR4       \        P                  ! RR7      ;_uu_ 4        \        W!P                  \        P                  \        P                  .4      VP                  R4      4      pVP                  ^ ,          R8X  d   VP                  ^ ,          '       d   Q hVP                  VP                   ^ ,          4      '       d)   VP                  VP"                  ^ ,          4      '       g   Q hVP                  ^,          ^ 8X  d   VP                  ^,          '       g   Q hVP                   ^,          VP"                  ^,          8X  g   Q hVP%                  VP&                  ^ ,          ^8H  4      '       g   Q h\        W!P                  R4      VP                  \        P                  ^.4      4      pVP                  ^ ,          R8X  d   VP                  ^ ,          '       d   Q hVP                  VP                   ^ ,          4      '       d)   VP                  VP"                  ^ ,          4      '       g   Q hVP                  ^,          ^ 8X  d   VP                  ^,          '       g   Q hVP                   ^,          VP"                  ^,          8X  g   Q hVP%                  VP&                  ^ ,          ^8H  4      '       g   Q h\        W!P                  R4      VP                  R4      VP                  VP                  VP                  ) VP                  R^ .4      R7      pVP%                  VP                  R8H  VP                  VP                   4      ,          VP                  VP"                  4      ,          VP                  ( ,          VP&                  ,          ^8H  4      '       g   Q h RRR4       Rp\        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        RR
7      R	7       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        \        P                  R7      R	7       RRR4       Rp\        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        \        P                  R
7      RR7       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#V\        \        P                  R7      RR7       RRR4       Rp\        P
                  ! \        VR7      ;_uu_ 4        \        W#VRR7       RRR4       \        P
                  ! \        VR7      ;_uu_ 4        \        W#VRR7       RRR4       R#   + '       g   i     EL+; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELc; i  + '       g   i     EL2; i  + '       g   i     EL; i  + '       g   i     EL[; i  + '       g   i     EL(; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELg; i  + '       g   i     EL>; i  + '       g   i     R# ; i)r   r   Nr   r   r   )stepr   r   
tolerancesr   rx   rF  r   g      $@r   r   T)r  r   z"...must be a non-negative integer.g      @maxtermsr   r   r  )r?   r   rP   r   r   r   r   r   rI  r;   r|   r  r   r   r   isnansumr   rG  r   )r=   r   r.   rP   r   r   r+   s   &&     r   r   TestNSum.test_input_validation  su   GGzz!##

1331)]]:W55QN 6 .]]:W55qa  6 -]]:W55JJt$a( 6]]:W55rzz$'( 6]]:W55qzz$/0 6]]:W55qTv%67 6]]:W55qTv%67 6 kkh''q**bffbff%56

2GCJJqMR'Q??88CGGAJ''BHHSYYq\,B,BBBJJqMQ&CKKNN::771:1---66#((1+*++++q**S/2::rvvqk+BCCJJqMR'Q??88CGGAJ''BHHSYYq\,B,BBBJJqMQ&CKKNN::771:1---66#((1+*++++q**R."**S/JJQ'GHJC663::+rxx/@@HHSYY/036;;,?ADJMNO P P P P# (( 8]]:W55qTr]3 6]]:W55qTrvv%67 6 5]]:W55qTrvv%6DA 6]]:W55qTrvv%6DA 6 7]]:W55q3' 6]]:W55q2& 65m 655 655 655555555555555 (''* 655555 655555 655555s   (^#^+ ^?(_0_'9_;>`A9`#<)`#&'`#2`#A`#A,`#)`#0'`#2`#A`##C-`#?`7'a(a-(a3b>b^(	+^<	?_	_$	'_8	;`	` 	#`4	7a	a	a0	3b	b	b,	r   c           
       aa
 SP                  R 4      P                  p\        V RV 24      o
SP                  S
P                  4      SP                  S
P                  4      rT\
        ;QJ d!    . V3R lS
P                   4       F  NK  	  5M! V3R lS
P                   4       4      pSP                  S
P                  VR7      p\        S
WEVR7      p\        VP                  V4       \        VP                  SP                  VP                  SP                  R7      4       \        VP                   SP#                  VP                  SP$                  R7      4       \&        P(                  ! RR7      ;_uu_ 4        \        V
V3R lWERVR	7      p	R
R
R
4       \        SP+                  X	P                  4      VP                  4       \        SP+                  V	P,                  4      VP,                  RR7       \        V	P                  VP                  4       \        V	P                   VP                   4       R
#   + '       g   i     L; i)r   r.   c              3   F   <"   T F  pSP                  V4      x  K  	  R # 5irI   r  ).0argr   s   & r   	<genexpr>&TestNSum.test_basic.<locals>.<genexpr>Z  s     7RZZ__s   !r   r   rx   ry   c                  .   < SP                  S! V !  4      # rI   r   )r   r.   r   s   *r   r   %TestNSum.test_basic.<locals>.<lambda>b  s    q$x(8r   T)r   r   Nr   r   )r   r   r   rP   r   r  r   r~   r   r   r  r   r   r  r%   r  r   onesr   r;   r|   r   r   )r=   r   r   r   rP   r   r   r~   r+   r   r.   s   &&f       @r   r   TestNSum.test_basicU  st   

2$$DAhZ.)zz!##

1331u77uu777jjej,1a&%

BHHSYYbhhH$GHRWWSYYbggW%FG[[))8T6F * 	vzz*CGG4v||,ciieDszz24 *)s   >H==I	r  c                  a V P                   pV3R  lpR pSP                  ^^.SP                  R7      RSP                  3,          pSP                  ^^dSP                  .SP                  R7      RSP                  SP                  3,          pSP                  . ROSP                  R7      P                  R4      pSP                  Wv,
          V,          4      p	Tp
WiV,          ,           pWaV,          ,           pSP                  V! VSP                  V4      V,          ,           4      RRR7      pV! V4      V! V4      ,
          V,          pW,           V! V4      ,           pW,           V! V4      ,           pW,           ^,          pW,
          ^,          pSP                  WgV4      w  rgp\        P                  ! VP                  4       F  p\        VV,          4      \        VV,          4      \        VV,          4      pppVV,
          V,          ^,           V8:  g   KW  SP                  V! SP                  VVV,           VSP                  R7      4      4      pVVV&   VSP                  VP                  4      P                   ,          VV&   K  	  Rp\#        W6WV\%        VR7      R7      p\'        VP                  V^
V,          R7       \'        VP(                  V^dV,          R7       W,
          V,          ^,           V8*  p\'        VP                  V,          VV,          R	R7       \'        VP(                  V,          VV,          R	R7       \#        WFWR\%        \*        P,                  ! V4      R7      VR
7      p\'        SP/                  VP                  4      VP                  4       \'        SP/                  VP(                  4      VP(                  4       R# )c                 4   < RSP                  V 4      ,          # r  r   r   s   &r   rD  $TestNSum.test_integral.<locals>.logfn  s    bffQi<r   c                     RV ,          # r   r1   r@  s   &r   F!TestNSum.test_integral.<locals>.Fq  s    6Mr   r   :NNNT)axiskeepdimsr3  r   )r  r  r  r   )r  r   r  r  N)r   r9   rD   r   )r   r9   r9   r9   )r?   r   r)  newaxisr   reshapefloorr  r  broadcast_arraysr;   ndindexr%   r   r   r   r   r   rI  r   r   r   r   r   )r=   r  r   r.   rD  r  rP   r   r  nsteps
b_originalr  directr   lowhighref_sumref_errr,   aibistepir   r+   r   s   &&f                      r   test_integralTestNSum.test_integrali  s    GG	 	 JJ1vRZZJ0BJJ?JJC(

J;Arzz2::<UVzz+RZZz8@@O15$,'
tO!bii1$667b4PaD1Q4K%!A$& 1Q4':q.:q. ((t4
dAGG$A!!A$KqteDGnEBR"h."))B5%rzz)"R ST#
#bhhv||&<&@&@@
 % 1"o/r$w7		7T:nd"Q&(2
GAJU;		!gaju=dz$!%488D>!:XOvzz*CGG4v||,cii8r   r%   c           
       aa \         P                  P                  R 4      pVP                  ^^
VR7      p\         P                  pVP                  V4      ^,           p\
        P                  ! V4      oVV3R lo^ Sn        \         P                  R 4       p\        SVP                  V4      VP                  V4      RVP                  V4      3R7      pV! WEVRR7      P                  4       p	. ROp
V
 Fo  pV	 Uu. uF  qP                  \        W4      4      NK  	  pp\        W4      p\        \        V4      VP                  V4      RR7       VP                  V8X  d   Ko  Q h	  VP!                  VP"                  P$                  R	4      '       g   Q hVP!                  VP&                  P$                  R
4      '       g   Q hVP!                  VP(                  P$                  R
4      '       g   Q h\+        V4      '       d8   \-        VP/                  VP(                  4      4      SP                  8X  g   Q hR# R# u upi )r   r  c                    < S;P                   V P                  S8X  g   V P                  ^8:  d   ^MV P                  R,          ,          un         ^W,          ,          # r   )r   r  r   r%   r   s   &&r   r.   &TestNSum.test_vectorization.<locals>.f  s;    GGQVVq[AFFaKqaggbkIGqv:r   c                 (   a \        V3R  lWVR7      # )c                 $   < ^V S,          ,          # r8   r1   r   s   &r   r   BTestNSum.test_vectorization.<locals>.nsum_single.<locals>.<lambda>  s    !ad(r   r  )r   )rP   r   r   r  s   &&f&r   nsum_single0TestNSum.test_vectorization.<locals>.nsum_single  s    *A8DDr   r  )r  r   r  r   r   r   r   N)r  r   r   r   r   )r;   r   r   integersr   r   r'   r   	vectorizer   r   ravelr   r   r   r%   r   r   r   r   r   r
   r   r   )r=   r%   r   r   rP   r   r   r  r+   r   r   r   r~   r   r   r.   r   s   &&&            @@r   r   TestNSum.test_vectorization  s    ii##$89LLBUL+ FFJJu!IIe	 		E 
	E 1bjjmRZZ]TA(*1T288:=DBFG$3

73#56$HGs)HHX.

80D5Q>>U***	  zz#++++V4444zz#****J7777zz#((..*5555B<<rvvchh'(AGG333  Hs   <"H<c           	        V P                   p. ROpVP                  ^ ^ ^^^\        P                  .VP                  R7      pVP                  ^
\        P
                  \        P
                  \        P
                  \        P
                  \        P
                  .VP                  R7      p\        P                  ! V^4      pVP                  W1P                  R7      p\        P                  ! RR7      ;_uu_ 4        \        W$WS3R7      pRRR4       VP                  . RO4      pVP                  . ROVP                  R7      p	\        XP                  V4       \        VP                  V	4       \        VP                  VP                  ,          VP                  V4      VP                  ,          4       R#   + '       g   i     L; i)	rD   r   rx   ry   r   N)rD   rD   g?g?rD   rD   )FFFFTF)r  r  r  ru  r   r   )rF   r   r;   r  r)  r   r   zetar|   r   r  r   r   r   r   r  )
r=   r   r.   r   rP   r   r~   r+   ref_success
ref_statuss
   &&        r   test_statusTestNSum.test_status  s)   GG"JJ1aArvv.bjjJAJJBFFBFFBFFBFFBFFC2::JVll1a JJq

J+[[))qQT*C * jj!JKZZ 7rxxZH
[1

J/,bjjockk.JK *)s   =F;;G	c           	     |  a V3R  lo^ Sn         \        SVP                  ^4      VP                  ^
4      4      pVP                   SP                   8X  g   Q h^ Sn         \        SVP                  ^4      VP                  VP                  4      \	        RR7      R7      pVP                   SP                   8X  g   Q hR# )c                 h   < S;P                   \        V 4      ,          un         ^V ^,          ,          # r8   )r   r   r  s   &r   r.   TestNSum.test_nfev.<locals>.f  s"    FFgaj Fq!t8Or   ư>r   r  N)r   r   r   r   rI  )r=   r   r+   r.   s   && @r   	test_nfevTestNSum.test_nfev  s    	 1bjjmRZZ^4xx166!!!1bjjmRZZ%7DdOTxx166!!!r   c           
        VP                  ^^.4      pVP                  VP                  4      p\        R W#R\        RR7      R7      p\        R W#4      pVP	                  VP
                  VP
                  VP                  ,
          8  4      '       g   Q hVP	                  VP
                  VP
                  VP                  ,           8  4      '       g   Q hR# )r9   c                 "    ^V ^,          ,          # r8   r1   r  s   &r   r   )TestNSum.test_inclusive.<locals>.<lambda>      QaZr   i  g?r   )r  r  c                 "    ^V ^,          ,          # r8   r1   r  s   &r   r   r    r  r   N)r   r   r   rI  rG  r  r   )r=   r   rP   r   r+   r~   s   &&    r   test_inclusiveTestNSum.test_inclusive  s     JJ1vJJrvv'DcN<'.vvcgg399!456666vvcgg399!456666r   r   TFc           	       aa SP                  ^\        P                  ) \        P                  ) .4      pSP                  \        P                  R	\        P                  .4      pSP                  . R
O4      pVV3R lp\        WcWE3SR7      pSP                  \        P
                  P                  ^ ^4      \        P
                  P                  ^ ^4      ^.4      pS'       d   SP                  V4      MTpS'       d    VP                  SP                  8X  d   RMRM^ p	\        VP                  SP                  WP                  R7      V	R7       VV3R lpSP                  ^\        P                  ) .4      pSP                  \        P                  R	.4      pSP                  ^R	.4      p
\        WcWJ3SR7      pS'       d+   \        P                  ! \        P                  ! ^4      4      M\        P                  ! ^4      p\        VP                  SP                  VP                  WP                  R7      4       R# )r9   c                 &  < S'       dE   SP                  SP                  V^,          4      4      VSP                  V 4      ,          ,
          # SP                  V^,          4      SP                  V) SP                  V 4      ,          4      ,          # rC   )r   tanhr{   r   )r   rP   r   r   s   &&r   r.   (TestNSum.test_infinite_bounds.<locals>.f  sc    <?BFF2771q5>*Qrvvay[8 >1r"&&)|(<<>r   )r   r   g|=rh  r   r   c                 |   < S'       d   RSP                  W,          4      ,          # ^W,          ^,          ,          # )r  r  r   )r   r  r   r   s   &&r   r.   r    s(    %(2bffQSk>:a13(l:r   Nr   )r9   rD   r  )r   r;   r   r   r   dlaplacesfr   r   r)  r   r  r   r	  r  r%   )r=   r   r   rP   r   r  r.   r+   r~   r   r  s   &ff        r   test_infinite_boundsTestNSum.test_infinite_bounds  s   JJBFF7RVVG,-JJBFF+,JJy!	> 13/jj%..++Aq15>>3D3DQ3JANO bffSkc;>"**,$ACww!?dK	; JJBFF7|$JJ|$jj!R!1S1),bffW\\!_%',,q/#WW!EFr   c                $  a V3R  lpSP                  RSP                  R7      SP                  \        P                  SP                  R7      rC\	        W#V4      pSP                  RSP                  R7      p\        VP                  VRR7       R# )c                 6   < SP                  V ^,          ) 4      # rC   r   r   s   &r   r.   )TestNSum.test_decreasing_check.<locals>.f  s    6616'?"r   r   gtfԸ\?r   r   Ni)r   r)  r;   r   r   r   r  rS  s   &f     r   test_decreasing_checkTestNSum.test_decreasing_check	  sk    	# zz#RZZz0"**RVV2::*2V11m jj*"**j=51r   c           	     	   V P                   pVP                  ^4      ;r4\        W#V4      p\        VP                  VP                  V! ^4      4      4       \        V P
                  VP                  ^4      VP                  \        P                  4      VP                  ^4      R7      p\        VP                  VP                  V P                   P                  4      4       VP                  R4      pVP                  R	4      pVP                  ^4      p\        P                  ! VP                  VP                  VP                  4      p\        V P
                  W4V3R7      pVP                  P                  V8X  g   Q hVP                  P                  V8X  g   Q hVP                  P                  V8X  g   Q hR p\        W!P                  ^ 4      VP                  ^
4      ^ R7      pVP                  VP                  4      '       g   Q hVP                  VP                   4      '       g   Q hVP                  R
8X  g   Q h\        W!P                  ^ 4      VP                  ^
4      ^R7      pVP#                  VP                  4      '       g   Q hVP#                  VP                   4      '       g   Q hVP                  R8X  g   Q hVP                  VP$                  ^^^.4      pVP                  VP                  VP$                  VP                  VP                  .4      pVP                  ^^VP$                  ^.4      p\        V P
                  W4V3R7      p\        VP                  VP                  VP$                  VP$                  VP$                  V P                   P                  .4      4       \        VP                   R,          VP'                  RVP$                  4      4       \        VP                  VP                  . ROVP(                  R7      4       \        VP*                  VP                  . RO4      4       \        VP                  R,          VP'                  R^VP(                  R7      4       R# )rD   r   c                     \         P                  ! R R7      ;_uu_ 4        ^V ,          uuRRR4       #   + '       g   i     R# ; i)rx   ry   N)r;   r|   r@  s   &r   r.   %TestNSum.test_special_case.<locals>.f5  s'    H--1u .---s	   	4A	r  r  r   :NrD   NN)r  r9   r9   )r   r9   r  r  r  )r   r   r  r   r  rC   )r?   r   r   r   r  rF   r;   r   r   r~   r  broadcast_shapesr%   r   r   ra  r   r  r  r  r  r   )r=   r   r.   rP   r   r+   r   r%   s   &&      r   test_special_caseTestNSum.test_special_case  s%   GG

11mAaD!12 477BJJqM2::bff+=BJJqMRDGGKK!89 HHYHHVHHQK##AGGQWWagg>477At,ww}}%%%zz5(((xx~~&&&	 1jjmRZZ^a@xx    xx		""""zzR1jjmRZZ^a@xx    xx		""""zzR JJ1a()JJ78JJ1bffa()477At,RVVRVVRVVTWW[[,Q!RS		"rwwtRVV'<=

BJJbhhJ$OPRZZ0K%LMbggdARXXg&FGr   r   r  r)  c                  aa \        SS4      oVV3R  lpSP                  ^SR7      pSP                  ^
SP                  .SR7      p\        W4V4      pVP                  P
                  S8X  g   Q hVP                  P
                  S8X  g   Q hSSP                  8X  d   RMRp\        ^
^4      \        P                  ! ^^4      .p\        VP                  SP                  VSR7      VR7       R# )c                 l   < V P                   S8X  g   Q h^V SP                  ^SR7      ,          ,          # )r9   r   )r   r   )r  r   r   s   &r   r.   TestNSum.test_dtype.<locals>.fT  s2    77e###qBJJqJ6666r   r   r3  r  r   N)r   r   r   r   r  r   r   r)  r   r   r	  r   )	r=   r   r   r.   rP   r   r+   r   r~   s	   &ff      r   ri  TestNSum.test_dtypeP  s    E"	7 JJqJ&JJBFF|5J11mww}}%%%yy%'''+uR#W\\!Q%78Cu!=DIr   r   c                (   Vw  r4R  p\         P                  pRpWcV,          ,           p\         P                  ! R^4      p	W\         P                  ! V4      ,          ,           p
\         P                  ! W,
          V,          4      p\        \        V4      4      ^8X  g   Q hVP                  WbP                  R7      VP                  WP                  R7      rVP                  WrP                  R7      VP                  WP                  R7      r\        WVWVR7      p\        VP                  V4      ^ 8  VP                  VP                  4      ^ 8  4       \        VP                  R,          VP                  ^ ,          V! V4      ,           4       R# )c                 "    ^V ^,          ,          # r8   r1   r  s   &r   r.   .TestNSum.test_nondivisible_interval.<locals>.fi  s    qAv:r   r   )r  r  NgUUUUUU?r  r   )r;   er  spacingr  lensetr   r)  r   r   diffr  r   )r=   r   r   r   r  r.   rP   r  b0r,   r   nsr+   s   &&&          r   test_nondivisible_interval#TestNSum.test_nondivisible_intervalb  s   
 	 DDT\IIb!RZZ^##XXqun%3r7|q   zz!::z.

1JJ
0O1::d**:5rzz"JJz7Wb19a)9A)=>SWWQZ!B%%78r   zNeeds beta function.r   c                   \         P                  P                  ^^4      pR p\        P                  ! RR7      ;_uu_ 4        \        P
                  ! V! \        P                  4      4      '       g   Q h RRR4       \        V^\        P                  4      p\        VP                  V4       R#   + '       g   i     LC; i)r  c                 ^    \         P                  P                  V ^4      V ^,          ,          # )   )r   	yulesimon_pmfr@  s   &r   r.   0TestNSum.test_logser_kurtosis_gh20648.<locals>.f  s"    ??''1-144r   rx   )invalidN)
r   rC  momentr;   r|   r  r   r   r   r  )r=   r   r~   r.   r+   s   &&   r   test_logser_kurtosis_gh20648%TestNSum.test_logser_kurtosis_gh20648z  s}     oo$$Q*	5 [[**88AbffI&&&& + 1a %	 +*s   3B22C	r1   N)r  r9   )r   r9   r      d   r  r  r  )r   rK  )rK  r   )-r  r  r  r  r;   r   r   r   uniformtolistr   r?   r   r~   rP   r   r   r  r   rF   r   r	  rL   r  r   r   r   r  r  r&   r   r  r   r  r  r  r#  r(  r.  ri  r>  r  rH  r  r  r  s   @r   r  r    s0    
))

 3
4CAr#**,A
 UUAXaZBFBD66BDgBG \\!QBFBD66BDdBG BD<<2F<+BD244#BFdBG<'| [[Zq!55 65& [[Z)<=09 >09d [[Wuwvy&IJ%4 K%4NL$"	7 [[UT5M2G 3G42,/Hb [[Wy)&<=J >J" [[Vi%;<9 =9. [[!!$7M!N& O&r   r  rI   )&r   r   r   numpyr;   numpy.testingr   (scipy._lib._elementwise_iterative_method_lib_elementwise_iterative_methodr5  scipy._lib._array_api_no_0dr   r   scipy._lib._array_apir   r   r   r	   r
   r   scipyr   r   scipy.integrater   r   r   r   scipy.integrate._tanhsinhr   scipy.special._ufuncsr   r   r    r4   r6   r  r1   r   r   <module>rY     s    	    ) 6 6 H@ @   A A 1 /.
+
$ 9E@ E@ E@P 4M& M& M&r   