
    Ed                     2   d Z ddlmZmZ ddlmZmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ d	d
lmZmZ d	dlmZmZ ddlmZmZ  G d de          Z  ee           d             Z! G d de           Z" ee"          d             Z#dS )zI
A Printer for generating readable representation of most SymPy classes.
    )AnyDict)SRationalPowBasicMulNumberAdd)_keep_coeff)
Relational)default_sort_key)SympifyError)sift   )
precedence
PRECEDENCE)Printerprint_function)prec_to_dpsto_strc                   X   e Zd ZdZddddddddZi ZddZdd	Zd
 ZddZ	d Z
d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd  Zd! Zd" Z d# Z!d$ Z"d% Z#d& Z$d' Z%d( Z&d) Z'd* Z(d+ Z)d, Z*d- Z+d. Z,d/ Z-d0 Z.d1 Z/d2 Z0d3 Z1d4 Z2d5 Z3d6 Z4d7 Z5d8 Z6d9 Z7d: Z8d; Z9d< Z:d= Z;d> Z<d? Z=d@ Z>dA Z?dB Z@dC ZAdD ZBdE ZCdF ZDdG ZEdH ZFdI ZGdJ ZHdK ZIdL ZJdM ZKdN ZLddOZMdP ZNdQ ZOdR ZPdS ZQdT ZRdU ZSdV ZTdW ZUdX ZVdY ZWdZ ZXd[ ZYd\ ZZd] Z[d^ Z\d_ Z]d` Z^da Z_db Z`dc Zadd Zbde Zcdf Zddg Zedh Zfdi Zgdj Zhdk ZieiZjeiZkdl Zldm Zmdn Zndo Zodp Zpdq Zqdr Zrds Zsdt Ztdu Zudv Zvdw Zwdx Zxdy Zydz Zzd{ Z{d| Z|d} Z}d~ Z~d Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )
StrPrinter	_sympystrNautoFT)order	full_precsympy_integersabbrevperm_cyclicminmaxc                     t          |          |k     s|s+t          |          |k    rd|                     |          z  S |                     |          S )N(%s))r   _print)selfitemlevelstricts       2lib/python3.11/site-packages/sympy/printing/str.pyparenthesizezStrPrinter.parenthesize!   s[    tu$ 	%v 	%:d;K;Ku;T 	%DKK----;;t$$$    r   c                 J     |                      fd|D                       S )Nc                 <    g | ]}                     |          S  r+   ).0r'   r(   r&   s     r*   
<listcomp>z(StrPrinter.stringify.<locals>.<listcomp>(   s)    IIID**477IIIr,   )join)r&   argssepr(   s   `  `r*   	stringifyzStrPrinter.stringify'   s.    xxIIIIIDIIIJJJr,   c                     t          |t                    r|S t          |t                    rt          |          S t          |          S N)
isinstancestrr   reprr&   exprs     r*   emptyPrinterzStrPrinter.emptyPrinter*   sC    dC   	Ke$$ 	::t99r,   c                    |                      ||          }t          |          }g }|D ]}|                     |          }|                    d          rd}|dd          }nd}t          |          |k     st	          |t
                    r|                    |d|z  g           ~|                    ||g           |                    d          }|dk    rd}|d                    |          z   S )	Nr   -r   +r$   r     )	_as_ordered_termsr   r%   
startswithr9   r   extendpopr3   )	r&   r=   r   termsPRECltermtsigns	            r*   
_print_AddzStrPrinter._print_Add2   s   &&t5&99$ 
	$ 
	$DD!!A||C   abbE$$& $*T3*?*? $$
+,,,,$####uuQxx3; 	Dchhqkk!!r,   c                     dS )NTruer/   r<   s     r*   _print_BooleanTruezStrPrinter._print_BooleanTrueG   s    vr,   c                     dS )NFalser/   r<   s     r*   _print_BooleanFalsezStrPrinter._print_BooleanFalseJ       wr,   c                 `    d|                      |j        d         t          d                   z  S )Nz~%sr   Not)r+   r4   r   r<   s     r*   
_print_NotzStrPrinter._print_NotM   s(    t((1j6GHHIIr,   c                 D   t          |j                  }t          |          D ][\  }}t          |t                    rA|j        j        t          j        u r)|	                    d|
                    |                     \|                     |dt          d                   S )Nr   z & 
BitwiseAnd)listr4   	enumerater9   r   	canonicalrhsr   NegativeInfinityinsertrH   r6   r   )r&   r=   r4   jis        r*   
_print_AndzStrPrinter._print_AndP   s    DIdOO 	, 	,DAq!Z(( ,KOq'99,Atxx{{+++~~dE:l+CDDDr,   c                 P    |                      |j        dt          d                   S )Nz | 	BitwiseOrr6   r4   r   r<   s     r*   	_print_OrzStrPrinter._print_OrX   s    ~~di
;0GHHHr,   c                 P    |                      |j        dt          d                   S )Nz ^ 
BitwiseXorrg   r<   s     r*   
_print_XorzStrPrinter._print_Xor[   s    ~~di
<0HIIIr,   c                 t    |                      |j                  d|                     |j        d          dS N(, ))r%   functionr6   	argumentsr<   s     r*   _print_AppliedPredicatez"StrPrinter._print_AppliedPredicate^   s=    KK&&&&t~t(L(L(L(LN 	Nr,   c                 t      fd|j         D             }|j        j        dd                    |          z  z   S )Nc                 :    g | ]}                     |          S r/   r%   )r1   or&   s     r*   r2   z+StrPrinter._print_Basic.<locals>.<listcomp>c   s#    ///T[[^^///r,   r$   ro   )r4   	__class____name__r3   )r&   r=   rK   s   `  r*   _print_BasiczStrPrinter._print_Basicb   s=    ////TY///~&$))A,,)>>>r,   c                     |j         j        dk    r |                     |j         d                    |                     |j                   S )N)r   r   )r   r   )blocksshaper%   )r&   Bs     r*   _print_BlockMatrixzStrPrinter._print_BlockMatrixf   s?    8>V# 	(KK'''{{18$$$r,   c                     dS )NCatalanr/   r<   s     r*   _print_CatalanzStrPrinter._print_Catalank   s    yr,   c                     dS )Nzoor/   r<   s     r*   _print_ComplexInfinityz!StrPrinter._print_ComplexInfinityn       ur,   c                      t           fd|j        |j        fD                       }|j        t          j        u rd|z  S |                     |j                  fz  }d|z  S )Nc                 :    g | ]}                     |          S r/   rv   r1   rc   r&   s     r*   r2   z2StrPrinter._print_ConditionSet.<locals>.<listcomp>r   s#    CCCdkk!nnCCCr,   zConditionSet(%s, %s)zConditionSet(%s, %s, %s))tuplesym	conditionbase_setr   UniversalSetr%   )r&   sr4   s   `  r*   _print_ConditionSetzStrPrinter._print_ConditionSetq   sp    CCCCquak.BCCCDD:' 	1)D00QZ((**)D00r,   c                      |j         }d |j        D             }dd                    t           fd|g|z                       z  S )Nc                 :    g | ]}|d          d k    r|d         n|S )r   r   r/   )r1   rc   s     r*   r2   z0StrPrinter._print_Derivative.<locals>.<listcomp>z   s-    GGGa1)1GGGr,   zDerivative(%s)ro   c                 .                         |           S r8   rv   argr&   s    r*   <lambda>z.StrPrinter._print_Derivative.<locals>.<lambda>{   s    DKK<L<L r,   )r=   variable_countr3   map)r&   r=   dexprdvarss   `   r*   _print_DerivativezStrPrinter._print_Derivativex   sR    	GG43FGGG$))C0L0L0L0LugX]o,^,^"_"___r,   c                     t          |                                t                    }g }|D ]J}|                     |          d|                     ||                   }|                    |           Kdd                    |          z  S )Nkeyz: {%s}ro   )sortedkeysr   r%   appendr3   )r&   dr   itemsr   r'   s         r*   _print_dictzStrPrinter._print_dict}   s    affhh$4555 	 	C#{{3////QsV1D1D1DEDLL		%((((r,   c                 ,    |                      |          S r8   )r   r<   s     r*   _print_DictzStrPrinter._print_Dict       %%%r,   c                 F   t          |d          r*d|                     |                                          z   S t          |d          r;d|                     |j                  z   dz   |                     |j                  z   S d|                     |j                  z   S )N
as_booleanzDomain: setz in z
Domain on )hasattrr%   r   symbolsr   )r&   r   s     r*   _print_RandomDomainzStrPrinter._print_RandomDomain   s    1l## 	9ALLNN ; ;;;Q 	9QY!7!77&@KK&&' (  $++ai"8"888r,   c                     d|j         z   S N_namer<   s     r*   _print_DummyzStrPrinter._print_Dummy   s    TYr,   c                     dS )N
EulerGammar/   r<   s     r*   _print_EulerGammazStrPrinter._print_EulerGamma   s    |r,   c                     dS )NEr/   r<   s     r*   _print_Exp1zStrPrinter._print_Exp1       sr,   c                 t    d|                      |j                  d|                      |j                  dS rm   )r%   r=   condr<   s     r*   _print_ExprCondPairzStrPrinter._print_ExprCondPair   s7     ![[3333T[[5K5K5K5KLLr,   c                 X    |j         j        d|                     |j        d          z  z   S Nr$   ro   )funcry   r6   r4   r<   s     r*   _print_FunctionzStrPrinter._print_Function   s'    y!FT^^DIt-L-L$LLLr,   c                     dS )NGoldenRatior/   r<   s     r*   _print_GoldenRatiozStrPrinter._print_GoldenRatio   s    }r,   c                 X    |j         j        d|                     |j        d          z  z   S r   )r   ry   r6   pargsr<   s     r*   _print_HeavisidezStrPrinter._print_Heaviside   s)     y!FT^^DJ-M-M$MMMr,   c                     dS )NTribonacciConstantr/   r<   s     r*   _print_TribonacciConstantz$StrPrinter._print_TribonacciConstant   s    ##r,   c                     dS NIr/   r<   s     r*   _print_ImaginaryUnitzStrPrinter._print_ImaginaryUnit   r   r,   c                     dS )Noor/   r<   s     r*   _print_InfinityzStrPrinter._print_Infinity       tr,   c                       fdd                     fd|j        D                       }d                     |j                  d|dS )Nc                     t          |           dk    r                    | d                   S                     | d         ft          | dd                    z             S Nr   r   lenr%   r   xabr&   s    r*   
_xab_tostrz.StrPrinter._print_Integral.<locals>._xab_tostr   V    3xx1} ?{{3q6***{{CF9uSW~~#=>>>r,   ro   c                 &    g | ]} |          S r/   r/   r1   rK   r   s     r*   r2   z.StrPrinter._print_Integral.<locals>.<listcomp>   !    :::zz!}}:::r,   z	Integral(rp   r3   limitsr%   rq   r&   r=   Lr   s   `  @r*   _print_IntegralzStrPrinter._print_Integral   sl    	? 	? 	? 	? 	?
 II::::dk:::;;%)[[%?%?%?%?CCr,   c                     d}|j         \  }}}}|j        r
|j        rd}n-|j        r|sd}n!|j        r|sd}n|s|sd}n|r|rd}n|rd}nd} |j        di |||dS )NzInterval{m}({a}, {b})rC   z.openz.Lopenz.Ropen)abmr/   )r4   is_infiniteformat)r&   rc   finr   r   rK   rr   s           r*   _print_IntervalzStrPrinter._print_Interval   s    &V
1a= 	Q] 	AA] 	1 	AA] 		1 		AA 	1 	AA 	1 	AA 	AAAsz55!!!44555r,   c                 t    d|                      |j                  d|                      |j                  dS )NzAccumBounds(ro   rp   )r%   r!   r"   )r&   rc   s     r*   _print_AccumulationBoundsz$StrPrinter._print_AccumulationBounds   s<     (,AE(:(:(:(:(,AE(:(:(:(:< 	<r,   c                 T    d|                      |j        t          d                   z  S )Nz%s**(-1)r   r+   r   r   )r&   r   s     r*   _print_InversezStrPrinter._print_Inverse   s$    D--aeZ5FGGGGr,   c                     |j         }|j        }t          |          dk    r|d         j        r|d         }d|                     |          d|                     |          dS )Nr   r   zLambda(ro   rp   )r=   	signaturer   	is_symbolr%   )r&   objr=   sigs       r*   _print_LambdazStrPrinter._print_Lambda   si    xms88q= 	SV- 	a&C#';;s#3#3#3#3T[[5F5F5F5FGGr,   c                      t          |j        t                    }|j        j        dd                     fd|D                       z  z   S )Nr   r$   ro   c              3   B   K   | ]}                     |          V  d S r8   rv   r1   r   r&   s     r*   	<genexpr>z.StrPrinter._print_LatticeOp.<locals>.<genexpr>   s/      6X6XCt{{37G7G6X6X6X6X6X6Xr,   )r   r4   r   r   ry   r3   r&   r=   r4   s   `  r*   _print_LatticeOpzStrPrinter._print_LatticeOp   sO    di%5666y!FTYY6X6X6X6XSW6X6X6X-X-X$XXXr,   c           
          |j         \  }}}}t          |          dk    r(dt          t          | j        |||f                    z  S dt          t          | j        ||||f                    z  S )NrB   zLimit(%s, %s, %s)zLimit(%s, %s, %s, dir='%s'))r4   r:   r   r   r%   )r&   r=   ezz0dirs         r*   _print_LimitzStrPrinter._print_Limit   s    	1b#s88s? 	N&s4;Ar
/K/K)L)LLL05T[=>2sO:M :M 4N 4N N Nr,   c                 4    d|                      |d          z  S )N[%s]ro   )r6   r<   s     r*   _print_listzStrPrinter._print_list   s    tT2222r,   c                 ,    |                      |          S r8   )r  r<   s     r*   _print_ListzStrPrinter._print_List   r   r,   c                 ,    |                     |           S r8   )_format_strr<   s     r*   _print_MatrixBasezStrPrinter._print_MatrixBase   r   r,   c                     |                      |j        t          d         d          d|                     |j                  d|                     |j                  dz   S )NAtomTr)   [ro   ])r+   parentr   r%   rc   rb   r<   s     r*   _print_MatrixElementzStrPrinter._print_MatrixElement   s`      j.@ NNN KK////TV1D1D1D1DEF 	Fr,   c                       fd}                      |j        t          d         d          dz    ||j        |j        j                  z   dz    ||j        |j        j                  z   dz   S )Nc                     t          |           } | d         dk    r| d= | d         dk    rd| d<   | d         |k    rd| d<   d                    t          fd|                     S )N   r   r   rC   :c                 .                         |           S r8   rv   r   s    r*   r   zAStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<lambda>   s    DKK,<,< r,   )r\   r3   r   )xdimr&   s     r*   strslicez/StrPrinter._print_MatrixSlice.<locals>.strslice   s}    QAtqy aDtqy !ts{ !88C < < < <a@@AAAr,   r  Tr  r  ro   r  )r+   r  r   rowslicerowscolslicecols)r&   r=   r  s   `  r*   _print_MatrixSlicezStrPrinter._print_MatrixSlice   s    	B 	B 	B 	B 	B !!$+z&/A$!OORUU(899:<@A(899:<?@ 	Ar,   c                     |j         S r8   r   r<   s     r*   _print_DeferredVectorz StrPrinter._print_DeferredVector  
    yr,   c                 	    t          |          |j        }|d         t          j        u s"t	          d |dd          D                       rt          |d d          \  }}t          |          D ]y\  }}|j        j        r	|j         }n9t          |j        j                  }|d          |d<   t          j        |          }|dz
  rt          |j        |d          n|j        ||<   zg }	|r=|d                                         r#t          |                    d                    g}	|	 fd	|D             z   }
|
sd
g}
t#          |          dk    r>|d                                         r$t          |                    d                    g}	ng }	|	 fd|D             z   }d                    |
          }d                    |          }t#          |          dk    r|d|dS |r|d|S |S |                                \  }}|dk     rt)          | |          }d}nd}g }g }g } j        dvr|                                }nt          j        |          }d }|D ]}|j        rt3          |t                    rt5          |j                                        d         dk               r|j        t          j        ur|                     ||                     t#          |j        d         j                  dk    r6t3          |j        t          t          f          r|                    |           |                    |j                   |j        rt|t          j        urf|j        dk    r'|                    tA          |j                             |j!        dk    r'|                    tA          |j!                             p|                    |           |pt          j        g} fd|D             } fd|D             }|D ]I}|j        |v r>d||"                    |j                           z  ||"                    |j                  <   J|s|d                    |          z   S t#          |          dk    r$|d                    |          z   dz   |d         z   S |d                    |          z   dd                    |          z  z   S )Nr   c              3      K   | ]>}t          |t                    p$|j        ot          d  |j        D                       V  ?dS )c              3   $   K   | ]}|j         V  d S r8   )
is_Integer)r1   ais     r*   r   z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>  s$       @ @2 @ @ @ @ @ @r,   N)r9   r
   is_Powallr4   )r1   r   s     r*   r   z(StrPrinter._print_Mul.<locals>.<genexpr>  sk       ## ##  1f%% A@S @ @ @ @ @@@## ## ## ## ## ##r,   r   c                     t          | t                    o/t          | j                                        d         dk               S Nr   )r9   r   boolexpas_coeff_Mul)r  s    r*   r   z'StrPrinter._print_Mul.<locals>.<lambda>  s9    1c""HtAE,>,>,@,@,Ca,G'H'H r,   T)binaryFevaluatec                 @    g | ]}                     |d           S Fr  r0   r1   r   precr&   s     r*   r2   z)StrPrinter._print_Mul.<locals>.<listcomp>%  >        #//4/FF   r,   1c                 @    g | ]}                     |d           S r4  r0   r5  s     r*   r2   z)StrPrinter._print_Mul.<locals>.<listcomp>/  r7  r,   *z/(rp   /rA   rC   )oldnonec                 x   |                                  \  }}t          t          j        |                    }|d         t          j        u r|dd          }n|d          |d<   t          j        |          }t          | t                    r| 	                    ||d          S | 	                    |d          S )Nr   r   Fr1  )
as_base_expr\   r	   	make_argsr   NegativeOne
_from_argsr9   r   r   )rc   r   r   eargss       r*   apowz#StrPrinter._print_Mul.<locals>.apowM  s    ==??DAqq))**EQx1=( %abb	!!H9au%%A!S!! 4vvaUv33366!e6,,,r,   c                 @    g | ]}                     |d           S r4  r0   r1   r  r6  r&   s     r*   r2   z)StrPrinter._print_Mul.<locals>.<listcomp>n  .    EEEa""1d5"99EEEr,   c                 @    g | ]}                     |d           S r4  r0   rF  s     r*   r2   z)StrPrinter._print_Mul.<locals>.<listcomp>o  rG  r,   r$   z/(%s))#r   r4   r   Oneanyr   r]   r.  	is_Numberr\   r	   rB  r   basecould_extract_minus_signr:   rH   r   r3   r/  r   r   as_ordered_factorsr@  is_commutativer9   r-  rA  r   is_RationalInfinitypr   qindex)r&   r=   r4   r   nrc   dir   dargsprenfactorsdfactorscrN   r   r   	pow_parenrD  r'   a_strb_strr6  s   `                    @r*   
_print_MulzStrPrinter._print_Mul  s   $ y7ae (	s ## ## abb## ## ##  #  # (	  I I  DAq #1 M M26# .AA --E %ayE!Hu--A:;a%Ls27A6666RW!C &QqT2244 &15588}}o        H !5 1vvz ad;;== 15588}}o        H ""A""A8}}q  ($%AAqqq)) ("#!!QQ''H  ""1q5 	r1%%DDDD	:_, 	'**,,DD =&&D
	- 
	- 
	-  	 	D# tS))..003a788 81=0 (HHTT$ZZ((((DIaL-..!3 /&ty3*==/ "((...HHTY''''! d!*&< 6Q; /HHXdf--...6Q; /HHXdf--...L!%EEEEE1EEEEEEEE1EEE  	O 	ODyA~ O,2U17749;M;M5N,Naggdi(() 	F#((5//))VVq[ 	F#((5//)C/%(::#((5//)Gchhuoo,EEEr,   c                 N                                     \  }}d}|j        rZ|                                \  }}|j        r|j        rt          | |          d}n!|j        r|j        rt          | |          d}|d                     fdj        D                       z   S )NrC   rA   r:  c                 V    g | ]%}                     |t                              &S r/   r+   r   r1   r   r=   r&   s     r*   r2   z,StrPrinter._print_MatMul.<locals>.<listcomp>  s1    KKK#TsJt$4$455KKKr,   )as_coeff_mmul	is_numberas_real_imagis_zerois_negativer   r3   r4   )r&   r=   r[  r   rN   reims   ``     r*   _print_MatMulzStrPrinter._print_MatMul}  s    !!##1; 	^^%%FBz bn "A2q))  "A2q))chhKKKKKKKK
 
 
 	
r,   c                 h    d                     |j        |                     |j                            S )Nz{}.({}))r   rq   r%   r=   r<   s     r*   _print_ElementwiseApplyFunctionz*StrPrinter._print_ElementwiseApplyFunction  s0    MKK	""
 
 	
r,   c                     dS )Nnanr/   r<   s     r*   
_print_NaNzStrPrinter._print_NaN  r   r,   c                     dS )Nz-oor/   r<   s     r*   _print_NegativeInfinityz"StrPrinter._print_NegativeInfinity  r   r,   c                 D   |j         rt          d |j        D                       r]t          |j                   dk    rd|                     |j                  z  S d|                     |j        f|j         z   dd          z  S d|                     |j        dd          z  S )Nc              3   2   K   | ]}|t           j        u V  d S r8   )r   Zero)r1   rR  s     r*   r   z*StrPrinter._print_Order.<locals>.<genexpr>  s(      $E$EQQ!&[$E$E$E$E$E$Er,   r   zO(%s)ro   r   )	variablesr*  pointr   r%   r=   r6   r4   r<   s     r*   _print_OrderzStrPrinter._print_Order  s    ~ 	@$E$E$*$E$E$E!E!E 	@4>""a' XTY!7!777t~0MtUV!W!WWWT^^DItQ????r,   c                 *    |                                 S r8   __str__r<   s     r*   _print_OrdinalzStrPrinter._print_Ordinal      ||~~r,   c                 *    |                                 S r8   rz  r<   s     r*   _print_CyclezStrPrinter._print_Cycle  r}  r,   c                    ddl m}m} ddlm} |j        }| |d| dddd	           n| j                            d
d          }|r|j        sdS   ||          |j        dz
            	                                t          d          d          }|                    d          }|dk    s!d||d          vr||d          |d |         z   }|                    dd          }|S |                                }|sE|j        dk     rd|                     |j                  z  S d|                     |j                  z  S |                     |j        d |d         dz                      d|                     |j                  z  z   }|                     |j                  x}	}
t          |          t          |
          k     r|}	d|	z  S )Nr   )PermutationCycle)sympy_deprecation_warningzw
                Setting Permutation.print_cyclic is deprecated. Instead use
                init_printing(perm_cyclic=z).
                z1.6z#deprecated-permutation-print_cyclic   )deprecated_since_versionactive_deprecations_target
stacklevelr    Tz()r   r  rn   ,rC      zPermutation(%s)zPermutation([], size=%s)z	, size=%s) sympy.combinatorics.permutationsr  r  sympy.utilities.exceptionsr  print_cyclic	_settingsgetsize__repr__r   rfindreplacesupportr%   
array_form)r&   r=   r  r  r  r    r   lasttrimusefulls              r*   _print_PermutationzStrPrinter._print_Permutation  s   GGGGGGGGHHHHHH!. 	B%%+6   */+P     .,,]DAAK 	+9 t dDIM**3355c'llmmDA773<<D19 (AdeeH!4 (deeHq$x'		#r""AHA K9q= L,t{{4?/K/KKK1DKK	4J4JJJ;;tz"	z:;;kDKKX\XaLbLb>bbDT_555C$4yy3t99$ $s**r,   c                     |j         \  }}}t          |j                  dk    r|d         }|d         }d|                     |          d|                     |          d|                     |          dS )Nr   r   zSubs(ro   rp   )r4   r   rw  r%   )r&   r   r=   r<  news        r*   _print_SubszStrPrinter._print_Subs  s    c3sy>>Q 	a&Ca&CKKt{{3////S1A1A1A1AC 	Cr,   c                 *    |                                 S r8   rv   r<   s     r*   _print_TensorIndexzStrPrinter._print_TensorIndex      {{}}r,   c                 *    |                                 S r8   rv   r<   s     r*   _print_TensorHeadzStrPrinter._print_TensorHead  r  r,   c                 *    |                                 S r8   rv   r<   s     r*   _print_TensorzStrPrinter._print_Tensor  r  r,   c                 ~                                      \  }}|d                     fd|D                       z   S )Nr:  c                 V    g | ]%}                     |t                              &S r/   rb  rc  s     r*   r2   z-StrPrinter._print_TensMul.<locals>.<listcomp>  s1    FFF#TsJt$4$455FFFr,   )!_get_args_for_traditional_printerr3   )r&   r=   rN   r4   s   ``  r*   _print_TensMulzStrPrinter._print_TensMul  sP    ;;==
dchhFFFFFFFF
 
 
 	
r,   c                 *    |                                 S r8   rv   r<   s     r*   _print_TensAddzStrPrinter._print_TensAdd  r  r,   c                 6    |                      |j                  S r8   r%   r   r<   s     r*   _print_ArraySymbolzStrPrinter._print_ArraySymbol  s    {{49%%%r,   c                                            |j        t          d         d          dd                     fd|j        D                       dS )NFuncTr  ro   c                 :    g | ]}                     |          S r/   rv   r   s     r*   r2   z2StrPrinter._print_ArrayElement.<locals>.<listcomp>  s%    NtNtNtbct{{[\~~NtNtNtr,   r  )r+   r   r   r3   indicesr<   s   ` r*   _print_ArrayElementzStrPrinter._print_ArrayElement  s^    diF);TBBBBDIINtNtNtNtgkgsNtNtNtDuDuDuDuw 	wr,   c                 Z      fd|j         D             }dd                    |          z  S )Nc                 @    g | ]}d                      |          z  S )z    %srv   )r1   r   r&   s     r*   r2   z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>  s(    :::1XA&:::r,   zPermutationGroup([
%s])z,
)r4   r3   )r&   r=   rR  s   `  r*   _print_PermutationGroupz"StrPrinter._print_PermutationGroup  s3    ::::	:::)EJJqMM99r,   c                     dS )Npir/   r<   s     r*   	_print_PizStrPrinter._print_Pi  r   r,   c                      dd                     t           fd|j                            d                     |j                  d                     |j                  dS )NzPolynomial ring in ro   c                 .                         |           S r8   rv   )rsr&   s    r*   r   z,StrPrinter._print_PolyRing.<locals>.<lambda>      dkk"oo r,    over  with  orderr3   r   r   r%   domainr   )r&   rings   ` r*   _print_PolyRingzStrPrinter._print_PolyRing  sg     YYs5555t|DDEEEEKK$$$$dkk$*&=&=&=&=? 	?r,   c                      dd                     t           fd|j                            d                     |j                  d                     |j                  dS )NzRational function field in ro   c                 .                         |           S r8   rv   )fsr&   s    r*   r   z-StrPrinter._print_FracField.<locals>.<lambda>  r  r,   r  r  r  r  r&   fields   ` r*   _print_FracFieldzStrPrinter._print_FracField   si     YYs5555u}EEFFFFKK%%%%t{{5;'?'?'?'?A 	Ar,   c                 *    |                                 S r8   rz  )r&   elms     r*   _print_FreeGroupElementz"StrPrinter._print_FreeGroupElement  s    {{}}r,   c                 (    d|j         d|j        dS )Nrn    + z*I))r  yr&   polys     r*   _print_GaussianElementz!StrPrinter._print_GaussianElement  s      $//r,   c                 <    |                     | t          dd          S )Nz%s**%sr:  )r:   r   r  s     r*   _print_PolyElementzStrPrinter._print_PolyElement  s    xxj(C888r,   c                     |j         dk    r|                     |j                  S |                     |j        t          d         d          }|                     |j         t          d         d          }|dz   |z   S )Nr   r	   Tr  r  r;  )denomr%   numerr+   r   )r&   fracr  r  s       r*   _print_FracElementzStrPrinter._print_FracElement  su    :? 	';;tz***%%dj*U2CD%QQE%%dj*V2DT%RRE3;&&r,   c                     t           d         dz
  g  fd|j        D             }}|                                D ]t\  }}g }t          |          D ]N\  }}|dk    rC|dk    r|                    ||                    -|                    ||         d|z  z              Od                    |          }|j        r4|rd                     |          z   dz   }	nz                     |          }	nd|rM|t          j	        u r|
                    d	|g           |t          j        u r|
                    d
|g                                |          }	|s|	}
n|	dz   |z   }
|
                    d
          r!|
                    d
|
dd          g           ]|
                    d	|
g           v|d         dv r)|                    d          }|d
k    rd
|d         z   |d<   |j        j        dz   }ddlm} 	 |d|                                z  z  }n%# |$ r |d|                                z  z  }Y nw xY w|dz  }t          |          D ]a\  }}t)          |          dk    rI|d d         dk    r;|t)          |          dz
  d          dk    r|dt)          |          dz
           ||<   b|d                    |          d                    |          fz  S )Nr  r   c                 <    g | ]}                     |          S r/   r0   )r1   r   	ATOM_PRECr&   s     r*   r2   z*StrPrinter._print_Poly.<locals>.<listcomp>  s)    PPPD--a;;PPPr,   r   z**%dr:  rn   rp   rB   rA   )rA   rB   z(%s, %s)PolynomialErrorz, modulus=%sz, domain='%s'r  rD   ro   )r   gensrI   r]   r   r3   is_Addr%   r   rI  rG   rA  rF   rH   rx   ry   sympy.polys.polyerrorsr  get_modulus
get_domainr   )r&   r=   rI   r  monomcoeffs_monomrc   r   s_coeffs_termmodifierr   r  rT  r'   r  s   `               @r*   _print_PolyzStrPrinter._print_Poly  sL   v&*	PPPPPTYPPPt JJLL %	, %	,LE5G!%(( = =1q5 =Av =tAw////tAw!';<<<hhw''G| - 1!DKK$6$66<GG"kk%00GG !~ !c7^444 - !c7^444 ++e,, 1  30  %% ,c6!"":.////c6]++++8z! 	*yy||H3 *q>a(94::::::	:nt'7'7'9'999FF 	: 	: 	:o(9(999FFF	: 	#$T?? 	4 	4KE44yy1} 4$rr(c/ 4d3t99q=>>6Jc6Q 4"1SYY]?3U%$))D//:::s   <H H98H9c                     dS )Nr   r/   )r&   rR  s     r*   _print_UniversalSetzStrPrinter._print_UniversalSetX  s    ~r,   c                     |j         r9|                     |                                                                          S |                     |                                          S r8   )
is_aliasedr%   as_polyas_exprr<   s     r*   _print_AlgebraicNumberz!StrPrinter._print_AlgebraicNumber[  sL    ? 	/;;t||~~5577888;;t||~~...r,   c                     t          |          }|j        t          j        u r|sd                     |j                  z  S |j        r|j         t          j        u r6|s4dt          t           fdt          j	        |j        f                    z  S |j        t          j	         u r?                     t          j	                  d 
                    |j        |d          S  
                    |j        |d          } j        dk    r[|j        j        rO|j        j        dk    r?|                    d	          r* 
                    |j        |d          d
|dd         S  
                    |j        |d          d
|S )a$  Printing helper function for ``Pow``

        Parameters
        ==========

        rational : bool, optional
            If ``True``, it will not attempt printing ``sqrt(x)`` or
            ``x**S.Half`` as ``sqrt``, and will use ``x**(1/2)``
            instead.

            See examples for additional details

        Examples
        ========

        >>> from sympy import sqrt, StrPrinter
        >>> from sympy.abc import x

        How ``rational`` keyword works with ``sqrt``:

        >>> printer = StrPrinter()
        >>> printer._print_Pow(sqrt(x), rational=True)
        'x**(1/2)'
        >>> printer._print_Pow(sqrt(x), rational=False)
        'sqrt(x)'
        >>> printer._print_Pow(1/sqrt(x), rational=True)
        'x**(-1/2)'
        >>> printer._print_Pow(1/sqrt(x), rational=False)
        '1/sqrt(x)'

        Notes
        =====

        ``sqrt(x)`` is canonicalized as ``Pow(x, S.Half)`` in SymPy,
        so there is no need of defining a separate printer for ``sqrt``.
        Instead, it should be handled here as well.
        zsqrt(%s)z%s/sqrt(%s)c                 .                         |           S r8   rv   r   s    r*   r   z'StrPrinter._print_Pow.<locals>.<lambda>  s    T[[=M=M r,   r;  Fr  
_sympyreprr   z	(Rational**r  )r   r.  r   Halfr%   rL  rO  r   r   rI  r+   printmethodrP  rS  rF   )r&   r=   rationalrJ   r   s   `    r*   
_print_PowzStrPrinter._print_Powa  s   L $8qv 	7h 	7DI 6 666 	TyAF" d8 d %uS1M1M1M1MPQPUW[W`Oa-b-b'c'cccxAE6! T"&++ae"4"4"4"4"&"3"3DItE"3"R"R"RT T dhU;;|+ 	^0D 	^WX 	^ ||K(( ^#'#4#4TYU#4#S#S#S#SUVWXY[W[U\U\]],,TYU,KKKKQQOOr,   c                 B    |                      |j        d                   S r,  r%   r4   r<   s     r*   _print_UnevaluatedExprz!StrPrinter._print_UnevaluatedExpr  s    {{49Q<(((r,   c                     t          |          }|                     |j        |d          d|                     |j        |d          S )NFr  r  )r   r+   rL  r.  )r&   r=   rJ   s      r*   _print_MatPowzStrPrinter._print_MatPow  sX    $,,TYU,KKKK**48T%*HHHJ 	Jr,   c                 j    | j                             dd          rd|z  S t          |j                  S )Nr   FzS(%s))r  r  r:   rR  r<   s     r*   _print_IntegerzStrPrinter._print_Integer  s6    >.66 	$d##46{{r,   c                     dS )NIntegersr/   r<   s     r*   _print_IntegerszStrPrinter._print_Integers      zr,   c                     dS )NNaturalsr/   r<   s     r*   _print_NaturalszStrPrinter._print_Naturals  r  r,   c                     dS )N	Naturals0r/   r<   s     r*   _print_Naturals0zStrPrinter._print_Naturals0      {r,   c                     dS )N	Rationalsr/   r<   s     r*   _print_RationalszStrPrinter._print_Rationals  r
  r,   c                     dS )NRealsr/   r<   s     r*   _print_RealszStrPrinter._print_Reals  rV   r,   c                     dS )N	Complexesr/   r<   s     r*   _print_ComplexeszStrPrinter._print_Complexes  r
  r,   c                     dS )NEmptySetr/   r<   s     r*   _print_EmptySetzStrPrinter._print_EmptySet  r  r,   c                     dS )NEmptySequencer/   r<   s     r*   _print_EmptySequencezStrPrinter._print_EmptySequence  s    r,   c                      t          |          S r8   r:   r<   s     r*   
_print_intzStrPrinter._print_int      4yyr,   c                      t          |          S r8   r  r<   s     r*   
_print_mpzzStrPrinter._print_mpz  r  r,   c                     |j         dk    rt          |j                  S | j                            dd          rd|j        d|j         S |j        d|j         S )Nr   r   FzS(z)/r;  )rS  r:   rR  r  r  r<   s     r*   _print_RationalzStrPrinter._print_Rational  sh    6Q; 	.tv;;~!!"2E:: 5 5%)VVVTVV44"fffdff--r,   c                 b    |j         dk    rt          |j                  S d|j        |j         fz  S )Nr   z%d/%d)rS  r:   rR  r<   s     r*   _print_PythonRationalz StrPrinter._print_PythonRational  s2    6Q; 	.tv;;dfdf---r,   c                 b    |j         dk    rt          |j                  S |j        d|j         S Nr   r;  denominatorr:   	numeratorr<   s     r*   _print_FractionzStrPrinter._print_Fraction  :    q  	@t~&&&"nnnd.>.>??r,   c                 b    |j         dk    rt          |j                  S |j        d|j         S r%  r&  r<   s     r*   
_print_mpqzStrPrinter._print_mpq  r*  r,   c                 (   |j         }|dk     rd}nt          |j                   }| j        d         du rd}n.| j        d         du rd}n| j        d         dk    r| j        dk    }d| j        v r| j        d         nd }d	| j        v r| j        d	         nd }t	          |j        ||||
          }|                    d          rd|dd          z   }n"|                    d          rd|dd          z   }|                    d          r
|dd          }|S )Nr  r   r   TFr   r   r!   r"   )strip_zeros	min_fixed	max_fixedz-.0z-0.   z.0z0.r  rB   )_precr   r  _print_levelmlib_to_str_mpf_rF   )r&   r=   r6  dpsstriplowhighrvs           r*   _print_FloatzStrPrinter._print_Float  sI   z!8 	*CCdj))C>+&$. 	*EE^K(E1 	*EE^K(F2 	*%)E','>HdnU##D(-(?It~e$$TSesVZ[[[== 	ABBBB]]4   	122B== 	ABBB	r,   c           
         ddddddddd	}|j         |v rF||j                  d
|                     |j                  d|                     |j                  dS |                     |j        t          |                    d| j                            |j                   p|j         d|                     |j        t          |                    S )NEqNe
AssignmentAddAugmentedAssignmentSubAugmentedAssignmentMulAugmentedAssignmentDivAugmentedAssignmentModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=rn   ro   rp   rD   )rel_opr%   lhsr_   r+   r   _relationalsr  )r&   r=   charmaps      r*   _print_RelationalzStrPrinter._print_Relational  s     *****	
 	
 ;'! 	:#*4;#7#7#7TX9N9N9N9N#';;tx#8#8#8#8: : "..txD9I9IJJJJ,00==LLL,,TXz$7G7GHHHJ 	Jr,   c                 N    d|                      |j        d          |j        fz  S )NzCRootOf(%s, %d)lexr@   )rO   r=   rT  r<   s     r*   _print_ComplexRootOfzStrPrinter._print_ComplexRootOf  s-     DOODIeO$L$L$(J$0 0 	0r,   c                     |                      |j        d          g}|j        t          j        ur-|                    |                     |j                             dd                    |          z  S )NrK  r@   zRootSum(%s)ro   )rO   r=   funr   IdentityFunctionr   r%   r3   r   s      r*   _print_RootSumzStrPrinter._print_RootSum  sc    	77881-- 	/KKDH--...tyy..r,   c                 \    j         j        } fdj        D             }dd                    |          z  } fdj        D             }d                     j                  z  }d                     j                  z  }|g|z   ||gz   }|dd                    |          dS )	Nc                 H    g | ]}                     |j                   S )r@   )rO   r   )r1   r   basisr&   s     r*   r2   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>  s+    PPPSEK88PPPr,   r  ro   c                 :    g | ]}                     |          S r/   rv   )r1   genr&   s     r*   r2   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>"  s%    999cS!!999r,   zdomain='%s'z
order='%s'rn   rp   )rx   ry   exprsr3   r  r%   r  r   )r&   rS  clsrV  r  r  r   r4   s   ``      r*   _print_GroebnerBasiszStrPrinter._print_GroebnerBasis  s    o&PPPPPEKPPP5)))9999UZ999U\!:!::t{{5;777w~/33		$00r,   c                      t          |t                    }d                     fd|D                       }|sdS d|z  S )Nr   ro   c              3   B   K   | ]}                     |          V  d S r8   rv   r1   r'   r&   s     r*   r   z(StrPrinter._print_set.<locals>.<genexpr>-  /      ==tT**======r,   zset()r   )r   r   r3   r&   r   r   r4   s   `   r*   
_print_setzStrPrinter._print_set*  sS    q.///yy====u===== 	7}r,   c                 
    ddl m t          |t                    }d                     fd|D                       }t          fd|D                       rd                    |          S d                    |          S )	Nr   )	FiniteSetr   ro   c              3   B   K   | ]}                     |          V  d S r8   rv   r[  s     r*   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>6  r\  r,   c              3   B   K   | ]}|                               V  d S r8   )has)r1   r'   r`  s     r*   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>7  s/      55ttxx	""555555r,   zFiniteSet({})z{{{}}})sympy.sets.setsr`  r   r   r3   rJ  r   )r&   r   r   r4   r`  s   `   @r*   _print_FiniteSetzStrPrinter._print_FiniteSet2  s    ------q.///yy====u=====5555u55555 	0"))$///t$$$r,   c                      t          |t                    }d                     fd|D                       }d                    |          S )Nr   ro   c              3   B   K   | ]}                     |          V  d S r8   rv   r   s     r*   r   z.StrPrinter._print_Partition.<locals>.<genexpr>>  s/      ;;cS));;;;;;r,   zPartition({}))r   r   r3   r   r]  s   `   r*   _print_PartitionzStrPrinter._print_Partition;  sP    q.///yy;;;;U;;;;;%%d+++r,   c                 :    |sdS d|                      |          z  S )Nzfrozenset()zfrozenset(%s))r^  r&   r   s     r*   _print_frozensetzStrPrinter._print_frozensetA  s&     	! =!3!333r,   c                       fdd                     fd|j        D                       }d                     |j                  d|dS )Nc                     t          |           dk    r                    | d                   S                     | d         ft          | dd                    z             S r   r   r   s    r*   r   z)StrPrinter._print_Sum.<locals>._xab_tostrG  r   r,   ro   c                 &    g | ]} |          S r/   r/   r   s     r*   r2   z)StrPrinter._print_Sum.<locals>.<listcomp>L  r   r,   zSum(rp   r   r   s   `  @r*   
_print_SumzStrPrinter._print_SumF  sl    	? 	? 	? 	? 	?
 II::::dk:::;; $DM : : : :AAA>>r,   c                     |j         S r8   r   r<   s     r*   _print_SymbolzStrPrinter._print_SymbolO  r#  r,   c                     dS r   r/   r<   s     r*   _print_IdentityzStrPrinter._print_IdentityT  r   r,   c                     dS )N0r/   r<   s     r*   _print_ZeroMatrixzStrPrinter._print_ZeroMatrixW  r   r,   c                     dS )Nr8  r/   r<   s     r*   _print_OneMatrixzStrPrinter._print_OneMatrixZ  r   r,   c                     d|j         z  S )NzQ.%sr   r<   s     r*   _print_PredicatezStrPrinter._print_Predicate]  s    	!!r,   c                      t          |          S r8   r  r<   s     r*   
_print_strzStrPrinter._print_str`  r  r,   c                     t          |          dk    rd|                     |d                   z  S d|                     |d          z  S )Nr   z(%s,)r   r$   ro   )r   r%   r6   r<   s     r*   _print_tuplezStrPrinter._print_tuplec  sH    t99> 	7T[[a1111DNN46666r,   c                 ,    |                      |          S r8   )r~  r<   s     r*   _print_TuplezStrPrinter._print_Tuplei  s      &&&r,   c                 T    d|                      |j        t          d                   z  S )Nz%s.Tr   r   )r&   Ts     r*   _print_TransposezStrPrinter._print_Transposel  s$    ))!%E1BCCCCr,   c                 t    d|                      |j                  d|                      |j                  dS )NzUniform(ro   rp   )r%   r   r   r<   s     r*   _print_UniformzStrPrinter._print_Uniformo  s7     $(KK$7$7$7$7TV9L9L9L9LMMr,   c                 `    | j                             dd          r
d|j        z  S d|j        z  S )Nr   Fz%s)r  r  r   r   r<   s     r*   _print_QuantityzStrPrinter._print_Quantityr  s6    >h.. 	&$+%%dir,   c                       fd|j         D             }|d         gd t          |dd          d          D             z   }d                    |          S )Nc                 V    g | ]%}                     |t          d          d          &S )r	   Tr  )r+   r   r   s     r*   r2   z0StrPrinter._print_Quaternion.<locals>.<listcomp>x  s3    UUUaTq*U"3DAAUUUr,   r   c                 $    g | ]\  }}|d z   |z   S )r:  r/   )r1   rc   rb   s      r*   r2   z0StrPrinter._print_Quaternion.<locals>.<listcomp>y  s$    <<<$!QaeAg<<<r,   r   ijkr  )r4   zipr3   )r&   r=   r   r   s   `   r*   _print_QuaternionzStrPrinter._print_Quaternionw  s_    UUUU49UUUqTF<<#aeU*;*;<<<<zz!}}r,   c                      t          |          S r8   r  r<   s     r*   _print_DimensionzStrPrinter._print_Dimension|  r  r,   c                     |j         dz   S r   r   r<   s     r*   _print_WildzStrPrinter._print_Wild      y3r,   c                     |j         dz   S r   r   r<   s     r*   _print_WildFunctionzStrPrinter._print_WildFunction  r  r,   c                     |j         S r8   r   r<   s     r*   _print_WildDotzStrPrinter._print_WildDot  r#  r,   c                     |j         S r8   r   r<   s     r*   _print_WildPluszStrPrinter._print_WildPlus  r#  r,   c                     |j         S r8   r   r<   s     r*   _print_WildStarzStrPrinter._print_WildStar  r#  r,   c                 @    | j                             dd          rdS dS )Nr   FzS(0)ru  )r  r  r<   s     r*   _print_ZerozStrPrinter._print_Zero  s'    >.66 	6sr,   c                 ^   	 |j         -|                     |j                             |                    S n# t          $ r Y nw xY w|j        j        }|                     |j                  }|                     |j                  }|                     |j                   }|d|d|d|dS rm   )r  r%   to_sympyr   rx   ry   repdom)r&   rR  rW  r  r  r  s         r*   
_print_DMPzStrPrinter._print_DMP  s    	v 7{{16??1#5#56667  	 	 	D	 k"kk!%  kk!%  {{16""#&33SSS$$$77s   37 
AAc                 ,    |                      |          S r8   )r  r<   s     r*   
_print_DMFzStrPrinter._print_DMF  s    t$$$r,   c                     d|j         z  S )NzObject("%s")r   )r&   r   s     r*   _print_ObjectzStrPrinter._print_Object  s    ((r,   c                     d|j         z  S )NzIdentityMorphism(%s))r  r&   morphisms     r*   _print_IdentityMorphismz"StrPrinter._print_IdentityMorphism  s    %77r,   c                 8    d|j         d|j        d|j        dS )NzNamedMorphism(ro   z, "z"))r  codomainr   r  s     r*   _print_NamedMorphismzStrPrinter._print_NamedMorphism  s,     !2!2!2HMMMC 	Cr,   c                     d|j         z  S )NzCategory("%s")r   )r&   categorys     r*   _print_CategoryzStrPrinter._print_Category  s    (-//r,   c                     |j         j         S r8   r   )r&   manifolds     r*   _print_ManifoldzStrPrinter._print_Manifold  s    }!!r,   c                     |j         j         S r8   r   )r&   patchs     r*   _print_PatchzStrPrinter._print_Patch  s    zr,   c                     |j         j         S r8   r   )r&   coordss     r*   _print_CoordSystemzStrPrinter._print_CoordSystem  s    {r,   c                 :    |j         j        |j                 j        S r8   
_coord_sysr   _indexr   r  s     r*   _print_BaseScalarFieldz!StrPrinter._print_BaseScalarField  s    '5::r,   c                 @    d|j         j        |j                 j        z  S )Nze_%sr  r  s     r*   _print_BaseVectorFieldz!StrPrinter._print_BaseVectorField  s    (0>CCCr,   c                     |j         }t          |d          rd|j        j        |j                 j        z  S d|                     |          z  S )Nr  zd%szd(%s))_form_fieldr   r  r   r  r   r%   )r&   diffr  s      r*   _print_DifferentialzStrPrinter._print_Differential  sN     5,'' 	05+3ELAFFFT[[////r,   c                 N    dd|                      |j        d                   dS )NTrrn   r   rp   r  r<   s     r*   	_print_TrzStrPrinter._print_Tr  s)    44TYq\!:!:!:!:;;r,   c                 6    |                      |j                  S r8   r  rj  s     r*   
_print_StrzStrPrinter._print_Str  s    {{16"""r,   c                     |j         }|                     |          d|                     |j                  d|                     |j                  dS rm   )rq   r%   rF  r_   )r&   r=   rels      r*   _print_AppliedBinaryRelationz'StrPrinter._print_AppliedBinaryRelation  sV    m#{{3////#{{484444#{{4844446 	6r,   )F)r   r8   )ry   
__module____qualname__r  _default_settingsrG  r+   r6   r>   rO   rR   rU   rY   rd   rh   rk   rs   rz   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_  rk  rm  rp  rr  rx  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)  r,  r;  rI  rL  rP  rX  r^  re  rh  rk  ro  rq  _print_MatrixSymbol_print_RandomSymbolrs  rv  rx  rz  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      s       K  L% % % %K K K K  " " " "*    J J JE E EI I IJ J JN N N? ? ?% % %
    1 1 1` ` `
) ) )& & &9 9 9      M M MM M M  N N N
$ $ $    D D D6 6 6&< < <H H HH H HY Y YN N N3 3 3& & && & &F F FA A A  tF tF tFl
 
 
"
 
 
    @ @ @    '+ '+ '+RC C C      
 
 
  & & &w w w: : :  ? ? ?
A A A
  0 0 09 9 9' ' '@; @; @;D  / / /;P ;P ;P ;Pz) ) )J J J
  
                    . . .. . .@ @ @@ @ @  0J J J*0 0 0/ / /1 1 1  % % %, , ,4 4 4
? ? ?  ''      " " "  7 7 7' ' 'D D DN N N     
  
              
8 8 8% % %) ) )8 8 8C C C0 0 0" " "       ; ; ;D D D0 0 0< < <# # #6 6 6 6 6r,   r   c                 N    t          |          }|                    |           }|S )ab  Returns the expression as a string.

    For large expressions where speed is a concern, use the setting
    order='none'. If abbrev=True setting is used then units are printed in
    abbreviated form.

    Examples
    ========

    >>> from sympy import symbols, Eq, sstr
    >>> a, b = symbols('a b')
    >>> sstr(Eq(a + b, 0))
    'Eq(a + b, 0)'
    )r   doprintr=   settingsrR  r   s       r*   sstrr    s%    " 	8A			$AHr,   c                       e Zd ZdZd Zd ZdS )StrReprPrinterz(internal) -- see sstrreprc                      t          |          S r8   )r;   rj  s     r*   r|  zStrReprPrinter._print_str  s    Awwr,   c                 V    |j         j        d|                     |j                  dS )Nrn   rp   )rx   ry   r%   r   rj  s     r*   r  zStrReprPrinter._print_Str  s,    ;///QV1D1D1D1DEEr,   N)ry   r  r  __doc__r|  r  r/   r,   r*   r  r    s=        $$  F F F F Fr,   r  c                 N    t          |          }|                    |           }|S )zreturn expr in mixed str/repr form

       i.e. strings are returned in repr form with quotes, and everything else
       is returned in str form.

       This function could be useful for hooking into sys.displayhook
    )r  r  r  s       r*   sstrreprr    s%     	x  A			$AHr,   N)$r  typingr   r   tDict
sympy.corer   r   r   r   r	   r
   r   sympy.core.mulr   sympy.core.relationalr   sympy.core.sortingr   sympy.core.sympifyr   sympy.utilities.iterablesr   r   r   printerr   r   mpmath.libmpr   r   r4  r   r  r  r  r/   r,   r*   <module>r     s    & % % % % % % % @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ & & & & & & , , , , , , / / / / / / + + + + + + * * * * * * . . . . . . . . , , , , , , , , ; ; ; ; ; ; ; ;@6 @6 @6 @6 @6 @6 @6 @6F 
  ,F F F F FZ F F F      r,   