403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/mpmath/libmp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/mpmath/libmp/__pycache__/libmpc.cpython-310.pyc
o

�"`�h�	@s�dZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9ddl:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRe efZSeefZTe!efZUe"efZVe#e$fZWe#e$e%fZXdd�ZYd	d
�ZZdd�Z[d
efdd�Z\dd�Z]efdd�Z^dd�Z_efdd�Z`efdd�Zadefdd�Zbdefdd�Zcefdd�Zddefd d!�Zed"d#�Zfefd$d%�Zgefd&d'�Zhefd(d)�Ziefd*d+�Zjefd,d-�Zkefd.d/�Zlefd0d1�Zmefd2d3�Znefd4d5�Zoefd6d7�Zpefd8d9�Zqefd:d;�Zrefd<d=�Zsefd>d?�Ztefd@dA�ZudBdC�ZvefdDdE�ZwefdFdG�ZxefdHdI�ZyefdJdK�ZzdLdM�Z{efdNdO�Z|efdPdQ�Z}efdRdS�Z~efdTdU�ZefdVdW�Z�efdXdY�Z�efdZd[�Z�efd\d]�Z�efd^d_�Z�efd`da�Z�efdbdc�Z�efddde�Z�efdfdg�Z�efdhdi�Z�efdjdk�Z�edl�Z�edm�Z�dndo�Z�efdpdq�Z�efdrds�Z�efdtdu�Z�efdvdw�Z�efdxdy�Z�efdzd{�Z�d�d}d~�Z�d�dd��Z�d�d�d��Z�d�d�d��Z�ed�k�rWzddl�m�m�m�Z�e�j~Z~e�jzZzWdSe�e�f�yVe�d��YdSwdS)�z-
Low-level functions for complex arithmetic.
�N�)�MPZ�MPZ_ZERO�MPZ_ONE�MPZ_TWO�BACKEND)1�round_floor�
round_ceiling�
round_down�round_up�
round_nearest�
round_fast�bitcount�bctable�	normalize�
normalize1�reciprocal_rnd�rshift�lshift�giant_steps�negative_rnd�to_str�to_fixed�from_man_exp�
from_float�to_float�from_int�to_int�fzero�fone�ftwo�fhalf�finf�fninf�fnan�fnone�mpf_abs�mpf_pos�mpf_neg�mpf_add�mpf_sub�mpf_mul�mpf_div�mpf_mul_int�	mpf_shift�mpf_sqrt�	mpf_hypot�mpf_rdiv_int�	mpf_floor�mpf_ceil�mpf_nint�mpf_frac�mpf_sign�mpf_hash�
ComplexResult)�mpf_pi�mpf_exp�mpf_log�mpf_cos_sin�
mpf_cosh_sinh�mpf_tan�mpf_pow_int�
mpf_log_hypot�mpf_cos_sin_pi�mpf_phi�mpf_cos�mpf_sin�
mpf_cos_pi�
mpf_sin_pi�mpf_atan�	mpf_atan2�mpf_cosh�mpf_sinh�mpf_tanh�mpf_asin�mpf_acos�	mpf_acosh�mpf_nthroot�
mpf_fibonaccicC�$|\}}|tvr
dS|tvrdSdS)z2Check if either real or imaginary part is infiniteTF)�_infs��z�re�im�rW�5/usr/lib/python3/dist-packages/mpmath/libmp/libmpc.py�
mpc_is_inf)�rYcCrQ)z9Check if either real or imaginary part is infinite or nanTF)�	_infs_nanrSrWrWrX�
mpc_is_infnan0rZr\cKsZ|\}}t||�}|dr|dtt|�|fi|��dS|dt||fi|��dS)Nrz - �jz + )rr()rT�dps�kwargsrUrV�rsrWrWrX�
mpc_to_str7s

"raFcCs"|\}}tt|||�t|||��S�N)�complexr)rT�strict�rndrUrVrWrWrX�mpc_to_complex?srfcCsptjdkr!|\}}t|�tjjt|�}|dtjj}t|�Sz	tt|dd��WSt	y7t|�YSw)N)��rhT)rd)
�sys�version_infor7�	hash_info�imag�width�int�hashrf�
OverflowError)rTrUrV�hrWrWrX�mpc_hashCs
�rrcCs|\}}|t|||�fSrb�r(�rT�precrerUrVrWrWrX�
mpc_conjugatePsrvcCs|tkSrb)�mpc_zero)rTrWrWrX�mpc_is_nonzeroTsrxcC�,|\}}|\}}t||||�t||||�fSrb�r)�rT�wrure�a�b�c�drWrWrX�mpc_addW�r�cC�|\}}t||||�|fSrbrz)rT�xrurer}r~rWrWrX�mpc_add_mpf\�r�cCryrb�r*r{rWrWrX�mpc_sub`r�r�cCr�rbr�)rT�prurer}r~rWrWrX�mpc_sub_mpfer�r�cC� |\}}t|||�t|||�fSrb)r'�rTrurer}r~rWrWrX�mpc_posi�r�cCr�rbrsr�rWrWrX�mpc_negmr�r�cCs|\}}t||�t||�fSrb)r.)rT�nr}r~rWrWrX�	mpc_shiftqsr�cCs|\}}t||||�S)zEAbsolute value of a complex number, |a+bi|.
    Returns an mpf value.)r0r�rWrWrX�mpc_absusr�cCs|\}}t||||�S)z3Argument of a complex number. Returns an mpf value.)rHr�rWrWrX�mpc_arg{sr�cCr�rb)r2r�rWrWrX�	mpc_floor�r�r�cCr�rb)r3r�rWrWrX�mpc_ceil�r�r�cCr�rb)r4r�rWrWrX�mpc_nint�r�r�cCr�rb)r5r�rWrWrX�mpc_frac�r�r�cCs\|\}}|\}}t||�}t||�}	t||�}
t||�}t||	||�}t|
|||�}
||
fS)z�
    Complex multiplication.

    Returns the real and imaginary part of (a+bi)*(c+di), rounded to
    the specified precision. The rounding mode applies to the real and
    imaginary parts separately.
    )r+r*r))rTr|rurer}r~rr�r��q�r�srUrVrWrWrX�mpc_mul�s



r�c
CsJ|\}}t||�}t||�}t||||�}t||||�}t|d�}	||	fS�Nr)r+r*r.)
rTrurer}r~r�r�r�rUrVrWrWrX�
mpc_square�s


r�cC�,|\}}t||||�}t||||�}||fSrb)r+�rTr�rurer}r~rUrVrWrWrX�mpc_mul_mpf��r�cCs0|\}}tt||||��}t||||�}||fS)zB
    Multiply the mpc value z by I*x where x is an mpf value.
    )r(r+)rTr�rurer}r~rUrVrWrWrX�mpc_mul_imag_mpf�sr�cCr�rb)r-)rTr�rurer}r~rUrVrWrWrX�mpc_mul_int�r�r�cCs||\}}|\}}|d}tt||�t||�|�}	tt||�t||�|�}
tt||�t||�|�}t|
|	||�t||	||�fS�N�
)r)r+r*r,)rTr|rurer}r~rr��wp�mag�t�urWrWrX�mpc_div�sr�cCr�)zCalculate z/p where p is real)r,r�rWrWrX�mpc_div_mpf�sr�cCsL|\}}tt||�t||�|d�}t||||�}tt||||��}||fS)zCalculate 1/z efficientlyr��r)r+r,r()rTrurer}r~�mrUrVrWrWrX�mpc_reciprocal�s
r�c	CsX|\}}tt||�t||�|d�}tt||�|||�}ttt||��|||�}||fS)z)Calculate p/z where p is real efficientlyr�r�)	r�rTrurer}r~r�rUrVrWrWrX�mpc_mpf_div�s
r�cCspd}d}|r4|d@r||||||||}}|d8}||||d||}}|d}|s||fS)zgComplex integer power: computes (a+b*I)**n exactly for
    nonnegative n (a and b must be Python ints).rrrhrW)r}r~r��wre�wimrWrWrX�complex_int_pow�s"�r�cCs@|dtkrt||d||�Sttt||d�||d�||�S)Nrrr�)r�mpc_pow_mpf�mpc_expr��mpc_log)rTr|rurerWrWrX�mpc_pow�s"r�c	Cs||\}}}}|dkrt|d|||>||�S|dkr-t||d�}t|d||||�Sttt||d�||d�||�S)Nr���r�)�mpc_pow_int�mpc_sqrtr�r�r�)	rTr�rure�psign�pman�pexp�pbc�sqrtzrWrWrXr��s"r�cCs�|\}}|tkrt||||�tfS|tkrDt||||�}|d;}|dkr(|tfS|dkr0t|fS|dkr:t|�tfS|dkrDtt|�fS|dkrJtS|dkrTt|||�S|dkr^t|||�S|dkrht|||�S|dkrytt|||d�||�S|\}}}	}
|\}}}
}|r�|}|r�|}|	|
}t|�}||t	|
|�}|dkr�|dkr�||K}|
}	n||K}|	}
t
|||�\}}t|t||	�||�}t|t||
�||�}||fSt
tt||d�||d�||�S)	N�rrrhrgr�i'r�)rr?r(�mpc_oner�r�r�r��abs�maxr�rrnr�r�r�)rTr�rurer}r~�v�asign�aman�aexp�abc�bsign�bman�bexp�bbc�de�abs_de�
exact_sizerUrVrWrWrXr��sJ"


"r�cCs(|\}}|tkr*|tkr||fS|dr tt|�||�}t|fSt|||�}|tfS|d}|ds]tt||f|�||�}t|d�}	t|	||�}t|d�}
t|
|�}t||||�}||fStt||f|�||�}t|d�}	t|	||�}t|d�}
t|
|�}t||||�}|dr�t|�}t|�}||fS)z�Complex square root (principal branch).

    We have sqrt(a+bi) = sqrt((r+a)/2) + b/sqrt(2*(r+a))*i where
    r = abs(a+bi), when a+bi is not a negative real number.r�r�r)rr/r(r)r�r.r,r*)rTrurer}r~rVrUr�r�r�r�r|rWrWrXr�'s8


�


r�cCs�d}tt||||��}tt||||��}z|d|d|}|j}|j}	tt|��}tt|	��}	Wn1tygt||�}t||�}t|�}
td|
|�}t||f|t	f|�\}}	t
|�}t
|	�}	Ynwd}|}
|}t|||�D]�}t||	|d�\}}t||d|
||�}t||d|
||�}||||||?}t|||�}t|||�}|||||?}|||||?}||>|}||>|}||dt
|||
�|}||dt
|	||
�|}	|}
qu||	fS)N�2y�?g�?rr�)rnr�realrlrrprr1r�rrrr�r)r}r~r�ru�start�a1�b1r�rUrV�fn�nth�extra�prevp�extra1r��re2�im2�r4�ap�bp�rec�imc�reb�imbrWrWrX�mpc_nthroot_fixedKsH

�r�cCs�|\}}|ddkr|tkrt||||�}|tfS|dkrQ|dkr#tS|dkr/t||f||�S|dkr<tt||f||�St||f||dt|�}tt|||�S|dkr�td|d�}|\}	}
}}|\}
}}}t||f|�}|d	|dd
kr�|d	|d|kr�t	||�}t	||�}t
||||�\}}d}t|||||�}t|||||�}||fSt|�}|dd}t
d||�}t||f|tf||�\}}t|d|d|d|d||�}t|d|d|d|d||�}||fS)zu
    Complex n-th root.

    Use Newton method as in the real case when it is faster,
    otherwise use z**(1/n)
    rrhrr��r�g333333�?r����i����rg)rrOr�r�r��mpc_nthrootrrnr�rr�rrr1r�r)rTr�rurer}r~rU�inverse�prec2r�r�r�r�r�r�r�r��pf�af�bfrVr�r�r�rWrWrXr�rsB(

""r�cCst|d||�S)z
    Complex cubic root.
    rg)r��rTrurerWrWrX�mpc_cbrt�sr�c
Cs||\}}|tkrt|||�S|tkrt|||�tfSt||d|�}t||d|�\}}t||||�}t||||�}	||	fS)av
    Complex exponential function.

    We use the direct formula exp(a+bi) = exp(a) * (cos(b) + sin(b)*i)
    for the computation. This formula is very nice because it is
    pefectly stable; since we just do real multiplications, the only
    numerical errors that can creep in are single-ulp rounding errors.

    The formula is efficient since mpmath's real exp is quite fast and
    since we can compute cos and sin simultaneously.

    It is no problem if a and b are large; if the implementations of
    exp/cos/sin are accurate and efficient for all real numbers, then
    so is this function for all complex numbers.
    r�)rr<r:r+)
rTrurer}r~r�rr�rUrVrWrWrXr��sr�cCs*t|d|d||�}t|||�}||fS)Nrr)r@r�rtrWrWrXr��sr�cCs�|\}}|tkrt|||�tfS|tkrt|||�tfS|d}t||�\}}t||�\}}	t||||�}
t||	||�}|
t|�fS)aSComplex cosine. The formula used is cos(a+bi) = cos(a)*cosh(b) -
    sin(a)*sinh(b)*i.

    The same comments apply as for the complex exp: only real
    multiplications are pewrormed, so no cancellation errors are
    possible. The formula is also efficient since we can compute both
    pairs (cos, sin) and (cosh, sinh) in single stwps.�)rrCrIr<r=r+r(�rTrurer}r~r�rr��ch�shrUrVrWrWrX�mpc_cos�sr�cCs�|\}}|tkrt|||�tfS|tkrtt|||�fS|d}t||�\}}t||�\}}	t||||�}
t||	||�}|
|fS)z�Complex sine. We have sin(a+bi) = sin(a)*cosh(b) +
    cos(a)*sinh(b)*i. See the docstring for mpc_cos for additional
    comments.r�)rrDrJr<r=r+r�rWrWrX�mpc_sin�sr�cCs�|\}}|\}}}}|\}	}
}}|tkrt|||�tfS|tkr(tt|||�fS|d}
t|d�}t|d�}t||
�\}}t||
�\}}t|||
�}t||||�}t||||�}||fS)zcComplex tangent. Computed as tan(a+bi) = sin(2a)/M + sinh(2b)/M*i
    where M = cos(2a) + cosh(2b).�r)rr>rKr.r<r=r)r,)rTrurer}r~r�r�r�r�r�r�r�r�r�rr�r�r�r�rUrVrWrWrX�mpc_tan�s

r�cCs�|\}}|tkrt|||�tfSt|t|d�|d�}|tkr(t|||�tfS|d}t||�\}}t||�\}}	t||||�}
t||	||�}|
t|�fS�Nr�r�)rrEr+r9rIrAr=r(r�rWrWrX�
mpc_cos_pi�sr�cCs�|\}}|tkrt|||�tfSt|t|d�|d�}|tkr(tt|||�fS|d}t||�\}}t||�\}}	t||||�}
t||	||�}|
|fSr�)rrFr+r9rJrAr=r�rWrWrX�
mpc_sin_pisr�cCs�|\}}|tkrt|||�\}}|tft|ffS|tkr,t|||�\}}|tf|tffS|d}	t||	�\}}t||	�\}}t||||�}
t||||�}t||||�}t||||�}
|
t|�f||
ffS)Nr�)rr=r<r+r()rTrurer}r~r�r�rr�r��cre�cim�sre�simrWrWrX�mpc_cos_sinsr�cCs�|\}}|tkrt|||�\}}|tf|tffSt|t|d�|d�}|tkr8t|||�\}}|tft|ffS|d}	t||	�\}}t||	�\}}t||||�}
t||||�}t||||�}t||||�}
|
t|�f||
ffSr�)rrAr+r9r=r()rTrurer}r~rr�r�r�r�r�r�r�r�rWrWrX�mpc_cos_sin_pi%s r�cCs|\}}t|t|�f||�S)z:Complex hyperbolic cosine. Computed as cosh(z) = cos(z*i).)r�r(r�rWrWrX�mpc_cosh7sr�cC�$|\}}t||f||�\}}||fS)z;Complex hyperbolic sine. Computed as sinh(z) = -i*sin(z*i).)r�r�rWrWrX�mpc_sinh<�rcCr)z>Complex hyperbolic tangent. Computed as tanh(z) = -i*tan(z*i).)r�r�rWrWrX�mpc_tanhBrrcCs�|\}}|d}tt||�t|�f}tt||�|f}t||�}t||�}	t||	||�\}}tt|d��t|d�f}
|
dtkrIt|�rI|
dt	f}
|
S)Nr�r�rr)
r)rr(r*r�r�r.r$rYr)rTrurer}r~r�r��y�l1�l2r�rWrWrX�mpc_atanIs

rg�:pΈ�?g�?cCs"|\}}|d}|tkrlttt|�|�}|ds,|dkr$t|||�tfSt|||�tfS|drPt||�}tt|�||�}	|dkrG|t|	�fStt	|d��|	fSt|||�}	|dkr^t|	fSt||�}t	|d�t|	�fSd}
}|drzt|�}d}
|dr�t|�}d}tt||�}t
t||�}t|||�}
t|||�}t	t
|
||�d�}t|||�}t
|||�}tt||�ds�|dkr�t||�}n�t||�}n�t
|||�}|d�st|t
|
||�|�}	t
|||�}t	t
|t
|	||�|�d�}|dk�rttt||�||�|�}nKtt|t||�|�|�}n>t|t
|
||�|�}	t|t|||�|�}t	t
|	||�d�}t
|t||�|�}|dk�rEtt|||�|�}n	tt|||�|�}tt||�d�s�t|t
|
||�|�}t|�d�r~t
|||�}t|||�}t	t
|||�d�}nt|||�}t	t
|||�d�}t
|t
|t|�|�}tt
tt
|t||�|�|�|�}nttt
|||�t|�|�}tt
|||�|�}|
�r�|dk�r�tt|�||�}nt|�}|�s�|dk�r�t|�}|�r�|dk�r�t|�}t|d|d|d|d||�}t|d|d|d|d||�}||fS)a& complex acos for n = 0, asin for n = 1
    The algorithm is described in
    T.E. Hull, T.F. Fairgrieve and P.T.P. Tang
    'Implementing the Complex Arcsine and Arcosine Functions
    using Exception Handling',
    ACM Trans. on Math. Software Vol. 23 (1997), p299
    The complex acos and asin can be defined as
    acos(z) = acos(beta) - I*sign(a)* log(alpha + sqrt(alpha**2 -1))
    asin(z) = asin(beta) + I*sign(a)* log(alpha + sqrt(alpha**2 -1))
    where z = a + I*b
    alpha = (1/2)*(r + s); beta = (1/2)*(r - s) = a/alpha
    r = sqrt((a+1)**2 + y**2); s = sqrt((a-1)**2 + y**2)
    These expressions are rewritten in different ways in different
    regions, delimited by two crossovers alpha_crossover and beta_crossover,
    and by abs(a) <= 1, in order to improve the numerical accuracy.
    r�rr�rrhrg)rr*rr&rMrLr9rNr(r.r)r0r,r+�beta_crossoverrGr/�alpha_crossoverr;r)rTrurer�r}r~r��am�pirr�r�r�r�r��alpha�beta�b2rU�Axr��c1�c2�Am1rVrWrWrX�	acos_asin_s�




"
""rcC�t|||d�S�Nr�rr�rWrWrX�mpc_acos��rcCrr�rr�rWrWrX�mpc_asin�rrcCs,|\}}t|t|�f||�\}}t|�|fSrb)rr(r�rWrWrX�	mpc_asinh�srcCs8t|||�\}}|ds|tkrt|�|fS|t|�fSr)rrr(r�rWrWrX�	mpc_acosh�srcCsj|d}t|t|�}tt||�}t||�}t||�}tt|||�d�}|dtkr3t|�r3t|df}|S)Nr�r�rr)r�r�r�r�r�r$rYr)rTrurer�r}r~r�rWrWrX�	mpc_atanh�s

rcCs�|\}}|tkrt|||�tfStt|d|d�t|d|d��}||d}t|�}tt|d�t|�}t|tf||�}	t	||�}
t
|
|	|�}
t|	|
|�}	t|	|||�}	|	S)Nrhrgr�r)
rrPr�r�rBr)r.r%r�r�r�r�r�)rTrurerUrV�sizer�r}r~r�r�rWrWrX�
mpc_fibonacci
s*
r�fcC�t�rb�r8�r�rurerWrWrX�mpf_expj�r#cCs�|\}}|tkrt|||�S|tkrtt|�||�tfStt|�|d�}t||d�\}}t||||�}t||||�}||fSr�)rr<r:r(r+)rTrurerUrV�eyrr�rWrWrX�mpc_expjsr&cCr rbr!r"rWrWrX�
mpf_expjpi(r$r'c
Cs�|\}}|tkrt|||�S|\}}}}|d}	|r#|	td||�7}	ttt|	�||	��}|tkr9t|||�tfSt||d�}
t||d�\}}t|
|||�}t|
|||�}||fS)Nr�r)rrAr�r(r+r9r:)
rTrurerUrV�sign�man�exp�bcr�r%rr�rWrWrX�
mpc_expjpi+sr,�sagez&Warning: Sage imports in libmpc failed)r)��__doc__ri�backendrrrrr�libmpfrr	r
rrr
rrrrrrrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8�	libelefunr9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPr�rw�mpc_two�mpc_halfrRr[rYr\rarfrrrvrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr	rrrrrrrr#r&r'r,�sage.libs.mpmath.ext_libmp�libs�mpmath�	ext_libmp�_lbmp�ImportError�AttributeError�printrWrWrWrX�<module>s��h



	
	($')		




��

Youez - 2016 - github.com/yon3zu
LinuXploit