o
    `^h×  ã                   @   sœ   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d„ Z	g d	¢Z
g d
¢Zee
ddd… ƒZeeddd… ƒZdd„ ZdS )é    N)Úpoly1d)Úbeta)gÓSb¦Q
@gŸo€|-aç?g_3
L¶/á¿g†|úA"Æ?gCÜUÑG˜¿)ç      ð?g<ŽŸ*x@gÿÍ y’¼@g`B{dêAü?g-¡~éëÐ?éÿÿÿÿc           
      C   sä   t  | ¡} | j}t  | ¡ t j¡} d}| dk }| dk}t  | ¡|k }||B |B  }| | }| | }t  | ¡}	t j|	|< t j	|	|< |j
dkrOt|ƒt|ƒ |	|< |j
dkrmd|d  ddd|   t|d |d ƒ  |	|< ||	_|	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Úv© r   ú\/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/scipy/stats/_tukeylambda_stats.pyÚtukeylambda_variance+   s*   






ÿr!   )g333333ó?g6|ýÃòiÀgeÛSH§6ÀgÑí™˜^Ê?gË)kPd@)r   g?…Ý»A¯@gID@êî)@g¢€¤Pr‘Û?g`2Ž¿fQÀc                 C   s4  t  | ¡} | j}t  | ¡ t j¡} d}| dk }| dk}t  | ¡|k }||B |B  }| | }| | }t  | ¡}	t j|	|< t j	|	|< |j
dkrOt|ƒt|ƒ |	|< |j
dkr•dd| d  dtd| d |d ƒ  dtd| d d| d ƒ  }
ddd| d  t|d |d ƒ d  }|
| d |	|< ||	_|	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Údenomr   r   r    Útukeylambda_kurtosis“   s.   





(ÿ*r*   )Únumpyr   r   Úscipy.specialr   Ú_tukeylambda_var_pcÚ_tukeylambda_var_qcr   r   r!   Ú_tukeylambda_kurt_pcÚ_tukeylambda_kurt_qcr$   r%   r*   r   r   r   r    Ú<module>   s    ]