K iׁdZddlmZddlmZddlmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZdd lmZd d lmZmZd d lmZmZdd lmZmZGddeZeedZ GddeZ!ee!dZ"y)zI A Printer for generating readable representation of most SymPy classes. ) annotations)Any)SRationalPowBasicMulNumber) _keep_coeff)Integer) Relational)default_sort_key)sift) precedence PRECEDENCE)Printerprint_function) prec_to_dpsto_strc neZdZUdZdddddddddZded<iZd ed <dd Zdd Zd Z ddZ dZ dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zd"Zd#Zd$Z d%Z!d&Z"d'Z#d(Z$d)Z%d*Z&d+Z'd,Z(d-Z)d.Z*d/Z+d0Z,d1Z-d2Z.d3Z/d4Z0d5Z1d6Z2d7Z3d8Z4d9Z5d:Z6d;Z7d<Z8d=Z9d>Z:d?Z;d@ZdCZ?dDZ@dEZAdFZBdGZCdHZDdIZEdJZFdKZGdLZHdMZIdNZJdOZKdPZLdQZMddRZNdSZOdTZPdUZQdVZRdWZSdXZTdYZUdZZVd[ZWd\ZXd]ZYd^ZZd_Z[d`Z\daZ]dbZ^dcZ_ddZ`deZadfZbdgZcdhZddiZedjZfdkZgdlZhdmZidnZjejZkejZldoZmdpZndqZodrZpdsZqdtZrduZsdvZtdwZudxZvdyZwdzZxd{Zyd|Zzd}Z{d~Z|dZ}dZ~dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZy) StrPrinter _sympystrNautoFT)order full_precsympy_integersabbrev perm_cyclicminmaxdpszdict[str, Any]_default_settingszdict[str, str] _relationalsct||ks|s"t||krd|j|zS|j|S)N(%s))r_print)selfitemlevelstricts X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/printing/str.py parenthesizezStrPrinter.parenthesize#s@ t u $v:d;Ku;TDKK-- -;;t$ $c j|j|Dcgc]}|j||c}Scc}wN)joinr-)r(argssepr*r)s r, stringifyzStrPrinter.stringify)s,xxDID**47IJJIs0crt|tr|St|tr t|St|Sr0) isinstancestrrreprr(exprs r, emptyPrinterzStrPrinter.emptyPrinter,s/ dC K e $: t9 r.c|j||}t|}g}|D]~}|j|}|jdr|jsd}|dd}nd}t||ks |jr|j |d|zgl|j ||g|j d}|dk(rd}|dj|zS) Nr-r+r&r )_as_ordered_termsrr' startswithis_Addextendpopr1) r(r:rtermsprecltermtsigns r, _print_AddzStrPrinter._print_Add4s&&t5&9$  $D D!A||C abE$$&$++$ +,$# $uuQx 3;Dchhqk!!r.cy)NTruer9s r,_print_BooleanTruezStrPrinter._print_BooleanTrueIsr.cy)NFalserPr9s r,_print_BooleanFalsezStrPrinter._print_BooleanFalseLr.cTd|j|jdtdzS)Nz~%srNot)r-r2rr9s r, _print_NotzStrPrinter._print_NotOs't((1j6GHIIr.c8t|j}t|D]^\}}t|ts|j j tjus>|jd|j|`|j|dtdS)Nrz & BitwiseAnd) listr2 enumerater6r canonicalrhsrNegativeInfinityinsertrFr4r)r(r:r2jis r, _print_AndzStrPrinter._print_AndRsvDIIdO ,DAq!Z(KKOOq'9'99 Atxx{+ ,~~dE:l+CDDr.cJ|j|jdtdS)Nz | BitwiseOrr4r2rr9s r, _print_OrzStrPrinter._print_OrZs~~dii ;0GHHr.cJ|j|jdtdS)Nz ^ BitwiseXorrfr9s r, _print_XorzStrPrinter._print_Xor]s~~dii <0HIIr.cx|j|jd|j|jddSN(, ))r'functionr4 argumentsr9s r,_print_AppliedPredicatez"StrPrinter._print_AppliedPredicate`s/ KK &t~~t(LN Nr.c|jDcgc]}|j|}}|jjddj |zzScc}wNr&rn)r2r' __class____name__r1)r(r:orIs r, _print_BasiczStrPrinter._print_BasicdsH%)YY /T[[^ / /~~&&$))A,)>>> 0sAc|jjdk(r|j|jd|j|jS)N)rr)rr)blocksshaper')r(Bs r,_print_BlockMatrixzStrPrinter._print_BlockMatrixhs9 88>>V # KK '{{188$$r.cy)NCatalanrPr9s r,_print_CatalanzStrPrinter._print_Catalanmsr.cy)NzoorPr9s r,_print_ComplexInfinityz!StrPrinter._print_ComplexInfinitypr.ct|j|jfDcgc]}|j|c}}|jt j urd|zS||j|jfz }d|zScc}w)NzConditionSet(%s, %s)zConditionSet(%s, %s, %s))tuplesym conditionr'base_setr UniversalSet)r(srbr2s r,_print_ConditionSetzStrPrinter._print_ConditionSetssrquuakk.BCdkk!nCD :: ')D0 0 QZZ(**)D00 DsBc|j}|jDcgc]}|ddk(r|dn|}}ddjfd|g|zDzScc}w)NrrzDerivative(%s)rnc3@K|]}j|ywr0r'.0argr(s r, z/StrPrinter._print_Derivative..}s,Y#T[[-=,Y)r:variable_countr1)r(r:dexprrbdvarss` r,_print_DerivativezStrPrinter._print_Derivativezs_ 373F3FGa11)GG$)),Y%SX,Y"ZZZHsAct|jt}g}|D];}|j|d|j||}|j |=ddj |zS)Nkeyz: {%s}rn)sortedkeysrr'appendr1)r(dritemsrr)s r, _print_dictzStrPrinter._print_dictskaffh$45 C#{{3/QsV1DED LL   %(((r.c$|j|Sr0)rr9s r, _print_DictzStrPrinter._print_Dict%%r.c,t|dr"d|j|jzSt|dr=d|j|jzdz|j|jzSd|j|jzS)N as_booleanzDomain: setz in z Domain on )hasattrr'rsymbolsr)r(rs r,_print_RandomDomainzStrPrinter._print_RandomDomains~ 1l # ALLN ;; ; Q QYY!77&@KK&' ( $++aii"88 8r.c d|jzSN_namer9s r, _print_DummyzStrPrinter._print_DummysTYYr.cy)N EulerGammarPr9s r,_print_EulerGammazStrPrinter._print_EulerGammasr.cy)NErPr9s r, _print_Exp1zStrPrinter._print_Exp1r.cxd|j|jd|j|jdSrl)r'r:condr9s r,_print_ExprCondPairzStrPrinter._print_ExprCondPairs'![[3T[[5KLLr.cn|jjd|j|jdzzSrt)funcrvr4r2r9s r,_print_FunctionzStrPrinter._print_Functions+yy!!FT^^DIIt-L$LLLr.cy)N GoldenRatiorPr9s r,_print_GoldenRatiozStrPrinter._print_GoldenRatiosr.cn|jjd|j|jdzzSrt)rrvr4pargsr9s r,_print_HeavisidezStrPrinter._print_Heavisides-yy!!FT^^DJJ-M$MMMr.cy)NTribonacciConstantrPr9s r,_print_TribonacciConstantz$StrPrinter._print_TribonacciConstants#r.cyNIrPr9s r,_print_ImaginaryUnitzStrPrinter._print_ImaginaryUnitrr.cy)NoorPr9s r,_print_InfinityzStrPrinter._print_Infinityr.cfd}dj|jDcgc] }|| c}}dj|jd|dScc}w)Nct|dk(rj|dSj|dft|ddzSNrrlenr'rxabr(s r, _xab_tostrz.StrPrinter._print_Integral.._xab_tostrE3x1}{{3q6**{{CF9uSW~#=>>r.rnz Integral(ror1limitsr'rpr(r:rrILs` r,_print_IntegralzStrPrinter._print_IntegralsH ? IIdkk:z!}: ;%)[[%?CC;Acd}|j\}}}}|jr|jrd}n7|jr|sd}n&|jr|sd}n|s|sd}n|r|rd}n|rd}nd}|jdi|||dS)NzInterval{m}({a}, {b})r@z.openz.Lopenz.Ropen)abmrP)r2 is_infiniteformat)r(rbfinrrrIrrs r,_print_IntervalzStrPrinter._print_Intervals&VV 1a ==Q]]A ]]1A ]]1A1A 1A AAszz5!!!455r.cxd|j|jd|j|jdS)Nz AccumBounds(rnro)r'r r!)r(rbs r,_print_AccumulationBoundsz$StrPrinter._print_AccumulationBoundss,(, AEE(:(, AEE(:< .s6XCt{{37G6Xr)rr2rrrvr1r(r:r2s` r,_print_LatticeOpzStrPrinter._print_LatticeOps>dii%56yy!!FTYY6XSW6X-X$XXXr.c p|j\}}}}dtt|j||||fzS)NzLimit(%s, %s, %s, dir='%s'))r2rmapr')r(r:ezz0dirs r, _print_LimitzStrPrinter._print_Limits7 1b#,uSq!RQTo5V/WWWr.c,d|j|dzS)N[%s]rn)r4r9s r, _print_listzStrPrinter._print_liststT222r.c$|j|Sr0)rr9s r, _print_ListzStrPrinter._print_Listrr.c$|j|Sr0) _format_strr9s r,_print_MatrixBasezStrPrinter._print_MatrixBaserr.c|j|jtddd|j|jd|j|j dzS)NAtomTr+[rn])r-parentrr'rbrar9s r,_print_MatrixElementzStrPrinter._print_MatrixElementsN  j.@ N KK/TVV1DEF Fr.c fd}j|jtdddz||j|jjzdz||j |jj zdzS)Nct|}|ddk(r|d=|ddk(rd|d<|d|k(rd|d<djfd|DS)Nrrr@:c3@K|]}j|ywr0rrs r,rzBStrPrinter._print_MatrixSlice..strslice..s;#T[[-;r)r[r1)xdimr(s r,strslicez/StrPrinter._print_MatrixSlice..strslices[QAtqyaDtqy!ts{!88;;< r||tj@urj|jBdk7r$| j=tE|jB|jFdk7sQ|j=tE|jFw| j=|| xstjg} | Dcgc]}|j%||d }}|Dcgc]}|j%||d }}|D]N}|j|vsd||jI|jz||jI|j<P|s|d j)|zSt'|dk(r|d j)|zdz|dzS|d j)|zdd j)|zzScc} wcc} wcc}wcc}w)Nrc3K|]@}t|txs*|jxrtd|jDByw)c34K|]}|jywr0) is_Integer)rais r,rz2StrPrinter._print_Mul...s @2 @sN)r6r is_Powallr2)rrs r,rz(StrPrinter._print_Mul..sH##1f%A@S @ @@A##sAArcxt|txr)t|jj ddkSNr)r6rboolexp as_coeff_Mul)rs r,z'StrPrinter._print_Mul..s21c"HtAEE,>,>,@,Ca,G'Hr.T)binaryFevaluater1*z/(ro/r>r@)oldnonecD|j\}}ttj|}|dtj ur|dd}n |d |d<tj |}t|tr|j||dS|j|dS)NrrFr+) as_base_expr[r make_argsr NegativeOne _from_argsr6rr)rbrreargss r,apowz#StrPrinter._print_Mul..apowLs==?DAqq)*EQx1==(ab !!H9au%A!S!vvaUv3366!e6, ,r.r&z/(%s))%rr2rOneanyrr\r' is_Numberr[r r6rbaserDcould_extract_minus_signr'rFr-rr1r(r ras_ordered_factorsr4is_commutativer6r&r5r is_RationalInfinityprqindex)r(r:rHr2rnrbdirdargsprernfactorsdfactorscrLr pow_parenr8r)ra_strb_strs r, _print_MulzStrPrinter._print_Muls$ yy 7aee s##ab## #IDAq#1 M266##A -E %ayE!Hu-A:;a%s277A6RWW! MC11)F)F)H{{1558,-#//4/FH51vzad;;={{1558,-#//4/FH"A"A8}q $%q))"#Q''H  "1 q5r1%DDD   ::_ ,**,D==&D - D##tS)..03a78881==0HHT$Z(DIIaL--.!3&tyy3*=!((.HHTYY'!!d!**&<66Q;HHXdff-.66Q;HHXdff-.% ( L!%%CDEa""1d5"9EECDEa""1d5"9EE ODyyA~,2U177499;M5N,Naggdii() O#((5/) ) Vq[#((5/)C/%(: :#((5/)Gchhuo,EE Em~FEsT0T  T%T*c |j\}}d}|jrb|j\}}|jr|jrt | |}d}n'|jr|jrt | |}d}|dj |jDcgc]}|j|t|c}zScc}w)Nr@r>r.) as_coeff_mmul is_number as_real_imagis_zero is_negativer r1r2r-r)r(r:rKrrLreimrs r, _print_MatMulzStrPrinter._print_MatMul|s!!#1 ;;^^%FBzzbnn"A2q)"A2q)chhAE K#T  sJt$4 5 K   Ks"C cldj|j|j|jS)Nz{}.({}))rrpr'r:r9s r,_print_ElementwiseApplyFunctionz*StrPrinter._print_ElementwiseApplyFunctions, MM KK "  r.cy)NnanrPr9s r, _print_NaNzStrPrinter._print_NaNrr.cy)Nz-oorPr9s r,_print_NegativeInfinityz"StrPrinter._print_NegativeInfinityrr.cZ|jrtd|jDrdt|jdkrd|j |j zSd|j |j f|jzddzSd|j |jddzS)Nc3@K|]}|tjuywr0)rZero)rrBs r,rz*StrPrinter._print_Order..s$EQQ!&&[$EsrzO(%s)rnr) variablesr#pointrr'r:r4r2r9s r, _print_OrderzStrPrinter._print_Orders~~$E$**$E!E4>>"a'TYY!777 t~~0MtUV!WWWT^^DIItQ?? ?r.c"|jSr0__str__r9s r,_print_OrdinalzStrPrinter._print_Ordinal||~r.c"|jSr0rgr9s r, _print_CyclezStrPrinter._print_Cyclerjr.cJddlm}m}ddlm}|j }||d|dddd n|j jd d }|r~|jsy |||jd z jtdd}|jd}|dk(sd||dvr ||d|d|z}|jdd}|S|j}|sK|jdkrd|j|jzSd|j|jzS|j|jd|dd zd|j|jzz}|j|jx} } t|t| kr|} d| zS)Nr) PermutationCycle)sympy_deprecation_warningzw Setting Permutation.print_cyclic is deprecated. Instead use init_printing(perm_cyclic=z). z1.6z#deprecated-permutation-print_cyclic)deprecated_since_versionactive_deprecations_target stacklevelrTz()rrorm,r@zPermutation(%s)zPermutation([], size=%s)z , size=%s) sympy.combinatorics.permutationsrnrosympy.utilities.exceptionsrp print_cyclic _settingsgetsize__repr__rrfindreplacesupportr' array_form) r(r:rnrorprrlasttrimusefulls r,_print_PermutationzStrPrinter._print_PermutationsGH!..  " %++6-8*/+P ..,,]DAK 99d DIIM*335c'lmDA773bbDT__5 5C$4y3t9$$s* *r.c|j\}}}t|jdk(r |d}|d}d|j|d|j|d|j|dS)NrrzSubs(rnro)r2rrdr')r(rr:r0news r, _print_SubszStrPrinter._print_Subssbc3 syy>Q a&Ca&C KK t{{3/S1AC Cr.c"|jSr0rr9s r,_print_TensorIndexzStrPrinter._print_TensorIndex{{}r.c"|jSr0rr9s r,_print_TensorHeadzStrPrinter._print_TensorHeadrr.c"|jSr0rr9s r, _print_TensorzStrPrinter._print_Tensorrr.c |j\}}|dj|Dcgc]}|j|t|c}zScc}w)Nr.)!_get_args_for_traditional_printerr1r-r)r(r:rLr2rs r,_print_TensMulzStrPrinter._print_TensMulsO;;= dchhAE F#T  sJt$4 5 F   Fs"A c"|jSr0rr9s r,_print_TensAddzStrPrinter._print_TensAddrr.c8|j|jSr0r'rr9s r,_print_ArraySymbolzStrPrinter._print_ArraySymbols{{499%%r.c |j|jtddddj|jDcgc]}|j |c}dScc}w)NFuncTr rnr )r-rrr1indicesr')r(r:rbs r,_print_ArrayElementzStrPrinter._print_ArrayElementsS   diiF);T BDIIgkgsgsNtbct{{[\~NtDuw wNtsA! c|jDcgc]}d|j|z}}ddj|zScc}w)Nz %szPermutationGroup([ %s])z, )r2r'r1)r(r:rrBs r,_print_PermutationGroupz"StrPrinter._print_PermutationGroups>04 :1X A & : :)EJJqM99 ;sAcy)NpirPr9s r, _print_PizStrPrinter._print_Pirr.cddjfd|jDdj|jdj|jdS)NzPolynomial ring in rnc3@K|]}j|ywr0r)rrsr(s r,rz-StrPrinter._print_PolyRing..s?B B?r over  with  orderr1rr'domainr)r(rings` r,_print_PolyRingzStrPrinter._print_PolyRingsB YY?$,,? @ KK $dkk$**&=? ?r.cddjfd|jDdj|jdj|jdS)NzRational function field in rnc3@K|]}j|ywr0r)rfsr(s r,rz.StrPrinter._print_FracField..s@B B@rrrrrr(fields` r,_print_FracFieldzStrPrinter._print_FracFieldsD YY@%--@ A KK %t{{5;;'?A Ar.c"|jSr0rg)r(elms r,_print_FreeGroupElementz"StrPrinter._print_FreeGroupElements{{}r.c<d|jd|jdS)Nrm + z*I))ryr(polys r,_print_GaussianElementz!StrPrinter._print_GaussianElements $//r.c2|j|tddS)Nz%s**%sr.)r7rrs r,_print_PolyElementzStrPrinter._print_PolyElement sxxj(C88r.c|jdk(r|j|jS|j|jtdd}|j|jtdd}|dz|zS)Nrr Trrr/)denomr'numerr-r)r(fracrrs r,_print_FracElementzStrPrinter._print_FracElement so ::?;;tzz* *%%djj*U2CD%QE%%djj*V2DT%RE3;& &r.c(tddz }g|jDcgc]}|j||}}}|jD]F\}}g}t |D]?\} } | dkDs | dk(r|j || &|j || d| zzAdj |}|jr,|rd|j|zdz} nq|j|} n_|rL|tjur|jd|g|tjur|jd |g|j|} |s| } n| dz|z} | jd r|jd | ddg4|jd| gI|dd vr!|jd} | d k(r d |dz|d<|jj d z}dd lm} |d |j'zz }|dz }t |D]F\}}t+|dkDs|dddk(s|t+|dz ddk(s3|dt+|dz ||<H|dj |dj |fzScc}w#|$r|d|j)zz }YwxYw)Nrrrz**%dr.rmror?r>)r>r?z(%s, %s)PolynomialErrorz , modulus=%sz , domain='%s'rrArn)rgensr-rGr\rr1rDr'rr9rEr5rCrFrurvsympy.polys.polyerrorsr get_modulus get_domainr)r(r: ATOM_PRECrrGrmonomcoeffs_monomrbrs_coeffs_termmodifierrrrDr)s r, _print_PolyzStrPrinter._print_Polysv&* TYYPD--a;PtP JJL% ,LE5G!%( =1q5AvtAw/tAw!';<  =hhw'G||!DKK$66a((94: : nt'7'7'99 9F # $T? 4KE44y1}$r(c/d3t9q=>6Jc6Q"1SY]3U  4%$))D/:::}Qj : o(99 9F :sI.I33JJcy)NrrP)r(rBs r,_print_UniversalSetzStrPrinter._print_UniversalSetWsr.c|jr-|j|jjS|j|jSr0) is_aliasedr'as_polyas_exprr9s r,_print_AlgebraicNumberz!StrPrinter._print_AlgebraicNumberZs< ??;;t||~5578 8;;t||~. .r.cpt|}|jtjur |sdj |j zS|j r|j tjur3|s1dtfdtj|j fDzS|jtj ur@j tjdj|j |dSj|j|d}jdk(rf|jjrP|jjdk7r7|jd r&j|j |dd |dd Sj|j |dd |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. zsqrt(%s)z %s/sqrt(%s)c3@K|]}j|ywr0rrs r,rz(StrPrinter._print_Pow..s-]3dkk#.>-]rr/Fr _sympyreprrz (Rational**rw)rr'rHalfr'r<r?rr9r- printmethodr@rCrC)r(r:rationalPRECrs` r, _print_PowzStrPrinter._print_Pow`sfL$ 88qvv h DII 66 6   yAFF"8%u-]155RVR[R[J\-]'^^^xxAEE6!"&++aee"4"&"3"3DIItE"3"RTT   dhhU  ;   | +0D0DWX||K(#'#4#4TYYU#4#SUVWXY[U\]],,TYYU,KQOOr.c>|j|jdSr%r'r2r9s r,_print_UnevaluatedExprz!StrPrinter._print_UnevaluatedExprs{{499Q<((r.ct|}|j|j|dd|j|j|dS)NFrr)rr-r<r')r(r:rs r, _print_MatPowzStrPrinter._print_MatPowsJ$,,TYYU,K**488T%*HJ Jr.cn|jjddrd|zSt|jS)NrFzS(%s))r{r|r7rBr9s r,_print_IntegerzStrPrinter._print_Integers0 >>  . 6d# #466{r.cy)NIntegersrPr9s r,_print_IntegerszStrPrinter._print_Integersr.cy)NNaturalsrPr9s r,_print_NaturalszStrPrinter._print_Naturalsrr.cy)N Naturals0rPr9s r,_print_Naturals0zStrPrinter._print_Naturals0r.cy)N RationalsrPr9s r,_print_RationalszStrPrinter._print_Rationalsrr.cy)NRealsrPr9s r, _print_RealszStrPrinter._print_RealsrUr.cy)N ComplexesrPr9s r,_print_ComplexeszStrPrinter._print_Complexesrr.cy)NEmptySetrPr9s r,_print_EmptySetzStrPrinter._print_EmptySetrr.cy)N EmptySequencerPr9s r,_print_EmptySequencezStrPrinter._print_EmptySequencesr.ct|Sr0r7r9s r, _print_intzStrPrinter._print_int 4yr.ct|Sr0rr9s r, _print_mpzzStrPrinter._print_mpzrr.c|jdk(rt|jS|jj ddrd|jd|jS|jd|jS)NrrFzS(z)/r/)rCr7rBr{r|r9s r,_print_RationalzStrPrinter._print_RationalsV 66Q;tvv; ~~!!"2E:%)VVTVV44"ffdff- -r.c|jdk(rt|jSd|j|jfzS)Nrz%d/%d)rCr7rBr9s r,_print_PythonRationalz StrPrinter._print_PythonRationals3 66Q;tvv; dffdff-- -r.c|jdk(rt|jS|jd|jSNrr/ denominatorr7 numeratorr9s r,_print_FractionzStrPrinter._print_Fraction4   q t~~& &"nnd.>.>? ?r.c|jdk(rt|jS|jd|jSr rr9s r, _print_mpqzStrPrinter._print_mpqrr.c\|j}|jjdd}||dkrdnt|j}|jddurd}n5|jddurd}n!|jddk(r|jdkD}d |jvr|jd nd}d |jvr|jd nd}t |j ||| }|jd r d |ddz}n|jdrd|ddz}|jd}|S)Nr"rvrrTFrrr r!) strip_zeros min_fixed max_fixedz-.0z-0.z.0z0.rr?) _precr{r|r _print_level mlib_to_str_mpf_rC removeprefix)r(r:rHr"striplowhighrvs r, _print_FloatzStrPrinter._print_Floatszznn  - ;ax![%>+ &$ .E ^^K (E 1E ^^K (F 2%%)E','>dnnU#D(-(?t~~e$T SesVZ [ == ABB ]]4 12B __S ! r.c ddddddddd }|j|vrJ||jd |j|jd |j|jd S|j |jt |d |j j|jxs |jd |j |jt |S)NEqNe AssignmentAddAugmentedAssignmentSubAugmentedAssignmentMulAugmentedAssignmentDivAugmentedAssignmentModAugmentedAssignment)z==z!=z:=z+=z-=z*=z/=z%=rmrnrorA)rel_opr'lhsr^r-rr$r|)r(r:charmaps r,_print_RelationalzStrPrinter._print_Relationals*****   ;;' !#*4;;#7TXX9N#';;txx#8: :"..txxD9IJ,,00=LL,,TXXz$7GHJ Jr.cZd|j|jd|jfzS)NzCRootOf(%s, %d)lexr=)rMr:rDr9s r,_print_ComplexRootOfzStrPrinter._print_ComplexRootOf s. DOODIIeO$L$(JJ$00 0r.c|j|jdg}|jtjur*|j |j |jddj|zS)Nr2r=z RootSum(%s)rn)rMr:funrIdentityFunctionrr'r1rs r,_print_RootSumzStrPrinter._print_RootSumsY 78 881-- - KK DHH- .tyy..r.c|jj}|jDcgc]}|j||j!}}ddj |z}|j Dcgc]}|j|}}d|j|jz}d|j|jz}|g|z||gz} |ddj | dScc}wcc}w)Nr=rrnz domain='%s'z order='%s'rmro) rurvexprsrMrr1rr'r) r(basisclsrr9genrrrr2s r,_print_GroebnerBasiszStrPrinter._print_GroebnerBasissoo&&DIKKPSEKK8PP5))-2ZZ9cS!99U\\!::t{{5;;77w~/ $00Q:s $C%-C*cjt|t}djfd|D}|syd|zS)Nrrnc3@K|]}j|ywr0rrr)r(s r,rz(StrPrinter._print_set..)=tT*=rzset()r)rrr1r(rrr2s` r, _print_setzStrPrinter._print_set&s4q./yy=u==}r.cddlmt|t}dj fd|D}t fd|Drdj |Sdj |S) Nr) FiniteSetrrnc3@K|]}j|ywr0rr@s r,rz.StrPrinter._print_FiniteSet..2rArc3@K|]}|jywr0)has)rr)rEs r,rz.StrPrinter._print_FiniteSet..3s5ttxx "5rz FiniteSet({})z{{{}}})sympy.sets.setsrErrr1r:r)r(rrr2rEs` @r,_print_FiniteSetzStrPrinter._print_FiniteSet.sU-q./yy=u== 5u5 5"))$/ /t$$r.c|t|t}djfd|D}dj|S)Nrrnc3@K|]}j|ywr0rrs r,rz.StrPrinter._print_Partition..:s;cS);rz Partition({}))rrr1rrBs` r,_print_PartitionzStrPrinter._print_Partition7s5q./yy;U;;%%d++r.c0|syd|j|zS)Nz frozenset()z frozenset(%s))rCr(rs r,_print_frozensetzStrPrinter._print_frozenset=s !333r.cfd}dj|jDcgc] }|| c}}dj|jd|dScc}w)Nct|dk(rj|dSj|dft|ddzSrrrs r,rz)StrPrinter._print_Sum.._xab_tostrCrr.rnzSum(rorrs` r, _print_SumzStrPrinter._print_SumBsH ? IIdkk:z!}: ; $ DMM :A>>;rc|jSr0rr9s r, _print_SymbolzStrPrinter._print_SymbolKrr.cyrrPr9s r,_print_IdentityzStrPrinter._print_IdentityPrr.cy)N0rPr9s r,_print_ZeroMatrixzStrPrinter._print_ZeroMatrixSrr.cy)Nr-rPr9s r,_print_OneMatrixzStrPrinter._print_OneMatrixVrr.c d|jzS)NzQ.%srr9s r,_print_PredicatezStrPrinter._print_PredicateYs !!r.ct|Sr0rr9s r, _print_strzStrPrinter._print_str\rr.cvt|dk(rd|j|dzSd|j|dzS)Nrz(%s,)rr&rn)rr'r4r9s r, _print_tuplezStrPrinter._print_tuple_s; t9>T[[a11 1DNN466 6r.c$|j|Sr0)rbr9s r, _print_TuplezStrPrinter._print_Tuplees  &&r.cNd|j|jtdzS)Nz%s.Trr)r(Ts r,_print_TransposezStrPrinter._print_Transposehs#))!%%E1BCCCr.cxd|j|jd|j|jdS)NzUniform(rnro)r'rrr9s r,_print_UniformzStrPrinter._print_Uniformks'$(KK$7TVV9LMMr.cv|jjddrd|jzSd|jzS)NrFz%s)r{r|rrr9s r,_print_QuantityzStrPrinter._print_Quantityns4 >>  h .$++% %diir.c|jDcgc]}|j|tdd}}|dgt|dddDcgc] \}}|dz|zc}}z}dj |Scc}wcc}}w) Nr Trrrijkr.r)r2r-rzipr1)r(r:rbrrars r,_print_QuaternionzStrPrinter._print_Quaternionss{KO99 UaT  q*U"3D  A U U qTF#aeU*;<$!QaeAg< <zz!} V>  . 6""71:..r.c|jj}|j|j}|j|j}|d|d|dSrl)rurvr'to_listdom)r(rBr;reprs r, _print_DMPzStrPrinter._print_DMPsDkk""kk!))+&kk!%% "C--r.c|jj}|j|j}|j|j}|j|j }|d|d|d|dSrl)rurvr'numdenr)r(r:r;rrrs r, _print_DMFzStrPrinter._print_DMFsVnn%%kk$((#kk$((#kk$((##&S#66r.c d|jzS)Nz Object("%s")r)r(rs r, _print_ObjectzStrPrinter._print_Objects((r.c d|jzS)NzIdentityMorphism(%s))rr(morphisms r,_print_IdentityMorphismz"StrPrinter._print_IdentityMorphisms%77r.cVd|jd|jd|jdS)NzNamedMorphism(rnz, "z"))rcodomainrrs r,_print_NamedMorphismzStrPrinter._print_NamedMorphisms#!2!2HMMC Cr.c d|jzS)NzCategory("%s")r)r(categorys r,_print_CategoryzStrPrinter._print_Categorys(--//r.c.|jjSr0r)r(manifolds r,_print_ManifoldzStrPrinter._print_Manifolds}}!!!r.c.|jjSr0r)r(patchs r, _print_PatchzStrPrinter._print_Patchszzr.c.|jjSr0r)r(coordss r,_print_CoordSystemzStrPrinter._print_CoordSystems{{r.c\|jj|jjSr0 _coord_sysr_indexrrs r,_print_BaseScalarFieldz!StrPrinter._print_BaseScalarFields#'' 5:::r.cbd|jj|jjzS)Nze_%srrs r,_print_BaseVectorFieldz!StrPrinter._print_BaseVectorFields(((00>CCCCr.c|j}t|dr0d|jj|jj zSd|j |zS)Nrzd%szd(%s)) _form_fieldrrrrrr')r(diffrs r,_print_DifferentialzStrPrinter._print_DifferentialsQ   5, '5++33ELLAFFF FT[[// /r.cJdd|j|jddS)NTrrmrrorr9s r, _print_TrzStrPrinter._print_TrsTYYq\!:;;r.c8|j|jSr0rrOs r, _print_StrzStrPrinter._print_Strs{{166""r.c|j}|j|d|j|jd|j|jdSrl)rpr'r.r^)r(r:rels r,_print_AppliedBinaryRelationz'StrPrinter._print_AppliedBinaryRelationsAmm#{{3/#{{4884#{{48846 6r.)F)rr0)rv __module__ __qualname__rr#__annotations__r$r-r4r;rMrQrTrXrcrgrjrrrxr}rrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrOrXrZr]r_rerirlrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrr#r0r3r7r=rCrJrMrPrSrU_print_MatrixSymbol_print_RandomSymbolrWrZr\r^r`rbrdrgrirkrorqrsrvrxrzr|r~rrrrrrrrrrrrrrrrPr.r,rrsK )~ $&L.%% K"*JEIJN?% 1[ )&9MMN $D6&<HHYX 3&&F AtFl " @'+RC &w:? A 09'@;D/ ;Pz)J  .. @ @ *J*0/ 1%, 4 ?''"7 'DN  / .7)8C0" ;D0<#6r.rc >t|}|j|}|S)abReturns 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)' )rdoprintr:settingsrBrs r,sstrrs " 8A $A Hr.ceZdZdZdZdZy)StrReprPrinterz(internal) -- see sstrreprct|Sr0)r8rOs r,r`zStrReprPrinter._print_strs Awr.cl|jjd|j|jdS)Nrmro)rurvr'rrOs r,rzStrReprPrinter._print_Strs$;;//QVV1DEEr.N)rvrr__doc__r`rrPr.r,rrs$Fr.rc >t|}|j|}|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 )rrrs r,sstrreprrs  x A $A Hr.N)#r __future__rtypingr sympy.corerrrrr r sympy.core.mulr sympy.core.numbersr sympy.core.relationalr sympy.core.sortingrsympy.utilities.iterablesrrrprinterrr mpmath.libmprrrrrrrrPr.r,rs#;;&&,/*.,;x6x6v   ,FZF     r.