U
    GvfÕ  ã                   @   s´   d dl Zd dl mZ d dlmZ dddddgZd	d
dddgZeeddd… ƒZeeddd… ƒZdd„ Z	dddddgZ
d	ddddgZee
ddd… ƒZeeddd… ƒZdd„ ZdS )é    N)Úpoly1d)ÚbetagÓ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ržt|ƒt|ƒ |	|< |j
dkrÚd|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_maskZneghalf_maskÚ
small_maskÚreg_maskÚsmallÚregÚv© r   úB/tmp/pip-unpacked-wheel-96ln3f52/scipy/stats/_tukeylambda_stats.pyÚtukeylambda_variance+   s*    





ÿ
r    g333333ó?g6|ýÃòiÀgeÛSH§6ÀgÑí™˜^Ê?gË)kPd@g?…Ý»A¯@gID@êî)@g¢€¤Pr‘Û?g`2Ž¿fQÀc                 C   s6  t  | ¡} | j}t  | ¡ t j¡} d}| dk }| dk}t  | ¡|k }||B |B  }| | }| | }t  | ¡}	t j|	|< t j	|	|< |j
dkržt|ƒ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   Znegqrtr_maskr   r   r   r   ÚkZnumerZdenomr   r   r   Útukeylambda_kurtosis“   s.    




(ÿ*r&   )Znumpyr   r   Zscipy.specialr   Z_tukeylambda_var_pcZ_tukeylambda_var_qcr   r   r    Z_tukeylambda_kurt_pcZ_tukeylambda_kurt_qcr#   r$   r&   r   r   r   r   Ú<module>   s2    þ ÿ] ÿ ÿ