+
    nDjf|                        ^ RI t ^ RIt^ RIHtHtHt ^ RIHt ^ RI	H
t ^ RIHu Ht ^ RIHtHtHtHtHtHtHtHtHt ^ RIHt ^ RIHtHtHt ^ RIH t  ^ RI!H"t"H#t#H$t$ ^ R	I%H&t&H't' ^ R
I(H)t* ] PV                  PX                  t,]"! ]4       ! R R4      4       t-]"! ]4       ! R R4      4       t.]"! ]4       ! R R4      4       t/]"! ]4       ! R R4      4       t0]"! ]4       ! R R4      4       t1 ! R R4      t2]"! ]4       ! R R]24      4       t3]"! ]4       ! R R]24      4       t4]"! ]4       ! R R4      4       t5RRRRRRR R&/R! lt6]"! ]4       ! R" R#4      4       t7]"! ]Pp                  4       ! R$ R%4      4       t9R# )'    N)assert_equalassert_almost_equalassert_allclose)given)	rombnewton_cotescumulative_trapezoid	trapezoidquadsimpson
fixed_quadqmc_quadcumulative_simpson)%_cumulative_simpson_unequal_intervals)statsspecial	integrate)skip_xp_invalid_arg)make_xp_test_casexp_default_dtypeis_numpy)xp_assert_closexp_assert_equal)array_api_extrac                      a  ] tR t^t o R tR t]P                  P                  R. RO4      R 4       t	]
! RRR7      ]
! R	RR7      R
 4       4       tRtV tR# )TestFixedQuadc                   a ^o^^S,          ,          p\        V3R l^ ^SR7      w  r#\        V\        P                  ! V4      RR7       R# )   c                 2   < V ^S,          ^,
          ,          #     xns   &_/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/integrate/tests/test_quadrature.py<lambda>+TestFixedQuad.test_scalar.<locals>.<lambda>       a!A#'l    r%   -q=rtolN)r   r   npasarray)selfexpectedgot_r%   s   &   @r&   test_scalarTestFixedQuad.test_scalar   s=    ac72AqA>RZZ1>r*   c                   a ^o^^S,          ,          p\        V3R lVP                  R4      VP                  R4      SR7      w  r4\        W1P                  V4      RR7       R# )r   c                 2   < V ^S,          ^,
          ,          # r    r"   r#   s   &r&   r'   'TestFixedQuad.test_0d.<locals>.<lambda>#   r)   r*                 ?r+   r,   r-   N)r   r0   r   )r1   xpr2   r3   r4   r%   s   &&   @r&   test_0dTestFixedQuad.test_0d    sL    ac72BJJrNBJJrNVWXZZ1>r*   dtypeNc                `  a Vf   TM\        SV4      p^pSP                  R^V,          VR7      pSP                  RVR7      SP                  RVR7      re^V^,           ,          p\        V3R lWVV3VR7      w  rVSP                  8X  d   RMRp
\        VSP                  V4      V
R7       R # )	Nr;   r?   r:   c                 :   < WR SP                   3,          ,          # )NNN)newaxis)r$   pr<   s   &&r&   r'   +TestFixedQuad.test_vector.<locals>.<lambda>.   s    am,<)<r*   )argsr%   r,   gH׊>r-   )getattraranger0   r   float64r   )r1   r?   r<   r%   rE   abr2   r3   r4   r.   s   &&f        r&   test_vectorTestFixedQuad.test_vector'   s    GB,>IIb!A#UI+zz"Ez*BJJrJ,G1a!e9<a!QRS+uRZZ1=r*   z	jax.numpyz lazy -> limited input validationreasonz
dask.arrayc           	        a ^oRp\         P                  ! \        VR7      ;_uu_ 4        \        V3R lVP	                  VP
                  ) 4      VP	                  R4      SR7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        \        V3R lVP	                  R4      VP	                  VP
                  4      SR7       RRR4       R#   + '       g   i     Lz; i  + '       g   i     R# ; i)	r   z8Gaussian quadrature is only available for finite limits.matchc                 2   < V ^S,          ^,
          ,          # r    r"   r#   s   &r&   r'   5TestFixedQuad.test_input_validation.<locals>.<lambda>8       QqS1Wr*   r;   r+   Nc                 2   < V ^S,          ^,
          ,          # r    r"   r#   s   &r&   r'   rU   :   rV   r*   r:   )pytestraises
ValueErrorr   r0   inf)r1   r<   messager%   s   && @r&   test_input_validation#TestFixedQuad.test_input_validation2   s     L]]:W55-rzz266'/BBJJrNVWX 6]]:W55-rzz"~rzz"&&?QUVW 65 65555s   =C<C,C)	,C=	r"   )Nfloat32rJ   )__name__
__module____qualname____firstlineno__r5   r=   rX   markparametrizerM   skip_xp_backendsr]   __static_attributes____classdictcell____classdict__s   @r&   r   r      sf     ?? [[W&BC> D> k*LMl+MNX O NXr*   r   c                   ,   a  ] tR t^=t o R tR tRtV tR# )TestRombc                    \        \        VP                  R 4      4      VP                  RVP                  R7      4       R# )      1@      `@rA   N)r   r   rI   r0   rJ   r1   r<   s   &&r&   	test_rombTestRomb.test_romb?   s*    RYYt_-rzz%rzzz/RSr*   c                `   \         P                  ! ^4      p\         P                  ! RV,          4      p\        VP	                  V4      4      p\        R \         P                  ! V4      \         P                  ! V4      4      w  rV\        WAP	                  WQP                  R7      R^ R7       R# )r!   皙?c                 d    \         P                  ! \         P                  ! R V ,          4      4      # )rt   )r/   cosarrayr$   s   &r&   r'   ,TestRomb.test_romb_gh_3731.<locals>.<lambda>G   s    RVVBHHSUO%<r*   rA   g:0yE>r.   atolN)
r/   rI   rv   r   r0   r   minmaxr   rJ   )r1   r<   r$   yvalr2   r4   s   &&     r&   test_romb_gh_3731TestRomb.test_romb_gh_3731B   sq    IIfFF3q5M2::a=!<bffQiPQSZZ

ZC$UVWr*   r"   N)r`   ra   rb   rc   rq   r   rg   rh   ri   s   @r&   rl   rl   =   s     TX Xr*   rl   c                   ,   a  ] tR t^Kt o R tR tRtV tR# )TestNewtonCotesc                   ^p\        V^4      w  r#\        W!\        P                  ! RR.4      ,          4       \	        W1^,          ) R,          4       ^p\        V^4      w  r#\	        W!\        P                  ! . R
O4      ,          R,          4       \	        W1^,          ) R,          4       ^p\        V^4      w  r#\	        W!\        P                  ! . RO4      ,          R,          4       \	        W1^,          ) R,          4       ^p\        V^4      w  r#\	        W!\        P                  ! . RO4      ,          R,          4       \	        W1^,          ) R,          4       R	# )z5Test the first few degrees, for evenly spaced points.      ?      (@      @g     @       @g     P@g     V@g     =AN)r;         @r;   )r;         @r   r;   )      @      @@r   r   r   )r   r   r/   rw   r   )r1   r%   wtserrcoffs   &   r&   test_newton_cotes!TestNewtonCotes.test_newton_cotesM   s   #Aq)SBHHc3Z001GdU4Z0#Aq)C288O#<!<S!@AGdU6\2#Aq)C288,@#A!A#!EFGdU6\2#Aq)C288,H#I!I$!NOGdU9_5r*   c                J   \         P                  ! . RO4      pV^,          p\        V4      w  r4Rp\         P                  ! W24      p\	        We4       \         P                  ! . RO4      pV^,          p\        V4      w  r4Rp\         P                  ! W24      p\	        We4       R# )z9Test newton_cotes with points that are not evenly spaced.      "@N)r:   g      ?       @gUUUUUU@)r:   gffffff?g @r   )r/   rw   r   dotr   )r1   r$   r~   r   r   exact_integralnumeric_integrals   &      r&   test_newton_cotes2"TestNewtonCotes.test_newton_cotes2c   s     HH_%qD#A66#>,=HH)*qD#A66#>,=r*   r"   N)r`   ra   rb   rc   r   r   rg   rh   ri   s   @r&   r   r   K   s     6,> >r*   r   c                      a  ] tR t^ut o R t]P                  P                  RRR7      ]P                  P                  RRR.4      R 4       4       t	R	t
V tR
# )TestSimpsonc           
        VP                  R 4      p\        \        V4      VP                  R4      4       \        \        VRR7      VP                  R4      4       \        \        W!P	                  RR^4      R7      VP                  R4      4       VP	                  R	R^4      pR
 p\        \        V! V4      VR7      VP                  R4      4       VP	                  R	R^4      p\        \        V! V4      RR7      VP                  R4      4       \        P                   ! R4      P                  ^^4      pVP                  VP                  R4      R4      pV! V4      p\        ^4       F  p\        W#VR7      p\        P                  ! VR.R7      pV F  p	\        VP                  4      p
V
P                  V\        R4      4       V\        V
4      ,          R,          ^,          ^,          V\        V
4      ,          ^ ,          ^,          ^,          ,
          p\        WxP                  ,          VP                  V4      4       K  	  K  	  VP                  VP                  R4      R4      pV! V4      p\        W#RR7      pRVR,          VR,          ,           ,          VR,          VR,          ,
          ,          p\        WqP                  V4      4       \        P                   ! ^4      P                  ^^4      pVP                  VP                  R4      R4      pV! V4      p\        ^4       F  p\        W#VR7      p\        P                  ! VR.R7      pV F  p	\        VP                  4      p
V
P                  V\        R4      4       V\        V
4      ,          R,          ^,          ^,          V\        V
4      ,          ^ ,          ^,          ^,          ,
          p\        WxP                  ,          VP                  V4      4       K  	  K  	  VP                  R.4      pV^,          p\        \        W#^ R7      VP                  R4      4       \        \        W#RR7      VP                  R4      4       VP                  . RO4      pV^,          p\        \        W#^ R7      VP                  R4      4       \        \        W#RR7      VP                  R4      4       VP                  . RO. RO. RO.4      pV^,          pVP                  . RO4      pVP                  R.^,          4      p\        \        W#^ R7      V4       \        \        W#RR7      V4       VP                  . RO. RO. R O.4      pV^,          pVP                  . R!O4      pVP                  . R"O4      p\        \        W#^ R7      V4       \        \        W#RR7      V4       R# )#rn   ro   r   dx      P@r:   r   rx   r   r;   c                     V ^,          # r    r"   rx   s   &r&   f#TestSimpson.test_simpson.<locals>.f   s    a4Kr*         5@r   r   g     \@      0@r$   axismulti_index)flagsNg     @_@r   )r   r   r   )   r!   )rC      )rC   r   )   r   r   )r   r   r   r   )r;   r   r   r   )r:   r:   r:   r:   竪Je@)r;   r   r   r   )r:   g      a@g      @g      @)r   r   g*U@)rI   r   r   r0   linspacer   r/   reshaperangenditerlistr   insertslicetuple)r1   r<   r~   r$   r   rK   iritr4   idxintegral	zero_axisdefault_axiss   &&            r&   test_simpsonTestSimpson.test_simpsonx   s_   IIcN
BJJt$45c*BJJsO<[[R%<=rzz#O KKB"	 	!*BJJt,<= KKB"!-rzz$/?@ IIcN""1a(JJryy~y1aDqAQ'A1]O4B2>>*

1eDk*U3Z=,a/!3ac
mA6F6IA6MM.. 12::h3GH	   JJryy~v.aDA$!D'AdG+,$!D'0AB::h/0 IIbM!!!Q'JJryy	2aDqAQ'A1]O4B2>>*

1eDk*U3Z=,a/!3ac
mA6F6IA6MM.. 12::h3GH	   JJtqDQ/CAR0"**S/BJJ'(qDQ/CAR0"**S/BJJ(*:<LMNqDJJ34	zz9+/2Q/;R0,?JJ(*:<NOPqDJJ;<	zz"IJQ/;R0,?r*   array_api_strictzno int->float promotionrO   droplastFTc                    VP                  . RO. RO.4      pV'       d   VRRR13,          p\        VRR7      p\        VP                  V\        V4      R7      RR7      p\        WE4       R# )r!   rC   Nr   rA   )r!   r!   r   r   r   r   r   )r   r   r!   r   
      r   r   )r0   r   r   r   )r1   r   r<   r~   resultr2   s   &&&   r&   test_simpson_2d_integer_no_x(TestSimpson.test_simpson_2d_integer_no_x   sd    
 JJ157 8!SbS&	A$2::a/?/C:D2N)r*   r"   N)r`   ra   rb   rc   r   rX   rd   rf   re   r   rg   rh   ri   s   @r&   r   r   u   sU     K@Z [[!!"4=V!W[[Z%7	* 8 X	*r*   r   c                      a  ] tR t^t o R tR tR tR t]P                  P                  R^R.4      R 4       tR tR	tV tR
# )TestCumulative_trapezoidc                    VP                  R^^R7      pTp\        W2^ R7      pVP                  . RO4      p\        WE4       \        W2RR7      p\        WER,          4       R# )r!   numinitialNr   NNr   )r:                r   r:   r   r	   r0   r   )r1   r<   r$   r~   y_int
y_expecteds   &&    r&   test_1d TestCumulative_trapezoid.test_1d   sV    KKA1K%$Q15ZZ 9:
*$Q48"~.r*   c                   VP                  VP                  ^\        V4      R7      R4      pTp\        W2^ R7      pVP	                  . RO. RO.. RO. R	O.. R
O. RO..4      p\        WE4       . ROp\        . ROV4       FG  w  rx\        W2^ VR7      pVP                  R8X  g   Q h\        W2RVR7      pVP                  V8X  d   KG  Q h	  R# )   rA   r   )r   r   Nr   r!   r   )r:   r   r         @)r:   r         $@     0@)r:         !@      2@g     <@)r:         )@g      :@     @D@)r:   r   g      A@g     @J@)r:        4@g      E@g      P@))r!   r!   r   )r   r   r   )r   r!   r   r   r   r!   )r   rI   r   r	   r0   r   zipshape)	r1   r<   r$   r~   r   r   shapesr   r   s	   &&       r&   test_y_nd_x_nd'TestCumulative_trapezoid.test_y_nd_x_nd   s    JJryy2B22FyGS$Q15ZZ"4"6"8"6"7"9"7"7"9	!: ;
 	* 3y&1KD(qtDE;;)+++(t$GE;;%'''	 2r*   c           	        VP                  VP                  ^\        V4      R7      R4      pVP                  ^\        V4      R7      ^,          pVP                  . RO. RO.. RO. RO..4      VP                  . R	O.. R
O.. RO..4      VP                  . RO. RO.. RO. RO.. RO. RO..4      3p\	        . ROV4       F2  w  rV\        W#RVP                  V,           VRR7      p\        Wv4       K4  	  R# )r   rA   N)r$   r   r   r   )r         @r   r   )r   r   r         &@)g      D@g      F@g      H@g      J@)g      L@g      N@r   g      Q@)r   r   r   r   )r   r   r         *@)r   g      3@      4@r   )r   r   g     1@)r   r   g     J@)r   g     B@g     `V@)r   g     J@g     `_@)r   g     @Q@g     0d@)r   g     @U@g     h@r   )r   rI   r   r0   r   r	   r   r   )r1   r<   r~   r$   ys_expectedr   r   r   s   &&      r&   test_y_nd_x_1d'TestCumulative_trapezoid.test_y_nd_x_1d   s   JJryy2B22FyGSIIa/3I4a7 JJ)+---/0 1 JJ)*-.-.0 1 JJ)+)+-++-	. /0 !$I{ ;D(.?d157EE. !<r*   c                   VP                  R^^R7      p\        V4      pVP                  . RO4      p\        W44       \        V^ R7      pVP                  . RO4      p\        W44       \        V^R7      pVP                  . R	O4      p\        W44       \        V^^ R7      pVP                  . R
O4      p\        W44       R# )r!   r   r   r   )r   r   Nr   )r   r   r   r:   )r   r   r   r   r:   )            r   r:   )r   r   r   r   r:   r   )r1   r<   r~   r   r   s   &&   r&   test_x_none$TestCumulative_trapezoid.test_x_none  s    KKA1K%$Q'ZZ 56
*$Q2ZZ 89
*$Q1-ZZ 56
*$Q1a8ZZ 89
*r*   r   r   c                    VP                  ^ ^
^
R7      p\        P                  ! \        RR7      ;_uu_ 4        \	        W1R7       RRR4       R#   + '       g   i     R# ; i)z4If initial is not None or 0, a ValueError is raised.r   z	`initial`rR   r   N)r   rX   rY   rZ   r	   )r1   r   r<   r~   s   &&& r&   test_initial_error+TestCumulative_trapezoid.test_initial_error  s@    
 KK22K&]]:[99 4 :999s   AA!	c                    \         P                  ! \        R R7      ;_uu_ 4        \        VP	                  . 4      R7       RRR4       R#   + '       g   i     R# ; i)At least one point is requiredrR   r~   N)rX   rY   rZ   r	   r0   rp   s   &&r&   test_zero_len_y(TestCumulative_trapezoid.test_zero_len_y(  s4    ]]:-MNN 2::b>2 ONNNs   AA	r"   N)r`   ra   rb   rc   r   r   r   r   rX   rd   re   r   r   rg   rh   ri   s   @r&   r   r      sO     /(*/0+& [[As8553 3r*   r   c                   ,   a  ] tR tRt o R tR tRtV tR# )CommonTrapezoidSimpsonTestsi-  c           	     ,   VP                  R^
R4      pV P                  VP                  RV^,          ,          4      VP                  ^VP	                  VP
                  4      ,          4      ,          RR7      p\        W1P	                  R4      4       R# )r   g?r   r;   N      )rI   quadrature_funcexpsqrtr0   pir   )r1   r<   r$   r   s   &&  r&   test_simple'CommonTrapezoidSimpsonTests.test_simple.  sq    IIc2r"  a1f!5BJJruuDU@U8V!V$' ! ) 	::c?+r*   c                2   VP                  ^ ^^4      pVP                  ^ ^^4      pVP                  ^ ^^4      pVP                  V4      V^,          V^ ,          ,
          ,          p\        P                  ! V4      ^ ,          P	                  ^4      p\        P                  ! V4      R,          P	                  ^4      pVP                  V4      V^,          V^ ,          ,
          ,          p\        P                  ! V4      ^ ,          P	                  ^4      p\        P                  ! V4      R,          P	                  ^4      pVP                  V4      V^,          V^ ,          ,
          ,          p\        P                  ! V4      ^ ,          P	                  ^4      p\        P                  ! V4      R,          P	                  ^4      pVR,          VR,          ,           VR,          ,           pVP                  WR,          ,          ^ R7      p	VP                  WR,          ,          ^R7      p
VP                  WR,          ,          ^R7      pV P                  WR,          ^ R7      p\        W4       V P                  WR,          ^R7      p\        W4       V P                  WR,          ^R7      p\        W4       V P                  W^ R7      p\        W4       V P                  W^R7      p\        W4       V P                  W^R7      p\        W4       R# )r   Nr   r   r   )rC   NN)NrC   N)NNrC   )r   	ones_likexpxatdividesumr  r   )r1   r<   r$   r~   zwxwywzqqxqyqzr   s   &&           r&   	test_ndim%CommonTrapezoidSimpsonTests.test_ndim5  sc   KK1a KK1a KK1b!\\!_!qt,VVBZ]!!!$VVBZ^""1%\\!_!qt,VVBZ]!!!$VVBZ^""1%\\!_!qt,VVBZ]!!!$VVBZ^""1%mq.<@VVA=))V2VVA=))V2VVA=))V2   &6Q ?  oA >  oA >   a 0  a 0  a 0r*   r"   N)r`   ra   rb   rc   r  r  rg   rh   ri   s   @r&   r   r   -  s     ,# #r*   r   c                   &   a  ] tR tRt o R tRtV tR# )TestSimpson2iZ  c                    \        V/ VB # N)r   r1   rG   kwargss   &*,r&   r  TestSimpson2.quadrature_func]  s    '''r*   r"   N)r`   ra   rb   rc   r  rg   rh   ri   s   @r&   r  r  Z  s     ( (r*   r  c                   B   a  ] tR tRt o R tR t]R 4       tR tRt	V t
R# )TestTrapezoidi`  c                    \        V/ VB # r  )r
   r  s   &*,r&   r  TestTrapezoid.quadrature_funcb  s    $)&))r*   c           
        VP                  VP                  ^ ^^4      R4      pVP                  VP                  ^ ^^4      R4      pVP                  ^R^
4      p\        \        W2^ R7      V4       \        \        W1P	                  . RO4      ^ R7      V4       \        \        W1P	                  . RO4      R,          ^ R7      V4       \
        P                  ! \        4      ;_uu_ 4        \        W1P	                  . RO4      R,          ^ R7       RRR4       VP	                  . RO4      p\        \        W2^R7      V4       \        \        W1P                  ^ ^	^
4      ^R7      V4       R#   + '       g   i     Ld; i)	r   i|  r   N)r   r   )r   r   r   )rC   N)NrC   )r   g     P`@g     k@)r   r   r   r
   r0   rX   rY   	Exception)r1   r<   r$   r~   out0out1s   &&    r&   test_gh21908TestTrapezoid.test_gh21908e  s   JJr{{1b"-w7JJr{{1b"-w7{{3R(	!q148	!zz-'@qI4Pa::m4W=AF	
 ]]9%%a::m4W=AF & zz/0	!q148a;;q!R0q9	
 &%s   *&E,,E<	c                   \         P                  ! ^4      pW",          pV^8H  p\         P                  P                  W4R7      pRp\	        \        WR4      V4       \         P                  P                  W$R7      p\	        \        WW4      V4       \         P                  P                  W$R7      p\	        \        W74      V4       R# )r   )maskr   N)r/   rI   marw   r   r
   )r1   r<   r$   r~   r+  ymr   xms   &&      r&   test_maskedTestTrapezoid.test_masked}  s     IIaLEAvUU[[[&	"(!,UU[[[&	")1-UU[[[&	!(!,r*   c                @   \        \        ^4      4      pV Uu. uF  q"V,          NK  	  pp\        P                  ! V\        P                  R7      p\        P                  ! V\        P                  R7      p\        W14      p\        WT4      p\        Wg4       R# u upi )r   rA   N)r   r   r/   r0   rJ   r
   r   )r1   r$   tr~   xarryarrresresarrs   &       r&   test_array_likeTestTrapezoid.test_array_like  so    qNAqUUAzz!2::.zz!2::.o4&$ s   Br"   N)r`   ra   rb   rc   r  r(  r   r/  r7  rg   rh   ri   s   @r&   r!  r!  `  s-     *
0 - - % %r*   r!  c                   d  a  ] tR tRt o R tRR lt]P                  P                  RRR.4      ]P                  P                  R^^.4      R 4       4       t	]P                  P                  RR	R	.RR.RR	.R	R..4      R
 4       t
]P                  P                  RRR.4      R 4       tR tRtV tR# )TestQMCQuadi  c           
     f  a SP                  R R .4      pSP                  RR.4      pRp\        P                  ! \        VR7      ;_uu_ 4        \	        RW#4       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \	        R W#4       RRR4       V3R lpR	p\        S4      '       d;   \        P                  ! \        VR7      ;_uu_ 4        \	        WRV4       RRR4       M9\        P                  ! \
        VR7      ;_uu_ 4        \	        WRV4       RRR4       R
p\        P                  ! \        VR7      ;_uu_ 4        \	        R W#RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        R W#RR7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        R W#RR7       RRR4       Rp\        P                  ! \
        VR7      ;_uu_ 4        \	        R W#\        P                  P                  ^4      R7       RRR4       Rp\        P                  ! \        VR7      ;_uu_ 4        \	        R W#^
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Lx; i  + '       g   i     ELN; i  + '       g   i     EL$; i  + '       g   i     L; i  + '       g   i     R# ; i)r:   r;   z`func` must be callable.rR   za duckNz/`func` must evaluate the integrand at points...c                      ^# r   r"   r"   r*   r&   r'   3TestQMCQuad.test_input_validation.<locals>.<lambda>  s    Qr*   c                 L   < V P                   ^8X  g   Q hSP                  V 4      # r=  )ndimr  r$   r<   s   &r&   func/TestQMCQuad.test_input_validation.<locals>.func  s!    66Q;;66!9r*   z8Exception encountered when attempting vectorized call...z`n_points` must be an integer.c                     ^# r=  r"   rx   s   &r&   r'   r>        qr*   g     @)n_pointsz!`n_estimates` must be an integer.c                     ^# r=  r"   rx   s   &r&   r'   r>    rE  r*   r   )n_estimatesz8`qrng` must be an instance of scipy.stats.qmc.QMCEngine.c                     ^# r=  r"   rx   s   &r&   r'   r>    rE  r*   )qrngz8`qrng` must be initialized with dimensionality equal to c                     ^# r=  r"   rx   s   &r&   r'   r>    rE  r*   z,`log` must be boolean \(`True` or `False`\).c                     ^# r=  r"   rx   s   &r&   r'   r>    rE  r*   log)r0   rX   rY   	TypeErrorr   rZ   r   warnsUserWarningr   qmcSobol)r1   r<   rK   rL   r\   rB  s   &f    r&   r]   !TestQMCQuad.test_input_validation  s   JJBx JJBx ,]]9G44Xq$ 5 D]]:W55Y% 6	 MB<<k99!$ :9 z99!$ : 3]]9G44[!8 5 6]]9G44[!C8 5 M]]9G44[!X6 5 M]]:W55[!UYY__Q-?@ 6 B]]9G44[!B/ 54G 544 655 :99 :99 544 544 544 65 544sl   J 	JJ(J<KK$K8-L&L J	J%	(J9	<K	K!	$K5	8L		L	L0	Nc           
       aa \        S4      pVf   \        P                  ! ^4      p^p\        P                  ! V4      p\        P                  ! V4      pV3R lo\        P
                  P                  R4      p	\        P                  P                  WiR7      p
\        P                  ! V4      p\        P                  ! V4      V,          p\        SSP                  WR7      SP                  WR7      WV
R7      p\        P                  P                  WWR7      p\        P                  ! V^,
          R4      VP                   ,          p\#        VP$                  SP                  WR7      VR7       \        P&                  ! V4      VP$                  ,          ^ 8  g   Q h\        P
                  P                  R4      p	\        P                  P                  WiR7      p
\        VV3R	 lSP                  WR7      SP                  WR7      WR
V
R7      pVP$                  P(                  SP*                  8X  d   RMRp\#        SP-                  SP/                  VP$                  4      4      VP$                  VR7       SP1                  VP$                  R,           4      \        P&                  ! V4      ^ 8  d   SP2                  M^ 8X  g   Q h\#        SP/                  VP                   4      VP                   VV^d,          R7       R # )Nc                    < SP                  RSP                  W ,          ^ R7      ,          4      ^SP                  ,          ,          # )r   r   r  )r  r  r  rA  s   &r&   rB  $TestQMCQuad.basic_test.<locals>.func  s3    66$!!445RUUCCr*   l   ^^@E9? )seedrA   )rF  rH  rJ  )lower_limitgףp=
?r{   c                  .   < SP                  S! V !  4      # r  rM  )rG   rB  r<   s   *r&   r'   (TestQMCQuad.basic_test.<locals>.<lambda>  s    tT{(;r*   T)rF  rH  rN  rJ  +=g>r-   y                rz   )r   r/   oneszeroseyerandomdefault_rngr   rR  rS  r   r0   multivariate_normalcdfr   stdtritstandard_errorr   r   prodr?   rJ   realr  imagr  )r1   rF  rH  signsr<   r?   r@  meancovrngrJ  rK   rL   r5  refr{   logresr.   rB  s   &&&&f             @r&   
basic_testTestQMCQuad.basic_test  s,    $=GGAJExx~ffTl	D ii##$78yyt.HHTNGGDME!tRZZZ7A9S (N''++AS+H{1}e4s7I7IIbjjj&BNwwu~cll*Q...ii##$78yyt.;**Q*4bjjj6P#+"/ **bjj8udv 78#,,TRwwv+,"''%.1:LRSTTTv445**DH	Fr*   rF  rH  c                ,    V P                  WVR 7       R# ))r<   Nrp  )r1   rF  rH  r<   s   &&&&r&   
test_basicTestQMCQuad.test_basic  s     	"5r*   rj  r;   c                *    V P                  WR 7       R# ))rj  r<   Nrs  )r1   rj  r<   s   &&&r&   	test_signTestQMCQuad.test_sign  s    e+r*   rN  FTc           
     d   R p\         P                  ! \        VR7      ;_uu_ 4        \        R VP	                  ^ ^ .4      VP	                  ^ ^.4      VR7      pRRR4       XP
                  V'       d   VP                  ) M^ 8X  g   Q hVP                  ^ 8X  g   Q hR#   + '       g   i     LM; i)z-A lower limit was equal to an upper limit, sorR   c                     ^# r=  r"   rx   s   &r&   r'   'TestQMCQuad.test_zero.<locals>.<lambda>  s    Qr*   rM  N)rX   rP  rQ  r   r0   r   r[   rf  )r1   rN  r<   r\   r5  s   &&&  r&   	test_zeroTestQMCQuad.test_zero  s    A\\+W55;

Aq6(:BJJ1v<NTWXC 6||3A666!!Q&&& 65s   3BB/	c                    R  p\        V^ ^4      p\        P                  P                  ^^R7      \        P                  P                  ^ ^R7      ,
          p\	        VP
                  VR4       R# )c                 D    \         P                  P                  V ^R7      # )r!   scale)r   normpdfrx   s   &r&   rB  -TestQMCQuad.test_flexible_input.<locals>.func  s    ::>>!1>--r*   r  g{Gz?N)r   r   r  rd  r   r   )r1   rB  r5  rn  s   &   r&   test_flexible_inputTestQMCQuad.test_flexible_input  sS    	. tQ"jjnnQan(5::>>!1>+EEc40r*   r"      )r  r   NNi   g      )r`   ra   rb   rc   r]   rp  rX   rd   re   rt  rw  r|  r  rg   rh   ri   s   @r&   r:  r:    s     )0V!FF [[Z$7[[]QG46 5 86 [[WBx#sc2YS	&RS, T, [[UUDM2' 3'1 1r*   r:  r$   r   r   r   c          	        a	 V P                   V,          ^8  d(   Vf   \        WW$RR7      # V\        WW$^ R7      ,           # \        P                  ! WR4      p \        P                  ! V4      ^8  d   \        P                  ! WR4      MTp\        P                  ! V4      ^8  d   \        P                  ! W$R4      MTp\        P                  ! V4      ^8  d   \        P                  ! W4R4      MTpV P                   R,          o	Ve   V\        P
                  ! S	4      ,          MTpVRJ pV'       d   ^ MTp\        P                  ! WP                   4      p\        P                  ! W0P                   RR R,           4      p\        P                  ! WV3RR7      pV	3R lp\        P                  ! VRV4      pV'       d
   VR,          MTp\        P                  ! VRV4      pV# )r   N)r$   r   r   r   r   c                 N   < \        V R S V S^S,           V ^S,          R  R7      # )N)r$   r   )r   )r  r%   s   &r&   r   *cumulative_simpson_nd_reference.<locals>.f  s,    !!BQ%1Qqs8QqstWEEr*   r   r=  .r   )	r   r	   r/   moveaxisr@  rI   broadcast_toconcatenateapply_along_axis)
r~   r$   r   r   r   initial_was_noner  r   r5  r%   s
   &$$$$    @r&   cumulative_simpson_nd_referencer    sp   wwt}q?'2$OO1!RTUVVV 	AR A$&GGAJNAR A&(ggbkAoRr	"2B020@10Dbkk','G 	
A^RYYq\A$#aG 	77#Aoogwws|d':;G
gR0AF


aQ
'C +#g,C
++c2t
$CJr*   c                   (  a  ] tR tRt o ]P
                  ! ^4      t]^,          t]P                  P                  RR'4      ]P                  P                  RR'4      R 4       4       t]! RR7      ]P                  P                  R]P
                  ! R(^4      4      ]P                  P                  R	R)4      ]P                  P                  R
R*4      ]P                  P                  RR+4      ]P                  P                  RR,4      R 4       4       4       4       4       4       t]P                  P                  R-R]! . R.OR7      3R]! ]. R/O.]].R7      3R]! ]]].]]].^ R7      3R]! . . R7      3R]! ^R7      3R]! ]P
                  ! ^4      R7      3R]! ]P
                  ! ^4      R7      3R]! R]P
                  ! ^4      R7      3.4      R 4       tR tR t]P                  P%                  ^
4      ]P                  P&                  ]! ]P,                  ! ]P.                  ]P0                  ! ^^^
R7      ]P4                  ! R0^
RR7      P7                  R  4      R!7      R"7      R# 4       4       4       t]P                  P%                  ^
4      ]P                  P&                  ]! ]P,                  ! ]P.                  ]P0                  ! ^^^
R7      ]P4                  ! R0^
RR7      P7                  R$ 4      R!7      R"7      R% 4       4       4       tR&tV tR# )1TestCumulativeSimpsoni)  use_dxFTuse_initialc                ~   \         P                  P                  R 4      p^
pV'       d   ^M^pVP                  VP                  4       4      pV^8X  d6   VP                  \         P                  ! VP                  V4      4      4      pMGVP                  WSP                  R7      V,          VP                  VP                  4       4      ,           pVP                  V^,           VP                  R7      RVP                  3,          p	VP                  VP                  V^,           4      4      RVP                  3,          p
VP                  WV	,          ,          ^ R7      pVP                  WV	^,           ,          ,          V	^,           ,          ^ R7      pV'       d   TMW^ ,          ,
          R,          pV'       d
   V^ ,          MRpV'       d   RV/MRV/p\        V3/ VBRV/B pV'       g   \        VVR	R
7       R# V'       d   ^ M^p\        VVRR
7       \        VVR^1,          VVR^1,          R	R
7       R# )   F*BG rA   rC   r   r   Nr   r$   r   gV瞯<r-   g{Gzd?)r/   ra  rb  r0   sortrI   rJ   rD   r  r   r   )r1   r  r  r<   rm  r%   orderr   r$   r   cr~   Yrn  r   kwargr5  i0s   &&&&              r&   r   TestCumulativeSimpson.test_1d.  s   
 ii##$89 ZZ

%A:

2773::a=12A		!::	.r1BJJszz|4LLAIIeairzzI21bjj=AJJszz%!),-am<FF1T6F"FF1QZ<Q'aF0aQtVRL &!A$4$r
3( =e=W= C51!qBC62CAJBEE
?r*   )cpu_onlyr   x_ndimx_leni_ndimNr   c                   \         P                  P                  R 4      p^^V.pVR,          W,          uW&   VR&   VP                  4       p	^W&   V^8X  d   T	MRp
VP	                  VP                  VR7      4      pRRr\V'       d<   V^8  d   VP                  V	R7      MVP                  4       pVP	                  V4      pMlV^8  d)   \         P
                  ! VP                  VR7      VR7      M+\         P
                  ! VP                  W,          R7      4      pVP	                  V4      pVf   RM VP	                  VP                  V
R7      4      p\        WW]VR7      p\        \         P                  ! V4      \         P                  ! V4      Vf   RM\         P                  ! V4      Vf   RM\         P                  ! V4      VR7      p\        WP	                  V4      RR7       R# )	r  sizeNr   )r$   r   r   r   V瞯<r-   r   r"   )	r/   ra  rb  copyr0   r  r   r  r   )r1   r   r  r  r  r   r<   rm  r   shape_len_1i_shaper~   r$   r   r5  rn  s   &&&&&&&         r&   test_ndTestCumulativeSimpson.test_ndS  s    ii##$89 Au!&rEKU2Yjjl!'1+" JJszzuz-.d217!-BBB?Ez/d;ggcjjekj:; 

1A .$bjj9Q.R !BdK .JJqMRZZ]rztrzzRT~#ODG1D4
 	ZZ_59r*   zx must be strictly increasingrx   )r$   r~   )r$   r~   r   r   z-`axis=4` is not valid for `y` with `y.ndim=1`r   z+shape of `x` must be the same as `y` or 1-Dz'`initial` must either be a scalar or...r   z"`dx` must either be a scalar or...)r$   r   c                    \        VP                  V P                  4      VP                  V P                  4      R R RR7      pVP	                  4        UUu/ uFC  w  rVT\        V\        4      '       d&   VP                  \        P                  ! V4      4      MTbKE  	  ppp\        P                  ! \        VR7      ;_uu_ 4        \        R/ \        V3/ VB B  R R R 4       R # u uppi   + '       g   i     R # ; i)N)r~   r$   r   r   r   rR   r   r"   )dictr0   y0x0items
isinstancer   r/   rX   rY   rZ   r   )r1   r\   kwarg_updater<   kwargs0kvs   &&&&   r&   test_simpson_exceptions-TestCumulativeSimpson.test_simpson_exceptionsz  s     DGG,

4770C#". %1$6$6$8:$8DA 
1d8K8K2::bjjm4QRR$8 	 :]]:W55?g!>!>? 65:555s   A	C&C,,C=	c                    \         P                  P                  R 4      pVP                  VP                  ^
R7      4      p\	        VRR7      p\        WAP                  ^	VP                  R7      4       R# )r  r  r:   r   rA   N)r/   ra  rb  r0   r   r   r_  rJ   )r1   r<   rm  r~   r5  s   &&   r&   test_special_cases(TestCumulativeSimpson.test_special_cases  sU    ii##$89JJszzrz*+ r*XXarzzX:;r*   c                   \         P                  ! VRR7      p\        W4      p\        VRRRR13,          VRRRR13,          4      RRRR13,          p. VP                  RR O^N5p\         P                  ! \         P
                  ! V4      VR,          VRRR13,          ,
          \         P
                  ! V4      .RR7      pRVR&   V# )aB  `cumulative_simpson` and `simpson` can be tested against other to verify
they give consistent results. `simpson` will iteratively be called with
successively higher upper limits of integration. This function calculates
the theoretical correction required to `simpson` at even intervals to match
with `cumulative_simpson`.
r   .Nr:   r   r  ).:r   Nr!   )r/   diffr   r   r  r_  )r1   r~   r$   dsub_integrals_h1sub_integrals_h2zeros_shapetheoretical_differences   &&&     r&   1_get_theoretical_diff_between_simps_and_cum_simpsGTestCumulativeSimpson._get_theoretical_diff_between_simps_and_cum_simps  s     GGAB@F@c4R4iL!C2I,

tt)
 )(a(!#%!'*-=c3B3h-GG%
 "
 -0y) &%r*   )max_dimsmin_sidemax_side)	allow_nanc                    \        V 4      R 8  # gHz>absrx   s   &r&   r'   TestCumulativeSimpson.<lambda>      #a&SW-r*   )elementsr   c                6   R p\        VP                  V4      RR7      pV! V4      pV P                  V\        P                  ! VP
                  R,          4      R7      p\        VR	,          VP                  VR	,          VR	,          ,           4      RR7       R# )
E  Theoretically, the output of `cumulative_simpson` will be identical
to `simpson` at all even indices and in the last index. The first index
will not match as `simpson` uses the trapezoidal rule when there are only two
data points. Odd indices after the first index are shown to match with
a mathematically-derived correction.c                     \         P                  ! \        ^V P                  R,          ^,           4       Uu. uF  p\	        V RRV13,          RR7      NK  	  upRR7      # u upi )r!   .Nr;   r   r   r   r/   stackr   r   r   )r~   r   s   & r&   simpson_referencehTestCumulativeSimpson.test_cumulative_simpson_against_simpson_with_default_dx.<locals>.simpson_reference  sS    886;Aqwwr{1}6MN6M37,6MNUW Ns   !A!r;   r   rx   gؗҜ<rZ  Nr   r  )r   r0   r  r/   rI   r   r   )r1   r~   r<   r  r5  rn  r  s   &&&    r&   7test_cumulative_simpson_against_simpson_with_default_dxMTestCumulativeSimpson.test_cumulative_simpson_against_simpson_with_default_dx  s    "	
 !A37"!%!W!W1772;' "X "
 	L"**S\4J74S%ST	
r*   c                    \        V 4      R 8  # r  r  rx   s   &r&   r'   r    r  r*   c           	     8   ^
VP                   R,          ^,
          ,          p\        P                  ! ^ ^
VP                   R,          R7      pVR,          RV,          \        P                  P	                  R^\        V4      ^,
          4      ,          ,           VR&   R p\        VP                  V4      VP                  V4      R7      pV! W4      pV P                  W4      p\        VR,          VP                  VR,          VR,          ,           4      4       R# )	r  r   r   rt   c                     \         P                  ! \        ^V P                  R,          ^,           4       Uu. uF&  p\	        V RRV13,          VRRV13,          R7      NK(  	  upRR7      # u upi )r!   .Nrx   r   r   r  )r~   r$   r   s   && r&   r  XTestCumulativeSimpson.test_cumulative_simpson_against_simpson.<locals>.simpson_reference  s`    88<A!QWWR[QR]<ST<Sq37qbqbz2<ST Ts   ,A,rx   Nr   r  )
r   r/   r   ra  uniformlenr   r0   r  r   )	r1   r~   r<   intervalr$   r  r5  rn  r  s	   &&&      r&   'test_cumulative_simpson_against_simpson=TestCumulativeSimpson.test_cumulative_simpson_against_simpson  s    " qwwr{Q'KK21772;/"HRYY%6%6r1c!fqj%III"	 !A"**Q-@%!%!W!W"
 	L"**S\4J74S%ST	
r*   r"   )FT)r   r   )r   r!      )Nr   r   )NT)r\   r  )r!   r!   r   r   )r!   r!   r   r   r  ) r`   ra   rb   rc   r/   rI   r  r  rX   rd   re   r   rf   r  r  r  r  r  	fail_slowslowr   hyp_numarraysrJ   array_shapesstfloatsfilterr  r  rg   rh   ri   s   @r&   r  r  )  s    	1B	QB[[X}5[[]M:!@ ; 6!@F t$[[VRYYr1%56[[Xv.[[Wi0[[X}5[[T<0: 1 6 1 / 7 %:B [[8	($*>?	($"l1CBx*PQ	($"b""b"TU*VW	)4"+;<	8$A,G	6ryy|8LM	2D14NO	-tdryy|/LM	; 	@	@<&< [[2[[

..JJ  !a"EYYsB%8??@WX

  
. [[2[[

..JJ  !a"EYYsB%8??@WX

  
r*   r  c                      a  ] tR tRt o R tR t]P                  P                  R]	! ]
! ^^ ^4      4      ]	! ]
! ^#^^4      4      ,           4      R 4       tRtV tR# )TestLebedevi  c                    R p\         P                  ! \        VR7      ;_uu_ 4        \        P                  ! R4       RRR4       R#   + '       g   i     R# ; i)zOrder n=-1 not available...rR   Nr   )rX   rY   NotImplementedErrorr   lebedev_rule)r1   r\   s   & r&   r]   !TestLebedev.test_input_validation  s6    /]].g>>""2& ?>>>s   AA	c                    R  p\         P                  ! ^4      w  r#W1! V4      ,          pRp\        WERR7       \        \        P                  ! V4      ^\        P
                  ,          4       R# )c                 <    \         P                  ! V ^ ,          4      # )r   )r/   r  rx   s   &r&   r   &TestLebedev.test_quadrature.<locals>.f  s    66!A$<r*   g9-@r]  r-   N)r   r  r   r/   r  r  )r1   r   r$   wr5  rn  s   &     r&   test_quadratureTestLebedev.test_quadrature  sQ    	  %%b)!A$hu-q	1ruu9-r*   r  c                   \         P                  ! V4      w  r#\        P                  ! R R R7      ;_uu_ 4        \        P
                  ! VP                  ^ R7      p\        VP                  ^ RR7       RRR4       \        \        P                  ! V4      ^\        P                  ,          4       R#   + '       g   i     LG; i)ignore)r  invalidr   r  rZ  N)r   r  r/   errstater   directional_statsTr   mean_resultant_lengthr  r  )r1   r  r$   r  r5  s   &&   r&   test_propertiesTestLebedev.test_properties  sw    %%e,[[(;;))!##A6CC55quE < 	q	1RUU7+	 <;s   ;B33C	r"   N)r`   ra   rb   rc   r]   r  rX   rd   re   r   r   r  rg   rh   ri   s   @r&   r  r    sV     '
. [[Wd5B?&;d5SRSCT>U&UV, W,r*   r  r   ):rX   numpyr/   numpy.testingr   r   r   
hypothesisr   hypothesis.strategies
strategiesr  hypothesis.extra.numpyextrar  scipy.integrater   r   r	   r
   r   r   r   r   r   scipy.integrate._quadraturer   scipyr   r   r   scipy.conftestr   scipy._lib._array_apir   r   r   scipy._lib._array_api_no_0dr   r   scipy._externalr   r  rd   rf   r   rl   r   r   r   r   r  r!  r:  r  r  r  r  r"   r*   r&   <module>r     s     L L  " ( (; ; ; N + + . O O H 2;;// :"X "X "XJ 4
X 
X 
X < &> &> !&>R 7Z* Z* Z*z '(V3 V3 )V3r+ +Z 7(. ( (
 94%/ 4% 4%n 8h1 h1 h1V"D "T "4 "b "J %&M
 M
 'M
` 9))*, , +,r*   