
    g                    6   d Z ddlmZ ddlmZ ddl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.
    )annotations)Any)SRationalPowBasicMulNumber)_keep_coeff)Integer)
Relational)default_sort_key)sift   )
precedence
PRECEDENCE)Printerprint_function)prec_to_dpsto_strc                  n   e Zd ZU dZddddddddZded<   i Zd	ed
<   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*d0 Z+d1 Z,d2 Z-d3 Z.d4 Z/d5 Z0d6 Z1d7 Z2d8 Z3d9 Z4d: Z5d; Z6d< Z7d= Z8d> Z9d? Z:d@ Z;dA Z<dB Z=dC Z>dD Z?dE Z@dF ZAdG ZBdH ZCdI ZDdJ ZEdK ZFdL ZGdM ZHdN ZIdO ZJdP ZKdQ ZLdR ZMddSZNdT ZOdU ZPdV ZQdW ZRdX ZSdY ZTdZ ZUd[ ZVd\ ZWd] ZXd^ ZYd_ ZZd` Z[da Z\db Z]dc Z^dd Z_de Z`df Zadg Zbdh Zcdi Zddj Zedk Zfdl Zgdm Zhdn Zido ZjejZkejZldp Zmdq Zndr Zods Zpdt Zqdu Zrdv Zsdw Ztdx Zudy Zvdz Zwd{ Zxd| Zyd} Zzd~ Z{d Z|d Z}d Z~d Zd Zd 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maxzdict[str, Any]_default_settingszdict[str, str]_relationalsc                    t          |          |k     s|s+t          |          |k    rd|                     |          z  S |                     |          S )N(%s))r   _print)selfitemlevelstricts       N/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/printing/str.pyparenthesizezStrPrinter.parenthesize"   sU    tu$$v$:d;K;Ku;T;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|j        sd}|dd          }nd}t          |          |k     s|j        r|                    |d|z  g           w|                    ||g           |                    d          }|dk    rd}|d                    |          z   S )	Nr   -r   +r%   r     )_as_ordered_termsr   r&   
startswithis_Addextendpopr4   )	r'   r>   r   termsprecltermtsigns	            r+   
_print_AddzStrPrinter._print_Add3   s   &&t5&99$ 
	$ 
	$DD!!A||C    abbE$$&&$+&$
+,,,,$####uuQxx3;;Dchhqkk!!r-   c                    dS )NTruer0   r=   s     r+   _print_BooleanTruezStrPrinter._print_BooleanTrueH   s    vr-   c                    dS )NFalser0   r=   s     r+   _print_BooleanFalsezStrPrinter._print_BooleanFalseK       wr-   c                `    d|                      |j        d         t          d                   z  S )Nz~%sr   Not)r,   r5   r   r=   s     r+   
_print_NotzStrPrinter._print_NotN   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)listr5   	enumerater:   r   	canonicalrhsr   NegativeInfinityinsertrJ   r7   r   )r'   r>   r5   jis        r+   
_print_AndzStrPrinter._print_AndQ   s    DIdOO 	, 	,DAq!Z(( ,KOq'999Atxx{{+++~~dE:l+CDDDr-   c                P    |                      |j        dt          d                   S )Nz | 	BitwiseOrr7   r5   r   r=   s     r+   	_print_OrzStrPrinter._print_OrY   s    ~~di
;0GHHHr-   c                P    |                      |j        dt          d                   S )Nz ^ 
BitwiseXorri   r=   s     r+   
_print_XorzStrPrinter._print_Xor\   s    ~~di
<0HIIIr-   c                t    |                      |j                  d|                     |j        d          dS N(, ))r&   functionr7   	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 r0   r&   )r2   or'   s     r+   r3   z+StrPrinter._print_Basic.<locals>.<listcomp>d   s#    ///T[[^^///r-   r%   rq   )r5   	__class____name__r4   )r'   r>   rM   s   `  r+   _print_BasiczStrPrinter._print_Basicc   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_BlockMatrixg   s=    8>V##KK'''{{18$$$r-   c                    dS )NCatalanr0   r=   s     r+   _print_CatalanzStrPrinter._print_Catalanl   s    yr-   c                    dS )Nzoor0   r=   s     r+   _print_ComplexInfinityz!StrPrinter._print_ComplexInfinityo       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 r0   rx   r2   re   r'   s     r+   r3   z2StrPrinter._print_ConditionSet.<locals>.<listcomp>s   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'   sr5   s   `  r+   _print_ConditionSetzStrPrinter._print_ConditionSetr   sn    CCCCquak.BCCCDD:'')D00QZ((**)D00r-   c                     |j         }d |j        D             }dd                     fd|g|z   D                       z  S )Nc                :    g | ]}|d          d k    r|d         n|S )r   r   r0   )r2   re   s     r+   r3   z0StrPrinter._print_Derivative.<locals>.<listcomp>{   s,    GGGa11GGGr-   zDerivative(%s)rq   c              3  B   K   | ]}                     |          V  d S r9   rx   r2   argr'   s     r+   	<genexpr>z/StrPrinter._print_Derivative.<locals>.<genexpr>|   s/      ,Y,Y#T[[-=-=,Y,Y,Y,Y,Y,Yr-   )r>   variable_countr4   )r'   r>   dexprdvarss   `   r+   _print_DerivativezStrPrinter._print_Derivativey   sS    	GG43FGGG$)),Y,Y,Y,Y%SX,Y,Y,Y"Z"ZZZr-   c                    t          |                                t                    }g }|D ]J}|                     |          d|                     ||                   }|                    |           Kdd                    |          z  S )Nkeyz: {%s}rq   )sortedkeysr   r&   appendr4   )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 r9   )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
EulerGammar0   r=   s     r+   _print_EulerGammazStrPrinter._print_EulerGamma   s    |r-   c                    dS )NEr0   r=   s     r+   _print_Exp1zStrPrinter._print_Exp1       sr-   c                t    d|                      |j                  d|                      |j                  dS ro   )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%   rq   )funcr{   r7   r5   r=   s     r+   _print_FunctionzStrPrinter._print_Function   s'    y!FT^^DIt-L-L$LLLr-   c                    dS )NGoldenRatior0   r=   s     r+   _print_GoldenRatiozStrPrinter._print_GoldenRatio   s    }r-   c                X    |j         j        d|                     |j        d          z  z   S r   )r   r{   r7   pargsr=   s     r+   _print_HeavisidezStrPrinter._print_Heaviside   s)     y!FT^^DJ-M-M$MMMr-   c                    dS )NTribonacciConstantr0   r=   s     r+   _print_TribonacciConstantz$StrPrinter._print_TribonacciConstant   s    ##r-   c                    dS NIr0   r=   s     r+   _print_ImaginaryUnitzStrPrinter._print_ImaginaryUnit   r   r-   c                    dS )Noor0   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   S    3xx1}}{{3q6***{{CF9uSW~~#=>>>r-   rq   c                &    g | ]} |          S r0   r0   r2   rM   r   s     r+   r3   z.StrPrinter._print_Integral.<locals>.<listcomp>   !    :::zz!}}:::r-   z	Integral(rr   r4   limitsr&   rs   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})rD   z.openz.Lopenz.Ropen)abmr0   )r5   is_infiniteformat)r'   re   finr   r   rM   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(rq   rr   )r&   r    r!   )r'   re   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(rq   rr   )r>   	signaturer   	is_symbolr&   )r'   objr>   sigs       r+   _print_LambdazStrPrinter._print_Lambda   sc    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%   rq   c              3  B   K   | ]}                     |          V  d S r9   rx   r   s     r+   r   z.StrPrinter._print_LatticeOp.<locals>.<genexpr>   s/      6X6XCt{{37G7G6X6X6X6X6X6Xr-   )r   r5   r   r   r{   r4   r'   r>   r5   s   `  r+   _print_LatticeOpzStrPrinter._print_LatticeOp   sO    di%5666y!FTYY6X6X6X6XSW6X6X6X-X-X$XXXr-   c           
     l    |j         \  }}}}dt          t          | j        ||||f                    z  S )NzLimit(%s, %s, %s, dir='%s'))r5   r   mapr&   )r'   r>   ezz0dirs         r+   _print_LimitzStrPrinter._print_Limit   s9    	1b#,uSq!RQTo5V5V/W/WWWr-   c                4    d|                      |d          z  S )N[%s]rq   )r7   r=   s     r+   _print_listzStrPrinter._print_list   s    tT2222r-   c                ,    |                      |          S r9   )r  r=   s     r+   _print_ListzStrPrinter._print_List   r   r-   c                ,    |                     |           S r9   )_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*   [rq   ])r,   parentr   r&   re   rd   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                    fd| D                       S )N   r   r   rD   :c              3  B   K   | ]}                     |          V  d S r9   rx   r   s     r+   r   zBStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<genexpr>   s/      ;;#T[[--;;;;;;r-   )r^   r4   )xdimr'   s     r+   strslicez/StrPrinter._print_MatrixSlice.<locals>.strslice   su    QAtqyyaDtqyy!ts{{!88;;;;;;;<<<r-   r  Tr  r  rq   r  )r,   r  r   rowslicerowscolslicecols)r'   r>   r  s   `  r+   _print_MatrixSlicezStrPrinter._print_MatrixSlice   s    	= 	= 	= 	= 	= !!$+z&/A$!OORUU(899:<@A(899:<?@ 	Ar-   c                    |j         S r9   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 }	|rP|d         j        sC|d                                         r)                     |                    d                    g}	|	 fd	|D             z   }
|
sd
g}
t%          |          dk    rD|d                                         r*                     |                    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        rt5          |t                    rt7          |j                                        d         dk               r|j        t          j        ur|                     ||                     t%          |j        d         j                  dk    r6t5          |j        t          t          f          r|                    |           |                    |j                   |j        rt|t          j        urf|j         dk    r'|                    tC          |j                              |j"        dk    r'|                    tC          |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 r9   )
is_Integer)r2   ais     r+   r   z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>  s$       @ @2 @ @ @ @ @ @r-   N)r:   r
   is_Powallr5   )r2   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   )r:   r   boolexpas_coeff_Mul)r  s    r+   <lambda>z'StrPrinter._print_Mul.<locals>.<lambda>  s9    1c""HtAE,>,>,@,@,Ca,G'H'H r-   T)binaryFevaluatec                @    g | ]}                     |d           S Fr  r1   r2   r   rL   r'   s     r+   r3   z)StrPrinter._print_Mul.<locals>.<listcomp>#  >        #//4/FF   r-   1c                @    g | ]}                     |d           S r5  r1   r6  s     r+   r3   z)StrPrinter._print_Mul.<locals>.<listcomp>-  r7  r-   *z/(rr   /rB   rD   )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   Fr2  )
as_base_expr^   r	   	make_argsr   NegativeOne
_from_argsr:   r   r   )re   r   r   eargss       r+   apowz#StrPrinter._print_Mul.<locals>.apowK  s    ==??DAqq))**EQx1=((abb	!!H9au%%A!S!! 4vvaUv33366!e6,,,r-   c                @    g | ]}                     |d           S r5  r1   r2   r  rL   r'   s     r+   r3   z)StrPrinter._print_Mul.<locals>.<listcomp>l  .    EEEa""1d5"99EEEr-   c                @    g | ]}                     |d           S r5  r1   rF  s     r+   r3   z)StrPrinter._print_Mul.<locals>.<listcomp>m  rG  r-   r%   z/(%s))$r   r5   r   Oneanyr   r_   r.  	is_Numberr^   r	   rB  r   baserH   could_extract_minus_signr&   rJ   r   r4   r/  r   r   as_ordered_factorsr@  is_commutativer:   r-  rA  r   is_RationalInfinitypr   qindex)r'   r>   r5   r   nre   dir   dargsprenfactorsdfactorscrP   r   r   	pow_parenrD  r(   a_strb_strrL   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 .1 .1)F)F)H)H .{{15588,,-        H !5 1vvzzad;;==z{{15588,,-        H ""A""A8}}q  $%AAqqq)) ("#!!QQ''H  ""1q55r1%%DDDD	:_,,**,,DD =&&D
	- 
	- 
	-  	 	D# tS))..003a788 81=00HHTT$ZZ((((DIaL-..!33&ty3*== 4 "((...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~~,2U17749;M;M5N,Naggdi(() 	F#((5//))VVq[[#((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 )NrD   rB   r:  c                V    g | ]%}                     |t                              &S r0   r,   r   r2   r   r>   r'   s     r+   r3   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   r4   r5   )r'   r>   r[  r   rP   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   rs   r&   r>   r=   s     r+   _print_ElementwiseApplyFunctionz*StrPrinter._print_ElementwiseApplyFunction  s0    MKK	""
 
 	
r-   c                    dS )Nnanr0   r=   s     r+   
_print_NaNzStrPrinter._print_NaN  r   r-   c                    dS )Nz-oor0   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 r9   )r   Zero)r2   rR  s     r+   r   z*StrPrinter._print_Order.<locals>.<genexpr>  s(      $E$EQQ!&[$E$E$E$E$E$Er-   r   zO(%s)rq   r   )	variablesr*  pointr   r&   r>   r7   r5   r=   s     r+   _print_OrderzStrPrinter._print_Order  s    ~ 	@$E$E$*$E$E$E!E!E 	@4>""a''TY!7!777t~0MtUV!W!WWWT^^DItQ????r-   c                *    |                                 S r9   __str__r=   s     r+   _print_OrdinalzStrPrinter._print_Ordinal      ||~~r-   c                *    |                                 S r9   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  rp   ,rD      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!."%%+6   */+P     .,,]DAAK 	+9 t dDIM**3355c'llmmDA773<<D199AdeeH!4!4deeHq$x'		#r""AHA K9q==,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(rq   rr   )r5   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 r9   rx   r=   s     r+   _print_TensorIndexzStrPrinter._print_TensorIndex      {{}}r-   c                *    |                                 S r9   rx   r=   s     r+   _print_TensorHeadzStrPrinter._print_TensorHead  r  r-   c                *    |                                 S r9   rx   r=   s     r+   _print_TensorzStrPrinter._print_Tensor  r  r-   c                ~                                      \  }}|d                     fd|D                       z   S )Nr:  c                V    g | ]%}                     |t                              &S r0   rb  rc  s     r+   r3   z-StrPrinter._print_TensMul.<locals>.<listcomp>  s1    FFF#TsJt$4$455FFFr-   )!_get_args_for_traditional_printerr4   )r'   r>   rP   r5   s   ``  r+   _print_TensMulzStrPrinter._print_TensMul  sP    ;;==
dchhFFFFFFFF
 
 
 	
r-   c                *    |                                 S r9   rx   r=   s     r+   _print_TensAddzStrPrinter._print_TensAdd  r  r-   c                6    |                      |j                  S r9   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  rq   c                :    g | ]}                     |          S r0   rx   r   s     r+   r3   z2StrPrinter._print_ArrayElement.<locals>.<listcomp>  s%    NtNtNtbct{{[\~~NtNtNtr-   r  )r,   r   r   r4   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    %srx   )r2   r   r'   s     r+   r3   z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>  s(    :::1XA&:::r-   zPermutationGroup([
%s])z,
)r5   r4   )r'   r>   rR  s   `  r+   _print_PermutationGroupz"StrPrinter._print_PermutationGroup  s3    ::::	:::)EJJqMM99r-   c                    dS )Npir0   r=   s     r+   	_print_PizStrPrinter._print_Pi  r   r-   c                     dd                      fd|j        D                       d                     |j                  d                     |j                  dS )NzPolynomial ring in rq   c              3  B   K   | ]}                     |          V  d S r9   rx   )r2   rsr'   s     r+   r   z-StrPrinter._print_PolyRing.<locals>.<genexpr>  s-      ??BB??????r-    over  with  orderr4   r   r&   domainr   )r'   rings   ` r+   _print_PolyRingzStrPrinter._print_PolyRing  sh     YY????$,???@@@@KK$$$$dkk$*&=&=&=&=? 	?r-   c                     dd                      fd|j        D                       d                     |j                  d                     |j                  dS )NzRational function field in rq   c              3  B   K   | ]}                     |          V  d S r9   rx   )r2   fsr'   s     r+   r   z.StrPrinter._print_FracField.<locals>.<genexpr>   s-      @@BB@@@@@@r-   r  r  r  r  r'   fields   ` r+   _print_FracFieldzStrPrinter._print_FracField  sj     YY@@@@%-@@@AAAAKK%%%%t{{5;'?'?'?'?A 	Ar-   c                *    |                                 S r9   rz  )r'   elms     r+   _print_FreeGroupElementz"StrPrinter._print_FreeGroupElement  s    {{}}r-   c                (    d|j         d|j        dS )Nrp    + 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  sr    :??;;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 r0   r1   )r2   r   	ATOM_PRECr'   s     r+   r3   z*StrPrinter._print_Poly.<locals>.<listcomp>  s)    PPPD--a;;PPPr-   r   z**%dr:  rp   rr   rC   rB   )rB   rC   z(%s, %s)PolynomialErrorz, modulus=%sz, domain='%s'r  rE   rq   )r   gensrK   r_   r   r4   rH   r&   r   rI  rI   rA  rG   rJ   rz   r{   sympy.polys.polyerrorsr  get_modulus
get_domainr   )r'   r>   rK   r  monomcoeffs_monomre   r   s_coeffs_termmodifierr   r  rT  r(   r  s   `               @r+   _print_PolyzStrPrinter._print_Poly  s4   v&*	PPPPPTYPPPt JJLL %	, %	,LE5G!%(( = =1q55Avv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}}$rr(c//d3t99q=>>6Jc6Q6Q"1SYY]?3U%$))D//:::s   <H H98H9c                    dS )Nr   r0   )r'   rR  s     r+   _print_UniversalSetzStrPrinter._print_UniversalSetV  s    ~r-   c                    |j         r9|                     |                                                                          S |                     |                                          S r9   )
is_aliasedr&   as_polyas_exprr=   s     r+   _print_AlgebraicNumberz!StrPrinter._print_AlgebraicNumberY  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 r1|s/dt           fdt          j        |j        fD                       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              3  B   K   | ]}                     |          V  d S r9   rx   r   s     r+   r   z(StrPrinter._print_Pow.<locals>.<genexpr>  s/      -]-]3dkk#.>.>-]-]-]-]-]-]r-   r;  Fr  
_sympyreprr   z	(Rational**r  )r   r.  r   Halfr&   rL  rO  r   rI  r,   printmethodrP  rS  rG   )r'   r>   rationalPRECr   s   `    r+   
_print_PowzStrPrinter._print_Pow_  s   L $8qvhDI 6 666 	TyAF""8" %u-]-]-]-]15RVR[J\-]-]-]'^'^^^xAE6!!"&++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&   r5   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>   r  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Integersr0   r=   s     r+   _print_IntegerszStrPrinter._print_Integers      zr-   c                    dS )NNaturalsr0   r=   s     r+   _print_NaturalszStrPrinter._print_Naturals  r  r-   c                    dS )N	Naturals0r0   r=   s     r+   _print_Naturals0zStrPrinter._print_Naturals0      {r-   c                    dS )N	Rationalsr0   r=   s     r+   _print_RationalszStrPrinter._print_Rationals  r	  r-   c                    dS )NRealsr0   r=   s     r+   _print_RealszStrPrinter._print_Reals  rX   r-   c                    dS )N	Complexesr0   r=   s     r+   _print_ComplexeszStrPrinter._print_Complexes  r	  r-   c                    dS )NEmptySetr0   r=   s     r+   _print_EmptySetzStrPrinter._print_EmptySet  r  r-   c                    dS )NEmptySequencer0   r=   s     r+   _print_EmptySequencezStrPrinter._print_EmptySequence  s    r-   c                     t          |          S r9   r;   r=   s     r+   
_print_intzStrPrinter._print_int      4yyr-   c                     t          |          S r9   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  se    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  s/    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  7    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  rC   )_precr   r  _print_levelmlib_to_str_mpf_rG   )r'   r>   rL   dpsstriplowhighrvs           r+   _print_FloatzStrPrinter._print_Float  s@   z!88CCdj))C>+&$..EE^K(E11EE^K(F22%)E','>'>dnU##D(-(?(?t~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%=rp   rq   rr   rE   )rel_opr&   lhsra   r,   r   r#   r  )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)lexrA   )rQ   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 )NrI  rA   zRootSum(%s)rq   )rQ   r>   funr   IdentityFunctionr   r&   r4   r   s      r+   _print_RootSumzStrPrinter._print_RootSum  sa    	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 )rA   )rQ   r   )r2   r   basisr'   s     r+   r3   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>  s+    PPPSEK88PPPr-   r  rq   c                :    g | ]}                     |          S r0   rx   )r2   genr'   s     r+   r3   z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>   s%    999cS!!999r-   zdomain='%s'z
order='%s'rp   rr   )rz   r{   exprsr4   r  r&   r  r   )r'   rQ  clsrT  r  r  r   r5   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   rq   c              3  B   K   | ]}                     |          V  d S r9   rx   r2   r(   r'   s     r+   r   z(StrPrinter._print_set.<locals>.<genexpr>+  /      ==tT**======r-   zset()r   )r   r   r4   r'   r   r   r5   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   rq   c              3  B   K   | ]}                     |          V  d S r9   rx   rY  s     r+   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>4  rZ  r-   c              3  B   K   | ]}|                               V  d S r9   )has)r2   r(   r^  s     r+   r   z.StrPrinter._print_FiniteSet.<locals>.<genexpr>5  s/      55ttxx	""555555r-   zFiniteSet({})z{{{}}})sympy.sets.setsr^  r   r   r4   rJ  r   )r'   r   r   r5   r^  s   `   @r+   _print_FiniteSetzStrPrinter._print_FiniteSet0  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   rq   c              3  B   K   | ]}                     |          V  d S r9   rx   r   s     r+   r   z.StrPrinter._print_Partition.<locals>.<genexpr><  s/      ;;cS));;;;;;r-   zPartition({}))r   r   r4   r   r[  s   `   r+   _print_PartitionzStrPrinter._print_Partition9  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_frozenset?  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_tostrE  r   r-   rq   c                &    g | ]} |          S r0   r0   r   s     r+   r3   z)StrPrinter._print_Sum.<locals>.<listcomp>J  r   r-   zSum(rr   r   r   s   `  @r+   
_print_SumzStrPrinter._print_SumD  sl    	? 	? 	? 	? 	?
 II::::dk:::;; $DM : : : :AAA>>r-   c                    |j         S r9   r   r=   s     r+   _print_SymbolzStrPrinter._print_SymbolM  r#  r-   c                    dS r   r0   r=   s     r+   _print_IdentityzStrPrinter._print_IdentityR  r   r-   c                    dS )N0r0   r=   s     r+   _print_ZeroMatrixzStrPrinter._print_ZeroMatrixU  r   r-   c                    dS )Nr8  r0   r=   s     r+   _print_OneMatrixzStrPrinter._print_OneMatrixX  r   r-   c                    d|j         z  S )NzQ.%sr   r=   s     r+   _print_PredicatezStrPrinter._print_Predicate[  s    	!!r-   c                     t          |          S r9   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%   rq   )r   r&   r7   r=   s     r+   _print_tuplezStrPrinter._print_tuplea  sE    t99>>T[[a1111DNN46666r-   c                ,    |                      |          S r9   )r|  r=   s     r+   _print_TuplezStrPrinter._print_Tupleg  s      &&&r-   c                T    d|                      |j        t          d                   z  S )Nz%s.Tr   r   )r'   Ts     r+   _print_TransposezStrPrinter._print_Transposej  s$    ))!%E1BCCCCr-   c                t    d|                      |j                  d|                      |j                  dS )NzUniform(rq   rr   )r&   r   r   r=   s     r+   _print_UniformzStrPrinter._print_Uniformm  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_Quantityp  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+   r3   z0StrPrinter._print_Quaternion.<locals>.<listcomp>v  s3    UUUaTq*U"3DAAUUUr-   r   c                $    g | ]\  }}|d z   |z   S )r:  r0   )r2   re   rd   s      r+   r3   z0StrPrinter._print_Quaternion.<locals>.<listcomp>w  s$    <<<$!QaeAg<<<r-   r   ijkr  )r5   zipr4   )r'   r>   r   r   s   `   r+   _print_QuaternionzStrPrinter._print_Quaternionu  s_    UUUU49UUUqTF<<#aeU*;*;<<<<zz!}}r-   c                     t          |          S r9   r  r=   s     r+   _print_DimensionzStrPrinter._print_Dimensionz  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 r9   r   r=   s     r+   _print_WildDotzStrPrinter._print_WildDot  r#  r-   c                    |j         S r9   r   r=   s     r+   _print_WildPluszStrPrinter._print_WildPlus  r#  r-   c                    |j         S r9   r   r=   s     r+   _print_WildStarzStrPrinter._print_WildStar  r#  r-   c                    | j                             dd          rdS |                     t          d                    S )Nr   FzS(0)r   )r  r  r  r   r=   s     r+   _print_ZerozStrPrinter._print_Zero  s<    >.66 	6""71::...r-   c                    |j         j        }|                     |                                          }|                     |j                  }|d|d|dS ro   )rz   r{   r&   to_listdom)r'   rR  rU  repr  s        r+   
_print_DMPzStrPrinter._print_DMP  sQ    k"kk!))++&&kk!%  "ssCCC--r-   c                    |j         j        }|                     |j                  }|                     |j                  }|                     |j                  }|d|d|d|dS ro   )rz   r{   r&   numdenr  )r'   r>   rU  r  r  r  s         r+   
_print_DMFzStrPrinter._print_DMF  sd    n%kk$(##kk$(##kk$(###&33SSS###66r-   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(rq   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 r9   r   )r'   manifolds     r+   _print_ManifoldzStrPrinter._print_Manifold  s    }!!r-   c                    |j         j         S r9   r   )r'   patchs     r+   _print_PatchzStrPrinter._print_Patch  s    zr-   c                    |j         j         S r9   r   )r'   coordss     r+   _print_CoordSystemzStrPrinter._print_CoordSystem  s    {r-   c                :    |j         j        |j                 j        S r9   
_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Trrp   r   rr   r  r=   s     r+   	_print_TrzStrPrinter._print_Tr  s)    44TYq\!:!:!:!:;;r-   c                6    |                      |j                  S r9   r  rh  s     r+   
_print_StrzStrPrinter._print_Str  s    {{16"""r-   c                    |j         }|                     |          d|                     |j                  d|                     |j                  dS ro   )rs   r&   rE  ra   )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   r9   )r{   
__module____qualname__r  r"   __annotations__r#   r,   r7   r?   rQ   rT   rW   r[   rf   rj   rm   ru   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_  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:  rG  rJ  rN  rV  r\  rc  rf  ri  rm  ro  _print_MatrixSymbol_print_RandomSymbolrq  rt  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  r0   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X X X
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     
  
            / / /
. . .7 7 7) ) )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 r9   )r<   rh  s     r+   rz  zStrReprPrinter._print_str  s    Awwr-   c                V    |j         j        d|                     |j                  dS )Nrp   rr   )rz   r{   r&   r   rh  s     r+   r  zStrReprPrinter._print_Str  s,    ;///QV1D1D1D1DEEr-   N)r{   r  r  __doc__rz  r  r0   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  
__future__r   typingr   
sympy.corer   r   r   r   r	   r
   sympy.core.mulr   sympy.core.numbersr   sympy.core.relationalr   sympy.core.sortingr   sympy.utilities.iterablesr   r   r   printerr   r   mpmath.libmpr   r   r3  r   r  r  r  r0   r-   r+   <module>r     s    # " " " " "       ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; & & & & & & & & & & & & , , , , , , / / / / / / * * * * * * . . . . . . . . , , , , , , , , ; ; ; ; ; ; ; ;z6 z6 z6 z6 z6 z6 z6 z6z 
  ,F F F F FZ F F F      r-   