Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/__pycache__/statistics.cpython-311.opt-2.pyc
�

�,dY���r�Ugd�ZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZddlm
Z
mZddlmZmZmZmZmZmZmZmZddlmZdd	lmZdd
lmZmZmZed��ZGd�d
e ��Z!d�Z"d>d�Z#d�Z$d�Z%d�Z&d�Z'd?d�Z(de)de)de)fd�Z*dej+j,zdzZ-e)e.d<de)de)de/fd�Z0de)de)defd�Z1d�Z2d>d �Z3d!�Z4d>d"�Z5d#�Z6d$�Z7d%�Z8d@d'�Z9d(�Z:d)�Z;d*d+d,�d-�Z<d>d.�Z=d>d/�Z>d>d0�Z?d>d1�Z@d2�ZAd3�ZBd4�ZCed5d6��ZDd7d8�d9�ZEd:�ZF	dd;lGmFZFn#eH$rYnwxYwGd<�d=��ZIdS)A)�
NormalDist�StatisticsError�correlation�
covariance�fmean�geometric_mean�
harmonic_mean�linear_regression�mean�median�median_grouped�median_high�
median_low�mode�	multimode�pstdev�	pvariance�	quantiles�stdev�variance�N��Fraction)�Decimal)�groupby�repeat)�bisect_left�bisect_right)�hypot�sqrt�fabs�exp�erf�tau�log�fsum)�reduce)�mul)�Counter�
namedtuple�defaultdict�@c��eZdZdS)rN)�__name__�
__module__�__qualname__���1/opt/alt/python311/lib64/python3.11/statistics.pyrr�s�������Dr1rc��	d}t��}|j}i}|j}t|t��D]B\}}||��tt|��D]\}}	|dz
}||	d��|z||	<��Cd|vr	|d}
n+td�|���D����}
tt|t��}||
|fS)Nr�c3�<K�|]\}}t||��V��dS�Nr��.0�d�ns   r2�	<genexpr>z_sum.<locals>.<genexpr>�s.����@�@�t�q�!�H�Q��N�N�@�@�@�@�@�@r1)�set�add�getr�type�map�_exact_ratio�sum�itemsr&�_coerce�int)�data�count�types�	types_add�partials�partials_get�typ�valuesr:r9�total�Ts            r2�_sumrP�s����>
�E��E�E�E��	�I��H��<�L��t�T�*�*�1�1���V��	�#������f�-�-�	1�	1�D�A�q��Q�J�E�&�,�q�!�,�,�q�0�H�Q�K�K�	1��x���������@�@�x�~�~�/?�/?�@�@�@�@�@���w��s�#�#�A�
�u�e��r1c����	��&t��fd�|D����\}}}||�|fSd}t��}|j}tt��}tt��}t|t��D]S\}	}
||	��tt|
��D]-\}�|dz
}|�xx|z
cc<|�xx||zz
cc<�.�T|std��x}�nxd|vr|dx}�nitd�|���D����}td�|���D����}
||
z||zz
|z}||z�tt|t��}||�|fS)Nc3�,�K�|]}|�z
x��zV��dSr6r0)r8�x�cr9s  ��r2r;z_ss.<locals>.<genexpr>�s0�����<�<�!�1�q�5�j�a�A�-�<�<�<�<�<�<r1rr4c3�<K�|]\}}t||��V��dSr6rr7s   r2r;z_ss.<locals>.<genexpr>�s.����@�@�D�A�q��!�Q���@�@�@�@�@�@r1c3�BK�|]\}}t|||z��V��dSr6rr7s   r2r;z_ss.<locals>.<genexpr>�s4����D�D�t�q�!�(�1�a��c�"�"�D�D�D�D�D�Dr1)rPr<r=r*rErr?r@rArrBrCr&rD)rFrTrO�ssdrGrHrI�sx_partials�sxx_partialsrLrMr:�sx�sxxr9s `            @r2�_ssr\�s������	�}��<�<�<�<�<�t�<�<�<�<�<�
��3���3��5�!�!�
�E��E�E�E��	�I��c�"�"�K��s�#�#�L��t�T�*�*�%�%���V��	�#������f�-�-�	%�	%�D�A�q��Q�J�E���N�N�N�a��N�N�N���O�O�O�q�1�u�$�O�O�O�O�	%��
��1�+�+���a�a�	
��	�	��d�#�#��a�a��@�@�K�,=�,=�,?�,?�@�@�@�
@�
@���D�D�|�/A�/A�/C�/C�D�D�D�D�D���s�{�R�"�W�$��-����J���w��s�#�#�A�
�s�A�u��r1c�t�	|���S#t$rtj|��cYSwxYwr6)�	is_finite�AttributeError�math�isfinite)rSs r2�	_isfiniterb�sF�� ��{�{�}�}���� � � ��}�Q������ ���s��7�7c���	||ur|S|tus	|tur|S|tur|St||��r|St||��r|St|t��r|St|t��r|St|t��rt|t��r|St|t��rt|t��r|Sd}t||j|jfz���)Nz"don't know how to coerce %s and %s)rE�bool�
issubclassr�float�	TypeErrorr-)rO�S�msgs   r2rDrDs����	�A�v�v�q���C�x�x�1��9�9�a�x��C�x�x��(��!�Q���"��(��!�Q���"��(��!�S���$�1�H��!�S���$�1�H��!�X����:�a��#7�#7�����!�U����
�1�h� 7� 7����
.�C�
�C�1�:�q�z�2�2�
3�
3�3r1c��		|���S#t$rYnttf$r|dfcYSwxYw	|j|jfS#t$r(dt
|��j�d�}t|���wxYw)Nzcan't convert type 'z' to numerator/denominator)	�as_integer_ratior_�
OverflowError�
ValueError�	numerator�denominatorr?r-rg)rSris  r2rArAs����:��!�!�#�#�#���
�
�
����:�&�����4�y�����������Q�]�+�+������Q�T�!�W�W�%5�Q�Q�Q����n�n�����s��
:�:�:�
A�2A>c��	t|��|ur|St|t��r|jdkrt}	||��S#t
$r:t|t��r#||j��||j��zcYS�wxYw)Nr4)r?rerErorfrgrrn)�valuerOs  r2�_convertrrMs���0��E�{�{�a������!�S����e�/�1�4�4�����q��x�x��������a��!�!�	��1�U�_�%�%���%�*;�(<�(<�<�<�<�<��	���s�
A�AB�
B�negative valuec#�HK�	|D]}|dkrt|���|V��dS)Nr)r)rM�errmsgrSs   r2�	_fail_negrv_sD����A�
�����q�5�5�!�&�)�)�)�������r1r:�m�returnc�P�	tj||z��}|||z|z|kzSr6)r`�isqrt)r:rw�as   r2�_integer_sqrt_of_frac_rtor|gs/��P��
�1��6���A���!��A���
��r1���_sqrt_bit_widthc���	|���|���z
tz
dz}|dkrt||d|zz��|z}d}nt|d|zz|��}d|z}||zS)Nr}rr4���)�
bit_lengthrr|)r:rw�qrnros     r2�_float_sqrt_of_fracr�ss���;�	
�����!�,�,�.�.�	(�?�	:�q�@�A��A�v�v�-�a��a�!�e��<�<��A�	����-�a�2��6�k�1�=�=�	��A�2�g���{�"�"r1c�
�	|dkr|std��S||}}t|��t|��z���}|���\}}|���}|���\}}d|z||zdzz|||z||zzdzzkr|S|���}|���\}	}
d|z||
zdzz|||	z|
|zzdzzkr|S|S)Nrz0.0�r})rrrk�	next_plus�
next_minus)r:rw�root�nr�dr�plus�np�dp�minus�nm�dms           r2�_decimal_sqrt_of_fracr��s#��=�	�A�v�v��	"��5�>�>�!��r�A�2�1���A�J�J�����#�)�)�+�+�D�
�
"�
"�
$�
$�F�B���>�>���D�
�
"�
"�
$�
$�F�B���1�u��2���z��A��B���B���� 2�2�2�2����O�O���E�
�
#�
#�
%�
%�F�B���1�u��2���z��A��B���B���� 2�2�2�2����Kr1c�z�	t|��\}}}|dkrtd���t||z|��S)Nr4z%mean requires at least one data point)rPrrr)rFrOrNr:s    r2r
r
�sF����t�*�*�K�A�u�a��1�u�u��E�F�F�F��E�A�I�q�!�!�!r1c����		t|���n"#t$rd��fd�}||��}YnwxYw|�%t|��}�std���|�zS	t|��}n.#t$r!t	|��}t|��}YnwxYwttt||����}�|krtd���t|��}|std���||zS)Nrc3�B�K�t|d���D]	\�}|V��
dS)Nr4)�start)�	enumerate)�iterablerSr:s  �r2rGzfmean.<locals>.count�s<�����!�(�!�4�4�4�
�
���1������
�
r1z&fmean requires at least one data pointz(data and weights must be the same lengthzsum of weights must be non-zero)�lenrgr%r�listr@r')rF�weightsrGrN�num_weights�num�denr:s       @r2rr�sC����	���I�I��������
��	�	�	�	�	��u�T�{�{�����������T�
�
���	L�!�"J�K�K�K��q�y��#��'�l�l�����#�#�#��w�-�-���'�l�l����#�����s�3��g�&�&�
'�
'�C��K����H�I�I�I�
�w�-�-�C��A��?�@�@�@���9�s��3�3�A.�.(B�Bc��		tttt|������S#t$rtd��d�wxYw)NzGgeometric mean requires a non-empty dataset containing positive numbers)r!rr@r$rmr)rFs r2rr�se��
�G��5��S�$���(�(�)�)�)���G�G�G��<�=�=�BF�	G�G���s	�.2�A
c�.�	t|��|urt|��}d}t|��}|dkrtd���|dkrQ|�O|d}t	|t
jtf��r|dkrt|���|Std���|�td|��}|}nmt|��|urt|��}t|��|krtd���td�t||��D����\}}}	t||��}td�t||��D����\}}}	n#t$rYdSwxYw|dkrtd	���t||z|��S)
Nz.harmonic mean does not support negative valuesr4z.harmonic_mean requires at least one data pointrzunsupported typez*Number of weights does not match data sizec3�K�|]}|V��dSr6r0)r8�ws  r2r;z harmonic_mean.<locals>.<genexpr>s"���� G� G�q�� G� G� G� G� G� Gr1c3�.K�|]\}}|r||zndV��dS)rNr0)r8r�rSs   r2r;z harmonic_mean.<locals>.<genexpr>s3����P�P�T�Q���0�q�1�u�u�q�P�P�P�P�P�Pr1zWeighted sum must be positive)�iterr�r�r�
isinstance�numbers�RealrrgrrPrv�zip�ZeroDivisionErrorrr)
rFr�rur:rS�sum_weights�_rOrNrGs
          r2rr�s����,�D�z�z�T����D�z�z��
=�F��D�	�	�A��1�u�u��N�O�O�O�	
�a���G�O���G���a�'�,��0�1�1�	0��1�u�u�%�f�-�-�-��H��.�/�/�/�����A�,�,�������=�=�G�#�#��7�m�m�G��w�<�<�1���!�"N�O�O�O� � G� G�I�g�v�,F�,F� G� G� G�G�G���;�����v�&�&���P�P�S��$�=O�=O�P�P�P�P�P���5�%�%�������q�q�������z�z��=�>�>�>��K�%�'��+�+�+s�";E�
E,�+E,c���	t|��}t|��}|dkrtd���|dzdkr||dzS|dz}||dz
||zdzS�Nr�no median for empty datar}r4��sortedr�r)rFr:�is   r2rr%sw����$�<�<�D��D�	�	�A��A�v�v��8�9�9�9��1�u��z�z��A��F�|��
��F���Q��U��d�1�g�%��*�*r1c��	t|��}t|��}|dkrtd���|dzdkr||dzS||dzdz
Sr�r��rFr:s  r2rr=se��
��$�<�<�D��D�	�	�A��A�v�v��8�9�9�9��1�u��z�z��A��F�|���A��F�Q�J��r1c��	t|��}t|��}|dkrtd���||dzS)Nrr�r}r�r�s  r2r
r
SsE��
��$�<�<�D��D�	�	�A��A�v�v��8�9�9�9���Q��<�r1��?c�v�	t|��}t|��}|std���||dz}t||��}t	|||���}	t|��}t|��}n#t$rtd���wxYw||dzz
}|}||z
}|||dz|z
z|zzS)Nr�r})�loz$Value cannot be converted to a floatr+)r�r�rrrrfrmrg)	rF�intervalr:rSr��j�L�cf�fs	         r2rrfs���)�T�$�<�<�D��D�	�	�A��:��8�9�9�9�	
�Q�!�V��A�	�D�!���A��T�1��#�#�#�A�A���?�?���!�H�H�����A�A�A��?�@�@�@�A����
	
�H�s�N��A�	
�B�	�A��A��x�1�q�5�2�:�&��*�*�*s�A>�>Bc��	tt|�����d��}	|ddS#t$rt	d��d�wxYw)Nr4rzno mode for empty data)r(r��most_common�
IndexErrorr)rF�pairss  r2rr�sn���,
�D��J�J���+�+�A�.�.�E�B��Q�x��{����B�B�B��6�7�7�T�A�B���s�
A�Ac����	tt|����}|sgSt|�������fd�|���D��S)Nc�&��g|]
\}}|�k�|��Sr0r0)r8rqrG�maxcounts   �r2�
<listcomp>zmultimode.<locals>.<listcomp>�s'���J�J�J�l�e�U���8I�8I�E�8I�8I�8Ir1)r(r��maxrMrC)rF�countsr�s  @r2rr�sa�����T�$�Z�Z�
 �
 �F����	��6�=�=�?�?�#�#�H�J�J�J�J�f�l�l�n�n�J�J�J�Jr1r��	exclusive)r:�methodc��	|dkrtd���t|��}t|��}|dkrtd���|dkrg|dz
}g}td|��D]M}t	||z|��\}}||||z
z||dz|zz|z}	|�|	���N|S|dkr||dz}g}td|��D]b}||z|z}|dkrdn||dz
kr|dz
n|}||z||zz
}||dz
||z
z|||zz|z}	|�|	���c|St
d|�����)Nr4zn must be at least 1r}z"must have at least two data points�	inclusiver�zUnknown method: )rr�r��range�divmod�appendrm)
rFr:r��ldrw�resultr�r��delta�interpolateds
          r2rrs����	�1�u�u��4�5�5�5��$�<�<�D�	�T���B�	�A�v�v��B�C�C�C�
������F�����q�!���	(�	(�A��a�!�e�Q�'�'�H�A�u� ��G�q�5�y�1�D��Q��K�%�4G�G�1�L�L��M�M�,�'�'�'�'��
�
������F�����q�!���	(�	(�A��A���
�A���U�U����B�q�D����1���a�A��a�C�!�A�#�I�E� ��Q��K�1�u�9�5��Q��%��G�1�L�L��M�M�,�'�'�'�'��
�
�2��2�2�
3�
3�3r1c��	t||��\}}}}|dkrtd���t||dz
z|��S)Nr}z*variance requires at least two data pointsr4�r\rrr)rF�xbarrO�ssrTr:s      r2rr6sO��$�J�d�D�/�/�K�A�r�1�a��1�u�u��J�K�K�K��B�!�a�%�L�!�$�$�$r1c�~�	t||��\}}}}|dkrtd���t||z|��S)Nr4z*pvariance requires at least one data pointr�)rF�murOr�rTr:s      r2rrbsK��!�D�d�B�-�-�K�A�r�1�a��1�u�u��J�K�K�K��B��F�A���r1c��	t||��\}}}}|dkrtd���||dz
z}t|t��rt	|j|j��St|j|j��S�Nr}z'stdev requires at least two data pointsr4�r\rrerr�rnror�)rFr�rOr�rTr:�msss       r2rr�s~����d�D�/�/�K�A�r�1�a��1�u�u��G�H�H�H�
��A��,�C��!�W���E�$�S�]�C�O�D�D�D��s�}�c�o�>�>�>r1c���	t||��\}}}}|dkrtd���||z}t|t��rt	|j|j��St|j|j��S)Nr4z'pstdev requires at least one data pointr�)rFr�rOr�rTr:r�s       r2rr�sz����d�B�-�-�K�A�r�1�a��1�u�u��G�H�H�H�
�q�&�C��!�W���E�$�S�]�C�O�D�D�D��s�}�c�o�>�>�>r1c�6�	t|��\}}}}|dkrtd���||dz
z}	t|��t|j|j��fS#t$r1t|��t|��t|��zfcYSwxYwr�)r\rrfr�rnror_)rFrOr�r�r:r�s      r2�_mean_stdevr��s���P���Y�Y�N�A�r�4���1�u�u��G�H�H�H�
��A��,�C�4��T�{�{�/��
�s��O�O�O�O���4�4�4��T�{�{�E�$�K�K�%��)�)�3�3�3�3�3�4���s�(A�8B�Bc�@���	t|��}t|��|krtd���|dkrtd���t|��|z�t|��|z�t��fd�t||��D����}||dz
zS)NzDcovariance requires that both inputs have same number of data pointsr}z,covariance requires at least two data pointsc3�4�K�|]\}}|�z
|�z
zV��dSr6r0�r8�xi�yir��ybars   ��r2r;zcovariance.<locals>.<genexpr>��4�����A�A�V�R���T�	�b�4�i�(�A�A�A�A�A�Ar1r4)r�rr%r�)rS�yr:�sxyr�r�s    @@r2rr�s������ 	�A���A�
�1�v�v��{�{��d�e�e�e��1�u�u��L�M�M�M���7�7�Q�;�D���7�7�Q�;�D�
�A�A�A�A�A�s�1�a�y�y�A�A�A�
A�
A�C��!�a�%�=�r1c�����	t|��}t|��|krtd���|dkrtd���t|��|z�t|��|z�t��fd�t||��D����}t��fd�|D����}t��fd�|D����}	|t	||z��zS#t
$rtd���wxYw)NzEcorrelation requires that both inputs have same number of data pointsr}z-correlation requires at least two data pointsc3�4�K�|]\}}|�z
|�z
zV��dSr6r0r�s   ��r2r;zcorrelation.<locals>.<genexpr>�r�r1c3�,�K�|]}|�z
x��zV��dSr6r0�r8r�r9r�s  ��r2r;zcorrelation.<locals>.<genexpr>��0�����0�0��R�$�Y���!�#�0�0�0�0�0�0r1c3�,�K�|]}|�z
x��zV��dSr6r0)r8r�r9r�s  ��r2r;zcorrelation.<locals>.<genexpr>�r�r1z&at least one of the inputs is constant)r�rr%r�rr�)	rSr�r:r�r[�syyr9r�r�s	      @@@r2rr�s+������ 	�A���A�
�1�v�v��{�{��e�f�f�f��1�u�u��M�N�N�N���7�7�Q�;�D���7�7�Q�;�D�
�A�A�A�A�A�s�1�a�y�y�A�A�A�
A�
A�C�
�0�0�0�0�0�a�0�0�0�
0�
0�C�
�0�0�0�0�0�a�0�0�0�
0�
0�C�H��T�#��)�_�_�$�$���H�H�H��F�G�G�G�H���s�C'�'D�LinearRegression��slope�	interceptF)�proportionalc�r��	�
�	t|��}t|��|krtd���|dkrtd���|rAtd�t||��D����}td�|D����}njt|��|z�	t|��|z�
t�	�
fd�t||��D����}t��	fd�|D����}	||z}n#t$rtd���wxYw|rd	n�
|�	zz
}t||�
��S)NzKlinear regression requires that both inputs have same number of data pointsr}z3linear regression requires at least two data pointsc3�&K�|]\}}||zV��
dSr6r0)r8r�r�s   r2r;z$linear_regression.<locals>.<genexpr>/s*����3�3�v�r�2�2��7�3�3�3�3�3�3r1c3� K�|]	}||zV��
dSr6r0)r8r�s  r2r;z$linear_regression.<locals>.<genexpr>0s&����'�'�r�2��7�'�'�'�'�'�'r1c3�4�K�|]\}}|�z
|�z
zV��dSr6r0r�s   ��r2r;z$linear_regression.<locals>.<genexpr>4s4�����E�E���R�B��I�"�t�)�,�E�E�E�E�E�Er1c3�,�K�|]}|�z
x��zV��dSr6r0r�s  ��r2r;z$linear_regression.<locals>.<genexpr>5s0�����4�4�B��d��N�A�a�'�4�4�4�4�4�4r1z
x is constant�r�)r�rr%r�r�r�)rSr�r�r:r�r[r�r�r9r�r�s        @@@r2r	r	sk�����$�J	�A���A�
�1�v�v��{�{��k�l�l�l��1�u�u��S�T�T�T��5��3�3��Q����3�3�3�3�3���'�'�Q�'�'�'�'�'����A�w�w��{���A�w�w��{���E�E�E�E�E�3�q�!�9�9�E�E�E�E�E���4�4�4�4�4�!�4�4�4�4�4��/��c�	�����/�/�/��o�.�.�.�/����#�<�������)<�I��%�9�=�=�=�=s�9C?�?Dc��|dz
}t|��dkrpd||zz
}d|zdz|zdz|zdz|zdz|zd	z|zd
z|zdz|z}d|zd
z|zdz|zdz|zdz|zdz|zdz|zdz}||z}|||zzS|dkr|nd|z
}tt|����}|dkr^|dz
}d|zdz|zdz|zdz|zdz|zdz|zdz|zdz}d|zd z|zd!z|zd"z|zd#z|zd$z|zd%z|zdz}n]|dz
}d&|zd'z|zd(z|zd)z|zd*z|zd+z|zd,z|zd-z}d.|zd/z|zd0z|zd1z|zd2z|zd3z|zd4z|zdz}||z}|dkr|}|||zzS)5N��?g333333�?g��Q��?g^�}o)��@g�E.k�R�@g ��Ul�@g*u��>l�@g�N����@g�"]Ξ@gnC���`@gu��@giK��~j�@gv��|E�@g��d�|1�@gfR��r��@g��u.2�@g���~y�@g�n8(E@r�r�g@g�������?g鬷�ZaI?gg�El�D�?g7\�����?g�uS�S�?g�=�.
@gj%b�@g���Hw�@gjR�e�?g�9dh?
>g('߿��A?g��~z �?g@�3��?gɅ3��?g3fR�x�?gI�F��l@g����t��>g*�Y��n�>gESB\T?g�N;A+�?g�UR1��?gE�F���?gP�n��@g&�>���@g����i�<g�@�F�>g�tcI,\�>g�ŝ���I?g*F2�v�?g�C4�?g��O�1�?)r rr$)�pr��sigmar��rr�r�rSs        r2�_normal_dist_inv_cdfr�As���	
�C��A��A�w�w�%����q�1�u���0�1�4�0�1�45�6�0�1�45�6�1�1�56�6�1�	1�56�	6�
1�1�
56�6�1�
1�56�
6�1�1�56�6��1�1�4�0�1�45�6�0�1�45�6�1�1�56�6�1�	1�56�	6�
1�1�
56�6�1�
1�56�
6����
�#�I���Q��Y���
�#�X�X���3��7�A��c�!�f�f�W�
�
�A��C�x�x�
��G��1�A�5�1�2�56�7�1�2�56�7�2�2�67�7�2�	2�67�	7�
2�2�
67�7�2�
2�67�
7�2�2��2�A�5�1�2�56�7�1�2�56�7�2�2�67�7�2�	2�67�	7�
2�2�
67�7�2�
2�67�
7�����
��G��1�A�5�1�2�56�7�1�2�56�7�2�2�67�7�2�	2�67�	7�
2�2�
67�7�2�
2�67�
7�2�2��3�Q�6�1�2�56�7�1�2�56�7�2�2�67�7�2�	2�67�	7�
2�2�
67�7�2�
2�67�
7����	�c�	�A��3�w�w�
�B��
��U���r1)r�c�(�eZdZ	ddd�Zd#d�Zed���Zdd	�d
�Zd�Zd�Z	d
�Z
d$d�Zd�Zd�Z
ed���Zed���Zed���Zed���Zed���Zd�Zd�Zd�Zd�Zd�Zd�ZeZd�ZeZd�Zd�Zd �Zd!�Z d"�Z!dS)%rz(Arithmetic mean of a normal distributionz+Standard deviation of a normal distribution��_mu�_sigmar�r�c��	|dkrtd���t|��|_t|��|_dS)Nr�zsigma must be non-negative)rrfrr)�selfr�r�s   r2�__init__zNormalDist.__init__�s;��N��3�;�;�!�">�?�?�?���9�9����E�l�l����r1c�(�	|t|���Sr6)r�)�clsrFs  r2�from_sampleszNormalDist.from_samples�s��?��s�K��%�%�&�&r1N)�seedc�����	|�tjntj|��j�|j|jc�����fd�t|��D��S)Nc�(��g|]}�������Sr0r0)r8r��gaussr�r�s  ���r2r�z&NormalDist.samples.<locals>.<listcomp>�s%���3�3�3�Q���b�%� � �3�3�3r1)�randomr
�Randomrrr�)rr:r
r
r�r�s   @@@r2�sampleszNormalDist.samples�sY�����G� $�����&�-��2E�2E�2K���H�d�k�	��E�3�3�3�3�3�3�%��(�(�3�3�3�3r1c��	|j|jz}|std���||jz
}t||zd|zz��t	t
|z��zS)Nz$pdf() not defined when sigma is zerog�)rrrr!rr#)rrSr�diffs    r2�pdfzNormalDist.pdf�sb��>��;���,���	J�!�"H�I�I�I��4�8�|���4�$�;�$��/�2�3�3�d�3��>�6J�6J�J�Jr1c��	|jstd���ddt||jz
|jtzz��zzS)Nz$cdf() not defined when sigma is zeror�r�)rrr"r�_SQRT2�rrSs  r2�cdfzNormalDist.cdf�sI��6��{�	J�!�"H�I�I�I��c�C��T�X��$�+��2F� G�H�H�H�I�Ir1c��	|dks|dkrtd���|jdkrtd���t||j|j��S)Nr�r�z$p must be in the range 0.0 < p < 1.0z-cdf() not defined when sigma at or below zero)rrr�r)rr�s  r2�inv_cdfzNormalDist.inv_cdf�s[��	�
��8�8�q�C�x�x�!�"H�I�I�I��;�#���!�"Q�R�R�R�#�A�t�x���=�=�=r1r�c�B���	��fd�td���D��S)Nc�@��g|]}��|�z����Sr0)r)r8r�r:rs  ��r2r�z(NormalDist.quantiles.<locals>.<listcomp>�s)���9�9�9�����Q��U�#�#�9�9�9r1r4)r�)rr:s``r2rzNormalDist.quantiles�s0����	�:�9�9�9�9�U�1�a�[�[�9�9�9�9r1c	��	t|t��std���||}}|j|jf|j|jfkr||}}|j|j}}|r|st
d���||z
}t|j|jz
��}|s%dt|d|jztzz��z
S|j|z|j|zz
}|j|jzt||z|t||z��zz��z}	||	z|z}
||	z
|z}dt|�|
��|�|
��z
��t|�|��|�|��z
��zz
S)Nz$Expected another NormalDist instancez(overlap() not defined when sigma is zeror�r+)
r�rrgrrrrr r"rrr$r)r�other�X�Y�X_var�Y_var�dvr�r{�b�x1�x2s            r2�overlapzNormalDist.overlap�s���
	��%��,�,�	D��B�C�C�C��U�1��
�H�a�e����!�%�0�0�0��a�q�A��z�1�:�u���	N�E�	N�!�"L�M�M�M�
�U�]��
�!�%�!�%�-�
 �
 ���	=���R�3���>�F�#:�;�<�<�<�<�
�E�E�M�A�E�E�M�)��
�H�q�x��$�r�B�w��c�%�%�-�6H�6H�1H�'H�"I�"I�I���!�e�r�\���!�e�r�\���d�1�5�5��9�9�q�u�u�R�y�y�0�1�1�D����r���Q�U�U�2�Y�Y�9N�4O�4O�O�P�Pr1c�T�	|jstd���||jz
|jzS)Nz'zscore() not defined when sigma is zero)rrrrs  r2�zscorezNormalDist.zscore�s6��	��{�	M�!�"K�L�L�L��D�H����+�+r1c��	|jSr6�r�rs r2r
zNormalDist.means��5��x�r1c��	|jSr6r*r+s r2rzNormalDist.median	s��6��x�r1c��	|jSr6r*r+s r2rzNormalDist.modes��	�
�x�r1c��	|jSr6�rr+s r2rzNormalDist.stdevs
��8��{�r1c�"�	|j|jzSr6r/r+s r2rzNormalDist.variances��+��{�T�[�(�(r1c���	t|t��r5t|j|jzt|j|j����St|j|z|j��Sr6�r�rrrr�r$r%s  r2�__add__zNormalDist.__add__!�Z��	��b�*�%�%�	L��b�f�r�v�o�u�R�Y��	�/J�/J�K�K�K��"�&�2�+�r�y�1�1�1r1c���	t|t��r5t|j|jz
t|j|j����St|j|z
|j��Sr6r2r3s  r2�__sub__zNormalDist.__sub__/r5r1c�^�	t|j|z|jt|��z��Sr6�rrrr r3s  r2�__mul__zNormalDist.__mul__=�,��	�
�"�&�2�+�r�y�4��8�8�';�<�<�<r1c�^�	t|j|z|jt|��z��Sr6r9r3s  r2�__truediv__zNormalDist.__truediv__Er;r1c�8�	t|j|j��Sr6�rrr�r$s r2�__pos__zNormalDist.__pos__Ms��(��"�&�"�)�,�,�,r1c�:�	t|j|j��Sr6r?r@s r2�__neg__zNormalDist.__neg__Qs��2��2�6�'�2�9�-�-�-r1c��	||z
Sr6r0r3s  r2�__rsub__zNormalDist.__rsub__Ws��F��b��z�r1c�|�	t|t��stS|j|jko|j|jkSr6)r�r�NotImplementedrrr3s  r2�__eq__zNormalDist.__eq__]s:��P��"�j�)�)�	"�!�!��v����:�B�I���$:�:r1c�:�	t|j|jf��Sr6)�hashrrr+s r2�__hash__zNormalDist.__hash__cs��M��T�X�t�{�+�,�,�,r1c�P�t|��j�d|j�d|j�d�S)Nz(mu=z, sigma=�))r?r-rrr+s r2�__repr__zNormalDist.__repr__gs.���t�*�*�%�O�O�4�8�O�O�t�{�O�O�O�Or1c��|j|jfSr6rr+s r2�__getstate__zNormalDist.__getstate__js���x���$�$r1c�$�|\|_|_dSr6r)r�states  r2�__setstate__zNormalDist.__setstate__ms�� %����$�+�+�+r1)r�r�)r�)"r-r.r/�	__slots__r�classmethodr	rrrrrr&r(�propertyr
rrrrr4r7r:r=rArC�__radd__rE�__rmul__rHrKrNrPrSr0r1r2rr�s-������.�
:�?���I�
#�#�#�#��'�'��[�'�"&�4�4�4�4�4�K�K�K�J�J�J�>�>�>� 	:�	:�	:�	:� Q� Q� Q�D	,�	,�	,�����X������X������X������X���)�)��X�)�2�2�2�2�2�2�=�=�=�=�=�=�-�-�-�.�.�.��H�����H�;�;�;�-�-�-�P�P�P�%�%�%�&�&�&�&�&r1rr6)rs)r�)J�__all__r`r�r�sys�	fractionsr�decimalr�	itertoolsrr�bisectrrrrr r!r"r#r$r%�	functoolsr&�operatorr'�collectionsr(r)r*rrmrrPr\rbrDrArrrvrEr|�
float_info�mant_digr�__annotations__rfr�r�r
rrrrrr
rrrrrrrrr�rrr�r	r��_statistics�ImportErrorrr0r1r2�<module>rgsv��h�T����.��������
�
�
�
�
�
�
�
�������������%�%�%�%�%�%�%�%�,�,�,�,�,�,�,�,�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�<�������������8�8�8�8�8�8�8�8�8�8�	
��c����	�	�	�	�	�j�	�	�	�3�3�3�l&�&�&�&�R � � �4�4�4�>+�+�+�\���$���������������3�>�2�2�Q�6���6�6�6�
#�3�
#�3�
#�5�
#�
#�
#�
#��S��S��W�����<"�"�"�,#�#�#�#�LG�G�G�&5,�5,�5,�5,�p+�+�+�0 � � �,���&E+�E+�E+�E+�PB�B�B�<K�K�K�r�;�(4�(4�(4�(4�(4�b)%�)%�)%�)%�X&�&�&�&�R?�?�?�?�$?�?�?�?�$
4�
4�
4�(���8H�H�H�B�:�0�2H�I�I��05�8>�8>�8>�8>�8>�|G�G�G�V	�0�0�0�0�0�0�0���	�	�	��D�	����\&�\&�\&�\&�\&�\&�\&�\&�\&�\&s�D�D'�&D'

ZeroDay Forums Mini