+
    i                       ^ RI Ht ^ RIHtHtHtHtHtHtH	t	 ^ RI
Ht ^ RIHt ^ RIHtHtHtHtHtHt ^ RIHtHt ^ RIHtHtHt ^ RIHt ^ R	IHt ^ R
I H!t! ^ RI"H#t#  ! R R]4      t$ ! R R]4      t% ! R R]4      t& ! R R]4      t' ! R R]4      t( ! R R]4      t) ! R R]4      t* ! R R]4      t+ ! R R]4      t, ! R R]4      t-R  t. ! R! R"]4      t/R(R# lt0R)R$ lt1R(R% lt2R*R' lt3R&# )+    )annotations)SAddMulsympifySymbolDummyBasic)Expr)factor_terms)DefinedFunction
DerivativeArgumentIndexErrorAppliedUndef
expand_mul	PoleError)	fuzzy_notfuzzy_or)piIoo)Pow)Eq)sqrt)	Piecewisec                  p    ] tR t^t$ RtR]R&   RtRtRt]	R 4       t
RR ltR tR tR	 tR
 tR tR tRtR# )rea{  
Returns real part of expression. This function performs only
elementary analysis and so it will fail to decompose properly
more complicated expressions. If completely simplified result
is needed then use ``Basic.as_real_imag()`` or perform complex
expansion on instance of this function.

Examples
========

>>> from sympy import re, im, I, E, symbols
>>> x, y = symbols('x y', real=True)
>>> re(2*E)
2*E
>>> re(2*I + 17)
17
>>> re(2*I)
0
>>> re(im(x) + x*I + 2)
2
>>> re(5 + I + 2)
7

Parameters
==========

arg : Expr
    Real or complex expression.

Returns
=======

expr : Expr
    Real part of expression.

See Also
========

im
tuple[Expr]argsTc                	t   V\         P                  J d   \         P                  # V\         P                  J d   \         P                  # VP                  '       d   V# VP                  '       g   \
        V,          P                  '       d   \         P                  # VP                  '       d   VP                  4       ^ ,          # VP                  '       d3   \        V\        4      '       d   \        VP                  ^ ,          4      # . . . rCp\        P                  ! V4      pV F  pVP!                  \
        4      pVe(   VP                  '       g   VP#                  V4       KA  KC  VP%                  \
        4      '       g&   VP                  '       d   VP#                  V4       K  VP                  VR7      pV'       d   VP#                  V^ ,          4       K  VP#                  V4       K  	  \'        V4      \'        V4      8w  d.   R W#V3 4       w  rpV ! V	4      \)        V
4      ,
          V,           # R# )r   Nignorec              3  4   "   T F  p\        V!  x  K  	  R # 5iNr   .0xss   & ڄ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/functions/elementary/complexes.py	<genexpr>re.eval.<locals>.<genexpr>i        M.L38.L   )r   NaNComplexInfinityis_extended_realis_imaginaryr   Zero	is_Matrixas_real_imagis_Function
isinstance	conjugater   r   r   	make_argsas_coefficientappendhaslenimclsargincludedrevertedexcludedr   termcoeff	real_imagabcs   &&          r)   evalre.evalD   s   !%%<55LA%%%55L!!!J!C%!9!9!966M]]]##%a((___C!;!;chhqk?" ,.r2H==%D++A.$ 111 . 2!)>)>)>OOD)
 !% 1 1 1 =I  	!5 -! $ 4yCM)Mx8.LMa1v1~)) *    c                &    V \         P                  3# )z6
Returns the real number with a zero imaginary part.

r   r2   selfdeephintss   &&,r)   r4   re.as_real_imagm       
 aff~rL   c           	     	   VP                   '       g$   V P                  ^ ,          P                   '       d)   \        \        V P                  ^ ,          VRR7      4      # VP                  '       g$   V P                  ^ ,          P                  '       d5   \
        ) \        \        V P                  ^ ,          VRR7      4      ,          # R# r   TevaluateN)r0   r   r   r   r1   r   r=   rP   xs   &&r)   _eval_derivativere._eval_derivativet       1!>!>!>j1q4@AA>>>TYYq\6662Z		!a$?@A A 7rL   c                	    V P                   ^ ,          \        \        V P                   ^ ,          4      ,          ,
          # r   )r   r   r=   rP   r@   kwargss   &&,r)   _eval_rewrite_as_imre._eval_rewrite_as_im{   s'    yy|a499Q< 0000rL   c                	<    V P                   ^ ,          P                  # r_   r   is_algebraicrP   s   &r)   _eval_is_algebraicre._eval_is_algebraic~       yy|(((rL   c                	    \        V P                  ^ ,          P                  V P                  ^ ,          P                  .4      # r_   )r   r   r1   is_zerorg   s   &r)   _eval_is_zerore._eval_is_zero   s.    122DIIaL4H4HIJJrL   c                	P    V P                   ^ ,          P                  '       d   R# R# r   TNr   	is_finiterg   s   &r)   _eval_is_finitere._eval_is_finite       99Q<!!! "rL   c                	P    V P                   ^ ,          P                  '       d   R# R# rp   rq   rg   s   &r)   _eval_is_complexre._eval_is_complex   ru   rL    NT)__name__
__module____qualname____firstlineno____doc____annotations__r0   
unbranched_singularitiesclassmethodrJ   r4   r[   rb   rh   rm   rs   rw   __static_attributes__ry   rL   r)   r   r      sX    'R JN&* &*PA1)KrL   r   c                  p    ] tR t^t$ RtR]R&   RtRtRt]	R 4       t
RR ltR tR tR	 tR
 tR tR tRtR# )r=   as  
Returns imaginary part of expression. This function performs only
elementary analysis and so it will fail to decompose properly more
complicated expressions. If completely simplified result is needed then
use ``Basic.as_real_imag()`` or perform complex expansion on instance of
this function.

Examples
========

>>> from sympy import re, im, E, I
>>> from sympy.abc import x, y
>>> im(2*E)
0
>>> im(2*I + 17)
2
>>> im(x*I)
re(x)
>>> im(re(x) + y)
im(y)
>>> im(2 + 3*I)
3

Parameters
==========

arg : Expr
    Real or complex expression.

Returns
=======

expr : Expr
    Imaginary part of expression.

See Also
========

re
r   r   Tc                	   V\         P                  J d   \         P                  # V\         P                  J d   \         P                  # VP                  '       d   \         P                  # VP
                  '       g   \        V,          P                  '       d   \        ) V,          # VP                  '       d   VP                  4       ^,          # VP                  '       d4   \        V\        4      '       d   \        VP                  ^ ,          4      ) # . . . rCp\        P                  ! V4      pV F  pVP!                  \        4      pVe9   VP                  '       g   VP#                  V4       KA  VP#                  V4       KT  VP%                  \        4      '       g   VP                  '       d   K  VP                  VR7      pV'       d   VP#                  V^,          4       K  VP#                  V4       K  	  \'        V4      \'        V4      8w  d.   R W#V3 4       w  rpV ! V	4      \)        V
4      ,           V,           # R# )   Nr!   c              3  4   "   T F  p\        V!  x  K  	  R # 5ir$   r%   r&   s   & r)   r*   im.eval.<locals>.<genexpr>   r,   r-   )r   r.   r/   r0   r2   r1   r   r3   r4   r5   r6   r7   r=   r   r   r8   r9   r:   r;   r<   r   r>   s   &&          r)   rJ   im.eval   s   !%%<55LA%%%55L!!!66M!C%!9!9!928O]]]##%a((___C!;!;sxx{O##+-r2H==%D++A.$ 111 . .XXa[[(=(=(= !% 1 1 1 =I  	!5 -! $ 4yCM)Mx8.LMa1v1~)) *rL   c                &    V \         P                  3# )z3
Return the imaginary part with a zero real part.

rN   rO   s   &&,r)   r4   im.as_real_imag   rT   rL   c           	     	   VP                   '       g$   V P                  ^ ,          P                   '       d)   \        \        V P                  ^ ,          VRR7      4      # VP                  '       g$   V P                  ^ ,          P                  '       d5   \
        ) \        \        V P                  ^ ,          VRR7      4      ,          # R# rV   )r0   r   r=   r   r1   r   r   rY   s   &&r)   r[   im._eval_derivative   r]   rL   c                	    \         ) V P                  ^ ,          \        V P                  ^ ,          4      ,
          ,          # r_   )r   r   r   r`   s   &&,r)   _eval_rewrite_as_reim._eval_rewrite_as_re   s)    r499Q<"TYYq\"2233rL   c                	<    V P                   ^ ,          P                  # r_   re   rg   s   &r)   rh   im._eval_is_algebraic   rj   rL   c                	<    V P                   ^ ,          P                  # r_   r   r0   rg   s   &r)   rm   im._eval_is_zero       yy|,,,rL   c                	P    V P                   ^ ,          P                  '       d   R# R# rp   rq   rg   s   &r)   rs   im._eval_is_finite   ru   rL   c                	P    V P                   ^ ,          P                  '       d   R# R# rp   rq   rg   s   &r)   rw   im._eval_is_complex  ru   rL   ry   Nrz   )r{   r|   r}   r~   r   r   r0   r   r   r   rJ   r4   r[   r   rh   rm   rs   rw   r   ry   rL   r)   r=   r=      sW    'R JN%* %*NA4)-rL   r=   c                     a  ] tR tRtRtRtRtV 3R lt]R 4       t	R t
R tR tR	 tR
 tR tR tR tR tRR ltR tR tR tR tRtV ;t# )signi	  aR  
Returns the complex sign of an expression:

Explanation
===========

If the expression is real the sign will be:

    * $1$ if expression is positive
    * $0$ if expression is equal to zero
    * $-1$ if expression is negative

If the expression is imaginary the sign will be:

    * $I$ if im(expression) is positive
    * $-I$ if im(expression) is negative

Otherwise an unevaluated expression will be returned. When evaluated, the
result (in general) will be ``cos(arg(expr)) + I*sin(arg(expr))``.

Examples
========

>>> from sympy import sign, I

>>> sign(-1)
-1
>>> sign(0)
0
>>> sign(-3*I)
-I
>>> sign(1 + I)
sign(1 + I)
>>> _.evalf()
0.707106781186548 + 0.707106781186548*I

Parameters
==========

arg : Expr
    Real or imaginary expression.

Returns
=======

expr : Expr
    Complex sign of expression.

See Also
========

Abs, conjugate
Tc                	   < \         SV `  4       pW 8X  dV   V P                  ^ ,          P                  RJ d5   V P                  ^ ,          \	        V P                  ^ ,          4      ,          # V# )r   F)superdoitr   rl   Abs)rP   rR   s	__class__s   &, r)   r   	sign.doitC  sM    GLN91--699Q<#diil"333rL   c                	   VP                   '       Ed   VP                  4       w  r#. p\        V4      pV F  pVP                  '       d   V) pK  VP                  '       d   K.  VP
                  '       dW   \        V4      pVP                  '       d'   V\        ,          pVP                  '       d   V) pK  K  VP                  V4       K  VP                  V4       K  	  V\        P                  J d   \        V4      \        V4      8X  d   R # WP! VP                  ! V!  4      ,          # V\        P                  J d   \        P                  # VP                  '       d   \        P                   # VP                  '       d   \        P                  # VP                  '       d   \        P"                  # VP$                  '       d   \'        V\        4      '       d   V# VP
                  '       dx   VP(                  '       d%   VP*                  \        P,                  J d   \        # \        ) V,          pVP                  '       d   \        # VP                  '       d   \        ) # R # R # r$   )is_Mulas_coeff_mulr   is_extended_negativeis_extended_positiver1   r=   is_comparabler   r:   r   Oner<   _new_rawargsr.   rl   r2   NegativeOner5   r6   is_PowexpHalf)	r?   r@   rI   r   unkr   rG   aiarg2s	   &&       r)   rJ   	sign.evalI  s    :::&&(GACQA)))A+++~~~U+++FA!666 &'B  7
  JJqM

1# $ AEEzc#h#d)3s3++S1222!%%<55L;;;66M###55L###== ???#t$$
zzzcgg/ 28D((((((r	 ) rL   c                	~    \        V P                  ^ ,          P                  4      '       d   \        P                  # R# r   N)r   r   rl   r   r   rg   s   &r)   	_eval_Abssign._eval_Abs{  s)    TYYq\))**55L +rL   c                	L    \        \        V P                  ^ ,          4      4      # r_   )r   r7   r   rg   s   &r)   _eval_conjugatesign._eval_conjugate  s    Idiil+,,rL   c                	   V P                   ^ ,          P                  '       dK   ^ RIHp ^\	        V P                   ^ ,          VRR7      ,          V! V P                   ^ ,          4      ,          # V P                   ^ ,          P
                  '       dW   ^ RIHp ^\	        V P                   ^ ,          VRR7      ,          V! \        ) V P                   ^ ,          ,          4      ,          # R# )r   )
DiracDeltaTrW   N)r   r0   'sympy.functions.special.delta_functionsr   r   r1   r   )rP   rZ   r   s   && r)   r[   sign._eval_derivative  s    99Q<(((Jz$))A,DAATYYq\*+ +YYq\&&&Jz$))A,DAAaR$))A,./0 0 'rL   c                	P    V P                   ^ ,          P                  '       d   R# R# rp   )r   is_nonnegativerg   s   &r)   _eval_is_nonnegativesign._eval_is_nonnegative      99Q<&&& 'rL   c                	P    V P                   ^ ,          P                  '       d   R# R# rp   )r   is_nonpositiverg   s   &r)   _eval_is_nonpositivesign._eval_is_nonpositive  r   rL   c                	<    V P                   ^ ,          P                  # r_   )r   r1   rg   s   &r)   _eval_is_imaginarysign._eval_is_imaginary  rj   rL   c                	<    V P                   ^ ,          P                  # r_   r   rg   s   &r)   _eval_is_integersign._eval_is_integer  r   rL   c                	<    V P                   ^ ,          P                  # r_   )r   rl   rg   s   &r)   rm   sign._eval_is_zero  s    yy|###rL   c                	    \        V P                  ^ ,          P                  4      '       d9   VP                  '       d%   VP                  '       d   \
        P                  # R# R# R# r   )r   r   rl   
is_integeris_evenr   r   )rP   others   &&r)   _eval_powersign._eval_power  sH    diil**++MMM55L   ,rL   c                	   V P                   ^ ,          pVP                  V^ 4      pV^ 8w  d   V P                  V4      # V^ 8w  d   VP                  W4      p\	        V4      ^ 8  d   \
        P                  ) # \
        P                  # r_   )r   subsfuncdirr   r   r   )rP   rZ   nlogxcdirarg0x0s   &&&&&  r)   _eval_nseriessign._eval_nseries  sg    yy|YYq!_799R= 1988A$DDAv01550rL   c                	X    VP                   '       d   \        ^V^ 8  3RV^ 8  3R4      # R# )r   Nr   T)r0   r   r`   s   &&,r)   _eval_rewrite_as_Piecewisesign._eval_rewrite_as_Piecewise  s2    aq\Ba=)DD  rL   c                	b    ^ RI Hp VP                  '       d   V! V4      ^,          ^,
          # R# r   )	HeavisideNr   r   r0   rP   r@   ra   r   s   &&, r)   _eval_rewrite_as_Heavisidesign._eval_rewrite_as_Heaviside  s*    ES>A%))  rL   c                	V    \        ^ \        V^ 4      3V\        V4      ,          R34      # r   )r   r   r   r`   s   &&,r)   _eval_rewrite_as_Abssign._eval_rewrite_as_Abs  s&    !RQZ3S>4*@AArL   c                	X    V P                  \        V P                  ^ ,          4      4      # r_   )r   r   r   )rP   ra   s   &,r)   _eval_simplifysign._eval_simplify  s    yydiil344rL   ry   r_   )r{   r|   r}   r~   r   
is_complexr   r   r   rJ   r   r   r[   r   r   r   r   rm   r   r   r   r   r   r   r   __classcell__)r   s   @r)   r   r   	  s|    4l JN / /b-0)-$1E*
B5 5rL   r   c                      ] tR tRt$ RtR]R&   RtRtRtRt	Rt
RR lt]R 4       tR	 tR
 tR tR tR tR tR tR tR tR tRR ltR tR tR tR tR tRtR# )r   i  a  
Return the absolute value of the argument.

Explanation
===========

This is an extension of the built-in function ``abs()`` to accept symbolic
values.  If you pass a SymPy expression to the built-in ``abs()``, it will
pass it automatically to ``Abs()``.

Examples
========

>>> from sympy import Abs, Symbol, S, I
>>> Abs(-1)
1
>>> x = Symbol('x', real=True)
>>> Abs(-x)
Abs(x)
>>> Abs(x**2)
x**2
>>> abs(-x) # The Python built-in
Abs(x)
>>> Abs(3*x + 2*I)
sqrt(9*x**2 + 4)
>>> Abs(8*I)
8

Note that the Python built-in will return either an Expr or int depending on
the argument::

    >>> type(abs(-1))
    <... 'int'>
    >>> type(abs(S.NegativeOne))
    <class 'sympy.core.numbers.One'>

Abs will always return a SymPy object.

Parameters
==========

arg : Expr
    Real or complex expression.

Returns
=======

expr : Expr
    Absolute value returned can be an expression or integer depending on
    input arg.

See Also
========

sign, conjugate
r   r   TFc                ^    V^8X  d   \        V P                  ^ ,          4      # \        W4      h)z5
Get the first derivative of the argument to Abs().

)r   r   r   )rP   argindexs   &&r)   fdiff	Abs.fdiff   s)    
 q=		!%%$T44rL   c           
     	  aa ^ RI Hp \        SR4      '       d   SP                  4       pVe   V# \	        S\
        4      '       g   \        R\        S4      ,          4      hV! SRR7      oSP                  4       w  rEVP                  '       d(   VP                  '       g   V ! V4      V ! V4      ,          # SP                  '       Ed5   . p. pSP                   F  pVP                  '       d   VP                  P                  '       dy   VP                  P                  '       d]   V ! VP                   4      p	\	        W4      '       d   VP#                  V4       K  VP#                  \%        WP                  4      4       K  V ! V4      p
\	        W4      '       d   VP#                  V4       K  VP#                  V
4       K  	  \'        V!  pV'       d   V ! \'        V!  RR7      M\(        P*                  pWg,          # S\(        P,                  J d   \(        P,                  # S\(        P.                  J d   \0        # ^ RIHpHp SP                  '       EdN   SP7                  4       w  rVP8                  '       d   VP                  '       dK   VP:                  '       d   S# V\(        P<                  J d   \(        P*                  # \?        V4      V,          # VP@                  '       d   V\C        V4      ,          # VPD                  '       d6   V) \C        V4      ,          V! \F        ) \I        V4      ,          4      ,          # R# VPK                  \L        4      '       gF   V! V4      PO                  4       w  ppV\P        V,          ,           pV! \C        VV,          4      4      # \	        SV4      '       d#   V! \C        SP                  ^ ,          4      4      # \	        S\R        4      '       d,   SPT                  '       d   S# SP                  '       d   S) # R# SPV                  '       d   SPK                  \0        \(        PX                  4      '       d]   \Z        ;QJ d*    R SPO                  4        4       F  '       g   K   R	M	  RM! R SPO                  4        4       4      '       d   \0        # SP\                  '       d   \(        P^                  # SP@                  '       d   S# SP`                  '       d   S) # SPb                  '       d#   \P        ) S,          pVP@                  '       d   V# SP8                  '       d   R# V! SPe                  4       RR7      oSPg                  \d        4      SPg                  \d        4      ,
          pV'       dC   \h        ;QJ d    V3R
 lV 4       F  '       d   K   RM	  R	M! V3R
 lV 4       4      '       d   R# SS8w  d   SS) 8w  d   SPg                  \>        4      pSPk                  V Uu/ uF  pV\m        R	R7      bK  	  up4      pVP                   Uu. uF  qP8                  e   K  VNK  	  ppV'       dA   \h        ;QJ d    V3R lV 4       F  '       d   K   RM	  R	M! V3R lV 4       4      '       g   \o        \q        SS,          4      4      # R# R# R# u upi u upi )r   )signsimpr   NzBad argument type for Abs(): %sFrW   )r   logc              3  8   "   T F  qP                   x  K  	  R # 5ir$   )is_infinite)r'   rG   s   & r)   r*   Abs.eval.<locals>.<genexpr>P  s     =*<Q==*<s   Tc              3  h   <"   T F'  pSP                  VP                  ^ ,          4      x  K)  	  R# 5ir   )r;   r   )r'   ir@   s   & r)   r*   r   b  s%     A1CGGAFF1I..s   /2)realc              3  X   <"   T F  pSP                  \        V4      4      x  K!  	  R # 5ir$   )r;   r7   )r'   uconjs   & r)   r*   r   h  s!     !F#Q$((9Q<"8"8#s   '*)9sympy.simplify.simplifyr   hasattrr   r6   r   	TypeErrortypeas_numer_denomfree_symbolsr   r   r   r   r   is_negativebaser:   r   r   r   r   r.   r/   r   &sympy.functions.elementary.exponentialr   as_base_expr0   r   r   r   is_extended_nonnegativer   r   r   r=   r;   r   r4   r   r   is_positiveis_AddNegativeInfinityanyrl   r2   is_extended_nonpositiver1   r7   atomsallxreplacer	   r   r   )r?   r@   r   objr   dknownr   tbnewtnewr   r   r  exponentrG   rH   zr   new_conjr"   r  abs_free_argr  s   &f                     @r)   rJ   Abs.eval
  s   43$$--/C
#t$$=S	IJJ sU+!!#>>>!...q6#a&= :::ECXX888 0 0 0QUU5F5F5Fqvv;D!$,,

1Suu%56q6D!$,,

1T*  KE47#c3i%0QUUC9!%%<55L!###IC::: __.ND$$$&&&'''"
q}}, uut9h..///H--,,,!EBxL0bSH5E1FFFXXf%%4y--/1!G2hqj>**c3r#((1+''c<((
t:::#''"a&8&899s=#*:*:*<=sss=#*:*:*<===	;;;66M&&&J&&&4K28D+++ %8::i(399Y+??AAAAAA$;34%<YYs^F<<f(MfEt,<)<f(MNL*77V7;M;M117CVcc!F#!Fccc!F#!FFFJs4x011 G	 (;(MVs   Z83Z=Z=c                	P    V P                   ^ ,          P                  '       d   R# R# rp   rq   rg   s   &r)   _eval_is_realAbs._eval_is_realk  ru   rL   c                	    V P                   ^ ,          P                  '       d   V P                   ^ ,          P                  # R# r   )r   r0   r   rg   s   &r)   r   Abs._eval_is_integero  s/    99Q<(((99Q<*** )rL   c                	N    \        V P                  ^ ,          P                  4      # r_   r   _argsrl   rg   s   &r)   _eval_is_extended_nonzeroAbs._eval_is_extended_nonzeros      A..//rL   c                	<    V P                   ^ ,          P                  # r_   )r,  rl   rg   s   &r)   rm   Abs._eval_is_zerov  s    zz!}$$$rL   c                	N    \        V P                  ^ ,          P                  4      # r_   r+  rg   s   &r)   _eval_is_extended_positiveAbs._eval_is_extended_positivey  r/  rL   c                	    V P                   ^ ,          P                  '       d   V P                   ^ ,          P                  # R# r   )r   r0   is_rationalrg   s   &r)   _eval_is_rationalAbs._eval_is_rational|  s/    99Q<(((99Q<+++ )rL   c                	    V P                   ^ ,          P                  '       d   V P                   ^ ,          P                  # R# r   )r   r0   r   rg   s   &r)   _eval_is_evenAbs._eval_is_even  s/    99Q<(((99Q<''' )rL   c                	    V P                   ^ ,          P                  '       d   V P                   ^ ,          P                  # R# r   )r   r0   is_oddrg   s   &r)   _eval_is_oddAbs._eval_is_odd  s/    99Q<(((99Q<&&& )rL   c                	<    V P                   ^ ,          P                  # r_   re   rg   s   &r)   rh   Abs._eval_is_algebraic  rj   rL   c                	d   V P                   ^ ,          P                  '       d   VP                  '       d{   VP                  '       d   V P                   ^ ,          V,          # V\        P
                  Jd;   VP                  '       d)   V P                   ^ ,          V^,
          ,          V ,          # R# r   )r   r0   r   r   r   r   
is_Integer)rP   r   s   &&r)   r   Abs._eval_power  sv    99Q<(((X-@-@-@yy|X--.83F3F3Fyy|hl3D88rL   c                	R   ^ RI Hp V P                  ^ ,          P                  V4      ^ ,          pVP	                  V! V4      4      '       d   VP                  V! V4      V4      pV P                  ^ ,          P                  WVR7      p\        V4      V,          P                  4       # )r   )r   )r   r   )	r  r   r   leadtermr;   r   r   r   expand)rP   rZ   r   r   r   r   	directionr   s   &&&&&   r)   r   Abs._eval_nseries  s~    >IIaL))!,Q/	==Q  !s1vt4IIIaL&&qD&9Y!))++rL   c                	   V P                   ^ ,          P                  '       g$   V P                   ^ ,          P                  '       dJ   \        V P                   ^ ,          VRR7      \	        \        V P                   ^ ,          4      4      ,          # \        V P                   ^ ,          4      \        \        V P                   ^ ,          4      VRR7      ,          \        V P                   ^ ,          4      \        \        V P                   ^ ,          4      VRR7      ,          ,           \        V P                   ^ ,          4      ,          pVP                  \        4      # r   TrW   )
r   r0   r1   r   r   r7   r   r=   r   rewrite)rP   rZ   rvs   && r)   r[   Abs._eval_derivative  s    99Q<(((DIIaL,E,E,EdiilA=y1./0 01Btyy|,<a" 		!-
2diil;KD1" ""%(1%67 zz$rL   c                	n    ^ RI Hp VP                  '       d   W! V4      V! V) 4      ,
          ,          # R# r   r   r   s   &&, r)   r   Abs._eval_rewrite_as_Heaviside  s3     	F	#C4899  rL   c                	    VP                   '       d   \        W^ 8  3V) R34      # VP                  '       d6   \        \        V,          \        V,          ^ 8  3\        ) V,          R34      # R# rp   )r0   r   r1   r   r`   s   &&,r)   r   Abs._eval_rewrite_as_Piecewise  s`    c!8_tTl;;aeQsUaZ0A2c64.AA rL   c                	&    V\        V4      ,          # r$   )r   r`   s   &&,r)   _eval_rewrite_as_signAbs._eval_rewrite_as_sign  s    49}rL   c                	8    \        V\        V4      ,          4      # r$   )r   r7   r`   s   &&,r)   _eval_rewrite_as_conjugateAbs._eval_rewrite_as_conjugate  s    C	#&''rL   ry   N)r   r_   )r{   r|   r}   r~   r   r   r0   r   r  r   r   r   r   rJ   r&  r   r-  rm   r3  r7  r:  r>  rh   r   r   r[   r   r   rT  rW  r   ry   rL   r)   r   r     s    7r  "JN5 ^2 ^2@+0%0,('), :B(rL   r   c                  V    ] tR tRtRtRtRtRtRt]	R 4       t
R tR tR tRR ltR	tR
# )r@   i  a  
Returns the argument (in radians) of a complex number. The argument is
evaluated in consistent convention with ``atan2`` where the branch-cut is
taken along the negative real axis and ``arg(z)`` is in the interval
$(-\pi,\pi]$. For a positive number, the argument is always 0; the
argument of a negative number is $\pi$; and the argument of 0
is undefined and returns ``nan``. So the ``arg`` function will never nest
greater than 3 levels since at the 4th application, the result must be
nan; for a real number, nan is returned on the 3rd application.

Examples
========

>>> from sympy import arg, I, sqrt, Dummy
>>> from sympy.abc import x
>>> arg(2.0)
0
>>> arg(I)
pi/2
>>> arg(sqrt(2) + I*sqrt(2))
pi/4
>>> arg(sqrt(3)/2 + I/2)
pi/6
>>> arg(4 + 3*I)
atan(3/4)
>>> arg(0.8 + 0.6*I)
0.643501108793284
>>> arg(arg(arg(arg(x))))
nan
>>> real = Dummy(real=True)
>>> arg(arg(arg(real)))
nan

Parameters
==========

arg : Expr
    Real or complex expression.

Returns
=======

value : Expr
    Returns arc tangent of arg measured in radians.

Tc                	   Tp\        ^4       FT  p\        W 4      '       d   VP                  ^ ,          pK)  V^8X  d%   VP                  '       d   \        P
                  u #  M	  \        P
                  # ^ RIHpHp \        W4      '       d   \        V\        4      # \        W4      '       d   \        VP                  ^ ,          4      pVP                  '       dT   V^\        P                  ,          ,          pV\        P                  8  d   V^\        P                  ,          ,          pV# VP                  '       g   \        V4      P!                  4       w  rxVP"                  '       d?   \%        VP                   Uu. uF   p\'        V4      R9  d   TM
\'        V4      NK"  	  up!  p\'        V4      V,          pMTp\(        ;QJ d/    R VP+                  \,        4       4       F  '       g   K   RM$	  RM ! R VP+                  \,        4       4       4      '       d   R# ^ RIHp	 VP3                  4       w  rV	! W4      pVP4                  '       d   V# W8w  d   V ! VRR7      # R# u upi )	   r   	exp_polarc              3  <   "   T F  qP                   R J x  K  	  R # 5ir$   )r   )r'   r  s   & r)   r*   arg.eval.<locals>.<genexpr>  s     P7O!%%-7Os   TFNatan2rW   )r   r   )ranger6   r   r0   r   r.   r  r   r]  periodic_argumentr   r=   r   Piis_Atomr   as_coeff_Mulr   r   r   r  r  r   (sympy.functions.elementary.trigonometricra  r4   	is_number)r?   r@   rG   r  r   r]  i_rI   arg_ra  rZ   yrM  s   &&           r)   rJ   arg.eval  s   qA!!!FF1I6a00055L  55LIc%%$S"--!!CHHQKBaf9!ADD&LB	{{{"3'446GA{{{%)YY0%. $(7'#9QG%.0 174<DD3Ptzz,7OP333Ptzz,7OPPPB  "1[<<<I;te,, 0s   &I+c                	    V P                   ^ ,          P                  4       w  r#V\        W1RR7      ,          V\        W!RR7      ,          ,
          V^,          V^,          ,           ,          # rK  )r   r4   r   )rP   r  rZ   rk  s   &&  r)   r[   arg._eval_derivative  sZ    yy|((*Jqd33aqd374 4891q!tE 	ErL   c                	d    ^ RI Hp V P                  ^ ,          P                  4       w  rEV! WT4      # )r   r`  )rg  ra  r   r4   )rP   r@   ra   ra  rZ   rk  s   &&,   r)   _eval_rewrite_as_atan2arg._eval_rewrite_as_atan2  s'    Byy|((*Q{rL   c                	0   V P                   ^ ,          p\        RRR7      pV^ 8X  d   ^pVP                  WV,          4      pVP                  '       d   \        P
                  # VP                  '       d   \        P                  # \        RV ,          4      h)r   r  T)positivezCannot expand %s around 0)	r   r	   r   r  r   r2   r  rd  r   )rP   rZ   r   r   r   r  r!  s   &&&&   r)   _eval_as_leading_termarg._eval_as_leading_term   sn    yy|#%19DIIaa ===66M]]]44K74@AArL   c                	R    ^ RI Hp V^ 8:  d	   V! ^4      # V P                  WVR7      # )r   )Order)r   r   )sympy.series.orderrw  rt  )rP   rZ   r   r   r   rw  s   &&&&& r)   r   arg._eval_nseries-  s+    ,68O))!T)BBrL   ry   Nr_   )r{   r|   r}   r~   r   r0   is_realrr   r   r   rJ   r[   rp  rt  r   r   ry   rL   r)   r@   r@     sO    -^ GIN&- &-PE

BC CrL   r@   c                  X    ] tR tRtRtRt]R 4       tR tR t	R t
R tR	 tR
 tR tRtR# )r7   i4  a  
Returns the *complex conjugate* [1]_ of an argument.
In mathematics, the complex conjugate of a complex number
is given by changing the sign of the imaginary part.

Thus, the conjugate of the complex number
:math:`a + ib` (where $a$ and $b$ are real numbers) is :math:`a - ib`

Examples
========

>>> from sympy import conjugate, I
>>> conjugate(2)
2
>>> conjugate(I)
-I
>>> conjugate(3 + 2*I)
3 - 2*I
>>> conjugate(5 - I)
5 + I

Parameters
==========

arg : Expr
    Real or complex expression.

Returns
=======

arg : Expr
    Complex conjugate of arg as real, imaginary or mixed expression.

See Also
========

sign, Abs

References
==========

.. [1] https://en.wikipedia.org/wiki/Complex_conjugation
Tc                	2    VP                  4       pVe   V# R # r$   )r   r?   r@   r  s   && r)   rJ   conjugate.evalb      !!#?J rL   c                	    \         # r$   )r7   rg   s   &r)   inverseconjugate.inverseh  s    rL   c                	>    \        V P                  ^ ,          RR7      # rK  r   r   rg   s   &r)   r   conjugate._eval_Absk      499Q<$//rL   c                	:    \        V P                  ^ ,          4      # r_   	transposer   rg   s   &r)   _eval_adjointconjugate._eval_adjointn      1&&rL   c                	(    V P                   ^ ,          # r_   r   rg   s   &r)   r   conjugate._eval_conjugateq      yy|rL   c                	    VP                   '       d)   \        \        V P                  ^ ,          VRR7      4      # VP                  '       d*   \        \        V P                  ^ ,          VRR7      4      ) # R# rV   )rz  r7   r   r   r1   rY   s   &&r)   r[   conjugate._eval_derivativet  sT    999Z		!a$GHH^^^j1q4HIII rL   c                	:    \        V P                  ^ ,          4      # r_   adjointr   rg   s   &r)   _eval_transposeconjugate._eval_transposez      tyy|$$rL   c                	<    V P                   ^ ,          P                  # r_   re   rg   s   &r)   rh   conjugate._eval_is_algebraic}  rj   rL   ry   N)r{   r|   r}   r~   r   r   r   rJ   r  r   r  r   r[   r  rh   r   ry   rL   r)   r7   r7   4  sE    *V N 
0'J%)rL   r7   c                  <    ] tR tRtRt]R 4       tR tR tR t	Rt
R# )	r  i  a  
Linear map transposition.

Examples
========

>>> from sympy import transpose, Matrix, MatrixSymbol
>>> A = MatrixSymbol('A', 25, 9)
>>> transpose(A)
A.T
>>> B = MatrixSymbol('B', 9, 22)
>>> transpose(B)
B.T
>>> transpose(A*B)
B.T*A.T
>>> M = Matrix([[4, 5], [2, 1], [90, 12]])
>>> M
Matrix([
[ 4,  5],
[ 2,  1],
[90, 12]])
>>> transpose(M)
Matrix([
[4, 2, 90],
[5, 1, 12]])

Parameters
==========

arg : Matrix
     Matrix or matrix expression to take the transpose of.

Returns
=======

value : Matrix
    Transpose of arg.

c                	2    VP                  4       pVe   V# R # r$   )r  r}  s   && r)   rJ   transpose.eval  r  rL   c                	:    \        V P                  ^ ,          4      # r_   r7   r   rg   s   &r)   r  transpose._eval_adjoint  r  rL   c                	:    \        V P                  ^ ,          4      # r_   r  rg   s   &r)   r   transpose._eval_conjugate  r  rL   c                	(    V P                   ^ ,          # r_   r  rg   s   &r)   r  transpose._eval_transpose  r  rL   ry   N)r{   r|   r}   r~   r   r   rJ   r  r   r  r   ry   rL   r)   r  r    s+    &P  
'%rL   r  c                  L    ] tR tRtRt]R 4       tR tR tR t	RR lt
R	 tR
tR# )r  i  aq  
Conjugate transpose or Hermite conjugation.

Examples
========

>>> from sympy import adjoint, MatrixSymbol
>>> A = MatrixSymbol('A', 10, 5)
>>> adjoint(A)
Adjoint(A)

Parameters
==========

arg : Matrix
    Matrix or matrix expression to take the adjoint of.

Returns
=======

value : Matrix
    Represents the conjugate transpose or Hermite
    conjugation of arg.

c                	p    VP                  4       pVe   V# VP                  4       pVe   \        V4      # R # r$   )r  r  r7   r}  s   && r)   rJ   adjoint.eval  s<    !?J!!#?S>! rL   c                	(    V P                   ^ ,          # r_   r  rg   s   &r)   r  adjoint._eval_adjoint  r  rL   c                	:    \        V P                  ^ ,          4      # r_   r  rg   s   &r)   r   adjoint._eval_conjugate  r  rL   c                	:    \        V P                  ^ ,          4      # r_   r  rg   s   &r)   r  adjoint._eval_transpose  r  rL   Nc                	    VP                  V P                  ^ ,          4      pRV,          pV'       d   RV: RV: R2pV# )r   z%s^{\dagger}z\left(z	\right)^{})_printr   )rP   printerr   r   r@   texs   &&&*  r)   _latexadjoint._latex  s6    nnTYYq\*#3-0#6C
rL   c                	    ^ RI Hp VP                  ! V P                  ^ ,          .VO5!  pVP                  '       d   WC! R4      ,          pV# WC! R4      ,          pV# )r   )
prettyFormu   †+) sympy.printing.pretty.stringpictr  r  r   _use_unicode)rP   r  r   r  pforms   &&*  r)   _prettyadjoint._pretty  sW    ?tyy|3d3:l33E  :c?*ErL   ry   r$   )r{   r|   r}   r~   r   r   rJ   r  r   r  r  r  r   ry   rL   r)   r  r    s4    4 " "''rL   r  c                  >    ] tR tRtRtRtRt]R 4       tR t	R t
RtR	# )

polar_lifti  a2  
Lift argument to the Riemann surface of the logarithm, using the
standard branch.

Examples
========

>>> from sympy import Symbol, polar_lift, I
>>> p = Symbol('p', polar=True)
>>> x = Symbol('x')
>>> polar_lift(4)
4*exp_polar(0)
>>> polar_lift(-4)
4*exp_polar(I*pi)
>>> polar_lift(-I)
exp_polar(-I*pi/2)
>>> polar_lift(I + 2)
polar_lift(2 + I)

>>> polar_lift(4*x)
4*polar_lift(x)
>>> polar_lift(4*p)
4*p

Parameters
==========

arg : Expr
    Real or complex expression.

See Also
========

sympy.functions.elementary.exponential.exp_polar
periodic_argument
TFc                	   ^ RI Hp VP                  '       dX   V! V4      pV^ \        ^,          \        ) ^,          \        39   d*   ^ RIHp V! \        V,          4      \        V4      ,          # VP                  '       d   VP                  pMV.p. p. p. pV FF  pVP                  '       d   Wa.,          pK   VP                  '       d   W.,          pK=  Wq.,          pKH  	  \        V4      \        V4      8  db   V'       d'   \        Wh,           !  \        \        V!  4      ,          # V'       d   \        Wh,           !  # ^ RIHp \        V!  V! ^ 4      ,          # R# )r   r@   r]  N)$sympy.functions.elementary.complexesr@   rh  r   r  r]  r   absr   r   is_polarr  r<   r   r  )	r?   r@   argumentarr]  r   rA   rC   rs  s	   &&       r)   rJ   polar_lift.eval%  s   H===#B
 aAs1ub))L 2s3x//:::88D5DC|||E!E!E!  x=3t9$X02:c8n3MMMX022LH~il22 %rL   c                F    V P                   ^ ,          P                  V4      # )z-Careful! any evalf of polar numbers is flaky )r   _eval_evalf)rP   precs   &&r)   r  polar_lift._eval_evalfI  s    yy|''--rL   c                	>    \        V P                  ^ ,          RR7      # rK  r  rg   s   &r)   r   polar_lift._eval_AbsM  r  rL   ry   N)r{   r|   r}   r~   r   r  r   r   rJ   r  r   r   ry   rL   r)   r  r    s1    #J HM!3 !3F.0rL   r  c                  @    ] tR tRtRt]R 4       t]R 4       tR tRt	R# )rc  iQ  aI  
Represent the argument on a quotient of the Riemann surface of the
logarithm. That is, given a period $P$, always return a value in
$(-P/2, P/2]$, by using $\exp(PI) = 1$.

Examples
========

>>> from sympy import exp_polar, periodic_argument
>>> from sympy import I, pi
>>> periodic_argument(exp_polar(10*I*pi), 2*pi)
0
>>> periodic_argument(exp_polar(5*I*pi), 4*pi)
pi
>>> from sympy import exp_polar, periodic_argument
>>> from sympy import I, pi
>>> periodic_argument(exp_polar(5*I*pi), 2*pi)
pi
>>> periodic_argument(exp_polar(5*I*pi), 3*pi)
-pi
>>> periodic_argument(exp_polar(5*I*pi), pi)
0

Parameters
==========

ar : Expr
    A polar number.

period : Expr
    The period $P$.

See Also
========

sympy.functions.elementary.exponential.exp_polar
polar_lift : Lift argument to the Riemann surface of the logarithm
principal_branch
c           	     	   ^ RI HpHp VP                  '       d   VP                  pMV.p^ pV EF  pVP
                  '       g   V\        V4      ,          pK*  \        Wb4      '       d*   WVP                  P                  4       ^,          ,          pKd  VP                  '       dg   VP                  P                  4       w  rxWW\        VP                  4      ,          W! \        VP                  4      4      ,          ,           ,          pK  \        V\        4      '       d'   V\        VP                  ^ ,          4      ,          pEK   R# 	  V# )r   )r]  r   N)r  r]  r   r   r   r  r@   r6   r   r4   r   unbranched_argumentr  r  r  )	r?   r  r]  r   r   r   rG   r   r=   s	   &&       r)   _getunbranched periodic_argument._getunbranchedz  s    I99977D4D
A:::c!f$
A))ee002155
++-!4FF"  S[!112 2
Az**c!&&)n,
  rL   c                	b   VP                   '       g   R # V\        8X  d*   \        V\        4      '       d   \	        VP
                  !  # \        V\        4      '       d0   V^\        ,          8  d   \	        VP
                  ^ ,          V4      # VP                  '       de   VP
                   Uu. uF  q3P                  '       d   K  VNK  	  pp\        V4      \        VP
                  4      8w  d   \	        \        V!  V4      # V P                  V4      pVf   R # ^ RIHpHp VP!                  \        Wv4      '       d   R # V\        8X  d   V# V\        8w  dR   ^ RIHp V! WR,          \&        P(                  ,
          4      V,          p	V	P!                  V4      '       g	   WY,
          # R # R # u upi )N)atanra  ceiling)r   r   r6   principal_branchrc  r   r  r   r   r  r<   r   r  rg  r  ra  r;   #sympy.functions.elementary.integersr  r   r   )
r?   r  periodrZ   newargsr   r  ra  r  r   s
   &&&       r)   rJ   periodic_argument.eval  s6    ***R<Jr+;<<$bgg..b*%%&AbD.$RWWQZ88999"$''?'Qqq'G?7|s277|+(g??''+
H>>+U99R<R<C
)AFF23F:A55>>!~% "  @s   .F,F,c                	T   V P                   w  r#V\        8X  d-   \        P                  V4      pVf   V # VP	                  V4      # \        V\        4      P	                  V4      p^ RIHp WV! WS,          \        P                  ,
          4      V,          ,
          P	                  V4      # )Nr  )	r   r   rc  r  r  r  r  r   r   )rP   r  r!  r  r   ubr  s   &&     r)   r  periodic_argument._eval_evalf  s    II	R<*99!<J!))$//q"%11$7?WRY/077DDTJJrL   ry   N)
r{   r|   r}   r~   r   r   r  rJ   r  r   ry   rL   r)   rc  rc  Q  s6    &P  , & &:	KrL   rc  c                "    \        V \        4      # )a(  
Returns periodic argument of arg with period as infinity.

Examples
========

>>> from sympy import exp_polar, unbranched_argument
>>> from sympy import I, pi
>>> unbranched_argument(exp_polar(15*I*pi))
15*pi
>>> unbranched_argument(exp_polar(7*I*pi))
7*pi

See also
========

periodic_argument
)rc  r   r  s   &r)   r  r    s    & S"%%rL   c                  8    ] tR tRtRtRtRt]R 4       tR t	Rt
R# )	r  i  aZ  
Represent a polar number reduced to its principal branch on a quotient
of the Riemann surface of the logarithm.

Explanation
===========

This is a function of two arguments. The first argument is a polar
number `z`, and the second one a positive real number or infinity, `p`.
The result is ``z mod exp_polar(I*p)``.

Examples
========

>>> from sympy import exp_polar, principal_branch, oo, I, pi
>>> from sympy.abc import z
>>> principal_branch(z, oo)
z
>>> principal_branch(exp_polar(2*pi*I)*3, 2*pi)
3*exp_polar(0)
>>> principal_branch(exp_polar(2*pi*I)*3*z, 2*pi)
3*principal_branch(z, 2*pi)

Parameters
==========

x : Expr
    A polar number.

period : Expr
    Positive real number or infinity.

See Also
========

sympy.functions.elementary.exponential.exp_polar
polar_lift : Lift argument to the Riemann surface of the logarithm
periodic_argument
TFc                	   ^ RI Hp \        V\        4      '       d   \	        VP
                  ^ ,          V4      # V\        8X  d   V# \        V\        4      p\        W4      pWE8w  d   VP                  \        4      '       g   VP                  \        4      '       g   \        V4      pR pVP                  \        V4      p\        V\        4      pVP                  \        4      '       gc   WE8w  d"   V! \        WT,
          ,          4      V,          pMTpVP                  '       g&   VP                  V4      '       g   W! ^ 4      ,          pV# VP                  '       g   TRrMVP                  ! VP                  !  w  r. pV
 F(  pVP                  '       d   W,          p	K  W.,          pK*  	  \        V4      p
\        W4      pVP                  \        4      '       d   R# VP                   '       d   \#        V	4      V8w  g   V^ 8X  dt   V
R8w  dm   V	^8w  df   V^ 8X  d$   \%        V	4      \	        \'        V
!  V4      ,          # \	        V! \        V,          4      \'        V
!  ,          V4      \%        V	4      ,          # VP                   '       dV   \%        V4      V^,          8  R8X  g   W^,          8X  d-   V
R8X  d$   V! V\        ,          4      \%        V	4      ,          # R# R# R# )r   r  c                H    \        V \        4      '       g   \        V 4      # V # r$   )r6   r   r  )exprs   &r)   mr!principal_branch.eval.<locals>.mr
  s    !$//%d++rL   NTry   )r  r]  r6   r  r  r   r   rc  r;   replacer   r  r  r   r  tuplerh  r  r  r   )rP   rZ   r  r]  r  bargplr  resrI   mothersrk  r@   s   &&&           r)   rJ   principal_branch.eval  s*   Da$$#AFF1Iv66R<Hq"% +:bff%677!233AB J+B"2r*B66*%%:#AtyM225CC|||CGGI,>,>9Q<'C
~~~bq>>1>>2DAA}}}#	 
 &M*77$%%===1!4;"axAGQax1v.sAw???#Iae$4S!W$<fEc!fLL===s3x&(2t;sQhGSU#CF**  @O=rL   c                	   V P                   w  r#\        W#4      P                  V4      p\        V4      \        8  g   V\        ) 8X  d   V # ^ RIHp \        V4      V! \        V,          4      ,          P                  V4      # )r   )r   )r   rc  r  r  r   r  r   r   )rP   r  r!  r  pr   s   &&    r)   r  principal_branch._eval_evalf1  s^    II	a(44T:q6B;!s(K>As1Q3x,,T22rL   ry   N)r{   r|   r}   r~   r   r  r   r   rJ   r  r   ry   rL   r)   r  r    s,    &P HM1+ 1+f3rL   r  c                   ^ RI Hp V P                  '       d   V # V P                  '       d   V'       g   \	        V 4      # \        V \        4      '       d   V'       g   V'       d   \	        V 4      # V P                  '       d   V # V P                  '       dK   V P                  ! V P                   Uu. uF  p\        WARR7      NK  	  up!  pV'       d   \	        V4      # V# V P                  '       dV   V P                  \        P                  8X  d7   V P                  \        P                  \        V P                   VRR7      4      # V P"                  '       d6   V P                  ! V P                   Uu. uF  p\        WARR7      NK  	  up!  # \        W4      '       d   \        V P$                  WR7      p. pV P                  R,           FE  p\        V^ ,          RVR7      p	\        VR,          WR7      p
VP'                  V	3V
,           4       KG  	  V! V3\)        V4      ,           !  # V P                  ! V P                   Uu. uF(  p\        V\*        4      '       d   \        WAVR7      MTNK*  	  up!  # u upi u upi u upi )r   )IntegralT)pauseF:r   NN)liftr  )sympy.integrals.integralsr  r  rh  r  r6   r   re  r  r   r   	_polarifyr   r  r   Exp1r   r5   functionr:   r  r   )eqr  r  r  r@   rr   limitslimitvarrests   &&&        r)   r  r  :  s   2	{{{		|||E"~"fe"~			GG"''J'3i6'JKa= 	rww!&&(wwqvvyUCDD	wwbggNgs3E:gNOO	B	!	!d8WWR[[EE!H5>CU2YT?DMM3&4-( ! 4'E&M133wwFHggOFMsJsD11 #3E:7:;FMO P 	P% K OOs   1I94I>.Jc           	     6   V'       d   Rp\        \        V 4      V4      p V'       g   V # V P                   Uu/ uF  q3\        VP                  RR7      bK  	  ppV P                  V4      p YP                  4        UUu/ uF  w  r5WSbK	  	  upp3# u upi u uppi )a[  
Turn all numbers in eq into their polar equivalents (under the standard
choice of argument).

Note that no attempt is made to guess a formal convention of adding
polar numbers, expressions like $1 + x$ will generally not be altered.

Note also that this function does not promote ``exp(x)`` to ``exp_polar(x)``.

If ``subs`` is ``True``, all symbols which are not already polar will be
substituted for polar dummies; in this case the function behaves much
like :func:`~.posify`.

If ``lift`` is ``True``, both addition statements and non-polar symbols are
changed to their ``polar_lift()``ed versions.
Note that ``lift=True`` implies ``subs=False``.

Examples
========

>>> from sympy import polarify, sin, I
>>> from sympy.abc import x, y
>>> expr = (-x)**y
>>> expr.expand()
(-x)**y
>>> polarify(expr)
((_x*exp_polar(I*pi))**_y, {_x: x, _y: y})
>>> polarify(expr)[0].expand()
_x**_y*exp_polar(_y*I*pi)
>>> polarify(x, lift=True)
polar_lift(x)
>>> polarify(x*(1+y), lift=True)
polar_lift(x)*polar_lift(y + 1)

Adds are treated carefully:

>>> polarify(1 + sin((1 + I)*x))
(sin(_x*polar_lift(1 + I)) + 1, {_x: x})
FT)polar)r  r   r  r	   namer   items)r  r   r  r   repsr  s   &&&   r)   polarifyr  [  s    P 	72;	%B	24//B/QuQVV4((/DB	B.... C.s    B>Bc           
     V   \        V \        4      '       d   V P                  '       d   V # V'       Egm   ^ RIHpHp \        W4      '       d   V! \        V P                  V4      4      # \        V \        4      '       dA   V P                  ^,          ^\        ,          8X  d   \        V P                  ^ ,          V4      # V P                  '       gj   V P                  '       gX   V P                  '       gF   V P                  '       dg   V P                  R9   d   ^ V P                  9   g   V P                  R9  d4   V P                  ! V P                   Uu. uF  p\        WQ4      NK  	  up!  # \        V \         4      '       d   \        V P                  ^ ,          V4      # V P"                  '       dT   \        V P                  V4      p\        V P$                  TVP&                  ;'       d    V'       * '       * 4      pWv,          # V P(                  '       dR   \+        V P                  RR4      '       d5   V P                  ! V P                   Uu. uF  p\        WQV4      NK  	  up!  # V P                  ! V P                   Uu. uF  p\        WQR4      NK  	  up!  # u upi u upi u upi )r   r\  r   FT)z==z!=)r6   r
   re  r  r   r]  _unpolarifyr  r   r   r  r   
is_Booleanis_Relationalrel_opr   r  r   r  r   r5   getattr)r  exponents_onlyr  r   r]  rZ   expor  s   &&&     r)   r  r    s   b%  BJJJ	5Ib$${266>:;;b*++
ad0Brwwqz>::IIIbmmm		\)a277l		-77RWWMW[;WMNNb*%%rwwqz>::	yyy266>2277N..Y/1z	~~~'"''<??wwWW %QG  	 77277K7a[D97KLL N Ls   JJ!J&Nc                h   \        V \        4      '       d   V # \        V 4      p Ve   \        V P	                  V4      4      # RpRpV'       d   RpV'       d3   Rp\        WV4      pWP8w  d   RpTp \        V\        4      '       g   K8  V# ^ RIHp XP	                  V! ^ 4      ^\        ^ 4      ^ /4      # )a  
If `p` denotes the projection from the Riemann surface of the logarithm to
the complex line, return a simplified version `eq'` of `eq` such that
`p(eq') = p(eq)`.
Also apply the substitution subs in the end. (This is a convenience, since
``unpolarify``, in a certain sense, undoes :func:`polarify`.)

Examples
========

>>> from sympy import unpolarify, polar_lift, sin, I
>>> unpolarify(polar_lift(I + 2))
2 + I
>>> unpolarify(sin(polar_lift(I + 7)))
sin(7 + I)
TFr  )	r6   boolr   
unpolarifyr   r  r  r]  r  )r  r   r  changedr  r  r]  s   &&&    r)   r  r    s    " "d		B"''$-((GE
"e49GBc4  J A88Yq\1jmQ788rL   )F)TF)NF)4
__future__r   
sympy.corer   r   r   r   r   r	   r
   sympy.core.exprr   sympy.core.exprtoolsr   sympy.core.functionr   r   r   r   r   r   sympy.core.logicr   r   sympy.core.numbersr   r   r   sympy.core.powerr   sympy.core.relationalr   (sympy.functions.elementary.miscellaneousr   $sympy.functions.elementary.piecewiser   r   r=   r   r   r@   r7   r  r  r  rc  r  r  r  r  r  r  ry   rL   r)   <module>r     s    " A A A   -) ) 0 ( (   $ 9 :w wtu uvr5? r5jw(/ w(tyC/ yCxJ) J)Z6 6r;o ;DR0 R0jgK gKT&,f3 f3RPB//dMB&9rL   