U
    ZÊ¹jÂ�  ã                   @  sì   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„ deƒZeeƒdd„ ƒZ G dd„ deƒZ!ee!ƒd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                   @  s¦  e Zd ZU dZddddddddœZded< i Zd	ed
< �ddd„Z�ddd„Zdd„ Z	�ddd„Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Zd8d9„ Zd:d;„ Zd<d=„ Zd>d?„ Z d@dA„ Z!dBdC„ Z"dDdE„ Z#dFdG„ Z$dHdI„ Z%dJdK„ Z&dLdM„ Z'dNdO„ Z(dPdQ„ Z)dRdS„ Z*dTdU„ Z+dVdW„ Z,dXdY„ Z-dZd[„ Z.d\d]„ Z/d^d_„ Z0d`da„ Z1dbdc„ Z2ddde„ Z3dfdg„ Z4dhdi„ Z5djdk„ Z6dldm„ Z7dndo„ Z8dpdq„ Z9drds„ Z:dtdu„ Z;dvdw„ Z<dxdy„ Z=dzd{„ Z>d|d}„ Z?d~d„ Z@d€d�„ ZAd‚dƒ„ ZBd„d…„ ZCd†d‡„ ZDdˆd‰„ ZEdŠd‹„ ZFdŒd�„ ZGdŽd�„ ZHd�d‘„ ZId’d“„ ZJd”d•„ ZKd–d—„ ZLd˜d™„ ZM�ddšd›„ZNdœd�„ ZOdždŸ„ ZPd d¡„ ZQd¢d£„ ZRd¤d¥„ ZSd¦d§„ ZTd¨d©„ ZUdªd«„ ZVd¬d­„ ZWd®d¯„ ZXd°d±„ ZYd²d³„ ZZd´dµ„ Z[d¶d·„ Z\d¸d¹„ Z]dºd»„ Z^d¼d½„ Z_d¾d¿„ Z`dÀdÁ„ ZadÂdÃ„ ZbdÄdÅ„ ZcdÆdÇ„ ZddÈdÉ„ ZedÊdË„ ZfdÌdÍ„ ZgdÎdÏ„ ZhdÐdÑ„ ZidÒdÓ„ ZjejZkejZldÔdÕ„ ZmdÖd×„ ZndØdÙ„ ZodÚdÛ„ ZpdÜdÝ„ ZqdÞdß„ Zrdàdá„ Zsdâdã„ Ztdädå„ Zudædç„ Zvdèdé„ Zwdêdë„ Zxdìdí„ Zydîdï„ Zzdðdñ„ Z{dòdó„ Z|dôdõ„ Z}död÷„ Z~dødù„ Zdúdû„ Z€düdý„ Z�dþdÿ„ Z‚�d �d„ Zƒ�d�d„ Z„�d�d„ Z…�d�d„ Z†�d�d	„ Z‡�d
�d„ Zˆ�d�d„ Z‰�d�d„ ZŠ�d�d„ Z‹�d�d„ ZŒ�d�d„ Z�dS (  Ú
StrPrinterZ	_sympystrNÚautoFT)ÚorderÚ	full_precÚsympy_integersÚabbrevÚperm_cyclicÚminÚmaxzdict[str, Any]Ú_default_settingszdict[str, str]Ú_relationalsc                 C  s8   t |ƒ|k s|s*t |ƒ|kr*d|  |¡ S |  |¡S d S )Nú(%s))r   Ú_print)ÚselfÚitemÚlevelÚstrict© r'   úQ/var/www/html/bwave/python/venv/lib/python3.8/site-packages/sympy/printing/str.pyÚparenthesize"   s    zStrPrinter.parenthesizer   c                   s   |  ‡ ‡fdd„|D ƒ¡S )Nc                   s   g | ]}ˆ  |ˆ ¡‘qS r'   ©r)   ©Ú.0r$   ©r%   r#   r'   r(   Ú
<listcomp>)   s     z(StrPrinter.stringify.<locals>.<listcomp>)Újoin)r#   ÚargsÚsepr%   r'   r-   r(   Ú	stringify(   s    zStrPrinter.stringifyc                 C  s,   t |tƒr|S t |tƒr t|ƒS t|ƒS d S ©N)Ú
isinstanceÚstrr   Úrepr©r#   Úexprr'   r'   r(   ÚemptyPrinter+   s
    

zStrPrinter.emptyPrinterc           	      C  s¬   | j ||d�}t|ƒ}g }|D ]h}|  |¡}| d¡rN|jsNd}|dd … }nd}t|ƒ|k sd|jrx| |d| g¡ q| ||g¡ q| d¡}|dkržd}|d |¡ S )	N©r   ú-r   ú+r!   r   Ú ú )Z_as_ordered_termsr   r"   Ú
startswithÚis_AddÚextendÚpopr/   )	r#   r8   r   ÚtermsÚprecÚlÚtermÚtÚsignr'   r'   r(   Ú
_print_Add3   s     

zStrPrinter._print_Addc                 C  s   dS )NÚTruer'   r7   r'   r'   r(   Ú_print_BooleanTrueH   s    zStrPrinter._print_BooleanTruec                 C  s   dS )NÚFalser'   r7   r'   r'   r(   Ú_print_BooleanFalseK   s    zStrPrinter._print_BooleanFalsec                 C  s   d|   |jd td ¡ S )Nz~%sr   ÚNot)r)   r0   r   r7   r'   r'   r(   Ú
_print_NotN   s    zStrPrinter._print_Notc                 C  sX   t |jƒ}t|ƒD ]2\}}t|tƒr|jjtjkr| 	d| 
|¡¡ q|  |dtd ¡S )Nr   z & Z
BitwiseAnd)Úlistr0   Ú	enumerater4   r   Ú	canonicalÚrhsr   ÚNegativeInfinityÚinsertrB   r2   r   )r#   r8   r0   ÚjÚir'   r'   r(   Ú
_print_AndQ   s    

ÿzStrPrinter._print_Andc                 C  s   |   |jdtd ¡S )Nz | Z	BitwiseOr©r2   r0   r   r7   r'   r'   r(   Ú	_print_OrY   s    zStrPrinter._print_Orc                 C  s   |   |jdtd ¡S )Nz ^ Z
BitwiseXorrY   r7   r'   r'   r(   Ú
_print_Xor\   s    zStrPrinter._print_Xorc                 C  s   d|   |j¡|  |jd¡f S )Nú%s(%s)ú, )r"   Úfunctionr2   Ú	argumentsr7   r'   r'   r(   Ú_print_AppliedPredicate_   s    
 ÿz"StrPrinter._print_AppliedPredicatec                   s*   ‡ fdd„|j D ƒ}|jjdd |¡  S )Nc                   s   g | ]}ˆ   |¡‘qS r'   ©r"   )r,   Úo©r#   r'   r(   r.   d   s     z+StrPrinter._print_Basic.<locals>.<listcomp>r!   r]   )r0   Ú	__class__Ú__name__r/   )r#   r8   rE   r'   rc   r(   Ú_print_Basicc   s    zStrPrinter._print_Basicc                 C  s(   |j jdkr|  |j d ¡ |  |j ¡S )N)r   r   )r   r   )ÚblocksÚshaper"   )r#   ÚBr'   r'   r(   Ú_print_BlockMatrixg   s    zStrPrinter._print_BlockMatrixc                 C  s   dS )NZCatalanr'   r7   r'   r'   r(   Ú_print_Catalanl   s    zStrPrinter._print_Catalanc                 C  s   dS )NZzoor'   r7   r'   r'   r(   Ú_print_ComplexInfinityo   s    z!StrPrinter._print_ComplexInfinityc                   sL   t ‡ fdd„|j|jfD ƒƒ}|jtjkr2d| S |ˆ  |j¡f7 }d| S )Nc                   s   g | ]}ˆ   |¡‘qS r'   ra   ©r,   rW   rc   r'   r(   r.   s   s     z2StrPrinter._print_ConditionSet.<locals>.<listcomp>zConditionSet(%s, %s)zConditionSet(%s, %s, %s))ÚtupleÚsymÚ	conditionZbase_setr   ÚUniversalSetr"   )r#   Úsr0   r'   rc   r(   Ú_print_ConditionSetr   s
    zStrPrinter._print_ConditionSetc                   s8   |j }dd„ |jD ƒ}dd ‡ fdd„|g| D ƒ¡ S )Nc                 S  s$   g | ]}|d  d kr|d n|‘qS )r   r   r'   rm   r'   r'   r(   r.   {   s     z0StrPrinter._print_Derivative.<locals>.<listcomp>zDerivative(%s)r]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   ©r,   Úargrc   r'   r(   Ú	<genexpr>|   s     z/StrPrinter._print_Derivative.<locals>.<genexpr>)r8   Zvariable_countr/   )r#   r8   ZdexprZdvarsr'   rc   r(   Ú_print_Derivativey   s    zStrPrinter._print_Derivativec                 C  sR   t | ¡ td�}g }|D ]*}d|  |¡|  || ¡f }| |¡ qdd |¡ S )N©Úkeyz%s: %sú{%s}r]   )ÚsortedÚkeysr   r"   Úappendr/   )r#   Údr|   Úitemsry   r$   r'   r'   r(   Ú_print_dict~   s    zStrPrinter._print_dictc                 C  s
   |   |¡S r3   )r€   r7   r'   r'   r(   Ú_print_Dictˆ   s    zStrPrinter._print_Dictc                 C  sZ   t |dƒrd|  | ¡ ¡ S t |dƒrFd|  |j¡ d |  |j¡ S d|  |j¡ S d S )NÚ
as_booleanzDomain: Úsetz in z
Domain on )Úhasattrr"   r‚   Úsymbolsrƒ   )r#   r~   r'   r'   r(   Ú_print_RandomDomain‹   s    


ÿzStrPrinter._print_RandomDomainc                 C  s
   d|j  S ©NÚ_©Únamer7   r'   r'   r(   Ú_print_Dummy”   s    zStrPrinter._print_Dummyc                 C  s   dS )NZ
EulerGammar'   r7   r'   r'   r(   Ú_print_EulerGamma—   s    zStrPrinter._print_EulerGammac                 C  s   dS )NÚEr'   r7   r'   r'   r(   Ú_print_Exp1š   s    zStrPrinter._print_Exp1c                 C  s   d|   |j¡|   |j¡f S )Nz(%s, %s))r"   r8   Zcondr7   r'   r'   r(   Ú_print_ExprCondPair�   s    zStrPrinter._print_ExprCondPairc                 C  s   |j jd|  |jd¡  S ©Nr!   r]   )Úfuncre   r2   r0   r7   r'   r'   r(   Ú_print_Function    s    zStrPrinter._print_Functionc                 C  s   dS )NZGoldenRatior'   r7   r'   r'   r(   Ú_print_GoldenRatio£   s    zStrPrinter._print_GoldenRatioc                 C  s   |j jd|  |jd¡  S r�   )r‘   re   r2   Zpargsr7   r'   r'   r(   Ú_print_Heaviside¦   s    zStrPrinter._print_Heavisidec                 C  s   dS )NZTribonacciConstantr'   r7   r'   r'   r(   Ú_print_TribonacciConstant«   s    z$StrPrinter._print_TribonacciConstantc                 C  s   dS ©NÚIr'   r7   r'   r'   r(   Ú_print_ImaginaryUnit®   s    zStrPrinter._print_ImaginaryUnitc                 C  s   dS )NZoor'   r7   r'   r'   r(   Ú_print_Infinity±   s    zStrPrinter._print_Infinityc                   s:   ‡fdd„‰ d  ‡ fdd„|jD ƒ¡}dˆ |j¡|f S )Nc                   s>   t | ƒdkrˆ  | d ¡S ˆ  | d ft| dd … ƒ ¡S d S ©Nr   r   ©Úlenr"   rn   ©Zxabrc   r'   r(   Ú
_xab_tostrµ   s    z.StrPrinter._print_Integral.<locals>._xab_tostrr]   c                   s   g | ]}ˆ |ƒ‘qS r'   r'   ©r,   rE   ©rž   r'   r(   r.   º   s     z.StrPrinter._print_Integral.<locals>.<listcomp>zIntegral(%s, %s)©r/   Zlimitsr"   r^   ©r#   r8   ÚLr'   ©rž   r#   r(   Ú_print_Integral´   s    zStrPrinter._print_Integralc                 C  s‚   d}|j \}}}}|jr$|jr$d}nJ|jr4|s4d}n:|jrD|sDd}n*|sR|sRd}n|r`|r`d}n|rjd}nd}|jf |||dœŽS )NzInterval{m}({a}, {b})r=   z.openz.Lopenz.Ropen)ÚaÚbÚm)r0   Úis_infiniteÚformat)r#   rW   Zfinr¦   r§   rE   Úrr¨   r'   r'   r(   Ú_print_Interval½   s     

zStrPrinter._print_Intervalc                 C  s   d|   |j¡|   |j¡f S )NzAccumBounds(%s, %s))r"   r   r   )r#   rW   r'   r'   r(   Ú_print_AccumulationBoundsÐ   s    
ÿz$StrPrinter._print_AccumulationBoundsc                 C  s   d|   |jtd ¡ S )Nz%s**(-1)r   ©r)   ru   r   )r#   r—   r'   r'   r(   Ú_print_InverseÔ   s    zStrPrinter._print_Inversec                 C  sB   |j }|j}t|ƒdkr*|d jr*|d }d|  |¡|  |¡f S )Nr   r   zLambda(%s, %s))r8   Ú	signaturerœ   Z	is_symbolr"   )r#   Úobjr8   Úsigr'   r'   r(   Ú_print_Lambda×   s
    zStrPrinter._print_Lambdac                   s2   t |jtd�}|jjdd ‡ fdd„|D ƒ¡  S )Nrx   r!   r]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   rt   rc   r'   r(   rv   à   s     z.StrPrinter._print_LatticeOp.<locals>.<genexpr>)r{   r0   r   r‘   re   r/   ©r#   r8   r0   r'   rc   r(   Ú_print_LatticeOpÞ   s    zStrPrinter._print_LatticeOpc                 C  s*   |j \}}}}dtt| j||||fƒƒ S )NzLimit(%s, %s, %s, dir='%s'))r0   rn   Úmapr"   )r#   r8   ÚeÚzZz0Údirr'   r'   r(   Ú_print_Limitâ   s    zStrPrinter._print_Limitc                 C  s   d|   |d¡ S )Nú[%s]r]   )r2   r7   r'   r'   r(   Ú_print_listç   s    zStrPrinter._print_listc                 C  s
   |   |¡S r3   )r¼   r7   r'   r'   r(   Ú_print_Listê   s    zStrPrinter._print_Listc                 C  s
   |  | ¡S r3   )Z_format_strr7   r'   r'   r(   Ú_print_MatrixBaseí   s    zStrPrinter._print_MatrixBasec                 C  s2   | j |jtd dd�d|  |j¡|  |j¡f  S )NÚAtomT©r&   z[%s, %s])r)   Úparentr   r"   rW   rV   r7   r'   r'   r(   Ú_print_MatrixElementð   s    ÿzStrPrinter._print_MatrixElementc                   sN   ‡ fdd„}ˆ j |jtd dd�d ||j|jjƒ d ||j|jjƒ d S )	Nc                   sZ   t | ƒ} | d dkr| d= | d dkr.d| d< | d |krBd| d< d ‡ fdd„| D ƒ¡S )Né   r   r   r=   ú:c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   rt   rc   r'   r(   rv   ý   s     zBStrPrinter._print_MatrixSlice.<locals>.strslice.<locals>.<genexpr>)rP   r/   )ÚxÚdimrc   r'   r(   Ústrsliceõ   s    z/StrPrinter._print_MatrixSlice.<locals>.strslicer¿   TrÀ   ú[r]   ú])r)   rÁ   r   ZrowsliceÚrowsZcolsliceÚcols)r#   r8   rÇ   r'   rc   r(   Ú_print_MatrixSliceô   s    	ÿÿþþzStrPrinter._print_MatrixSlicec                 C  s   |j S r3   r‰   r7   r'   r'   r(   Ú_print_DeferredVector  s    z StrPrinter._print_DeferredVectorc                   s´  t |ƒ‰ |j}|d tjks8tdd„ |dd … D ƒƒ�rœt|dd„ dd�\}}t|ƒD ]`\}}|jjrp|j }n$t	|jjƒ}|d  |d< t
 |¡}|d r¬t|j|d	d
�n|j||< qVg }	|rè|d jsè|d  ¡ rèˆ | d¡¡g}	|	‡ ‡fdd„|D ƒ }
|
�sdg}
t|ƒdk�r<|d  ¡ �r<ˆ | d¡¡g}	ng }	|	‡ ‡fdd„|D ƒ }d |
¡}d |¡}t|ƒdk�r†d||f S |�r˜d||f S |S | ¡ \}}|dk �rÄt| |ƒ}d}nd}g }g }g }ˆjdk�rê| ¡ }n
t
 |¡}dd„ }|D ]è}|j�rŽt|tƒ�rŽt|j ¡ d dk ƒ�rŽ|jtjk	�rN| ||ƒ¡ n>t|jd jƒdk�r€t|jt
tfƒ�r€| |¡ | |j¡ nX|j�rÜ|tjk	�rÜ|j dk�r¾| t!|j ƒ¡ |j"dk�ræ| t!|j"ƒ¡ n
| |¡ �q |�pötjg}‡ ‡fdd„|D ƒ}‡ ‡fdd„|D ƒ}|D ]2}|j|k�r$d|| #|j¡  || #|j¡< �q$|�sl|d |¡ S t|ƒdk�r”|d |¡ d |d  S |d |¡ dd |¡  S d S )Nr   c                 s  s2   | ]*}t |tƒp(|jo(td d„ |jD ƒƒV  qdS )c                 s  s   | ]}|j V  qd S r3   )Z
is_Integer)r,   Zair'   r'   r(   rv     s     z2StrPrinter._print_Mul.<locals>.<genexpr>.<genexpr>N)r4   r	   Zis_PowÚallr0   ©r,   r¦   r'   r'   r(   rv     s   þ
z(StrPrinter._print_Mul.<locals>.<genexpr>r   c                 S  s    t | tƒot| j ¡ d dk ƒS ©Nr   )r4   r   ÚboolÚexpÚas_coeff_Mul)rÅ   r'   r'   r(   Ú<lambda>  s    z'StrPrinter._print_Mul.<locals>.<lambda>T)ÚbinaryF©Úevaluatec                   s   g | ]}ˆj |ˆ d d�‘qS ©FrÀ   r*   rÏ   ©rD   r#   r'   r(   r.   #  s   ÿz)StrPrinter._print_Mul.<locals>.<listcomp>Ú1c                   s   g | ]}ˆj |ˆ d d�‘qS rØ   r*   rÏ   rÙ   r'   r(   r.   -  s   ÿÚ*z%s/(%s)ú%s/%sr;   r=   )ÚoldÚnonec                 S  sv   |   ¡ \}}tt |¡ƒ}|d tjkr6|dd … }n|d  |d< t |¡}t| tƒrh| j	||dd�S | j	|dd�S )Nr   r   FrÖ   )
Zas_base_exprP   r   Ú	make_argsr   ÚNegativeOneÚ
_from_argsr4   r   r‘   )rW   r§   r·   Zeargsr'   r'   r(   ÚapowK  s    

z#StrPrinter._print_Mul.<locals>.apowc                   s   g | ]}ˆj |ˆ d d�‘qS rØ   r*   ©r,   rÅ   rÙ   r'   r(   r.   l  s     c                   s   g | ]}ˆj |ˆ d d�‘qS rØ   r*   rã   rÙ   r'   r(   r.   m  s     r!   ú/z/(%s))$r   r0   r   ÚOneÚanyr   rQ   rÒ   Z	is_NumberrP   r   rá   r   Úbaser@   Zcould_extract_minus_signr"   rB   rœ   r/   rÓ   r
   r   Zas_ordered_factorsrß   Úis_commutativer4   rÑ   rà   r}   Úis_RationalÚInfinityÚpr   ÚqÚindex)r#   r8   r0   r~   ÚnrW   Zdir·   ZdargsÚpreZnfactorsZdfactorsÚcrH   r¦   r§   Z	pow_parenrâ   r$   Za_strZb_strr'   rÙ   r(   Ú
_print_Mul  sœ    
ý

þ


$ÿÿ




ÿþÿ
$zStrPrinter._print_Mulc                   s|   ˆ   ¡ \}}d}|jr\| ¡ \}}|jr@|jr@t| |ƒ‰ d}n|jr\|jr\t| |ƒ‰ d}|d ‡ ‡fdd„ˆ jD ƒ¡ S )Nr=   r;   rÛ   c                   s   g | ]}ˆ  |tˆ ƒ¡‘qS r'   ©r)   r   rt   ©r8   r#   r'   r(   r.   ‰  s     z,StrPrinter._print_MatMul.<locals>.<listcomp>)Zas_coeff_mmulZ	is_numberZas_real_imagÚis_zeroZis_negativer
   r/   r0   )r#   r8   rð   r¨   rH   ÚreZimr'   ró   r(   Ú_print_MatMul{  s    ÿzStrPrinter._print_MatMulc                 C  s   d  |j|  |j¡¡S )Nz{}.({}))rª   r^   r"   r8   r7   r'   r'   r(   Ú_print_ElementwiseApplyFunctionŒ  s    
þz*StrPrinter._print_ElementwiseApplyFunctionc                 C  s   dS )NÚnanr'   r7   r'   r'   r(   Ú
_print_NaN’  s    zStrPrinter._print_NaNc                 C  s   dS )Nz-oor'   r7   r'   r'   r(   Ú_print_NegativeInfinity•  s    z"StrPrinter._print_NegativeInfinityc                 C  sn   |j rtdd„ |jD ƒƒrVt|j ƒdkr8d|  |j¡ S d|  |jf|j  dd¡ S nd|  |jdd¡ S d S )Nc                 s  s   | ]}|t jkV  qd S r3   )r   ZZero)r,   rë   r'   r'   r(   rv   ™  s     z*StrPrinter._print_Order.<locals>.<genexpr>r   zO(%s)r]   r   )Ú	variablesrÎ   Úpointrœ   r"   r8   r2   r0   r7   r'   r'   r(   Ú_print_Order˜  s
    zStrPrinter._print_Orderc                 C  s   |  ¡ S r3   ©Ú__str__r7   r'   r'   r(   Ú_print_Ordinal¡  s    zStrPrinter._print_Ordinalc                 C  s   |  ¡ S r3   rþ   r7   r'   r'   r(   Ú_print_Cycle¤  s    zStrPrinter._print_Cyclec                 C  sb  ddl m}m} ddlm} |j}|d k	rD|d|› d�dddd	� n| j d
d¡}|rÌ|js`dS ||ƒ|jd ƒ 	¡ t
dƒd … }| d¡}|dks¼d||d … kr¼||d … |d |…  }| dd¡}|S | ¡ }|�s|jdk rôd|  |j¡ S d|  |j¡ S |  |jd |d d … ¡d|  |j¡  }|  |j¡ }	}
t
|ƒt
|
ƒk �rV|}	d|	 S d 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é   )Zdeprecated_since_versionZactive_deprecations_targetÚ
stacklevelr   Tz()r   r  ú(ú,r=   é   zPermutation(%s)zPermutation([], size=%s)éÿÿÿÿz	, size=%s)Z sympy.combinatorics.permutationsr  r  Zsympy.utilities.exceptionsr  Zprint_cyclicÚ	_settingsÚgetÚsizeÚ__repr__rœ   ÚrfindÚreplaceZsupportr"   Z
array_form)r#   r8   r  r  r  r   rr   ÚlastZtrimZuseÚfullr'   r'   r(   Ú_print_Permutation§  s@    þù
"

,zStrPrinter._print_Permutationc                 C  sJ   |j \}}}t|jƒdkr*|d }|d }d|  |¡|  |¡|  |¡f S )Nr   r   zSubs(%s, %s, %s))r0   rœ   rü   r"   )r#   r±   r8   rÝ   Únewr'   r'   r(   Ú_print_SubsÐ  s      ÿzStrPrinter._print_Subsc                 C  s   |  ¡ S r3   ra   r7   r'   r'   r(   Ú_print_TensorIndexØ  s    zStrPrinter._print_TensorIndexc                 C  s   |  ¡ S r3   ra   r7   r'   r'   r(   Ú_print_TensorHeadÛ  s    zStrPrinter._print_TensorHeadc                 C  s   |  ¡ S r3   ra   r7   r'   r'   r(   Ú_print_TensorÞ  s    zStrPrinter._print_Tensorc                   s*   ˆ   ¡ \}}|d ‡ ‡fdd„|D ƒ¡ S )NrÛ   c                   s   g | ]}ˆ  |tˆ ƒ¡‘qS r'   rò   rt   ró   r'   r(   r.   å  s     z-StrPrinter._print_TensMul.<locals>.<listcomp>)Z!_get_args_for_traditional_printerr/   )r#   r8   rH   r0   r'   ró   r(   Ú_print_TensMulá  s    ÿzStrPrinter._print_TensMulc                 C  s   |  ¡ S r3   ra   r7   r'   r'   r(   Ú_print_TensAddè  s    zStrPrinter._print_TensAddc                 C  s   |   |j¡S r3   ©r"   rŠ   r7   r'   r'   r(   Ú_print_ArraySymbolë  s    zStrPrinter._print_ArraySymbolc                   s2   dˆ   |jtd d¡d ‡ fdd„|jD ƒ¡f S )Nz%s[%s]ZFuncTr]   c                   s   g | ]}ˆ   |¡‘qS r'   ra   rm   rc   r'   r(   r.   ð  s     z2StrPrinter._print_ArrayElement.<locals>.<listcomp>)r)   rŠ   r   r/   Úindicesr7   r'   rc   r(   Ú_print_ArrayElementî  s     ÿzStrPrinter._print_ArrayElementc                   s"   ‡ fdd„|j D ƒ}dd |¡ S )Nc                   s   g | ]}d ˆ   |¡ ‘qS )z    %sra   rÏ   rc   r'   r(   r.   ó  s     z6StrPrinter._print_PermutationGroup.<locals>.<listcomp>zPermutationGroup([
%s])z,
)r0   r/   )r#   r8   rë   r'   rc   r(   Ú_print_PermutationGroupò  s    z"StrPrinter._print_PermutationGroupc                 C  s   dS )NÚpir'   r7   r'   r'   r(   Ú	_print_Piö  s    zStrPrinter._print_Pic                   s4   dd  ‡ fdd„|jD ƒ¡ˆ  |j¡ˆ  |j¡f S )Nz+Polynomial ring in %s over %s with %s orderr]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   )r,   Úrsrc   r'   r(   rv   û  s     z-StrPrinter._print_PolyRing.<locals>.<genexpr>©r/   r…   r"   Údomainr   )r#   Úringr'   rc   r(   Ú_print_PolyRingù  s    
 
ÿÿzStrPrinter._print_PolyRingc                   s4   dd  ‡ fdd„|jD ƒ¡ˆ  |j¡ˆ  |j¡f S )Nz3Rational function field in %s over %s with %s orderr]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   )r,   Úfsrc   r'   r(   rv      s     z.StrPrinter._print_FracField.<locals>.<genexpr>r#  ©r#   Úfieldr'   rc   r(   Ú_print_FracFieldþ  s    
 
ÿÿzStrPrinter._print_FracFieldc                 C  s   |  ¡ S r3   rþ   )r#   Úelmr'   r'   r(   Ú_print_FreeGroupElement  s    z"StrPrinter._print_FreeGroupElementc                 C  s   d|j |jf S )Nz(%s + %s*I))rÅ   Úy©r#   Zpolyr'   r'   r(   Ú_print_GaussianElement  s    z!StrPrinter._print_GaussianElementc                 C  s   |  | tdd¡S )Nú%s**%srÛ   )r5   r   r.  r'   r'   r(   Ú_print_PolyElement	  s    zStrPrinter._print_PolyElementc                 C  sR   |j dkr|  |j¡S | j|jtd dd�}| j|j td dd�}|d | S d S )Nr   r   TrÀ   r¿   rä   )Údenomr"   Únumerr)   r   )r#   Úfracr3  r2  r'   r'   r(   Ú_print_FracElement  s
    
zStrPrinter._print_FracElementc                   sT  t d d ‰ g ‡ ‡fdd„|jD ƒ }}| ¡ D �]\}}g }t|ƒD ]>\}}|dkrF|dkrn| || ¡ qF| || d|  ¡ qFd |¡}|jrº|r®dˆ |¡ d	 }	qüˆ |¡}	nB|rò|tj	krØ| 
d
|g¡ q0|tjkrò| 
d|g¡ q0ˆ |¡}	|�s|	}
n|	d | }
|
 d¡�r8| 
d|
dd … g¡ q0| 
d
|
g¡ q0|d dk�rz| d¡}|dk�rzd|d  |d< |jjd }ddlm} z|d| ¡  7 }W n& |k
�rÌ   |d| ¡  7 }Y nX |d	7 }t|ƒD ]\\}}t|ƒdk�rÞ|d d… dk�rÞ|t|ƒd d … d	k�rÞ|dt|ƒd … ||< �qÞ|d |¡d |¡f S )Nr¿   r   c                   s   g | ]}ˆ  |ˆ ¡‘qS r'   r*   )r,   rr   ©Z	ATOM_PRECr#   r'   r(   r.     s     z*StrPrinter._print_Poly.<locals>.<listcomp>r   z**%drÛ   r  ú)r<   r;   )r;   r<   z(%s, %s)ÚPolynomialErrorz, modulus=%sz, domain='%s'rÃ   r>   r]   )r   ÚgensrC   rQ   r}   r/   r@   r"   r   rå   rA   rà   r?   rB   rd   re   Zsympy.polys.polyerrorsr8  Zget_modulusZ
get_domainrœ   )r#   r8   rC   r9  ZmonomZcoeffZs_monomrW   r·   Zs_coeffZs_termÚmodifierrª   r8  rí   r$   r'   r6  r(   Ú_print_Poly  sV    





:zStrPrinter._print_Polyc                 C  s   dS )Nrq   r'   )r#   rë   r'   r'   r(   Ú_print_UniversalSetV  s    zStrPrinter._print_UniversalSetc                 C  s*   |j r|  | ¡  ¡ ¡S |  | ¡ ¡S d S r3   )Z
is_aliasedr"   Zas_polyZas_exprr7   r'   r'   r(   Ú_print_AlgebraicNumberY  s    z!StrPrinter._print_AlgebraicNumberc                   s  t |ƒ}|jtjkr(|s(dˆ  |j¡ S |jr’|j tjkrb|sbdt‡ fdd„tj|jfD ƒƒ S |jtj kr’dˆ  tj¡ˆ j	|j|dd�f S ˆ j	|j|dd�}ˆ j
dkrî|jjrî|jjd	krî| d
¡rîdˆ j	|j|dd�|d	d… f S dˆ j	|j|dd�|f 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  s   | ]}ˆ   |¡V  qd S r3   ra   rt   rc   r'   r(   rv   Ž  s     z(StrPrinter._print_Pow.<locals>.<genexpr>rÜ   FrÀ   Z
_sympyreprr   z	(Rationalr0  r
  )r   rÒ   r   ZHalfr"   rç   rè   rn   rå   r)   Úprintmethodré   rì   r?   )r#   r8   ZrationalÚPRECr·   r'   rc   r(   Ú
_print_Pow_  s    &"ÿ
"zStrPrinter._print_Powc                 C  s   |   |jd ¡S rÐ   ©r"   r0   r7   r'   r'   r(   Ú_print_UnevaluatedExprœ  s    z!StrPrinter._print_UnevaluatedExprc                 C  s0   t |ƒ}d| j|j|dd�| j|j|dd�f S )Nr0  FrÀ   )r   r)   rç   rÒ   )r#   r8   r?  r'   r'   r(   Ú_print_MatPowŸ  s    ÿzStrPrinter._print_MatPowc                 C  s    | j  dd¡rd| S t|jƒS )Nr   FzS(%s))r  r  r5   rë   r7   r'   r'   r(   Ú_print_Integer¤  s    zStrPrinter._print_Integerc                 C  s   dS )NZIntegersr'   r7   r'   r'   r(   Ú_print_Integers©  s    zStrPrinter._print_Integersc                 C  s   dS )NZNaturalsr'   r7   r'   r'   r(   Ú_print_Naturals¬  s    zStrPrinter._print_Naturalsc                 C  s   dS )NZ	Naturals0r'   r7   r'   r'   r(   Ú_print_Naturals0¯  s    zStrPrinter._print_Naturals0c                 C  s   dS )NZ	Rationalsr'   r7   r'   r'   r(   Ú_print_Rationals²  s    zStrPrinter._print_Rationalsc                 C  s   dS )NZRealsr'   r7   r'   r'   r(   Ú_print_Realsµ  s    zStrPrinter._print_Realsc                 C  s   dS )NZ	Complexesr'   r7   r'   r'   r(   Ú_print_Complexes¸  s    zStrPrinter._print_Complexesc                 C  s   dS )NZEmptySetr'   r7   r'   r'   r(   Ú_print_EmptySet»  s    zStrPrinter._print_EmptySetc                 C  s   dS )NZEmptySequencer'   r7   r'   r'   r(   Ú_print_EmptySequence¾  s    zStrPrinter._print_EmptySequencec                 C  s   t |ƒS r3   ©r5   r7   r'   r'   r(   Ú
_print_intÁ  s    zStrPrinter._print_intc                 C  s   t |ƒS r3   rM  r7   r'   r'   r(   Ú
_print_mpzÄ  s    zStrPrinter._print_mpzc                 C  sF   |j dkrt|jƒS | j dd¡r2d|j|j f S d|j|j f S d S )Nr   r   FzS(%s)/%srÜ   )rì   r5   rë   r  r  r7   r'   r'   r(   Ú_print_RationalÇ  s
    

zStrPrinter._print_Rationalc                 C  s(   |j dkrt|jƒS d|j|j f S d S )Nr   z%d/%d)rì   r5   rë   r7   r'   r'   r(   Ú_print_PythonRationalÏ  s    

z StrPrinter._print_PythonRationalc                 C  s(   |j dkrt|jƒS d|j|j f S d S ©Nr   rÜ   ©Údenominatorr5   Ú	numeratorr7   r'   r'   r(   Ú_print_FractionÕ  s    

zStrPrinter._print_Fractionc                 C  s(   |j dkrt|jƒS d|j|j f S d S rR  rS  r7   r'   r'   r(   Ú
_print_mpqÛ  s    

zStrPrinter._print_mpqc                 C  sò   |j }|dk rd}n
t|j ƒ}| jd dkr2d}n,| jd dkrFd}n| jd dkr^| jdk}d| jkrr| jd nd }d	| jkrŠ| jd	 nd }t|j||||d
�}| d¡r¾d|dd …  }n| d¡rØd|dd …  }| d¡rî|dd … }|S )Nr	  r   r   TFr   r   r   r   )Zstrip_zerosZ	min_fixedZ	max_fixedz-.0z-0.é   z.0z0.rÃ   r<   )Z_precr   r  Z_print_levelÚmlib_to_strZ_mpf_r?   )r#   r8   rD   ZdpsÚstripÚlowÚhighÚrvr'   r'   r(   Ú_print_Floatá  s(    




zStrPrinter._print_Floatc              	   C  s~   ddddddddd	œ}|j |krDd
||j  |  |j¡|  |j¡f S d|  |jt|ƒ¡| j |j ¡ph|j |  |jt|ƒ¡f S )NÚEqZNeZ
AssignmentZAddAugmentedAssignmentZSubAugmentedAssignmentZMulAugmentedAssignmentZDivAugmentedAssignmentZModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=ú
%s(%s, %s)z%s %s %s)Zrel_opr"   ÚlhsrS   r)   r   r    r  )r#   r8   Úcharmapr'   r'   r(   Ú_print_Relationalù  s"    ø

ÿþzStrPrinter._print_Relationalc                 C  s   d| j |jdd�|jf S )NzCRootOf(%s, %d)Úlexr:   )rI   r8   rí   r7   r'   r'   r(   Ú_print_ComplexRootOf  s    ÿzStrPrinter._print_ComplexRootOfc                 C  s>   | j |jdd�g}|jtjk	r0| |  |j¡¡ dd |¡ S )Nrd  r:   zRootSum(%s)r]   )rI   r8   Zfunr   ZIdentityFunctionr}   r"   r/   r´   r'   r'   r(   Ú_print_RootSum  s    zStrPrinter._print_RootSumc                   s„   ˆ j j}‡ ‡fdd„ˆ jD ƒ}dd |¡ }‡fdd„ˆ jD ƒ}dˆ ˆ j¡ }dˆ ˆ j¡ }|g| ||g }d|d |¡f S )	Nc                   s   g | ]}ˆj |ˆ jd �‘qS )r:   )rI   r   rt   ©Úbasisr#   r'   r(   r.     s     z3StrPrinter._print_GroebnerBasis.<locals>.<listcomp>r»   r]   c                   s   g | ]}ˆ   |¡‘qS r'   ra   )r,   Úgenrc   r'   r(   r.      s     zdomain='%s'z
order='%s'r\   )rd   re   Úexprsr/   r9  r"   r$  r   )r#   rh  Úclsrj  r9  r$  r   r0   r'   rg  r(   Ú_print_GroebnerBasis  s    zStrPrinter._print_GroebnerBasisc                   s4   t |td�}d ‡ fdd„|D ƒ¡}|s,dS d| S )Nrx   r]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   r+   rc   r'   r(   rv   +  s     z(StrPrinter._print_set.<locals>.<genexpr>zset()rz   )r{   r   r/   ©r#   rr   r   r0   r'   rc   r(   Ú
_print_set(  s
    zStrPrinter._print_setc                   sZ   ddl m‰  t|td�}d ‡fdd„|D ƒ¡}t‡ fdd„|D ƒƒrPd |¡S d	 |¡S )
Nr   ©Ú	FiniteSetrx   r]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   r+   rc   r'   r(   rv   4  s     z.StrPrinter._print_FiniteSet.<locals>.<genexpr>c                 3  s   | ]}|  ˆ ¡V  qd S r3   )Úhasr+   ro  r'   r(   rv   5  s     zFiniteSet({})z{{{}}})Zsympy.sets.setsrp  r{   r   r/   ræ   rª   rm  r'   )rp  r#   r(   Ú_print_FiniteSet0  s    
zStrPrinter._print_FiniteSetc                   s.   t |td�}d ‡ fdd„|D ƒ¡}d |¡S )Nrx   r]   c                 3  s   | ]}ˆ   |¡V  qd S r3   ra   rt   rc   r'   r(   rv   <  s     z.StrPrinter._print_Partition.<locals>.<genexpr>zPartition({}))r{   r   r/   rª   rm  r'   rc   r(   Ú_print_Partition9  s    zStrPrinter._print_Partitionc                 C  s   |sdS d|   |¡ S )Nzfrozenset()zfrozenset(%s))rn  ©r#   rr   r'   r'   r(   Ú_print_frozenset?  s    zStrPrinter._print_frozensetc                   s:   ‡fdd„‰ d  ‡ fdd„|jD ƒ¡}dˆ |j¡|f S )Nc                   s>   t | ƒdkrˆ  | d ¡S ˆ  | d ft| dd … ƒ ¡S d S rš   r›   r�   rc   r'   r(   rž   E  s    z)StrPrinter._print_Sum.<locals>._xab_tostrr]   c                   s   g | ]}ˆ |ƒ‘qS r'   r'   rŸ   r    r'   r(   r.   J  s     z)StrPrinter._print_Sum.<locals>.<listcomp>zSum(%s, %s)r¡   r¢   r'   r¤   r(   Ú
_print_SumD  s    zStrPrinter._print_Sumc                 C  s   |j S r3   r‰   r7   r'   r'   r(   Ú_print_SymbolM  s    zStrPrinter._print_Symbolc                 C  s   dS r–   r'   r7   r'   r'   r(   Ú_print_IdentityR  s    zStrPrinter._print_Identityc                 C  s   dS )NÚ0r'   r7   r'   r'   r(   Ú_print_ZeroMatrixU  s    zStrPrinter._print_ZeroMatrixc                 C  s   dS )NrÚ   r'   r7   r'   r'   r(   Ú_print_OneMatrixX  s    zStrPrinter._print_OneMatrixc                 C  s
   d|j  S )NzQ.%sr‰   r7   r'   r'   r(   Ú_print_Predicate[  s    zStrPrinter._print_Predicatec                 C  s   t |ƒS r3   rM  r7   r'   r'   r(   Ú
_print_str^  s    zStrPrinter._print_strc                 C  s2   t |ƒdkrd|  |d ¡ S d|  |d¡ S d S )Nr   z(%s,)r   r!   r]   )rœ   r"   r2   r7   r'   r'   r(   Ú_print_tuplea  s    zStrPrinter._print_tuplec                 C  s
   |   |¡S r3   )r~  r7   r'   r'   r(   Ú_print_Tupleg  s    zStrPrinter._print_Tuplec                 C  s   d|   |jtd ¡ S )Nz%s.Tr   r®   )r#   ÚTr'   r'   r(   Ú_print_Transposej  s    zStrPrinter._print_Transposec                 C  s   d|   |j¡|   |j¡f S )NzUniform(%s, %s))r"   r¦   r§   r7   r'   r'   r(   Ú_print_Uniformm  s    zStrPrinter._print_Uniformc                 C  s"   | j  dd¡rd|j S d|j S )Nr   Fz%s)r  r  r   rŠ   r7   r'   r'   r(   Ú_print_Quantityp  s    
zStrPrinter._print_Quantityc                   sD   ‡ fdd„|j D ƒ}|d gdd„ t|dd … dƒD ƒ }d |¡S )Nc                   s    g | ]}ˆ j |td  dd�‘qS )r   TrÀ   )r)   r   rm   rc   r'   r(   r.   v  s     z0StrPrinter._print_Quaternion.<locals>.<listcomp>r   c                 S  s   g | ]\}}|d  | ‘qS )rÛ   r'   )r,   rW   rV   r'   r'   r(   r.   w  s     r   Zijkz + )r0   Úzipr/   )r#   r8   rr   r¦   r'   rc   r(   Ú_print_Quaternionu  s    &zStrPrinter._print_Quaternionc                 C  s   t |ƒS r3   rM  r7   r'   r'   r(   Ú_print_Dimensionz  s    zStrPrinter._print_Dimensionc                 C  s
   |j d S r‡   r‰   r7   r'   r'   r(   Ú_print_Wild}  s    zStrPrinter._print_Wildc                 C  s
   |j d S r‡   r‰   r7   r'   r'   r(   Ú_print_WildFunction€  s    zStrPrinter._print_WildFunctionc                 C  s   |j S r3   r‰   r7   r'   r'   r(   Ú_print_WildDotƒ  s    zStrPrinter._print_WildDotc                 C  s   |j S r3   r‰   r7   r'   r'   r(   Ú_print_WildPlus†  s    zStrPrinter._print_WildPlusc                 C  s   |j S r3   r‰   r7   r'   r'   r(   Ú_print_WildStar‰  s    zStrPrinter._print_WildStarc                 C  s    | j  dd¡rdS |  tdƒ¡S )Nr   FzS(0)r   )r  r  rD  r   r7   r'   r'   r(   Ú_print_ZeroŒ  s    zStrPrinter._print_Zeroc                 C  s0   |j j}|  | ¡ ¡}|  |j¡}d|||f S ©Nr`  )rd   re   r"   Zto_listÚdom)r#   rë   rk  ÚreprŽ  r'   r'   r(   Ú
_print_DMP‘  s    zStrPrinter._print_DMPc                 C  s<   |j j}|  |j¡}|  |j¡}|  |j¡}d||||f S )Nz%s(%s, %s, %s))rd   re   r"   ÚnumÚdenrŽ  )r#   r8   rk  r‘  r’  rŽ  r'   r'   r(   Ú
_print_DMF˜  s
    zStrPrinter._print_DMFc                 C  s
   d|j  S )NzObject("%s")r‰   )r#   r±   r'   r'   r(   Ú_print_Object   s    zStrPrinter._print_Objectc                 C  s
   d|j  S )NzIdentityMorphism(%s))r$  ©r#   Zmorphismr'   r'   r(   Ú_print_IdentityMorphism£  s    z"StrPrinter._print_IdentityMorphismc                 C  s   d|j |j|jf S )NzNamedMorphism(%s, %s, "%s"))r$  ZcodomainrŠ   r•  r'   r'   r(   Ú_print_NamedMorphism¦  s    ÿzStrPrinter._print_NamedMorphismc                 C  s
   d|j  S )NzCategory("%s")r‰   )r#   Úcategoryr'   r'   r(   Ú_print_Categoryª  s    zStrPrinter._print_Categoryc                 C  s   |j j S r3   r‰   )r#   Zmanifoldr'   r'   r(   Ú_print_Manifold­  s    zStrPrinter._print_Manifoldc                 C  s   |j j S r3   r‰   )r#   Úpatchr'   r'   r(   Ú_print_Patch°  s    zStrPrinter._print_Patchc                 C  s   |j j S r3   r‰   )r#   Zcoordsr'   r'   r(   Ú_print_CoordSystem³  s    zStrPrinter._print_CoordSystemc                 C  s   |j j|j jS r3   ©Ú
_coord_sysr…   Ú_indexrŠ   r(  r'   r'   r(   Ú_print_BaseScalarField¶  s    z!StrPrinter._print_BaseScalarFieldc                 C  s   d|j j|j j S )Nze_%srž  r(  r'   r'   r(   Ú_print_BaseVectorField¹  s    z!StrPrinter._print_BaseVectorFieldc                 C  s6   |j }t|dƒr$d|jj|j j S d|  |¡ S d S )NrŸ  zd%szd(%s))Z_form_fieldr„   rŸ  r…   r   rŠ   r"   )r#   Údiffr)  r'   r'   r(   Ú_print_Differential¼  s    
zStrPrinter._print_Differentialc                 C  s   dd|   |jd ¡f S )Nr\   ZTrr   rA  r7   r'   r'   r(   Ú	_print_TrÃ  s    zStrPrinter._print_Trc                 C  s   |   |j¡S r3   r  rt  r'   r'   r(   Ú
_print_StrÇ  s    zStrPrinter._print_Strc                 C  s*   |j }d|  |¡|  |j¡|  |j¡f S r�  )r^   r"   ra  rS   )r#   r8   Úrelr'   r'   r(   Ú_print_AppliedBinaryRelationÊ  s
    


þz'StrPrinter._print_AppliedBinaryRelation)F)r   )N)F)Žre   Ú
__module__Ú__qualname__r>  r   Ú__annotations__r    r)   r2   r9   rI   rK   rM   rO   rX   rZ   r[   r`   rf   rj   rk   rl   rs   rw   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  r  r  r  r!  r&  r*  r,  r/  r1  r5  r;  r<  r=  r@  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rN  rO  rP  rQ  rV  rW  r^  rc  re  rf  rl  rn  rr  rs  ru  rv  rw  Z_print_MatrixSymbolZ_print_RandomSymbolrx  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'   r(   r      s"  
ù

		v	)B=		r   c                 K  s   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©r8   Úsettingsrë   rr   r'   r'   r(   ÚsstrÑ  s    
r¯  c                   @  s    e Zd ZdZdd„ Zdd„ ZdS )ÚStrReprPrinterz(internal) -- see sstrreprc                 C  s   t |ƒS r3   )r6   rt  r'   r'   r(   r}  ë  s    zStrReprPrinter._print_strc                 C  s   d|j j|  |j¡f S )Nr\   )rd   re   r"   rŠ   rt  r'   r'   r(   r¦  î  s    zStrReprPrinter._print_StrN)re   r©  rª  Ú__doc__r}  r¦  r'   r'   r'   r(   r°  è  s   r°  c                 K  s   t |ƒ}| | ¡}|S )zÞreturn 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­  r'   r'   r(   Ússtrrepró  s    

r²  N)#r±  Ú
__future__r   Útypingr   Z
sympy.corer   r   r   r   r   r	   Zsympy.core.mulr
   Zsympy.core.numbersr   Zsympy.core.relationalr   Zsympy.core.sortingr   Zsympy.utilities.iterablesr   r   r   Úprinterr   r   Zmpmath.libmpr   r   rY  r   r¯  r°  r²  r'   r'   r'   r(   Ú<module>   s0           D
