+
    LV-jH  ã                   óB   € ^ RI HtHtHtHtHt ^ RIHt RR ltRR lt	R# )é    )ÚarangeÚnewaxisÚhstackÚprodÚarray)Úlinalgc                óž  € W^,           8  d   \        R4      hV ^,          ^ 8X  d   \        R4      hV ^,	          p\        V) VR,           4      pVR\        3,          pVR,          p\        ^V 4       F  p\	        WCV,          .4      pK  	  \        \        ^V^,           4      ^ R7      \        P                  ! V4      V,          ,          pV# )a#  
Return weights for an Np-point central derivative.

Assumes equally-spaced function points.

If weights are in the vector w, then
derivative is w[0] * f(x-ho*dx) + ... + w[-1] * f(x+h0*dx)

Parameters
----------
Np : int
    Number of points for the central derivative.
ndiv : int, optional
    Number of divisions. Default is 1.

Returns
-------
w : ndarray
    Weights for an Np-point central derivative. Its size is `Np`.

Notes
-----
Can be inaccurate for a large number of points.

Examples
--------
We can calculate a derivative value of a function.

>>> def f(x):
...     return 2 * x**2 + 3
>>> x = 3.0 # derivative point
>>> h = 0.1 # differential step
>>> Np = 3 # point number for central derivative
>>> weights = _central_diff_weights(Np) # weights for first derivative
>>> vals = [f(x + (i - Np/2) * h) for i in range(Np)]
>>> sum(w * v for (w, v) in zip(weights, vals))/h
11.79999999999998

This value is close to the analytical solution:
f'(x) = 4x, so f'(3) = 12

References
----------
.. [1] https://en.wikipedia.org/wiki/Finite_difference

z;Number of points must be at least the derivative order + 1.z!The number of points must be odd.ç      ð?:NNNç        ©Úaxis)Ú
ValueErrorr   r   Úranger   r   r   Úinv)ÚNpÚndivÚhoÚxÚXÚkÚws   &&     Úp/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/scipy/stats/_finite_differences.pyÚ_central_diff_weightsr      s¶   € ð^ 
�1�H„}ÜØIó
ð 	
ð 
ˆA…v�„{ÜÐ<Ó=Ð=à	ˆq�€BÜ�ˆs�B˜•HÓ€AØ	ˆ!ŒWˆ*�€AØ	ˆ3�€AÜ�1�bŽ\ˆÜ�A˜!•t�9ÓŠñ äŒV�A�t˜a•xÓ  qÔ)¬F¯JªJ°q«M¸$Õ,?Õ?€AØ€Hó    c                óR  € WS^,           8  d   \        R4      hV^,          ^ 8X  d   \        R4      hV^8X  d~   V^8X  d   \        . RO4      R,          pMéV^8X  d   \        . RO4      R,          pMÍV^8X  d   \        . RO4      R,          pM±V^	8X  d   \        . RO4      R,          pM•\        V^4      pMˆV^8X  dw   V^8X  d   \        . RO4      pMlV^8X  d   \        . RO4      R,          pMPV^8X  d   \        . RO4      R,          pM4V^	8X  d   \        . RO4      R,          pM\        V^4      pM\        WS4      pR	pV^,	          p\        V4       F5  p	WvV	,          V ! WV,
          V,          ,           .VO5!  ,          ,          pK7  	  V\	        V3V,          ^ R
7      ,          # )až  
Find the nth derivative of a function at a point.

Given a function, use a central difference formula with spacing `dx` to
compute the nth derivative at `x0`.

Parameters
----------
func : function
    Input function.
x0 : float
    The point at which the nth derivative is found.
dx : float, optional
    Spacing.
n : int, optional
    Order of the derivative. Default is 1.
args : tuple, optional
    Arguments
order : int, optional
    Number of points to use, must be odd.

Notes
-----
Decreasing the step size too small can result in round-off error.

Examples
--------
>>> def f(x):
...     return x**3 + x**2
>>> _derivative(f, 1.0, dx=1e-6)
4.9999999999217337

zm'order' (the number of points used to compute the derivative), must be at least the derivative order 'n' + 1.zJ'order' (the number of points used to compute the derivative) must be odd.g       @g      (@g      N@g     @Š@g     €f@g     °³@r   r   )éÿÿÿÿr   é   )r   iøÿÿÿr   é   r   )r   é	   iÓÿÿÿr   é-   é÷ÿÿÿr   )	é   iàÿÿÿé¨   i`ýÿÿr   i   iXÿÿÿé    éýÿÿÿ)r   g       Àr   )r   é   iâÿÿÿr&   r   )é   éåÿÿÿé  iþÿÿr)   r(   r'   )	r!   é€   éüÿÿé€  iòÇÿÿr,   r+   r*   r!   )r   r   r   r   r   )
ÚfuncÚx0ÚdxÚnÚargsÚorderÚweightsÚvalr   r   s
   &&&&&&    r   Ú_derivativer5   E   s„  € ðD �1�u„}Üð=ó
ð 	
ð ˆq…y�A„~Üðó
ð 	
ð
 	ˆA„vØ�AŒ:ÜšJÓ'¨#Õ-‰GØ�aŒZÜÒ-Ó.°Õ5‰GØ�aŒZÜÒ6Ó7¸$Õ>‰GØ�aŒZÜÒEÓFÈÕN‰Gä+¨E°1Ó5‰GØ	
ˆaŒØ�AŒ:ÜšLÓ)‰GØ�aŒZÜÒ1Ó2°TÕ9‰GØ�aŒZÜÒ<Ó=ÀÕE‰GØ�aŒZäÒJÓKØõñ ô
 ,¨E°1Ó5‰Gä'¨Ó1ˆØ
€CØ	�!�€BÜ�5Ž\ˆØ�q�z™D ¨2¥v°¥mÕ!3Ð;°dÓ;Õ;Õ;Šñ à”�r�e˜a•i aÔ(Õ(Ð(r   N)r   )r
   r   © r"   )
Únumpyr   r   r   r   r   Úscipyr   r   r5   r6   r   r   Ú<module>r9      s   ðß 6Õ 6Ý ô=ö@L)r   