K iZ+dZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZmZdd lmZmZmZdd lmZdd lmZmZdd lmZmZmZGd deZGddeZGddeZ eeddZ!ddZ"eZ#y)z A MathML printer. ) annotations)Any)Mul)S)default_sort_key)sympify)split_super_subrequires_partial)precedence_traditional PRECEDENCEPRECEDENCE_TRADITIONAL) greek_unicode)Printerprint_function) prec_to_dpsrepr_dpsto_strcTeZdZUdZddddddddddddid dd Zd ed <dd ZdZdZy)MathMLPrinterBasez^Contains common code required for MathMLContentPrinter and MathMLPresentationPrinter. Nzutf-8F abbreviated[plainT·)orderencodingfold_frac_powersfold_func_bracketsfold_short_fracinv_trig_style ln_notationlong_frac_ratio mat_delimmat_symbol_style mul_symbol root_notation symbol_namesmul_symbol_mathml_numbersdisable_split_super_subzdict[str, Any]_default_settingsctj|ddlm}m}|_Gdd|fd}|j _y)Nr)DocumentTextceZdZddZy)+MathMLPrinterBase.__init__..RawTextcv|jr-|jdj||j|yy)Nz{}{}{})datawriteformat)selfwriterindent addindentnewls [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/printing/mathml.pywritexmlz4MathMLPrinterBase.__init__..RawText.writexml7s+99LLD!IJN)r;r;)__name__ __module__ __qualname__r9r:r8RawTextr.6s Kr:r@cF}||_j|_|SN)r0dom ownerDocument)r0rr@r3s r8createRawTextNodez5MathMLPrinterBase.__init__..createRawTextNode;s! AAF"hhAOHr:)r__init__xml.dom.minidomr+r,rCcreateTextNode)r3settingsr+r,rFr@s` @r8rGzMathMLPrinterBase.__init__,s@x(2:  Kd K   #4r:ctj||}|j}|jdd}|j }|S)z2 Prints the expression as MathML. asciixmlcharrefreplace)r_printtoxmlencodedecode)r3exprmathMLunistrxmlbstrress r8doprintzMathMLPrinterBase.doprintCsAd+--)<=nn r:c@|jdr|ggfSt|S)Nr() _settingsr )r3names r8_split_super_subz"MathMLPrinterBase._split_super_subMs& >>3 4"b> !"4( (r:rB) r<r=r>__doc__r)__annotations__rGrWr[r?r:r8rrsT !#'#%-#()~$4.)r:rceZdZdZdZdZdZd'dZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZeZeZdZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%e"Z&e"Z'e"Z(d#Z)d$Z*d%Z+d&Z,y)(MathMLContentPrinterz}Prints an expression to the Content MathML markup language. References: https://www.w3.org/TR/MathML2/chapter4.html _mathml_contentciddddddddd dd d d d ddddddddddddddddddddid d d!d"d#d#d$d$d%d%d&d&d'd'd(d(d)d)d*d*d+d+d,d,d-d-d.d.d/d0d1d2d3d4id5d6d7d8d9d:d;d8dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdX}|jjD]}|j}||vs||cS|jj}|jS)Y)Returns the MathML tag for an expression.Addplusrtimes DerivativediffNumbercnintPowpowerMaxmaxMinminAbsabsAndandOrorXorxorNotnotImpliesimpliesSymbolci MatrixSymbol RandomSymbolIntegralSumsumsincostancotcscsecsinhcoshtanhcothcschsechasinarcsinasinharcsinhacosarccosacosharccoshatanarctanatanharctanhatan2acotarccotacotharccothasecarcsecasecharcsechacscarccscacscharccschloglnEqualityeq Unequalityneq GreaterThangeqLessThanleqStrictGreaterThangtStrictLessThanltunion intersect)Union Intersection __class____mro__r<lower)r3e translateclsns r8 mathml_tagzMathMLContentPrinter.mathml_tag[s6 66 76  &6  d 6 4 6 7 6  56  56  56  56  $6  56  56  y6  d6 D!6 " D#6 $ %6 & 5'6 ( 5)6 * 5+6 , 5-6 . 5/6 0 516 2 536 4 F56 6 F76 8 F96 : F;6 < F=6 > F?6 @ HA6 B YC6 D HE6 F YG6 H HI6 J YK6 L XM6 N HO6 P YQ6 R HS6 T YU6 V HW6 X YY6 Z 4[6 \ ]6 ^ %_6 ` 5a6 b c6 d e6 f dg6 h'k6 p;;&& $C AI~ |# $ KK wwyr:c^|jrh|jjd}|j|jjd|j|j | |Sddlm}||\}}|tjur|jjd}|j|jjd|j|j||j|j||S|j\}}|tjur"t|dk(r|j|dS|jdk7r#tj|j}|jjd}|j|jjd|dk7r |j|j||D]"}|j|j|$|S) Napplyminusrfractiondivideoldre)could_extract_minus_signrC createElement appendChild _print_Mulsympy.simplifyrrOnerN as_coeff_mullenrr _from_argsas_ordered_factors) r3rRxrnumerdenomcoefftermsterms r8rzMathMLContentPrinter._print_Muls  ( ( *&&w/A MM$((009 : MM$//4%0 1H+~ u  &&w/A MM$((00: ; MM$++e, - MM$++e, -H((* u AEE>c%jAo;;uQx( ( :: NN5)<<>E HH " "7 + dhh,,W56 A: MM$++e, - -D MM$++d+ , -r:Nc>|j||}|j|d}g}|ddD]}|jr|jj d}|j |jj d|j ||j |j| |}||dk(s|j ||j ||j|}||dk(s|j |j|t|dk(r|S|jj d}|j |jj d|r#|j |jd|r#|S)Nrrrrrrd) _as_ordered_termsrNrrCrrappendrpop)r3rRrargs lastProcessed plusNodesargrs r8 _print_AddzMathMLContentPrinter._print_Addsb%%d%%8 DG,  8 7C++-HH**73 dhh44W=> m, dkk3$/0 ! $r(?$$]3  / $ C 0 $r(?$$T[[%56 7 y>Q  HH " "7 + dhh,,V45 MM)--* +r:cZ|jdjdk7r td|jj d}t |jD]\}\}}|t |jdz k(rA|dk(r<|jj d}|j|j|n[|jj d}|j|j||j|j||j||S)NrTzAll Piecewise expressions must contain an (expr, True) statement to be used as a default condition. Without one, the generated expression may not evaluate to anything under some condition. piecewiser otherwisepiece) rcond ValueErrorrCr enumeraterrrN)r3rRrootircrs r8_print_Piecewisez%MathMLContentPrinter._print_Piecewises 99R=   %/0 0 xx%%k2"499- $IAv1C NQ&&19..{;!!$++a.1..w7!!$++a.1!!$++a.1   U # $ r:c F|jjd}t|jD]m}|jjd}t|jD]'}|j |j |||f)|j |o|S)Nmatrix matrixrow)rCrrangerowscolsrrN)r3mrrx_rjs r8_print_MatrixBasez&MathMLContentPrinter._print_MatrixBases HH " "8 ,qvv A((((5C166] 6 AadG 45 6 MM#    r:c|jdk(rZ|jjd}|j|jj t |j |S|jjd}|j|jjd|jjd}|j|jj t |j |jjd}|j|jj t |j|j||j||S)Nrrirr)qrCrrrIstrp)r3rrxnumxdenoms r8_print_Rationalz$MathMLContentPrinter._print_Rationals 33!8&&t,A MM$((11#acc(; <H HH " "7 + dhh,,X67xx%%d+ 00QSS:;''-488223qss8<= d fr:cl|jjd}|j|jj|j||jjd}|jjd}|j|j |j d|j|j |j d|j||j||j|j |j d|S)Nrbvarlowlimitrr)rCrrrrNr)r3rrx_1x_2s r8 _print_Limitz!MathMLContentPrinter._print_Limit s HH " "7 + dhh,,T__Q-?@Ahh$$V,hh$$Z0  AFF1I./  AFF1I./ c c dkk!&&),-r:c8|jjdS)N imaginaryirCrr3rs r8_print_ImaginaryUnitz)MathMLContentPrinter._print_ImaginaryUnitxx%%l33r:c8|jjdS)N eulergammar r s r8_print_EulerGammaz&MathMLContentPrinter._print_EulerGammarr:c|jjd}|j|jjd|S)zwWe use unicode #x3c6 for Greek letter phi as defined here https://www.w3.org/2003/entities/2007doc/isogrk1.htmlriuφrCrrrIr3rrs r8_print_GoldenRatioz'MathMLContentPrinter._print_GoldenRatio s9 HH " "4 ( dhh--.JKLr:c8|jjdS)N exponentialer r s r8 _print_Exp1z MathMLContentPrinter._print_Exp1'sxx%%n55r:c8|jjdS)Npir r s r8 _print_PizMathMLContentPrinter._print_Pi*sxx%%d++r:c8|jjdS)Ninfinityr r s r8_print_Infinityz$MathMLContentPrinter._print_Infinity-xx%%j11r:c8|jjdS)N notanumberr r s r8 _print_NaNzMathMLContentPrinter._print_NaN0rr:c8|jjdS)Nemptysetr r s r8_print_EmptySetz$MathMLContentPrinter._print_EmptySet3r r:c8|jjdS)Ntruer r s r8_print_BooleanTruez'MathMLContentPrinter._print_BooleanTrue6sxx%%f--r:c8|jjdS)Nfalser r s r8_print_BooleanFalsez(MathMLContentPrinter._print_BooleanFalse9sxx%%g..r:c|jjd}|j|jjd|j|jjd|S)Nrrr)rCrrrs r8_print_NegativeInfinityz,MathMLContentPrinter._print_NegativeInfinity<sQ HH " "7 + dhh,,W56 dhh,,Z89r:cpfdtj}|j|S)Nc,jjd}|jjjjjjd}|jj |dd|j|t |ddk(rjjd}|jj |dd|j|jjd}|jj |dd|j|t |ddk(rRjjd}|jj |dd|j|t |dk(r,|jj j |S|j|dd|S) Nrrrrruplimitr)rCrrrrNrfunction)limitsr bvar_elemlow_elemup_elemr lime_recurr3s r8r8z8MathMLContentPrinter._print_Integral..lime_recurCs&&w/A MM$((001CD E..v6I  ! !$++fQil"; < MM) $6!9~"8811*=$$T[[1%>? h'((00;##DKKq ! $=> g&6!9~"((00;##DKKq ! $=> g&6{a dkk!**56H j45Hr:)listr4reverse)r3rr4r8s`` @r8_print_Integralz$MathMLContentPrinter._print_IntegralBs, 0ahh&!!r:c$|j|SrB)r;r s r8 _print_SumzMathMLContentPrinter._print_Sum_s##A&&r:c>jjj|}fd}d}j|j\}}}||}|Dcgc] }|| }}|D cgc] } ||  }} jjd} | j jj ||s|s,|j jj ||Sjjd} | j | | j |||j | |S|sVjjd} | j | | j |||j | |Sjjd} | j | | j ||| j |||j | |Scc}wcc} w)Ncvt|dkDrjjd}t|D]\}}|dkDrVjjd}|j jj d|j |jjd}|j jj ||j ||Sjjd}|j jj |d|S)Nrzmml:mrowrzmml:mo mml:mirrCrrrrIitemsmrowritemmomir3s r8joinz0MathMLContentPrinter._print_Symbol..joings5zA~xx--j9(/)GAt1u!XX33H=txx'>'>s'CD((,//9BNN488#:#:4#@A$$R() XX++H5txx66uQx@A r:c@|tvrtj|S|SrBrgetss r8rz5MathMLContentPrinter._print_Symbol..translatey M!$((++r:rAzmml:msubzmml:msupz mml:msubsup)rCrrr[rZrrI)r3symr~rIrrZsuperssubssupsubmnamemsubmsupmsubsups` r8 _print_Symbolz"MathMLContentPrinter._print_Symbolds XX # #DOOC$8 9 $  "22388<fd,23S)C.33*./3 #//&&x0 $((11$78txx66t<=$ !xx--j9  '  d,t$ xx--j9  '  f.t$ ((00?##E*##DJ/##DL1w' 34/s H4Hc.|jdrZ|jjrC|jjdk(r)|jj d}|j |jj d|jjdk7r|jj d}|jj d}|j |jjt|jj|j ||j ||j |j|j|S|jj d}|jj |j|}|j ||j |j|j|j |j|j|S)Nr%rrrrdegreeri) rYexp is_RationalrrCrrrrIrrNbaser)r3rrxmldegxmlcnrs r8 _print_PowzMathMLContentPrinter._print_Powsf NN? +0A0AEEGGqL&&w/A MM$((008 9uuww!|//9..t4!!$(("9"9#aeegg,"GH""5) f% MM$++aff- .H HH " "7 +hh$$T__Q%78 c dkk!&&)* dkk!%%()r:c|jj|j|}|j|jj t ||SrBrCrrrrIrrs r8 _print_Numberz"MathMLContentPrinter._print_NumberC HH " "4??1#5 6 dhh--c!f56r:c|jj|j|}t|jt |j }|j|jj||SrB) rCrr mlib_to_str_mpf_r_precrrI)r3rrrepr_es r8 _print_Floatz!MathMLContentPrinter._print_FloatsX HH " "4??1#5 6QWWhqww&78 dhh--f56r:c|jjd}|j|}t|jrd}|j |jj||jjd}t |jD]\}}|j |j||dkDs,|jjd}|j |jt||j ||j ||j |j|j|S)Nr partialdiffrrr[) rCrrr rRrreversedvariable_countrNr)r3rr diff_symbolrrPrer[s r8_print_Derivativez&MathMLContentPrinter._print_Derivatives HH " "7 +ooa( AFF #'K dhh,,[9:hh$$V,"1#3#34 (JC OODKK, -qy//9""4;;wu~#>?'  ( c dkk!&&)*r:c|jjd}|j|jj|j||jD]"}|j|j |$|SNr)rCrrrrrNr3rrrs r8_print_Functionz$MathMLContentPrinter._print_Functionsg HH " "7 + dhh,,T__Q-?@A66 ,C MM$++c* + ,r:c|jj|j|}|jD]"}|j |j |$|SrB)rCrrrrrNrts r8 _print_Basicz!MathMLContentPrinter._print_BasicsL HH " "4??1#5 666 ,C MM$++c* + ,r:c|jjd}|jj|j|}|j||jD]"}|j|j |$|Srs)rCrrrrrN)r3rrrrs r8_print_AssocOpz#MathMLContentPrinter._print_AssocOpsl HH " "7 +hh$$T__Q%78 c66 ,C MM$++c* + ,r:cV|jjd}|j|jj|j||j|j |j |j|j |j |Srs)rCrrrrNlhsrhsrs r8_print_Relationalz&MathMLContentPrinter._print_Relationalsq HH " "7 + dhh,,T__Q-?@A dkk!%%() dkk!%%()r:c|jjd}|D]"}|j|j|$|S)zgMathML reference for the element: https://www.w3.org/TR/MathML2/chapter4.html#contm.listr9)rCrrrN)r3seq dom_elementrFs r8 _print_listz MathMLContentPrinter._print_listsDhh,,V4  7D  # #DKK$5 6 7r:c|jj|j|}|j|jj t ||SrBrcr3rrs r8 _print_intzMathMLContentPrinter._print_intFhh,,T__Q-?@  7 7A ?@r:c|jjd}|jD]"}|j|j |$|S)Nset)rCrrrrNrts r8_print_FiniteSetz%MathMLContentPrinter._print_FiniteSetsC HH " "5 )66 ,C MM$++c* + ,r:c|jjd}|j|jjd|jD]"}|j|j |$|S)NrsetdiffrCrrrrNrts r8_print_Complementz&MathMLContentPrinter._print_Complements^ HH " "7 + dhh,,Y7866 ,C MM$++c* + ,r:c|jjd}|j|jjd|jD]"}|j|j |$|S)Nrcartesianproductrrts r8_print_ProductSetz&MathMLContentPrinter._print_ProductSets_ HH " "7 + dhh,,-?@A66 ,C MM$++c* + ,r:ch|jj|j|}|jD]N}|jjd}|j |j ||j |P|j |j |j |S)Nr)rCrr signaturerrNrR)r3rrrrs r8 _print_Lambdaz"MathMLContentPrinter._print_Lambdas HH " "4??1#5 6;; C((((0C OODKK, - MM#   dkk!&&)*r:rB)-r<r=r>r\ printmethodrrrrrrr rrrrrrr#r&r)r,r.r;r=rY_print_MatrixSymbol_print_RandomSymbolrardrkrqrurwryr}rr_print_Implies _print_Not _print_Xorrrrrr?r:r8r_r_Ts$K@D!F8*$ 446,242./ ":' 6p('.  &  $NJJ  r:r_cleZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zdd ZdZddZdZddZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%dd%Z&d&Z'e&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7dd6Z8e8Z9d7Z:dd8Z;dd9Zd<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEeEZFdCZGdDZHdEZIdFZJdGZKdHZLdIZMdJZNdKZOeOZPeOZQdLZRdMZSdNZTeTxZUZVdOZWdPZXdQZYdRZZdSZ[dTZ\dUZ]dVZ^dWZ_dXZ`dYZadZZbd[Zcd\Zdd]Zed^Zfd_Zgd`ZhdaZidbZjdcZkekZlddZmdeZndfZodgZpdhZqdiZrdjZsdkZtdlZudmZvdnZwdoZxdpZydqZzdrZ{dsZ|dtZ}duZ~dvZdwZdxZdyZdzZd{Zd|Zd}Zd~ZdZdZdZdZdZdZdZdZdZdZdZdZy)MathMLPresentationPrinterzPrints an expression to the Presentation MathML markup language. References: https://www.w3.org/TR/MathML2/chapter3.html _mathml_presentationcidddddddddd d d d d ddddddddddddddddddddiddd dd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d8d:d;dd?d@dAdBdCdDdEdFd@dAdGdHdIdJ}fdK}|jjD]}|j}||vs||cS|jjdLk(r|S|jj}|jS)MrbrhmnLimitz→rfⅆrjr}rHrz∫rz∑rrrrrrrrrrrrrrrrrrrr=rz≠rz≥rz≤r>r<lerchphiΦzetazζ dirichlet_etazη elliptic_kzΚ lowergammaγ uppergammazΓgammatotientzϕreduced_totientzλzνzΩrCWzΘTrueFalseNonez S′z C′lambda)primenu primeomegafresnelsfresnelcLambertW Heaviside BooleanTrue BooleanFalseNoneTypemathieusmathieuc mathieusprime mathieucprimeLambdacjdjddk(ryjddk(ryjddk(ryjddk(ry tjdtstjdS) Nr$r⁢re×dotrldotz․)rY isinstancer TypeError)r3sr8mul_symbol_selectionzBMathMLPresentationPrinter.mathml_tag..mul_symbol_selection_s|,4NN<0F:) -8 -6 -7!| )?1 @ YA1 B yC1 D yE1 F!#"!#((a1 f 4;;&& $C AI~ |# $ ;;  5 (') ) KK wwyr:c|jjd}|j|jjd|S)NrG(rr3rGs r8_l_parenz"MathMLPresentationPrinter._l_parenw6 XX # #D ) txx..s34 r:c|jjd}|j|jjd|S)NrG)rrs r8_r_parenz"MathMLPresentationPrinter._r_paren|rr:c|jjd}|j|jjd|S)NrG{rrs r8_l_bracez"MathMLPresentationPrinter._l_bracerr:c|jjd}|j|jjd|S)NrG}rrs r8_r_bracez"MathMLPresentationPrinter._r_bracerr:c|jjd}|j|jjd|S)NrG,rrs r8_commaz MathMLPresentationPrinter._commarr:c|jjd}|j|jjd|S)NrG|rrs r8_barzMathMLPresentationPrinter._barrr:c|jjd}|j|jjd|S)NrG;rrs r8 _semicolonz$MathMLPresentationPrinter._semicolonrr:c`|jjd}|j|jt |D]F\}}|r|j|j |j|j |H|j|j|SNrE)rCrrrrrrNrr3rrErrs r8_paren_comma_separatedz0MathMLPresentationPrinter._paren_comma_separatedsxx%%f- )o /FAs  /   T[[- . / ) r:c`|jjd}|j|jt |D]F\}}|r|j|j |j|j |H|j|j|Sr)rCrrrrrrNrrs r8_paren_bar_separatedz.MathMLPresentationPrinter._paren_bar_separatedsxx%%f- )o /FAs  -   T[[- . / ) r:cHt|}||ks|s||kr{|jjd}|j|j |j|j ||j|j |S|j |Sr)r rCrrrrNr)r3rFlevelstrictprec_valrEs r8 parenthesizez&MathMLPresentationPrinter.parenthesizes)$/ u v8u3D88))&1D   T]]_ -   T[[. /   T]]_ -K{{4  r:c>fd}jjd}|jrbjjd}|jjj d|j||| |}|S|||}|S)Ncddlm}||\}}|tjur jj d} j dr)tt|dkr|jdd j|} j|}|j||j||j||S|j\}} |tjur3t| dk(r%|j j| d|S jd k7r#tj| j!} |dk7r j|} jj d } | j jj# j%||j| |j| | D]} |j j'| t(d | | d k(r4 jj d } | j jj# j%||j| |S) Nrrmfracrbevelledr(rrrGrr)rrrrrCrrYrr setAttributerNrrrrrrrIrrr )rRrErrrfracrxdenrrryrr3s r8multiplyz6MathMLPresentationPrinter._print_Mul..multiplys /#D>LE5AEE!xx--g6>>"34SY!9K%%j&9{{5){{5)  &  &  & ,,.LE5~#e*/  U1X!67 zzU"u-@@BzKK&HH**40 dhh55dood6KLM  #  # (  !2!24E9J!KLuRy(..t4AMM$(("9"9$//$:O"PQ$$Q'  ( Kr:rErG-)rCrrrrI)r3rRrrErs` r8rz$MathMLPresentationPrinter._print_Muls! Dxx%%f-  ( ( *&&t,A MM$((11#6 7   Q TE4(D D$'D r:Nc||jjd}|j||}|j|j |d|ddD]}|j rX|jjd}|j|jj d|j | }nV|jjd}|j|jj d|j |}|j||j||S)NrErrrrGr+)rCrrrrNrrI)r3rRrrErrrrs r8rz$MathMLPresentationPrinter._print_Addsxx%%f-%%d%%8 T!W-.8 C++-HH**40 dhh55c:;KK%HH**40 dhh55c:;KK$   Q    Q   r:c .|jjd}t|jD]}|jjd}t|jD]S}|jjd}|j |j |||f|j |U|j ||jd}|dk(r|S|jjd}|jjd} |dk(rU|j |jjd| j |jjdnT|j |jjd | j |jjd |jjd } | j || j || j | | S) Nmtablemtrmtdr"r;rGr]rrrE) rCrrrrrrNrYrI) r3rtablerrrrr"leftrightrEs r8rz+MathMLPresentationPrinter._print_MatrixBases&&x0qvv !A&&u-A166] !HH**51 dkk!AqD'23 a  !   a  !NN;/ ?Lxx%%d+&&t,     TXX44S9 :   dhh55c: ;   TXX44S9 :   dhh55c: ;xx%%f-    r:c|jdkr|j }n |j}|jjd}|s|jdr|j dd|j |j ||j |j |j|jdkr|jjd}|jjd}|j |jjd|j ||j ||S|S) Nrrrrr(rErGr) rrCrrYrrrNrrI)r3rfoldedrrrErGs r8_get_printed_Rationalz/MathMLPresentationPrinter._get_printed_Rationals 337AA HH " "7 + T^^$56 NN:v . dkk!n% dkk!##&' 33788))&1D''-B NN4882237 8   R   Q KHr:c|jdk(r|j|jS|j||jdS)Nrr)rrNrrrYr s r8rz)MathMLPresentationPrinter._print_Rational)s= 33!8;;qss# #))!T^^r:c|jjd}|j|jjd|S)NrHrrrs r8rz,MathMLPresentationPrinter._print_GoldenRatioK6 HH " "4 ( dhh--i89r:c|jjd}|j|jjd|S)NrHzⅇrrs r8rz%MathMLPresentationPrinter._print_Exp1Ps7 HH " "4 ( dhh--.>?@r:c|jjd}|j|jjd|S)NrHzπrrs r8rz#MathMLPresentationPrinter._print_PiUs6 HH " "4 ( dhh--f56r:c|jjd}|j|jjd|S)NrH∞rrs r8rz)MathMLPresentationPrinter._print_InfinityZ6 HH " "4 ( dhh--j9:r:c,|jjd}|jjd}|j|jjd|j |}|j||j||S)NrErGr)rCrrrIr)r3rrErrs r8r.z1MathMLPresentationPrinter._print_NegativeInfinity_svxx%%f- HH " "4 ( dhh--c23   #   r:c|jjd}|j|jjd|S)NrHzℏrrs r8 _print_HBarz%MathMLPresentationPrinter._print_HBarhrr:c|jjd}|j|jjd|S)NrHrrrs r8rz+MathMLPresentationPrinter._print_EulerGammamr r:c|jjd}|j|jjd|S)NrHTribonacciConstantrrs r8_print_TribonacciConstantz3MathMLPresentationPrinter._print_TribonacciConstantrs7 HH " "4 ( dhh--.BCDr:c|jjd}|j|j|jd|j|jj d|S)NrWr†rCrrrNrrIr3rrWs r8 _print_Daggerz'MathMLPresentationPrinter._print_DaggerwsWxx%%f- QVVAY/0 00<= r:c|jjd}|j|j|jd|jjd}|j|jj d|j||j|j|jd|S)NrErrGz∈rr)r3rrErGs r8_print_Containsz)MathMLPresentationPrinter._print_Contains}sxx%%f- QVVAY/0 XX # #D ) txx..z:;  QVVAY/0 r:c|jjd}|j|jjd|S)NrHzℋrrs r8_print_HilbertSpacez-MathMLPresentationPrinter._print_HilbertSpacerr:c|jjd}|j|jjd|j|j |j d|S)NrWz 𝒞rrCrrrIrNrrs r8_print_ComplexSpacez-MathMLPresentationPrinter._print_ComplexSpacesWxx%%f- 00=> QVVAY/0 r:c|jjd}|j|jjd|S)NrHzℱrrs r8_print_FockSpacez*MathMLPresentationPrinter._print_FockSpacerr:c dddd}|jjd}t|jdkrt d|jDrn|jjd}|j |jj |t|j|j |nt|jD]j}|jjd}|j |jj |d t|d k(r|j |t|d k(r`|jjd }|j ||j |j|d |j |t|dk(s|jjd }|j ||j |j|d |j |j|d |j |m|j |j|jtd dt|jD]{}|jjd}|j |jj d|j ||j |j|d}|S)Nz∫z∬z∭)rrr1rEr1c38K|]}t|dk(yw)rN)r).0rs r8 z.s(N3SQ(NsrGrrrWrXrTrrr) rCrrr4allrrIrnrNrr3r ) r3rR intsymbolsrErGrrWrXds r8r;z)MathMLPresentationPrinter._print_Integralsg# zB xx%%f- t{{ q S(N$++(N%N''-B NN48822:c$++>N3OP Q   R   , .XX++D1txx66z!}EFs8q=$$R(s8q=8811&9D$$R($$T[[Q%89$$T*s8q="hh44Y?G''+'' CF(;<'' CF(;<$$W- ." **4==*U:K26+8 9DKK( 2C&&t,A MM$((11&9 :   Q    T[[Q0 1  2  r:ct|j}|jjd}|j |dd}|j |dd}|jjd}|j |jj |j||jjd}|j |dd}|jjd} | j |jj d|j ||j | |j ||j ||j ||j ||jjd} | j || j |j|jt|| S)N munderoverrrrrGrEr) r9r4rCrrNrrIrrr3r ) r3rr4subsupr6r7summandlowvarequalrEs r8r=z$MathMLPresentationPrinter._print_Sums~ahh'' 5;;vay|,++fQil+((((.DHH33DOOA4FGHhh$$V,kk&)A,'&&t, $((11#67   !7#37#xx%%f-   **1::7Ma7PQR r:cfd}d}j|j\}}}||}|Dcgc] }|| }}|D cgc] } ||  }} jjd} | j jj |t |dk(rUt |dk(r| } njjd} | j | | j ||nt |dk(rDjjd} | j | | j ||nZjjd} | j | | j ||| j |||dk(r| jd d| Scc}wcc} w) Ncvt|dkDrjjd}t|D]\}}|dkDrVjjd}|j jj d|j |jjd}|j jj ||j ||Sjjd}|j jj |d|S)NrrErrGr@rHrBrCs r8rIz5MathMLPresentationPrinter._print_Symbol..joins5zA~xx--f5(/)GAt1u!XX33D9txx'>'>s'CD((,//5BNN488#:#:4#@A$$R() XX++D1txx66uQx@A r:c@|tvrtj|S|SrBrKrMs r8rz:MathMLPresentationPrinter._print_Symbol..translaterOr:rHrrVrWrXbold mathvariant)r[rZrCrrrIrr) r3rPstylerIrrZrQrRrSrTrUrs ` r8rYz'MathMLPresentationPrinter._print_Symbols{ $  "22388<fd,23S)C.33*./3 #//&&t, $((11$78 v;! 4yA~HH**62 e$ d4j)4yA~HH**62 e$ d6l+HH**95 e$ d4j) d6l+ F? NN=& 134/s G G cB|j||jdS)Nr#)r:)rYrY)r3rPs r8rz-MathMLPresentationPrinter._print_MatrixSymbol s+!!#(,7I(J"L Lr:c|jjd}|jdd|j|j |j d|S)Nmenclosenotationtopr)rCrrrrNr)r3rRencs r8_print_conjugatez*MathMLPresentationPrinter._print_conjugatesHhh$$Z0 U+  DIIaL12 r:c8|jjd}|j|j|td|jjd}|j|jj ||j||S)NrEFuncrG)rCrrrr rI)r3oprRrowrGs r8_print_operator_afterz/MathMLPresentationPrinter._print_operator_aftersthh$$V, ))$ 60BCD XX # #D ) txx..r23  r:c@|jd|jdS)N!rrFrr3rRs r8_print_factorialz*MathMLPresentationPrinter._print_factorial s))#tyy|<>-+H MM$((11$7 8 MM$((11$//!2DE Fxx%%f-  444aff=> r:ct|j}t|j|d}|jd}|j j d}d|vr|jd\}}|ddk(r|dd}|j j d }|j|j j||j||j j d } | j|j j||j| |j j d } |j j d }|j|j jd | j||j j d }|j|j j|| j||j| |S|d k(r|jdS|dk(r|jdS|j j d }|j|j j||S)NT) strip_zerosr'rErrrrrrGrW10z+infz-inf) rrirgrhrYrCrsplitrrIrr.) r3rRdpsstr_real separatorrEmantr\rrGrWs r8rkz&MathMLPresentationPrinter._print_Floats$**%tzz3DANN#>? xx%%f- (?"..-KT31v}!"g''-B NN4882248 9   R ''-B NN488229= >   R 88))&1D''-B NN4882248 9   R ''-B NN4882237 8   R   T "K  ''- -  //5 5''-B NN488228< =Ir:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||jjd}|j|j |j|j |j d|j|j|j||S)NrErVrHLirr)rCrrrIrNrrr)r3rRrErrHrQs r8_print_polylogz(MathMLPresentationPrinter._print_polylogsxx%%f- HH " "6 * XX # #D ) txx..t45 b dkk$))A,/0 xx%%f- ) TYYq\23 )  r:cV|jjd}|jjd}|j|jj|j ||j||j|j |j |SNrErH)rCrrrIrrr)r3rrErHs r8rwz&MathMLPresentationPrinter._print_Basicsxx%%f- XX # #D ) txx..tq/ABC  444aff=> r:c4|j|jSrB)rrr s r8 _print_Tuplez&MathMLPresentationPrinter._print_Tuples*t**AFF33r:cV|jjd}|jr+|j|jj dn*|j|jj d|jjd}|j r+|j|jj dn*|j|jj d|jjd}|j||j|j |j|j|j|j|j |j|j||S)NrGrrrrrE) rCr right_openrrI left_openrNstartrend)r3rrrrEs r8_print_Intervalz)MathMLPresentationPrinter._print_Intervals+&&t, <<   dhh55c: ;   dhh55c: ;xx%%d+ ;;   TXX44S9 :   TXX44S9 :xx%%f-  QWW-. ' QUU+,  r:c|jjd}|j|j|j|j |j d|j|j|S)NrEr)rCrrrrNr)r3rRr\rEs r8 _print_Absz$MathMLPresentationPrinter._print_Abs sbxx%%f- % TYYq\23 % r:c|jjd}|j|j|j|j ||j|j |jjd}|j|jj ||jjd}|j||j||Srn)rCrrrrNrrI)r3rrRrQrHrEs r8 _print_re_imz&MathMLPresentationPrinter._print_re_imsxx%%f- ) T*+ ) XX # #D ) txx..q12xx%%f-   r:c@|jd|jdS)Nuℜrrzrr3rRr\s r8 _print_rez#MathMLPresentationPrinter._print_re  499Q<88r:c@|jd|jdS)Nuℑrr|r}s r8 _print_imz#MathMLPresentationPrinter._print_im!rr:ch|jjd}|jjd}|j|jj|j ||j||j D]"}|j|j |$|Srn)rCrrrIrrrN)r3rrErHrs r8ryz(MathMLPresentationPrinter._print_AssocOp$sxx%%f- XX # #D ) txx..tq/ABC 66 /C   T[[- . / r:c|jjd}|j|j|jd||jddD]{}|jjd}|j|jj ||j||}|j||j|}|SNrErrrG)rCrrrrrI)r3rRsymbolprecrErrrs r8 _print_SetOpz&MathMLPresentationPrinter._print_SetOp-sxx%%f- **499Q<>?99QR= C&&t,A MM$((11&9 :!!#t,A   Q    Q    r:c:td}|j|d|S)Nrz∪r rr3rRrs r8 _print_Unionz&MathMLPresentationPrinter._print_Union8s!%g.  z488r:c:td}|j|d|S)Nrz∩rrs r8_print_Intersectionz-MathMLPresentationPrinter._print_Intersection<s!%n5  z488r:c:td}|j|d|S)N Complementz∖rrs r8rz+MathMLPresentationPrinter._print_Complement@!%l3  z488r:c:td}|j|d|S)NSymmetricDifference∆rrs r8_print_SymmetricDifferencez4MathMLPresentationPrinter._print_SymmetricDifferenceDs"%&;<  z488r:c:td}|j|d|S)N ProductSetz×rrs r8rz+MathMLPresentationPrinter._print_ProductSetHrr:c8|j|jSrB) _print_setr)r3rNs r8rz*MathMLPresentationPrinter._print_FiniteSetLsqvv&&r:ct|t}|jjd}|j |j t |D]F\}}|r|j |j|j |j|H|j |j|S)NkeyrE) sortedrrCrrrrrrNr)r3rNrDrQrrFs r8rz$MathMLPresentationPrinter._print_setOsq./xx%%f- ) ' 0GAt  /   T[[. / 0 ) r:c|jjd}|djr|djs|jjd}|j |j |j |j |d|j |j|j |n#|j |j |d|ddD] }|jjd}|j |jj||jr|jsz|jjd}|j |j |j |j ||j |jn|j |}|j ||j ||Sr) rCr is_Booleanis_NotrrrNrrI)r3rrrErQrrrs r8 _print_LogOpz&MathMLPresentationPrinter._print_LogOp\s|xx%%f- 7  d1gnn88))&1D   T]]_ -   T[[a1 2   T]]_ -   T "   T[[a1 28 C&&t,A MM$((11&9 :~~cjjHH**62 dmmo. dkk#./ dmmo.KK$   Q    Q   r:cVddlm}||jk(r|j|jSt ||r|j j }nd|fg}|jjd}|D]\}}t|jj }|jdt|D]\\}\} } | dk(ry|rV|jjd} | j|jjd|j| |j|j| | d k(rx|jjd} | j|jjd |j| |j|j| |rV|jjd} | j|jjd|j| |jjd} | j|j| j|j| | j|j!|j| |jjd} | j|jjd |j| |j|j| _|S) Nr)VectorrEc(|djS)Nr)__str__)rs r8zAMathMLPresentationPrinter._print_BasisDependent..s1Q4<<>r:rrrGrrrr) sympy.vectorrzerorNrseparaterDrCrr9 componentssortrrrIrr) r3rRrrDrEsystemvect inneritemsrkvrGmbracs r8_print_BasisDependentz/MathMLPresentationPrinter._print_BasisDependenttsh' 499 ;;tyy) ) dF #MMO))+EYKExx%%f-! 5LFDdoo3356J OO"9O :&z2 5 6Aq6!XX33D9txx'>'>s'CD((,$$T[[^4"W//5BNN488#:#:3#?@$$R($$T[[^4!XX33D9txx'>'>s'CD((, HH226:E%%dmmo6%%dkk!n5%%dmmo6$$U+//5BNN488#:#:;M#NO$$R($$T[[^43 5 5: r:c\t|jt}|j|dS)Nrz∧rrrrr3rRrs r8 _print_Andz$MathMLPresentationPrinter._print_And&dii%56  z22r:c\t|jt}|j|dS)Nrz∨rrs r8 _print_Orz#MathMLPresentationPrinter._print_Orrr:c\t|jt}|j|dS)Nrz⊻rrs r8rz$MathMLPresentationPrinter._print_Xorrr:c:|j|jdS)Nz⇒)rrrJs r8rz(MathMLPresentationPrinter._print_Impliess  J77r:c\t|jt}|j|dS)Nrz⇔rrs r8_print_Equivalentz+MathMLPresentationPrinter._print_Equivalentrr:c|jjd}|jjd}|j|jjd|j||jdj r|jjd}|j|j |j|j|jd|j|jn|j|jd}|j||S)NrErGz¬r) rCrrrIrrrrNr)r3rrErGrs r8rz$MathMLPresentationPrinter._print_Notsxx%%f- XX # #D ) txx..x89  FF1I &&v.A MM$--/ * MM$++affQi0 1 MM$--/ * AFF1I&A  r:c|jjd}|j|jj|j ||SNrHrCrrrIrr3rrHs r8 _print_boolz%MathMLPresentationPrinter._print_bool? XX # #D ) txx..tq/ABC r:c|jjd}|j|jj|j ||Srrrs r8_print_NoneTypez)MathMLPresentationPrinter._print_NoneTyperr:cd}|jjr<|jjr&|jjr|ddd|f}n|ddd|f}n|jjr||d|jz |df}ny|jjr#t |}t |t ||f}n@t|dkDr't |}t |t |||df}n t|}|jjd}|j|jt|D]\}}|r|j|j||k(rW|jjd}|j|jj||j||j|j!||j|j#|S)Nu…rrrrErH)rt is_infinitestopstep is_positiveiternextrtuplerCrrrrrrIrNr) r3rNdotsprintsetitrQrelrHs r8 _print_Rangez&MathMLPresentationPrinter._print_Ranges 77  166#5#5vv!!Q4/Ar4/ WW QrUQVV^QrU2H VV  aBBxb4/H VaZaBBxb426HQxHxx%%f- )x( 2EAr  /TzXX++D1txx66t<=  $  R1 2 ) r:ct|jt}|jj d}|jj d}|j |jj t|jj|j ||j |j||S)NrrErG) rrrrCrrrIrfuncrr)r3rRrrErGs r8_hprint_variadic_functionz3MathMLPresentationPrinter._hprint_variadic_functionsdii%56xx%%f- XX # #D ) txx..DII/E/E/GHI  444d;< r:c|jjd}|j|jd|j|j |j d|S)NrWr)rCrrrrNr)r3rRrWs r8 _print_expz$MathMLPresentationPrinter._print_expsSxx%%f- ))$/0 TYYq\23 r:c|jjd}|j|j|j|jjd}|j|jj |j ||j||j|j|j|S)NrErG)rCrrrNr{rIrr|)r3rrErs r8r}z+MathMLPresentationPrinter._print_Relationalsxx%%f- QUU+, HH " "4 ( dhh--dooa.@AB  QUU+, r:c|jj|j|}|j|jj t ||SrBrcrs r8rz$MathMLPresentationPrinter._print_intrr:c(|jjd}|j\}}|jjd}|jdd|j |jj |j ||j ||jjd}|jdd|j |jj |j|j ||S)NrVrHr9r8)rCr_idrrrI_variable_names_name)r3rrVindexrrHs r8_print_BaseScalarz+MathMLPresentationPrinter._print_BaseScalar sxx%%f- v XX # #D )  v. txx..v/E/Ee/LMN  XX # #D )  v. txx..v||<=  r:c,|jjd}|j\}}|jjd}|jjd}|jdd|j |jj |j ||j ||jjd}|j |jj d|j ||j ||jjd}|jdd|j |jj |j|j ||S)NrVmoverrHr9r8rG^)rCrrrrrI _vector_namesr)r3rrVrrrrHrGs r8_print_BaseVectorz+MathMLPresentationPrinter._print_BaseVectors,xx%%f- v&&w/ XX # #D )  v. txx..v/C/CE/JKL " XX # #D ) txx..s34 "  XX # #D )  v. txx..v||<=  r:c|jjd}|jjd}|jdd|j|jj d|j||jjd}|j|jj d|j||S)NrrHr9r8rPrGrrCrrrrI)r3rrrHrGs r8_print_VectorZeroz+MathMLPresentationPrinter._print_VectorZero,s&&w/ XX # #D )  v. txx..s34 " XX # #D ) txx..s34 " r:c|jjd}|j}|j}|j |j |t d|jjd}|j |jjd|j ||j |j |t d|S)NrErrGrrCr_expr1_expr2rrr rIr3rRrEvec1vec2rGs r8 _print_Crossz&MathMLPresentationPrinter._print_Cross7xx%%f-{{{{ **4E1BCD XX # #D ) txx..x89  **4E1BCD r:c|jjd}|jjd}|j|jjd|j||jjd}|j|jjd|j||j|j |j t d|S)NrErG∇rrrCrrrIr_exprr r3rRrErGs r8 _print_Curlz%MathMLPresentationPrinter._print_CurlBxx%%f- XX # #D ) txx..z:;  XX # #D ) txx..x89  **4::z%7HIJ r:c|jjd}|jjd}|j|jjd|j||jjd}|j|jjd|j||j|j |j t d|S)NrErGrrrrrs r8_print_Divergencez+MathMLPresentationPrinter._print_DivergenceMrr:c|jjd}|j}|j}|j |j |t d|jjd}|j |jjd|j ||j |j |t d|S)NrErrGrrrs r8 _print_Dotz$MathMLPresentationPrinter._print_DotXrr:cL|jjd}|jjd}|j|jjd|j||j|j |j t d|S)NrErGrrrrs r8_print_Gradientz)MathMLPresentationPrinter._print_Gradientc|xx%%f- XX # #D ) txx..z:;  **4::z%7HIJ r:cL|jjd}|jjd}|j|jjd|j||j|j |j t d|S)NrErGrrrrs r8_print_Laplacianz*MathMLPresentationPrinter._print_Laplaciankrr:c|jjd}|jdd|j|jj d|S)NrHr9normalzℤrrs r8_print_Integersz)MathMLPresentationPrinter._print_IntegerssD HH " "4 ( }h/ dhh--j9:r:c|jjd}|jdd|j|jj d|S)NrHr9rzℂrrs r8_print_Complexesz*MathMLPresentationPrinter._print_Complexesyrr:c|jjd}|jdd|j|jj d|S)NrHr9rzℝrrs r8 _print_Realsz&MathMLPresentationPrinter._print_Realsrr:c|jjd}|jdd|j|jj d|S)NrHr9rℕrrs r8_print_Naturalsz)MathMLPresentationPrinter._print_Naturalsrr:ch|jjd}|jjd}|jdd|j|jj d|j||j|j t j|S)NrVrHr9rr )rCrrrrIrNrZero)r3rrTrs r8_print_Naturals0z*MathMLPresentationPrinter._print_Naturals0s}hh$$V, HH " "4 ( }h/ dhh--j9:   AFF+, r:c|jd|jdz }|jd}|jjd}|j|jj d|jjd}|j|jj d|jjd}|j||j|j ||j||jjd}|j||j|j ||S) NrrrrGrYrZrErW)rrCrrrIrN)r3rRshiftrlrrrQrSs r8_print_SingularityFunctionz4MathMLPresentationPrinter._print_SingularityFunctions  ! tyy|+ ! xx%%d+ 00:;&&t, $((11(;<xx%%f-  U+, hh$$V,   E*+ r:c|jjd}|j|jjd|S)NrHNaNrrs r8r#z$MathMLPresentationPrinter._print_NaNs6 HH " "4 ( dhh--e45r:c$|jjd}|jjd}|j|jj||j||j|j |j dt |j dk(r|S|jjd}|j||j|j|j dd|S)NrVrHrrrE)rCrrrIrNrrr)r3rrZrTrHrEs r8_print_number_functionz0MathMLPresentationPrinter._print_number_functionshh$$V, XX # #D ) txx..t45   AFF1I./ qvv;! Jxx%%f-  444affQRjAB r:c&|j|dS)NBrr s r8_print_bernoulliz*MathMLPresentationPrinter._print_bernoulli**1c22r:c&|j|dS)Nrrr s r8_print_catalanz(MathMLPresentationPrinter._print_catalanrr:c&|j|dS)NErr s r8 _print_eulerz&MathMLPresentationPrinter._print_eulerrr:c&|j|dS)NFrr s r8_print_fibonacciz*MathMLPresentationPrinter._print_fibonaccirr:c&|j|dS)NLrr s r8 _print_lucasz&MathMLPresentationPrinter._print_lucasrr:c&|j|dS)Nzγrr s r8_print_stieltjesz*MathMLPresentationPrinter._print_stieltjess**1j99r:c&|j|dS)NTrr s r8_print_tribonacciz+MathMLPresentationPrinter._print_tribonaccirr:c|jjd}|jjd}|j|jjd|j||jjd}|j|jjd|j||S)NrrGr~r)r3rrrGs r8_print_ComplexInfinityz0MathMLPresentationPrinter._print_ComplexInfinitys HH " "7 + XX # #D ) txx..z:; b XX # #D ) txx..s34 br:c|jjd}|j|jjd|S)NrGz∅rrs r8r&z)MathMLPresentationPrinter._print_EmptySetrr:c|jjd}|j|jjd|S)NrGz 𝕌rrs r8_print_UniversalSetz-MathMLPresentationPrinter._print_UniversalSet6 HH " "4 ( dhh--k:;r:czddlm}|j}|jj d}t ||s|jj d}|j |j|j |j||j |j|j |n |j |j||jj d}|j |jjd|j ||S)NrrrWrErGr sympy.matricesrrrCrrrrrNrrIr3rRrmatrSrQrGs r8_print_Adjointz(MathMLPresentationPrinter._print_Adjoints/hhhh$$V,#|,88))&1D   T]]_ -   T[[- .   T]]_ - OOD ! OODKK, - XX # #D ) txx..z:;  r:czddlm}|j}|jj d}t ||s|jj d}|j |j|j |j||j |j|j |n |j |j||jj d}|j |jjd|j ||S)Nrr4rWrErGr*r5r7s r8_print_Transposez*MathMLPresentationPrinter._print_Transposes/hhhh$$V,#|,88))&1D   T]]_ -   T[[- .   T]]_ - OOD ! OODKK, - XX # #D ) txx..s34  r:cddlm}|j}|jj d}t ||s|jj d}|j |j|j |j||j |j|j |n |j |j||j |jd|S)Nrr4rWrEr) r6rrrCrrrrrNr)r3rRrr8rSrQs r8_print_Inversez(MathMLPresentationPrinter._print_Inverses/hhhh$$V,#|,88))&1D   T]]_ -   T[[- .   T]]_ - OOD ! OODKK, -  B( r:c fddlm}|jjd}|j}t |dt r#|djt|ddz}n t|}t ||r}|jrm|ddk(r|dd}n |d |d<|jjd}|j|jjd|j||ddD]}|j|j|t|d|jjd}|j|jjd |j||j|j|dt|d|S) Nr)MatMulrErrrGrFr)!sympy.matrices.expressions.matmulr?rCrrrrrr9rrrIrr )r3rRr?rrrGrs r8 _print_MatMulz'MathMLPresentationPrinter._print_MatMulsw< HH " "6 *yy d1gs #7--/$tABx.@D:D dF #(E(E(GAw"}ABx7(Q''-B NN4882237 8 MM" 9 C MM$++C1G1M,13 4''-B NN488223EF G MM"    d''R2H2N(-/ 0r:c&ddlm}|j|j}}|jj d}t ||s|jj d}|j|j|j|j||j|j|j|n |j|j||j|j||S)Nrr4rWrE) r6rr^r\rCrrrrrNr)r3rRrr^r\rSrQs r8 _print_MatPowz'MathMLPresentationPrinter._print_MatPow1s/IItxxchh$$V,$ -88))&1D   T]]_ -   T[[. /   T]]_ - OOD ! OODKK- .  C() r:c |jjd}|j}|ddD]}|j|j |t |d|jjd}|j|jj d|j||j|j |dt |d|S)NrErFrGz∘)rCrrrrr rI)r3rRrrrrGs r8_print_HadamardProductz0MathMLPresentationPrinter._print_HadamardProduct@s HH " "6 *yy9 C MM!!#'=d'CUK M''-B NN48822:> ? MM"      d2h(>t(De L Nr:c|jjd}|j|jjd|S)Nrz𝟘rr3Zrs r8_print_ZeroMatrixz+MathMLPresentationPrinter._print_ZeroMatrixMrr:c|jjd}|j|jjd|S)Nrz𝟙rrGs r8_print_OneMatrixz*MathMLPresentationPrinter._print_OneMatrixRrr:c|jjd}|j|jjd|S)NrHz 𝕀r)r3Irs r8_print_Identityz)MathMLPresentationPrinter._print_IdentityWr2r:c|jjd}|j|jjd|jjd}|j|jjd|jjd}|j||j|j |j d|j||S)NrGu⌊u⌋rErr"r3rrrrEs r8 _print_floorz&MathMLPresentationPrinter._print_floor\xx%%d+ 00:;&&t, $((11(;<xx%%f-  QVVAY/0  r:c|jjd}|j|jjd|jjd}|j|jjd|jjd}|j||j|j |j d|j||S)NrGu⌈u⌉rErr"rPs r8_print_ceilingz(MathMLPresentationPrinter._print_ceilinggrRr:cf|jjd}|jd}t|dk(r|j |d}n|j |}|j |j |j ||jjd}|j |jjd|j ||j |j |jd|j |j|S)NrErrrGz↦) rCrrrrNrrrIr)r3rrEsymbolsrGs r8rz'MathMLPresentationPrinter._print_Lambdarsxx%%f-&&) w<1 kk'!*-Gkk'*G ) ! XX # #D ) txx..z:;  QVVAY/0 ) r:c |j|SrB)rr s r8 _print_tuplez&MathMLPresentationPrinter._print_tuples*t**A..r:c8|j|jSrB)rNlabelr s r8_print_IndexedBasez,MathMLPresentationPrinter._print_IndexedBases{{177##r:cr|jjd}|j|j|jt |j dk(r/|j|j|j d|S|j|j|j |S)NrVrr)rCrrrNr^rindicesrs r8_print_Indexedz(MathMLPresentationPrinter._print_Indexeds HH " "6 * dkk!&&)* qyy>Q  MM$++aiil3 4H dkk!)),-r:c|jjd}|j|j|jt dd|jjd}t |jD]F\}}|r|j|j|j|j|H|j||S)NrVAtomTr*rE) rCrrrparentr rr]rrN)r3rrrQrrs r8_print_MatrixElementz.MathMLPresentationPrinter._print_MatrixElements HH " "6 * d''*V2Dt'TUxx%%f- * /FAs  /   T[[- . / dr:c8|jjd}|jjd}|j|jjd|j||j|j|j |S)NrErHz 𝖥rCrrrIrrr3rrrHs r8_print_elliptic_fz+MathMLPresentationPrinter._print_elliptic_ft HH " "6 * XX # #D ) txx..{;< b /d//89r:c8|jjd}|jjd}|j|jjd|j||j|j|j |S)NrErHz 𝖤rdres r8_print_elliptic_ez+MathMLPresentationPrinter._print_elliptic_ergr:c&|jjd}|jjd}|j|jjd|j||jjd}|j|j t |j dk(ro|j \}}|j|j||j|j|j|j|n|j \}}}|j|j||j|j|j|j||j|j|j|j||j|j|j||S)NrErHz 𝛱r) rCrrrIrrrrNrrr)r3rrrHrrrzs r8_print_elliptic_piz,MathMLPresentationPrinter._print_elliptic_pisa HH " "6 * XX # #D ) txx..{;< b HH " "6 * dmmo& qvv;! 66DAq MM$++a. ) MM$))+ & MM$++a. )ffGAq! MM$++a. ) MM$//+ , MM$++a. ) MM$))+ & MM$++a. ) dmmo& ar:c<|jjd}|jjd}|j|jjd|j||j|j |j |S)NrErHEir"res r8 _print_Eiz#MathMLPresentationPrinter._print_Eiso HH " "6 * XX # #D ) txx..t45 b dkk!&&)*r:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGrrrr"r3rrrrGs r8 _print_expintz'MathMLPresentationPrinter._print_expint HH " "6 * HH " "6 * XX # #D ) txx..s34 b dkk!&&),- a dkk!&&*-.r:cN|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j|j |j dd|j||j|j |j dd|S)NrErXrGPrrr1r"rqs r8 _print_jacobiz'MathMLPresentationPrinter._print_jacobi HH " "6 * HH " "9 - XX # #D ) txx..s34 b dkk!&&),- dkk!&&1+./ a dkk!&&*-.r:cN|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j|j |j dd|j||j|j |j dd|S)NrErXrGrrrrr"rqs r8_print_gegenbauerz+MathMLPresentationPrinter._print_gegenbauerrwr:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGr*rrr"rqs r8_print_chebyshevtz+MathMLPresentationPrinter._print_chebyshevtrsr:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGUrrr"rqs r8_print_chebyshevuz+MathMLPresentationPrinter._print_chebyshevursr:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGrurrr"rqs r8_print_legendrez)MathMLPresentationPrinter._print_legendrersr:cN|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j|j |j dd|j||j|j |j dd|S)NrErXrGrurrrr"rqs r8_print_assoc_legendrez/MathMLPresentationPrinter._print_assoc_legendrerwr:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGr%rrr"rqs r8_print_laguerrez)MathMLPresentationPrinter._print_laguerrersr:cN|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j|j |j dd|j||j|j |j dd|S)NrErXrGr%rrrr"rqs r8_print_assoc_laguerrez/MathMLPresentationPrinter._print_assoc_laguerre&rwr:c|jjd}|jjd}|jjd}|j|jjd|j||j|j |j d|j||j|j |j dd|S)NrErVrGHrrr"rqs r8_print_hermitez(MathMLPresentationPrinter._print_hermite2rsr:)FrB)r)r<r=r>r\rrrrrrrrrrrrrrrrrr rrrrrr.rrrrrr r#r%r;r=rYrrrArFrKrMrRrardr[rqrurkrlrwrprvrx_print_Determinantrzr~rryrrrrrrrr_print_frozensetrrrrrrrrrr)r,rrr _print_Min _print_Maxrr}rrrrrrrrrrrrr r rrr#rr _print_bellrr r#r&r(r+r.r&r1r9r;r=rArCrErIrKrNrQrTrrXr[r^rbrfrirlrorrrvryr{r~rrrrrr?r:r8rr#s)KKZ       !-^(4(P,            $L24lL( => 4l .` %N 4&$ 99 99999' "0)X33383  %% >87J  $           3#K3333:3  "" :       /$ .          r:rc t|dk(rt|j|St|j|S)zReturns the MathML representation of expr. If printer is presentation then prints Presentation MathML else prints content MathML. presentation)rrWr_)rRprinterrJs r8mathmlr>s8 . (2::4@@#H-55d;;r:c |dk(r t|}n t|}|jt|}|j }t |y)a Prints a pretty representation of the MathML code for expr. If printer is presentation then prints Presentation MathML else prints content MathML. Examples ======== >>> ## >>> from sympy import print_mathml >>> from sympy.abc import x >>> print_mathml(x+1) #doctest: +NORMALIZE_WHITESPACE x 1 >>> print_mathml(x+1, printer='presentation') x + 1 rN)rr_rNr toprettyxmlprint)rRrrJrNxml pretty_xmls r8 print_mathmlrIsF2. %h /  * ((74= !C"J *r:N)content)$r\ __future__rtypingrsympy.core.mulrsympy.core.singletonrsympy.core.sortingrsympy.core.sympifyrsympy.printing.conventionsr r sympy.printing.precedencer r r &sympy.printing.pretty.pretty_symbologyrsympy.printing.printerrr mpmath.libmprrrrgrr_rrr MathMLPrinterr?r:r8rs#"/&H??@:EE<)<)~J,J^X 1Xv0!"<#< H% r: