
    _Mh                         d dl Zd dl mZ d dlmZ g dZg dZ eeddd                   Z eeddd                   Zd Z	g dZ
g d	Z ee
ddd                   Z eeddd                   Zd
 ZdS )    N)poly1d)beta)gSbQ
@go|-a?g_3
L/g|A"?gCUG)      ?g<*x@g y@g`B{dA?g-~?c                 Z   t          j        |           } | j        }t          j        |                               t           j                  } d}| dk     }| dk    }t          j        |           |k     }||z  |z   }| |         }| |         }t          j        |           }	t           j        |	|<   t           j	        |	|<   |j
        dk    r"t          |          t          |          z  |	|<   |j
        dk    r.d|dz  z  ddd|z  z   z  t          |dz   |dz             z
  z  |	|<   ||	_        |	S )a  Variance of the Tukey Lambda distribution.

    Parameters
    ----------
    lam : array_like
        The lambda values at which to compute the variance.

    Returns
    -------
    v : ndarray
        The variance.  For lam < -0.5, the variance is not defined, so
        np.nan is returned.  For lam = 0.5, np.inf is returned.

    Notes
    -----
    In an interval around lambda=0, this function uses the [4,4] Pade
    approximation to compute the variance.  Otherwise it uses the standard
    formula (https://en.wikipedia.org/wiki/Tukey_lambda_distribution).  The
    Pade approximation is used because the standard formula has a removable
    discontinuity at lambda = 0, and does not produce accurate numerical
    results near lambda = 0.
    g333333?g      r   g       @   r      )npasarrayshape
atleast_1dastypefloat64abs
empty_likenaninfsize_tukeylambda_var_p_tukeylambda_var_qr   )
lamshp	thresholdlow_maskneghalf_mask
small_maskreg_masksmallregvs
             ^/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/stats/_tukeylambda_stats.pytukeylambda_variancer"   +   s2   . *S//C
)C
-


#
#BJ
/
/C I
 TzH$;Ly(JL(:56H 
OE
h-C 	cA&AhKfAlOzA~~*5114Fu4M4MM*
x!||S!V|sQW}(=(,S1WcAg(>(>)? @(AGH    )g333333?g6|igeSH6gѐ환^?g˝)kPd@)r   g?ݻA@gID@)@gPr?g`2fQc                    t          j        |           } | j        }t          j        |                               t           j                  } d}| dk     }| dk    }t          j        |           |k     }||z  |z   }| |         }| |         }t          j        |           }	t           j        |	|<   t           j	        |	|<   |j
        dk    r"t          |          t          |          z  |	|<   |j
        dk    r{dd|z  dz   z  dt          d|z  dz   |dz             z  z
  dt          d|z  dz   d|z  dz             z  z   }
ddd|z  dz   z  t          |dz   |dz             z
  dz  z  }|
|z  dz
  |	|<   ||	_        |	S )	aR  Kurtosis of the Tukey Lambda distribution.

    Parameters
    ----------
    lam : array_like
        The lambda values at which to compute the variance.

    Returns
    -------
    v : ndarray
        The variance.  For lam < -0.25, the variance is not defined, so
        np.nan is returned.  For lam = 0.25, np.inf is returned.

    g)\(?g      пr   r      r	      r   )r
   r   r   r   r   r   r   r   r   r   r   _tukeylambda_kurt_p_tukeylambda_kurt_qr   )r   r   r   r   negqrtr_maskr   r   r   r   knumerdenoms               r!   tukeylambda_kurtosisr-      s    *S//C
)C
-


#
#BJ
/
/C I U{H%<Ly(JL(:56H 
OE
h-C 	cA&AhKfAlOzA~~+E225H5O5OO*
x!||C!$q4C!S1W+E+E'EET!c'A+q3w{3334S!c'A+&cAgsQw)?)??!CCema'( AGHr#   )numpyr
   r   scipy.specialr   _tukeylambda_var_pc_tukeylambda_var_qcr   r   r"   _tukeylambda_kurt_pc_tukeylambda_kurt_qcr'   r(   r-    r#   r!   <module>r5      s                  8- - - ? ? ? 
 V/"566 V/"566 9 9 9z? ? ? A A A 
 f1$$B$788 f1$$B$788 4 4 4 4 4r#   