
    XhZ+                   0   d 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 ddlmZmZ dd	lmZmZmZ dd
lmZ ddlmZmZ ddlmZmZmZ  G d de          Z G d de          Z G d de          Z  ee          dd            Z!ddZ"eZ#dS )z
A MathML printer.
    )annotations)Any)Mul)S)default_sort_key)sympify)split_super_subrequires_partial)precedence_traditional
PRECEDENCEPRECEDENCE_TRADITIONAL)greek_unicode)Printerprint_function)prec_to_dpsrepr_dpsto_strc                  V    e Zd ZU dZddddddddddddi d	dd
Zded<   ddZd Zd ZdS )MathMLPrinterBasez^Contains common code required for MathMLContentPrinter and
    MathMLPresentationPrinter.
    Nzutf-8Fabbreviated[plainT&#xB7;)orderencodingfold_frac_powersfold_func_bracketsfold_short_fracinv_trig_styleln_notationlong_frac_ratio	mat_delimmat_symbol_style
mul_symbolroot_notationsymbol_namesmul_symbol_mathml_numbersdisable_split_super_subzdict[str, Any]_default_settingsc                     t          j         |           ddlm}m}  |             _         G d d|           fd}| j        _        d S )Nr   )DocumentTextc                      e Zd ZddZdS )+MathMLPrinterBase.__init__.<locals>.RawText c                v    | j         r1|                    d                    || j         |                     d S d S )Nz{}{}{})datawriteformat)selfwriterindent	addindentnewls        g/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/sympy/printing/mathml.pywritexmlz4MathMLPrinterBase.__init__.<locals>.RawText.writexml7   sC    9 KLLD!I!IJJJJJK K    N)r/   r/   r/   )__name__
__module____qualname__r:    r;   r9   RawTextr.   6   s.        K K K K K Kr;   r@   c                B                 }| |_         j        |_        |S N)r1   domownerDocument)r1   rr@   r4   s     r9   createRawTextNodez5MathMLPrinterBase.__init__.<locals>.createRawTextNode;   s#    		AAF"hAOHr;   )r   __init__xml.dom.minidomr+   r,   rC   createTextNode)r4   settingsr+   r,   rF   r@   s   `    @r9   rG   zMathMLPrinterBase.__init__,   s    x(((222222228::	K 	K 	K 	K 	Kd 	K 	K 	K
	 	 	 	 	 	 #4r;   c                    t          j        | |          }|                                }|                    dd          }|                                }|S )z2
        Prints the expression as MathML.
        asciixmlcharrefreplace)r   _printtoxmlencodedecode)r4   exprmathMLunistrxmlbstrress         r9   doprintzMathMLPrinterBase.doprintC   sJ     d++--)<==nn
r;   c                D    | j         d         r|g g fS t          |          S )Nr(   )	_settingsr	   )r4   names     r9   _split_super_subz"MathMLPrinterBase._split_super_subM   s,    >34 	)"b>!"4(((r;   rB   )	r<   r=   r>   __doc__r)   __annotations__rG   rW   r[   r?   r;   r9   r   r      s          
 !#'#%-#() )    $4 4 4 4.  ) ) ) ) )r;   r   c                      e Zd ZdZdZd Zd Zd'dZd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZeZeZd Zd Zd Zd Zd Z d Z!d Z"d  Z#d! Z$d" Z%e"Z&e"Z'e"Z(d# Z)d$ Z*d% Z+d& Z,dS )(MathMLContentPrinterz}Prints an expression to the Content MathML markup language.

    References: https://www.w3.org/TR/MathML2/chapter4.html
    _mathml_contentc                   i 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ddddddi 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.d/d0d1d2d3d4i d5d6d7d8d9d:d;d8d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdX}|j         j        D ]}|j        }||v r
||         c S |j         j        }|                                S )Y)Returns the MathML tag for an expression.Addplusr   times
DerivativediffNumbercnintPowpowerMaxmaxMinminAbsabsAndandOrorXorxorNotnotImpliesimpliesSymbolciMatrixSymbolRandomSymbolIntegralSumsumsincostancotcscsecsinhcoshtanhcothcschsechasinarcsinasinharcsinhacosarccosacosharccoshatanarctanatanharctanhatan2acotarccotacotharccothasecarcsecasecharcsechacscarccscacscharccschloglnEqualityeq
UnequalityneqGreaterThangeqLessThanleqStrictGreaterThangtStrictLessThanltunion	intersect)UnionIntersection	__class____mro__r<   lower)r4   e	translateclsns        r9   
mathml_tagzMathMLContentPrinter.mathml_tag[   s   6
66
76
 &6
 d	6

 46
 76
 56
 56
 56
 56
 $6
 56
 56
 y6
 d6
  D!6
" D#6
 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
@ HA6
B YC6
D HE6
 6
 6
F YG6
H HI6
J YK6
L XM6
N HO6
P YQ6
R HS6
T YU6
V HW6
X YY6
Z 4[6
\ ]6
^ %_6
` 5a6
b c6
d  e6
f dg6
 6
h 'k6
 6
 6
	p ;& 	$ 	$CAI~~ |###  K wwyyr;   c                   |                                 rr| j                            d          }|                    | j                            d                     |                    |                     |                      |S ddlm}  ||          \  }}|t          j        ur| j                            d          }|                    | j                            d                     |                    | 	                    |                     |                    | 	                    |                     |S |
                                \  }}|t          j        u r.t          |          dk    r| 	                    |d                   S | j        dk    r&t          j        |                                          }| j                            d          }|                    | j                            d                     |dk    r(|                    | 	                    |                     |D ]*}|                    | 	                    |                     +|S )	Napplyminusr   fractiondivide   oldre   )could_extract_minus_signrC   createElementappendChild
_print_Mulsympy.simplifyr   r   OnerN   as_coeff_mullenr   r   
_from_argsas_ordered_factors)	r4   rR   xr   numerdenomcoefftermsterms	            r9   r   zMathMLContentPrinter._print_Mul   s   ((** 	&&w//AMM$(0099:::MM$//4%00111H++++++x~~u&&w//AMM$(00::;;;MM$++e,,---MM$++e,,---H((**uAE>>c%jjAoo ;;uQx(((:N5))<<>>EH""7++	dh,,W55666A::MM$++e,,--- 	- 	-DMM$++d++,,,,r;   Nc                   |                      ||          }|                     |d                   }g }|dd          D ]}|                                r| j                            d          }|                    | j                            d                     |                    |           |                    |                     |                      |}||d         k    r|                    |           |                    |           |                     |          }||d         k    r(|                    |                     |                      t          |          dk    r|S | j                            d          }|                    | j                            d                     |r*|                    |                    d                     |*|S )Nr   r   r   r   r   rd   )	_as_ordered_termsrN   r   rC   r   r   appendr   pop)r4   rR   r   argslastProcessed	plusNodesargr   s           r9   
_print_AddzMathMLContentPrinter._print_Add   s   %%d%%88DG,,	8 	7 	7C++-- 7H**733dh44W==>>>m,,,dkk3$//000 !$r(??$$]333  /// $C 0 0$r(??$$T[[%5%5666y>>Q  H""7++	dh,,V44555 	,MM)--**+++  	,r;   c                   |j         d         j        dk    rt          d          | j                            d          }t          |j                   D ]\  }\  }}|t          |j                   dz
  k    rI|dk    rC| j                            d          }|                    |                     |                     nj| j                            d          }|                    |                     |                     |                    |                     |                     |                    |           |S )Nr   TzAll 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   	otherwisepiece)	r   cond
ValueErrorrC   r   	enumerater   r   rN   )r4   rR   rootir   cr   s          r9   _print_Piecewisez%MathMLContentPrinter._print_Piecewise   s*   9R=%%  / 0 0 0
 x%%k22"49-- 	$ 	$IAv1C	NNQ&&&199..{;;!!$++a..1111..w77!!$++a..111!!$++a..111U####r;   c           	     T   | j                             d          }t          |j                  D ]x}| j                             d          }t          |j                  D ]2}|                    |                     |||f                              3|                    |           y|S )Nmatrix	matrixrow)rC   r   rangerowscolsr   rN   )r4   mr   r   x_rjs         r9   _print_MatrixBasez&MathMLContentPrinter._print_MatrixBase   s    H""8,,qv 	 	A(((55C16]] 6 6AadG 4 45555MM#r;   c                   |j         dk    r[| j                            d          }|                    | j                            t          |j                                       |S | j                            d          }|                    | j                            d                     | j                            d          }|                    | j                            t          |j                                       | j                            d          }|                    | j                            t          |j                                        |                    |           |                    |           |S )Nr   ri   r   r   )qrC   r   r   rI   strp)r4   r   r   xnumxdenoms        r9   _print_Rationalz$MathMLContentPrinter._print_Rational   s3   3!88&&t,,AMM$(11#ac((;;<<<HH""7++	dh,,X66777x%%d++00QS::;;;''--48223qs88<<===	d	fr;   c                   | j                             d          }|                    | j                             |                     |                               | j                             d          }| j                             d          }|                    |                     |j        d                              |                    |                     |j        d                              |                    |           |                    |           |                    |                     |j        d                              |S )Nr   bvarlowlimitr      r   )rC   r   r   r   rN   r   )r4   r   r   x_1x_2s        r9   _print_Limitz!MathMLContentPrinter._print_Limit  s   H""7++	dh,,T__Q-?-?@@AAAh$$V,,h$$Z00AF1I..///AF1I..///	c	c	dkk!&),,---r;   c                6    | j                             d          S )N
imaginaryirC   r   r4   r   s     r9   _print_ImaginaryUnitz)MathMLContentPrinter._print_ImaginaryUnit      x%%l333r;   c                6    | j                             d          S )N
eulergammar  r  s     r9   _print_EulerGammaz&MathMLContentPrinter._print_EulerGamma  r  r;   c                    | j                             d          }|                    | j                             d                     |S )zwWe use unicode #x3c6 for Greek letter phi as defined here
        https://www.w3.org/2003/entities/2007doc/isogrk1.htmlri   u   φrC   r   r   rI   r4   r   r   s      r9   _print_GoldenRatioz'MathMLContentPrinter._print_GoldenRatio   sA     H""4((	dh--.JKKLLLr;   c                6    | j                             d          S )Nexponentialer  r  s     r9   _print_Exp1z MathMLContentPrinter._print_Exp1'  s    x%%n555r;   c                6    | j                             d          S )Npir  r  s     r9   	_print_PizMathMLContentPrinter._print_Pi*  s    x%%d+++r;   c                6    | j                             d          S )Ninfinityr  r  s     r9   _print_Infinityz$MathMLContentPrinter._print_Infinity-      x%%j111r;   c                6    | j                             d          S )N
notanumberr  r  s     r9   
_print_NaNzMathMLContentPrinter._print_NaN0  r  r;   c                6    | j                             d          S )Nemptysetr  r  s     r9   _print_EmptySetz$MathMLContentPrinter._print_EmptySet3  r   r;   c                6    | j                             d          S )Ntruer  r  s     r9   _print_BooleanTruez'MathMLContentPrinter._print_BooleanTrue6  s    x%%f---r;   c                6    | j                             d          S )Nfalser  r  s     r9   _print_BooleanFalsez(MathMLContentPrinter._print_BooleanFalse9  s    x%%g...r;   c                    | j                             d          }|                    | j                             d                     |                    | j                             d                     |S )Nr   r   r  )rC   r   r   r  s      r9   _print_NegativeInfinityz,MathMLContentPrinter._print_NegativeInfinity<  s`    H""7++	dh,,W55666	dh,,Z88999r;   c                |      fdt          j                  }|                                  |          S )Nc                   j                             d          }|                    j                                                                                j                             d          }|                                        | d         d                              |                    |           t          | d                   dk    rƉj                             d          }|                                        | d         d                              |                    |           j                             d          }|                                        | d         d                              |                    |           t          | d                   dk    rcj                             d          }|                                        | d         d                              |                    |           t          |           dk    r.|                                        j                             n&|                     | dd                               |S )	Nr   r  r      r  r   uplimitr  )rC   r   r   r   rN   r   function)limitsr   	bvar_elemlow_elemup_elemr   
lime_recurr4   s        r9   r8  z8MathMLContentPrinter._print_Integral.<locals>.lime_recurC  s	   &&w//AMM$(001C1CDDEEE..v66I!!$++fQil";";<<<MM)$$$6!9~~""811*==$$T[[1%>%>???h'''(00;;##DKKq	!$=$=>>>g&&&6!9~~""(00;;##DKKq	!$=$=>>>g&&&6{{adkk!*556666jj44555Hr;   )listr4  reverse)r4   r   r4  r8  s   `` @r9   _print_Integralz$MathMLContentPrinter._print_IntegralB  sW    	 	 	 	 	 	 	0 ahz&!!!r;   c                ,    |                      |          S rB   )r;  r  s     r9   
_print_SumzMathMLContentPrinter._print_Sum_  s     ##A&&&r;   c                     j                                                  |                    } fd}d                      |j                  \  }}} |          }fd|D             }fd|D             } j                             d          }|                     j                             |                     |s|s/|                     j                             |                     nH j                             d          }|                    |           |                     ||                     |                    |           n|sc j                             d          }	|	                    |           |	                     ||                     |                    |	           n j                             d          }
|
                    |           |
                     ||                     |
                     ||                     |                    |
           |S )	Nc                   t          |           dk    rj                            d          }t          |           D ]\  }}|dk    r\j                            d          }|                    j                            d                     |                    |           j                            d          }|                    j                            |                     |                    |           |S j                            d          }|                    j                            | d                              |S )Nr   zmml:mrowr   zmml:mo mml:mir   rC   r   r   r   rI   itemsmrowr   itemmomir4   s         r9   joinz0MathMLContentPrinter._print_Symbol.<locals>.joing  s)   5zzA~~x--j99(// ) )GAt1uu!X33H==tx'>'>s'C'CDDD((,,,//99BNN48#:#:4#@#@AAA$$R((((X++H55tx66uQx@@AAA	r;   c                @    | t           v rt          j        |           S | S rB   r   getss    r9   r   z5MathMLContentPrinter._print_Symbol.<locals>.translatey  #    M!!$(+++r;   c                &    g | ]} |          S r?   r?   .0supr   s     r9   
<listcomp>z6MathMLContentPrinter._print_Symbol.<locals>.<listcomp>  !    333S))C..333r;   c                &    g | ]} |          S r?   r?   rR  subr   s     r9   rT  z6MathMLContentPrinter._print_Symbol.<locals>.<listcomp>  !    ///3		#///r;   rA  zmml:msubzmml:msupzmml:msubsup)rC   r   r   r[   rZ   r   rI   )r4   symr~   rI  rZ   superssubsmnamemsubmsupmsubsupr   s   `          @r9   _print_Symbolz"MathMLContentPrinter._print_Symbold  sL   X##DOOC$8$899	 	 	 	 	$	 	 	 "2238<<fdy3333F333////$///&&x00$(11$77888 	( %tx66t<<====x--j99  '''  d,,,t$$$$ 
(x--j99  '''  f...t$$$$(00??##E***##DDJJ///##DDLL111w'''	r;   c                   | j         d         rF|j        j        r9|j        j        dk    r(| j                            d          }|                    | j                            d                     |j        j        dk    r| j                            d          }| j                            d          }|                    | j                            t          |j        j                                       |                    |           |                    |           |                    | 
                    |j                             |S | j                            d          }| j                            |                     |                    }|                    |           |                    | 
                    |j                             |                    | 
                    |j                             |S )Nr%   r   r   r   r  degreeri   )rY   expis_Rationalr   rC   r   r   r   rI   r   rN   baser   )r4   r   r   xmldegxmlcnr  s         r9   
_print_PowzMathMLContentPrinter._print_Pow  s    N?+ 	0A 	EGqLL&&w//AMM$(0088999uw!||//99..t44!!$("9"9#aeg,,"G"GHHH""5)))f%%%MM$++af--...HH""7++h$$T__Q%7%788	c	dkk!&))***	dkk!%(()))r;   c                    | j                             |                     |                    }|                    | j                             t          |                               |S rB   rC   r   r   r   rI   r   r  s      r9   _print_Numberz"MathMLContentPrinter._print_Number  P    H""4??1#5#566	dh--c!ff55666r;   c                   | j                             |                     |                    }t          |j        t          |j                            }|                    | j                             |                     |S rB   )	rC   r   r   mlib_to_str_mpf_r   _precr   rI   )r4   r   r   repr_es       r9   _print_Floatz!MathMLContentPrinter._print_Float  se    H""4??1#5#566QWhqw&7&788	dh--f55666r;   c                   | j                             d          }|                     |          }t          |j                  rd}|                    | j                             |                     | j                             d          }t          |j                  D ]\  }}|                    |                     |                     |dk    rd| j                             d          }|                    |                     t          |                               |                    |           |                    |           |                    |                     |j                             |S )Nr   partialdiffr  r   rc  )
rC   r   r   r
   rR   r   reversedvariable_countrN   r   )r4   r   r   diff_symbolr  rZ  re   rc  s           r9   _print_Derivativez&MathMLContentPrinter._print_Derivative  s@   H""7++ooa((AF## 	('K	dh,,[99:::h$$V,,"1#344 	( 	(JCOODKK,,---qyy//99""4;;wu~~#>#>???'''	c	dkk!&))***r;   c                   | j                             d          }|                    | j                             |                     |                               |j        D ]*}|                    |                     |                     +|S Nr   )rC   r   r   r   r   rN   r4   r   r   r   s       r9   _print_Functionz$MathMLContentPrinter._print_Function  s|    H""7++	dh,,T__Q-?-?@@AAA6 	, 	,CMM$++c**++++r;   c                    | j                             |                     |                    }|j        D ]*}|                    |                     |                     +|S rB   )rC   r   r   r   r   rN   r|  s       r9   _print_Basicz!MathMLContentPrinter._print_Basic  sZ    H""4??1#5#5666 	, 	,CMM$++c**++++r;   c                "   | j                             d          }| j                             |                     |                    }|                    |           |j        D ]*}|                    |                     |                     +|S r{  )rC   r   r   r   r   rN   )r4   r   r   r  r   s        r9   _print_AssocOpz#MathMLContentPrinter._print_AssocOp  s    H""7++h$$T__Q%7%788	c6 	, 	,CMM$++c**++++r;   c                n   | j                             d          }|                    | j                             |                     |                               |                    |                     |j                             |                    |                     |j                             |S r{  )rC   r   r   r   rN   lhsrhsr  s      r9   _print_Relationalz&MathMLContentPrinter._print_Relational  s    H""7++	dh,,T__Q-?-?@@AAA	dkk!%(()))	dkk!%(()))r;   c                    | j                             d          }|D ]*}|                    |                     |                     +|S )zgMathML reference for the <list> element:
        https://www.w3.org/TR/MathML2/chapter4.html#contm.listr9  )rC   r   r   rN   )r4   seqdom_elementrF  s       r9   _print_listz MathMLContentPrinter._print_list  sQ     h,,V44 	7 	7D##DKK$5$56666r;   c                    | j                             |                     |                    }|                    | j                             t          |                               |S rB   rk  r4   r   r  s      r9   
_print_intzMathMLContentPrinter._print_int  S    h,,T__Q-?-?@@ 7 7A ? ?@@@r;   c                    | j                             d          }|j        D ]*}|                    |                     |                     +|S )Nset)rC   r   r   r   rN   r|  s       r9   _print_FiniteSetz%MathMLContentPrinter._print_FiniteSet  sN    H""5))6 	, 	,CMM$++c**++++r;   c                    | j                             d          }|                    | j                             d                     |j        D ]*}|                    |                     |                     +|S )Nr   setdiffrC   r   r   r   rN   r|  s       r9   _print_Complementz&MathMLContentPrinter._print_Complement  sp    H""7++	dh,,Y778886 	, 	,CMM$++c**++++r;   c                    | j                             d          }|                    | j                             d                     |j        D ]*}|                    |                     |                     +|S )Nr   cartesianproductr  r|  s       r9   _print_ProductSetz&MathMLContentPrinter._print_ProductSet  sq    H""7++	dh,,-?@@AAA6 	, 	,CMM$++c**++++r;   c                |   | j                             |                     |                    }|j        D ]Y}| j                             d          }|                    |                     |                     |                    |           Z|                    |                     |j                             |S )Nr  )rC   r   r   	signaturer   rN   rR   )r4   r   r   r   r  s        r9   _print_Lambdaz"MathMLContentPrinter._print_Lambda  s     H""4??1#5#566; 	 	C(((00COODKK,,---MM#	dkk!&))***r;   rB   )-r<   r=   r>   r\   printmethodr   r   r   r   r   r  r	  r  r  r  r  r  r  r#  r&  r)  r,  r.  r;  r=  ra  _print_MatrixSymbol_print_RandomSymbolri  rl  rs  ry  r}  r  r  r  r  r  _print_Implies
_print_Not
_print_Xorr  r  r  r  r?   r;   r9   r_   r_   T   s\         $K@ @ @D! ! !F   8  *    $  4 4 44 4 4  6 6 6, , ,2 2 24 4 42 2 2. . ./ / /  " " ":' ' '
6 6 6p ('  .  
    &            
 $NJJ      	 	 	 	 	r;   r_   c                  n   e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd ZddZd ZddZd ZddZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd  Z d! Z!d" Z"d# Z#d$ Z$d% Z%dd'Z&d( Z'e&Z(d) Z)d* Z*d+ Z+d, Z,d- Z-d. Z.d/ Z/d0 Z0d1 Z1d2 Z2d3 Z3d4 Z4d5 Z5d6 Z6d7 Z7dd8Z8e8Z9d9 Z:dd:Z;dd;Z<d< Z=d= Z>d> Z?d? Z@d@ ZAdA ZBdB ZCdC ZDdD ZEeEZFdE ZGdF ZHdG ZIdH ZJdI ZKdJ ZLdK ZMdL ZNdM ZOeOZPeOZQdN ZRdO ZSdP ZTeTxZUZVdQ ZWdR ZXdS ZYdT ZZdU Z[dV Z\dW Z]dX Z^dY Z_dZ Z`d[ Zad\ Zbd] Zcd^ Zdd_ Zed` Zfda Zgdb Zhdc Zidd Zjde ZkekZldf Zmdg Zndh Zodi Zpdj Zqdk Zrdl Zsdm Ztdn Zudo Zvdp Zwdq Zxdr Zyds Zzdt Z{du Z|dv Z}dw Z~dx Zdy Zdz Zd{ Zd| Zd} Zd~ Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdS )MathMLPresentationPrinterzPrints an expression to the Presentation MathML markup language.

    References: https://www.w3.org/TR/MathML2/chapter3.html
    _mathml_presentationc                    i 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ddddddi ddd dd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d8d:d;d<d=d>d?d@dAdBdCdDdEdFd@dAdGdHdIdJ} fdK}|j         j        D ]}|j        }||v r
||         c S |j         j        dLk    r
 |            S |j         j        }|                                S )Mrb   rh   mnLimitz&#x2192;rf   &dd;rj   r}   rH  r   z&int;r   z&#x2211;r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   =r   z&#x2260;r   z&#x2265;r   z&#x2264;r   >r   <lerchphi&#x3A6;zetaz&#x3B6;dirichlet_etaz&#x3B7;
elliptic_kz&#x39A;
lowergamma&#x3B3;
uppergammaz&#x393;gammatotientz&#x3D5;reduced_totientz&#x3BB;z&#x3BD;z&#x3A9;r   CWz&#x398;TrueFalseNonez	S&#x2032;z	C&#x2032;lambda)primenu
primeomegafresnelsfresnelcLambertW	HeavisideBooleanTrueBooleanFalseNoneTypemathieusmathieucmathieusprimemathieucprimeLambdac                     j         d          j         d         dk    rdS  j         d         dk    rdS  j         d         dk    rdS  j         d         dk    rd	S t           j         d         t                    st           j         d         S )
Nr$   r  &InvisibleTimes;re   &#xD7;dotr   ldotz&#x2024;)rY   
isinstancer   	TypeError)r4   s   r9   mul_symbol_selectionzBMathMLPresentationPrinter.mathml_tag.<locals>.mul_symbol_selection_  s    |,4N<0F::))-88x-66x-77!z| <cBB 4~l33r;   r   r   )r4   r   r   r  r   r   s   `     r9   r   z$MathMLPresentationPrinter.mathml_tag*  sy   1
d1
Z1
 &1
 4	1

 d1
 1
 :1
 51
 51
 51
 51
 H1
 Y1
 H1
 Y1
  H!1
" Y#1
 1
$ H%1
& X'1
( )1
* *+1
, :-1
. 
/1
0  11
2 c31
4 	51
6 I71
8 Y91
: );1
< )=1
> )?1
@ YA1
B yC1
D yE1
 1
F !#"!#((a1
 1
 1
	f	4 	4 	4 	4 	4 ;& 	$ 	$CAI~~ |###  ;5(('')))K wwyyr;   c                    | j                             d          }|                    | j                             d                     |S )NrG  (r  r4   rG  s     r9   _l_parenz"MathMLPresentationPrinter._l_parenw  >    X##D))
tx..s33444	r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  )r  r  s     r9   _r_parenz"MathMLPresentationPrinter._r_paren|  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  {r  r  s     r9   _l_bracez"MathMLPresentationPrinter._l_brace  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  }r  r  s     r9   _r_bracez"MathMLPresentationPrinter._r_brace  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  ,r  r  s     r9   _commaz MathMLPresentationPrinter._comma  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  |r  r  s     r9   _barzMathMLPresentationPrinter._bar  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  ;r  r  s     r9   
_semicolonz$MathMLPresentationPrinter._semicolon  r  r;   c                   | j                             d          }|                    |                                            t	          |          D ]V\  }}|r'|                    |                                            |                    |                     |                     W|                    |                                            |S NrE  )rC   r   r   r  r   r  rN   r  r4   r   rE  r   r   s        r9   _paren_comma_separatedz0MathMLPresentationPrinter._paren_comma_separated  s    x%%f--)))oo 	/ 	/FAs 0  ///T[[--....)))r;   c                   | j                             d          }|                    |                                            t	          |          D ]V\  }}|r'|                    |                                            |                    |                     |                     W|                    |                                            |S r  )rC   r   r   r  r   r  rN   r  r  s        r9   _paren_bar_separatedz.MathMLPresentationPrinter._paren_bar_separated  s    x%%f--)))oo 	/ 	/FAs .  ---T[[--....)))r;   Fc                   t          |          }||k     s|s||k    r| j                            d          }|                    |                                            |                    |                     |                     |                    |                                            |S |                     |          S r  )r   rC   r   r   r  rN   r  )r4   rF  levelstrictprec_valrE  s         r9   parenthesizez&MathMLPresentationPrinter.parenthesize  s    )$//uv8u3D3D8))&11DT]]__---T[[..///T]]__---K{{4   r;   c                Z     fd} j                             d          }|                                rj j                             d          }|                     j                             d                     |                    |            || |          }n |||          }|S )Nc                   ddl m}  ||           \  }}|t          j        urȉj                            d          }j        d         r6t          t          |                     dk     r|	                    dd           
                    |          }
                    |          }|                    |           |                    |           |                    |           |S |                                 \  }}	|t          j        u rCt          |	          dk    r0|                    
                    |	d                              |S j        d	k    r&t          j        |	                                          }	|dk    r
                    |          }
j                            d
          }|                    j                                                |                                |                    |
           |                    |           |	D ]}|                                        |t(          d                              ||	d         k    soj                            d
          }|                    j                                                |                                |                    |           |S )Nr   r   mfracr      bevelledr(  r   r   rG  r   r   )r   r   r   r   rC   r   rY   r   r   setAttributerN   r   r   r   r   r   r   rI   r   r  r   )rR   rE  r   r   r   fracr   xdenr   r   r   yr   r4   s                r9   multiplyz6MathMLPresentationPrinter._print_Mul.<locals>.multiply  s   //////#8D>>LE5AE!!x--g66>"34 :SYY!9K9K%%j&999{{5)){{5))  &&&  &&&  &&&,,..LE5~~#e**//  U1X!6!6777zU""u--@@BBzzKK&&H**400dh55dood6K6KLLMMM  ###  ### ( (  !2!24E9J!K!KLLLuRy((..t44AMM$("9"9$//$:O:O"P"PQQQ$$Q'''Kr;   rE  rG  -)rC   r   r   r   rI   )r4   rR   r  rE  r   s   `    r9   r   z$MathMLPresentationPrinter._print_Mul  s    !	 !	 !	 !	 !	D x%%f--((** 	(&&t,,AMM$(11#66777Q8TE4((DD8D$''Dr;   Nc                   | j                             d          }|                     ||          }|                    |                     |d                              |dd          D ]}|                                r^| j                             d          }|                    | j                             d                     |                     |           }n\| j                             d          }|                    | j                             d                     |                     |          }|                    |           |                    |           |S )NrE  r   r   r   rG  r  +)rC   r   r   r   rN   r   rI   )r4   rR   r   rE  r   r   r   r  s           r9   r   z$MathMLPresentationPrinter._print_Add  sD   x%%f--%%d%%88T!W--...8 	  	 C++-- 	%H**400dh55c::;;;KK%% H**400dh55c::;;;KK$$QQr;   c           	     l   | j                             d          }t          |j                  D ]}| j                             d          }t          |j                  D ]a}| j                             d          }|                    |                     |||f                              |                    |           b|                    |           | j        d         }|dk    r|S | j                             d          }| j                             d          }	|dk    r[|                    | j                             d                     |	                    | j                             d                     nZ|                    | j                             d	                     |	                    | j                             d
                     | j                             d          }
|
                    |           |
                    |           |
                    |	           |
S )Nmtablemtrmtdr"   r/   rG  r   ]r  r  rE  )	rC   r   r   r   r   r   rN   rY   rI   )r4   r   tabler   r   r   r  r"   leftrightrE  s              r9   r   z+MathMLPresentationPrinter._print_MatrixBase  s   &&x00qv 	! 	!A&&u--A16]] ! !H**511dkk!AqD'22333a    a    N;/	??Lx%%d++&&t,,TX44S99:::dh55c::;;;;TX44S99:::dh55c::;;;x%%f--r;   c                   |j         dk     r	|j          }n|j         }| j                            d          }|s| j        d         r|                    dd           |                    |                     |                     |                    |                     |j                             |j         dk     r| j                            d          }| j                            d          }|                    | j                            d                     |                    |           |                    |           |S |S )	Nr   r  r   r  r(  rE  rG  r  )	r   rC   r   rY   r  r   rN   r   rI   )r4   r   foldedr   r   rE  rG  s          r9   _get_printed_Rationalz/MathMLPresentationPrinter._get_printed_Rational  s$   377AAAH""7++ 	/T^$56 	/NN:v...	dkk!nn%%%	dkk!#&&'''3778))&11D''--BNN4822377888R   QKHr;   c                    |j         dk    r|                     |j                  S |                     || j        d                   S )Nr   r   )r   rN   r   r  rY   r  s     r9   r  z)MathMLPresentationPrinter._print_Rational)  s?    3!88;;qs###))!T^<M-NOOOr;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     | j                             d          }|                     |j        d                   }| j                             d          }|                    | j                             |                     |                               |                     |j        d                   }|                    |           |                    |           |                    |           |                    |           |                    |           |                    |           |                    |                     |j        d                              |S )	NrE  munderrH  limr   rG  r  r   )rC   r   r   rI   rN   r   r   )	r4   r   rE  r  rH  r   r  arrowr  s	            r9   r	  z&MathMLPresentationPrinter._print_Limit0  s   x%%f--''11X##D))
tx..u55666H""6**kk!&)$$&&t,,$(11$//!2D2DEEFFFkk!&)$$	c	e	c21   QVAY//000r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&ImaginaryI;r  r  s      r9   r  z.MathMLPresentationPrinter._print_ImaginaryUnitF  s>    H""4((	dh--n==>>>r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  r  r  r  s      r9   r  z,MathMLPresentationPrinter._print_GoldenRatioK  >    H""4((	dh--i88999r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&ExponentialE;r  r  s      r9   r  z%MathMLPresentationPrinter._print_Exp1P  s?    H""4((	dh--.>??@@@r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&pi;r  r  s      r9   r  z#MathMLPresentationPrinter._print_PiU  s>    H""4((	dh--f55666r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  &#x221E;r  r  s      r9   r  z)MathMLPresentationPrinter._print_InfinityZ  >    H""4((	dh--j99:::r;   c                F   | j                             d          }| j                             d          }|                    | j                             d                     |                     |          }|                    |           |                    |           |S )NrE  rG  r  )rC   r   r   rI   r  )r4   r   rE  r  r   s        r9   r.  z1MathMLPresentationPrinter._print_NegativeInfinity_  s    x%%f--H""4((	dh--c22333  ##r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&#x210F;r  r  s      r9   _print_HBarz%MathMLPresentationPrinter._print_HBarh  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  r  r  r  s      r9   r  z+MathMLPresentationPrinter._print_EulerGammam  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  TribonacciConstantr  r  s      r9   _print_TribonacciConstantz3MathMLPresentationPrinter._print_TribonacciConstantr  s?    H""4((	dh--.BCCDDDr;   c                    | j                             d          }|                    |                     |j        d                              |                    | j                             d                     |S )Nr_  r   &#x2020;rC   r   r   rN   r   rI   r4   r   r_  s      r9   _print_Daggerz'MathMLPresentationPrinter._print_Daggerw  sf    x%%f--QVAY//00000<<===r;   c                   | j                             d          }|                    |                     |j        d                              | j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |S )NrE  r   rG  z&#x2208;r   r"  )r4   r   rE  rG  s       r9   _print_Containsz)MathMLPresentationPrinter._print_Contains}  s    x%%f--QVAY//000X##D))
tx..z::;;;QVAY//000r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&#x210B;r  r  s      r9   _print_HilbertSpacez-MathMLPresentationPrinter._print_HilbertSpace  r  r;   c                    | j                             d          }|                    | j                             d                     |                    |                     |j        d                              |S )Nr_  z	&#x1D49E;r   rC   r   r   rI   rN   r   r#  s      r9   _print_ComplexSpacez-MathMLPresentationPrinter._print_ComplexSpace  sf    x%%f--00==>>>QVAY//000r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z&#x2131;r  r  s      r9   _print_FockSpacez*MathMLPresentationPrinter._print_FockSpace  r  r;   c                   dddd}| j                             d          }t          |j                  dk    rt	          d |j        D                       rv| j                             d          }|                    | j                             |t          |j                                                |                    |           nt          |j                  D ]}| j                             d          }|                    | j                             |d	                              t          |          d	k    r|                    |           t          |          d
k    rr| j                             d          }|                    |           |                    |                     |d	                              |                    |           t          |          dk    r| j                             d          }|                    |           |                    |                     |d	                              |                    |                     |d
                              |                    |           |                    | 	                    |j
        t          d         d                     t          |j                  D ]}| j                             d          }|                    | j                             d                     |                    |           |                    |                     |d                              |S )Nz&#x222B;z&#x222C;z&#x222D;)r   r  r1  rE  r1  c              3  <   K   | ]}t          |          d k    V  dS )r   N)r   )rR  r  s     r9   	<genexpr>z<MathMLPresentationPrinter._print_Integral.<locals>.<genexpr>  s,      (N(N3SQ(N(N(N(N(N(Nr;   rG  r   r  r_  r`  r   Tr  r  r   )rC   r   r   r4  allr   rI   rv  rN   r  r3  r   )	r4   rR   
intsymbolsrE  rG  r  r_  r`  ds	            r9   r;  z)MathMLPresentationPrinter._print_Integral  s   #
zBB
x%%f--t{q  S(N(N$+(N(N(N%N%N ''--BNN4822:c$+>N>N3OPPQQQR      ,, . .X++D11tx66z!}EEFFFs88q==$$R(((s88q==811&99D$$R((($$T[[Q%8%8999$$T***s88q=="h44Y??G''+++''CF(;(;<<<''CF(;(;<<<$$W---**4=*U:K26 + 8 8 	9 	9 	9 DK(( 	2 	2C&&t,,AMM$(11&99:::QT[[Q001111r;   c                n   t          |j                  }| j                            d          }|                     |d         d                   }|                     |d         d                   }| j                            d          }|                    | j                            |                     |                               | j                            d          }|                     |d         d                   }| j                            d          }	|	                    | j                            d                     |                    |           |                    |	           |                    |           |                    |           |                    |           |                    |           | j                            d          }
|
                    |           |
                    |                     |j	        t          |                               |
S )N
munderoverr   r   r  rG  rE  r  )r9  r4  rC   r   rN   r   rI   r   r  r3  r   )r4   r   r4  subsupr6  r7  summandlowvarequalrE  s              r9   r=  z$MathMLPresentationPrinter._print_Sum  s   ah''55;;vay|,,++fQil++(((..DH33DOOA4F4FGGHHHh$$V,,kk&)A,''&&t,,$(11#66777!!!7###37###x%%f--   **1:7Ma7P7PQQRRRr;   r   c                   	  fd}d 	                      |j                  \  }}} 	|          }	fd|D             }	fd|D             } j                            d          }|                     j                            |                     t          |          dk    ret          |          dk    r|}n j                            d          }|                    |           |                     ||                     nt          |          dk    rN j                            d          }|                    |           |                     ||                     nk j                            d	          }|                    |           |                     ||                     |                     ||                     |d
k    r|                    dd
           |S )Nc                   t          |           dk    rj                            d          }t          |           D ]\  }}|dk    r\j                            d          }|                    j                            d                     |                    |           j                            d          }|                    j                            |                     |                    |           |S j                            d          }|                    j                            | d                              |S )Nr   rE  r   rG  r@  rH  rB  rC  s         r9   rI  z5MathMLPresentationPrinter._print_Symbol.<locals>.join  s)   5zzA~~x--f55(// ) )GAt1uu!X33D99tx'>'>s'C'CDDD((,,,//55BNN48#:#:4#@#@AAA$$R((((X++D11tx66uQx@@AAA	r;   c                @    | t           v rt          j        |           S | S rB   rK  rM  s    r9   r   z:MathMLPresentationPrinter._print_Symbol.<locals>.translate  rO  r;   c                &    g | ]} |          S r?   r?   rQ  s     r9   rT  z;MathMLPresentationPrinter._print_Symbol.<locals>.<listcomp>  rU  r;   c                &    g | ]} |          S r?   r?   rW  s     r9   rT  z;MathMLPresentationPrinter._print_Symbol.<locals>.<listcomp>  rY  r;   rH  r   r^  r_  r`  boldmathvariant)r[   rZ   rC   r   r   rI   r   r  )
r4   rZ  stylerI  rZ   r[  r\  r]  r   r   s
   `        @r9   ra  z'MathMLPresentationPrinter._print_Symbol  s   	 	 	 	 	$	 	 	 "2238<<fdy3333F333////$///&&t,,$(11$77888v;;!4yyA~~H**622e$$$dd4jj))))4yyA~~H**622e$$$dd6ll++++H**955e$$$dd4jj)))dd6ll+++F??NN=&111r;   c                F    |                      || j        d                   S )Nr#   )rC  )ra  rY   )r4   rZ  s     r9   r  z-MathMLPresentationPrinter._print_MatrixSymbol  s/    !!#(,7I(J " L L 	Lr;   c                    | j                             d          }|                    dd           |                    |                     |j        d                              |S )Nmenclosenotationtopr   )rC   r   r  r   rN   r   )r4   rR   encs      r9   _print_conjugatez*MathMLPresentationPrinter._print_conjugate  sV    h$$Z00U+++DIaL11222
r;   c                Z   | j                             d          }|                    |                     |t          d                              | j                             d          }|                    | j                             |                     |                    |           |S )NrE  FuncrG  )rC   r   r   r  r   rI   )r4   oprR   rowrG  s        r9   _print_operator_afterz/MathMLPresentationPrinter._print_operator_after  s    h$$V,,))$
60BCCDDDX##D))
tx..r22333
r;   c                D    |                      d|j        d                   S )N!r   rO  r   r4   rR   s     r9   _print_factorialz*MathMLPresentationPrinter._print_factorial   s    ))#ty|<<<r;   c                D    |                      d|j        d                   S )Nz!!r   rR  rS  s     r9   _print_factorial2z+MathMLPresentationPrinter._print_factorial2#  s    ))$	!===r;   c                ,   | j                             d          }|                    dd           |                    |                     |j        d                              |                    |                     |j        d                              | j                             d          }|                    |                                            |                    |           |                    |                                            |S )Nr  linethickness0r   r   rE  )rC   r   r  r   rN   r   r  r  )r4   rR   r  bracs       r9   _print_binomialz)MathMLPresentationPrinter._print_binomial&  s    x%%g../3///TYq\22333TYq\22333x%%f--))))))r;   c                	   |j         j        rt          |j         j                  dk    rj|j         j        dk    rY| j        d         rK|j         j        dk    rG| j                            d          }|                    | 	                    |j
                             |j         j        dk    ry| j                            d          }|                    | 	                    |j
                             |                    | 	                    |j         j                             |j         j        dk    rY| j                            d          }|                    | 	                    d                     |                    |           |S |S |j         j        r|j         j        dk    r|j         j        r| j                            d          }|                    | 	                    d                     | j                            d          }|                    |                     |j
        t          d	                              |                    |                     |j          | j        d
                              |                    |           |S | j                            d          }|                    |                     |j
        t          d	                              |                    |                     |j         | j        d
                              |S |j         j        r| j                            d          }|                    | 	                    d                     |j         dk    r.|                    | 	                    |j
                             n| j                            d          }|                    |                     |j
        t          d	                              |                    | 	                    |j                               |                    |           |S | j                            d          }|                    |                     |j
        t          d	                              |                    | 	                    |j                              |S )Nr   r%   r  msqrtmrootr   r  r_  rk   r   )rd  re  rr   r   r   rY   rC   r   r   rN   rf  is_negativer  r   r  )r4   r   r   r  rH  s        r9   ri  z$MathMLPresentationPrinter._print_Pow1  s    E 	#aeg,,!"3"31/ 9Euw!||H**733dkk!&11222uw!||H**733dkk!&11222dkk!%'22333uw"}}x--g66  Q000  ###5 	Au  h,,W55A///H**622d//
58IJJKKKd88!%$(N3E$FH H I I I"""
H**622d//
58IJJKKKd88$(N3E$FH H I I I5 
	h,,W55A///5B;;OODKK$7$78888..v66AMM$"3"3AFJu<M"N"NOOOMM$++quf"5"5666OOA&&&
H""6**	d''
50ABBCCC	dkk!%(()))r;   c                    | j                             |                     |                    }|                    | j                             t          |                               |S rB   rk  r  s      r9   rl  z'MathMLPresentationPrinter._print_Numberg  rm  r;   c                   | j                             d          }|                    | j                             d                     | j                             d          }|                    | j                             d                     | j                             d          }|                    |           |                    |                     |j                             |                    |                                            |                    |                     |j                             |                    |           |S )NrG     ⟨   ⟩rE  )rC   r   r   rI   rN   rp   r  rn   )r4   r   r  r  rZ  s        r9   _print_AccumulationBoundsz3MathMLPresentationPrinter._print_AccumulationBoundsl  s   x%%d++00::;;;&&t,,$(11(;;<<<x%%f--QU++,,,'''QU++,,,r;   c                   t          |j                  rd}n|                     |          }| j                            d          }d}t          |j                  D ]6\  }}||z  }|dk    r| j                            d          }| j                            d          }|                    | j                            |                     |                    |           |                    | 	                    |                     nG| j                            d          }|                    | j                            |                     |                    |           | 	                    |          }	|                    |	           8| j                            d          }
|dk    r| j                            d          }| j                            d          }|                    | j                            |                     |                    |           |                    | 	                    |                     nG| j                            d          }|                    | j                            |                     |
                    |           | j                            d          }| j                            d          }|                    |
           |                    |           |                    |           |                    | 	                    |j                             |S )Nz&#x2202;rE  r   r  r_  rG  r  )
r
   rR   r   rC   r   rv  rw  r   rI   rN   )r4   r   r4  r   dimrZ  numr   xxr  mnumrE  r  s                r9   ry  z+MathMLPresentationPrinter._print_Derivativey  s   AF## 	#AA""A H""6** !122 	 	HC3JCaxxH**622X++D11tx66q99:::b!!!dkk#..////H**400dh55a88999MM!C  AMM!x%%f--!88&&v..A''--BNN4822155666MM"MM$++c**++++&&t,,AMM$(11!44555x%%f--x%%g.. 	QV,,---r;   c                   | j                             d          }|                     |          dk    r;| j        d         r.|                    | j                             d                     n@|                    | j                             |                     |                               | j                             d          }|                    |           |                     | j        |j                    |S )NrH  r   r    r   rE  )rC   r   r   rY   r   rI   r  r   )r4   r   r   rE  s       r9   r}  z)MathMLPresentationPrinter._print_Function  s    H""4((??1&&4>-+H&MM$(11$778888MM$(11$//!2D2DEEFFFx%%f--44af=>>>r;   c                L   t          |j                  }t          |j        |d          }| j        d         }| j                            d          }d|v r|                    d          \  }}|d         dk    r
|dd          }| j                            d	          }|                    | j        	                    |                     |                    |           | j                            d
          }	|	                    | j        	                    |                     |                    |	           | j                            d          }
| j                            d	          }|                    | j        	                    d                     |
                    |           | j                            d	          }|                    | j        	                    |                     |
                    |           |                    |
           |S |dk    r| 
                    d           S |dk    r|                     d           S | j                            d	          }|                    | j        	                    |                     |S )NT)strip_zerosr'   rE  r   r   r   r   r  rG  r_  10z+infz-inf)r   rq  ro  rp  rY   rC   r   splitr   rI   r  r.  )r4   rR   dpsstr_real	separatorrE  mantrd  r  rG  r_  s              r9   rs  z&MathMLPresentationPrinter._print_Float  sW   $*%%tz3DAAA N#>?	x%%f--(??"..--KT31v}}!""g''--BNN4822488999R   ''--BNN48229==>>>R   8))&11D''--BNN4822488999R   ''--BNN4822377888R   T"""K''---//555''--BNN48228<<===Ir;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           | j                             d          }|                    |                                            |                    |                     |j        d                              |                    |                                            |                    |           |S )NrE  r^  rH  Lir   r   )rC   r   r   rI   rN   r   r  r  )r4   rR   rE  r   rH  rZ  s         r9   _print_polylogz(MathMLPresentationPrinter._print_polylog  s9   x%%f--H""6**X##D))
tx..t44555	b	dkk$)A,//000x%%f--)))TYq\22333)))r;   c                \   | j                             d          }| j                             d          }|                    | j                             |                     |                               |                    |           |                     | j        |j                    |S NrE  rH  )rC   r   r   rI   r   r  r   )r4   r   rE  rH  s       r9   r  z&MathMLPresentationPrinter._print_Basic  s    x%%f--X##D))
tx..tq/A/ABBCCC44af=>>>r;   c                      | j         |j         S rB   )r  r   r  s     r9   _print_Tuplez&MathMLPresentationPrinter._print_Tuple  s    *t*AF33r;   c                   | j                             d          }|j        r.|                    | j                             d                     n-|                    | j                             d                     | j                             d          }|j        r.|                    | j                             d                     n-|                    | j                             d                     | j                             d          }|                    |           |                    |                     |j                             |                    |                                            |                    |                     |j	                             |                    |           |S )NrG  r  r  r  r   rE  )
rC   r   
right_openr   rI   	left_openrN   startr  end)r4   r   r  r  rE  s        r9   _print_Intervalz)MathMLPresentationPrinter._print_Interval  sx   &&t,,< 	<dh55c::;;;;dh55c::;;;x%%d++; 	;TX44S99::::TX44S99:::x%%f--QW--...'''QU++,,,r;   c                <   | j                             d          }|                    |                                            |                    |                     |j        d                              |                    |                                            |S )NrE  r   )rC   r   r   r  rN   r   )r4   rR   rd  rE  s       r9   
_print_Absz$MathMLPresentationPrinter._print_Abs	  sz    x%%f--%%%TYq\22333%%%r;   c                <   | j                             d          }|                    |                                            |                    |                     |                     |                    |                                            | j                             d          }|                    | j                             |                     | j                             d          }|                    |           |                    |           |S rw  )rC   r   r   r  rN   r  rI   )r4   r   rR   rZ  rH  rE  s         r9   _print_re_imz&MathMLPresentationPrinter._print_re_im  s    x%%f--)))T**+++)))X##D))
tx..q11222x%%f--r;   c                D    |                      d|j        d                   S )Nu   ℜr   r  r   r4   rR   rd  s      r9   	_print_rez#MathMLPresentationPrinter._print_re        49Q<888r;   c                D    |                      d|j        d                   S )Nu   ℑr   r  r  s      r9   	_print_imz#MathMLPresentationPrinter._print_im!  r  r;   c                |   | j                             d          }| j                             d          }|                    | j                             |                     |                               |                    |           |j        D ]*}|                    |                     |                     +|S rw  )rC   r   r   rI   r   r   rN   )r4   r   rE  rH  r   s        r9   r  z(MathMLPresentationPrinter._print_AssocOp$  s    x%%f--X##D))
tx..tq/A/ABBCCC6 	/ 	/CT[[--....r;   c                   | j                             d          }|                    |                     |j        d         |                     |j        dd          D ]}| j                             d          }|                    | j                             |                     |                     ||          }|                    |           |                    |           |S NrE  r   r   rG  )rC   r   r   r  r   rI   )r4   rR   symbolprecrE  r   r   r  s           r9   _print_SetOpz&MathMLPresentationPrinter._print_SetOp-  s    x%%f--**49Q<>>???9QRR= 	  	 C&&t,,AMM$(11&99:::!!#t,,AQQr;   c                J    t           d         }|                     |d|          S )Nr   z&#x222A;r   r  r4   rR   r  s      r9   _print_Unionz&MathMLPresentationPrinter._print_Union8  s$    %g.  z4888r;   c                J    t           d         }|                     |d|          S )Nr   z&#x2229;r  r  s      r9   _print_Intersectionz-MathMLPresentationPrinter._print_Intersection<  s$    %n5  z4888r;   c                J    t           d         }|                     |d|          S )N
Complementz&#x2216;r  r  s      r9   r  z+MathMLPresentationPrinter._print_Complement@  $    %l3  z4888r;   c                J    t           d         }|                     |d|          S )NSymmetricDifference&#x2206;r  r  s      r9   _print_SymmetricDifferencez4MathMLPresentationPrinter._print_SymmetricDifferenceD  s%    %&;<  z4888r;   c                J    t           d         }|                     |d|          S )N
ProductSetz&#x00d7;r  r  s      r9   r  z+MathMLPresentationPrinter._print_ProductSetH  r  r;   c                6    |                      |j                  S rB   )
_print_setr   )r4   rN  s     r9   r  z*MathMLPresentationPrinter._print_FiniteSetL  s    qv&&&r;   c                   t          |t                    }| j                            d          }|                    |                                            t          |          D ]V\  }}|r'|                    |                                            |                    |                     |                     W|                    | 	                                           |S )NkeyrE  )
sortedr   rC   r   r   r  r   r  rN   r  )r4   rN  rD  rZ  r   rF  s         r9   r  z$MathMLPresentationPrinter._print_setO  s    q.///x%%f--))) '' 	0 	0GAt 0  ///T[[..////)))r;   c                   | j                             d          }|d         j        r|d         j        s| j                             d          }|                    |                                            |                    |                     |d                              |                    |                                            |                    |           n.|                    |                     |d                              |dd          D ](}| j                             d          }|                    | j                             |                     |j        r|j        s| j                             d          }|                    |                                            |                    |                     |                     |                    |                                            n|                     |          }|                    |           |                    |           *|S r  )	rC   r   
is_Booleanis_Notr   r  rN   r  rI   )r4   r   r  rE  rZ  r   r   r  s           r9   _print_LogOpz&MathMLPresentationPrinter._print_LogOp\  s   x%%f--7 	3d1gn 	38))&11DT]]__---T[[a11222T]]__---T""""T[[a112228 	  	 C&&t,,AMM$(11&99:::~ %cj %H**622dmmoo...dkk#..///dmmoo....KK$$QQr;   c                
   ddl m} ||j        k    r|                     |j                  S t	          ||          r'|                                                                }nd|fg}| j                            d          }|D ]\  }}t          |j
                                                  }|                    d            t          |          D ]\  }\  }	}
|
dk    r|r\| j                            d          }|                    | j                            d                     |                    |           |                    |                     |	                     |
d	k    r| j                            d          }|                    | j                            d
                     |                    |           |                    |                     |	                     "|r\| j                            d          }|                    | j                            d                     |                    |           | j                            d          }|                    |                                            |                    |                     |
                     |                    |                                            |                    |           | j                            d          }|                    | j                            d                     |                    |           |                    |                     |	                     |S )Nr   )VectorrE  c                6    | d                                          S )Nr   )__str__)r   s    r9   <lambda>zAMathMLPresentationPrinter._print_BasisDependent.<locals>.<lambda>  s    1Q4<<>> r;   r  r   rG  r   r   r  r  )sympy.vectorr  zerorN   r  separaterD  rC   r   r9  
componentssortr   r   rI   r  r  )r4   rR   r  rD  rE  systemvect
inneritemsr   kvrG  mbracs                r9   _print_BasisDependentz/MathMLPresentationPrinter._print_BasisDependentt  s$   ''''''49;;ty)))dF## 	 MMOO))++EEYKEx%%f--! 	5 	5LFDdo335566JOO"9"9O:::&z22 5 5	6Aq66 -!X33D99tx'>'>s'C'CDDD((,,,$$T[[^^4444"WW//55BNN48#:#:3#?#?@@@$$R((($$T[[^^4444 -!X33D99tx'>'>s'C'CDDD((,,, H226::E%%dmmoo666%%dkk!nn555%%dmmoo666$$U+++//55BNN48#:#:;M#N#NOOO$$R((($$T[[^^4444354 r;   c                d    t          |j        t                    }|                     |d          S )Nr  z&#x2227;r  r   r   r  r4   rR   r   s      r9   
_print_Andz$MathMLPresentationPrinter._print_And  -    di%5666  z222r;   c                d    t          |j        t                    }|                     |d          S )Nr  z&#x2228;r  r  s      r9   	_print_Orz#MathMLPresentationPrinter._print_Or  r  r;   c                d    t          |j        t                    }|                     |d          S )Nr  z&#x22BB;r  r  s      r9   r  z$MathMLPresentationPrinter._print_Xor  r  r;   c                8    |                      |j        d          S )Nz&#x21D2;)r  r   rS  s     r9   r  z(MathMLPresentationPrinter._print_Implies  s      J777r;   c                d    t          |j        t                    }|                     |d          S )Nr  z&#x21D4;r  r  s      r9   _print_Equivalentz+MathMLPresentationPrinter._print_Equivalent  r  r;   c                   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |j        d         j        r| j                             d          }|                    |                                            |                    |                     |j        d                              |                    |                                            n |                     |j        d                   }|                    |           |S )NrE  rG  z&#xAC;r   )	rC   r   r   rI   r   r  r  rN   r  )r4   r   rE  rG  r   s        r9   r  z$MathMLPresentationPrinter._print_Not  s   x%%f--X##D))
tx..x88999F1I  	'&&v..AMM$--//***MM$++afQi00111MM$--//****AF1I&&Ar;   c                    | j                             d          }|                    | j                             |                     |                               |S NrH  rC   r   r   rI   r   r4   r   rH  s      r9   _print_boolz%MathMLPresentationPrinter._print_bool  J    X##D))
tx..tq/A/ABBCCC	r;   c                    | j                             d          }|                    | j                             |                     |                               |S r  r  r  s      r9   _print_NoneTypez)MathMLPresentationPrinter._print_NoneType  r  r;   c                F   d}|j         j        r(|j        j        r|j        j        r|ddd|f}n|ddd|f}n|j         j        r||d         |j        z
  |d         f}n|j        j        r/t          |          }t          |          t          |          |f}nXt          |          dk    r6t          |          }t          |          t          |          ||d         f}nt          |          }| j	        
                    d          }|                    |                                            t          |          D ]\  }}|r'|                    |                                            ||k    r]| j	        
                    d          }|                    | j	                            |                     |                    |           |                    |                     |                     |                    |                                            |S )Nu   …r   r   r      rE  rH  )r}  is_infinitestopstepis_positiveiternextr   tuplerC   r   r   r  r   r  rI   rN   r  )	r4   rN  dotsprintsetitrZ  r   elrH  s	            r9   _print_Rangez&MathMLPresentationPrinter._print_Range  s   7 	 16#5 	 v! 0Q4/Ar4/W  		 QrUQV^QrU2HHV 	 aBBxxb4/HHVVaZZaBBxxb426HHQxxHx%%f--)))x(( 	2 	2EAr 0  ///TzzX++D11tx66t<<===  $$$$  R1111)))r;   c                   t          |j        t                    }| j                            d          }| j                            d          }|                    | j                            t          |j                  	                                                     |                    |           |                     | j
        |            |S )Nr  rE  rG  )r  r   r   rC   r   r   rI   r   funcr   r  )r4   rR   r   rE  rG  s        r9   _hprint_variadic_functionz3MathMLPresentationPrinter._hprint_variadic_function  s    di%5666x%%f--X##D))
tx..DI/E/E/G/GHHIII44d;<<<r;   c                    | j                             d          }|                    |                     d                      |                    |                     |j        d                              |S )Nr_  r   )rC   r   r   r  rN   r   )r4   rR   r_  s      r9   
_print_expz$MathMLPresentationPrinter._print_exp  sd    x%%f--))$//000TYq\22333r;   c                   | j                             d          }|                    |                     |j                             | j                             d          }|                    | j                             |                     |                               |                    |           |                    |                     |j                             |S )NrE  rG  )rC   r   r   rN   r  rI   r   r  )r4   r   rE  r   s       r9   r  z+MathMLPresentationPrinter._print_Relational  s    x%%f--QU++,,,H""4((	dh--dooa.@.@AABBBQU++,,,r;   c                    | j                             |                     |                    }|                    | j                             t          |                               |S rB   rk  r  s      r9   r  z$MathMLPresentationPrinter._print_int  r  r;   c                6   | j                             d          }|j        \  }}| j                             d          }|                    dd           |                    | j                             |j        |                              |                    |           | j                             d          }|                    dd           |                    | j                             |j                             |                    |           |S )Nr^  rH  rB  rA  )rC   r   _idr  r   rI   _variable_names_name)r4   r   r^  indexr  rH  s         r9   _print_BaseScalarz+MathMLPresentationPrinter._print_BaseScalar  s    x%%f--vX##D))
v...
tx..v/Ee/LMMNNNX##D))
v...
tx..v|<<===r;   c                L   | j                             d          }|j        \  }}| j                             d          }| j                             d          }|                    dd           |                    | j                             |j        |                              |                    |           | j                             d          }|                    | j                             d                     |                    |           |                    |           | j                             d          }|                    dd           |                    | j                             |j                             |                    |           |S )Nr^  moverrH  rB  rA  rG  ^)rC   r   r  r  r   rI   _vector_namesr  )r4   r   r^  r  r  r  rH  rG  s           r9   _print_BaseVectorz+MathMLPresentationPrinter._print_BaseVector  sc   x%%f--v&&w//X##D))
v...
tx..v/CE/JKKLLL"X##D))
tx..s33444"X##D))
v...
tx..v|<<===r;   c                   | j                             d          }| j                             d          }|                    dd           |                    | j                             d                     |                    |           | j                             d          }|                    | j                             d                     |                    |           |S )Nr  rH  rB  rA  rY  rG  r  rC   r   r  r   rI   )r4   r   r  rH  rG  s        r9   _print_VectorZeroz+MathMLPresentationPrinter._print_VectorZero,  s    &&w//X##D))
v...
tx..s33444"X##D))
tx..s33444"r;   c                   | j                             d          }|j        }|j        }|                    |                     |t          d                              | j                             d          }|                    | j                             d                     |                    |           |                    |                     |t          d                              |S )NrE  r   rG  r  rC   r   _expr1_expr2r   r  r   rI   r4   rR   rE  vec1vec2rG  s         r9   _print_Crossz&MathMLPresentationPrinter._print_Cross7      x%%f--{{**4E1BCCDDDX##D))
tx..x88999**4E1BCCDDDr;   c                   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           | j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        t          d                              |S )NrE  rG  &#x2207;r  r   rC   r   r   rI   r  _exprr   r4   rR   rE  rG  s       r9   _print_Curlz%MathMLPresentationPrinter._print_CurlB      x%%f--X##D))
tx..z::;;;X##D))
tx..x88999**4:z%7HIIJJJr;   c                   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           | j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        t          d                              |S )NrE  rG  r  r   r   r  r  s       r9   _print_Divergencez+MathMLPresentationPrinter._print_DivergenceM  r  r;   c                   | j                             d          }|j        }|j        }|                    |                     |t          d                              | j                             d          }|                    | j                             d                     |                    |           |                    |                     |t          d                              |S )NrE  r   rG  r   r  r  s         r9   
_print_Dotz$MathMLPresentationPrinter._print_DotX  r  r;   c                d   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        t          d                              |S )NrE  rG  r  r   r  r  s       r9   _print_Gradientz)MathMLPresentationPrinter._print_Gradientc      x%%f--X##D))
tx..z::;;;**4:z%7HIIJJJr;   c                d   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        t          d                              |S )NrE  rG  r  r   r  r  s       r9   _print_Laplacianz*MathMLPresentationPrinter._print_Laplaciank  r  r;   c                    | j                             d          }|                    dd           |                    | j                             d                     |S )NrH  rB  normalz&#x2124;r  r  s      r9   _print_Integersz)MathMLPresentationPrinter._print_Integerss  R    H""4((	}h///	dh--j99:::r;   c                    | j                             d          }|                    dd           |                    | j                             d                     |S )NrH  rB  r  z&#x2102;r  r  s      r9   _print_Complexesz*MathMLPresentationPrinter._print_Complexesy  r  r;   c                    | j                             d          }|                    dd           |                    | j                             d                     |S )NrH  rB  r  z&#x211D;r  r  s      r9   _print_Realsz&MathMLPresentationPrinter._print_Reals  r  r;   c                    | j                             d          }|                    dd           |                    | j                             d                     |S )NrH  rB  r  &#x2115;r  r  s      r9   _print_Naturalsz)MathMLPresentationPrinter._print_Naturals  r  r;   c                   | j                             d          }| j                             d          }|                    dd           |                    | j                             d                     |                    |           |                    |                     t          j                             |S )Nr^  rH  rB  r  r  )rC   r   r  r   rI   rN   r   Zero)r4   r   rX  r   s       r9   _print_Naturals0z*MathMLPresentationPrinter._print_Naturals0  s    h$$V,,H""4((	}h///	dh--j99:::AF++,,,
r;   c                   |j         d         |j         d         z
  }|j         d         }| j                            d          }|                    | j                            d                     | j                            d          }|                    | j                            d                     | j                            d          }|                    |           |                    |                     |                     |                    |           | j                            d          }|                    |           |                    |                     |                     |S )	Nr   r   r  rG  rb  rc  rE  r_  )r   rC   r   r   rI   rN   )r4   rR   shiftrl   r  r  rZ  rS  s           r9   _print_SingularityFunctionz4MathMLPresentationPrinter._print_SingularityFunction  s<   	!ty|+	!x%%d++00::;;;&&t,,$(11(;;<<<x%%f--U++,,,h$$V,,E**+++
r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  NaNr  r  s      r9   r#  z$MathMLPresentationPrinter._print_NaN  s>    H""4((	dh--e44555r;   c                >   | j                             d          }| j                             d          }|                    | j                             |                     |                    |           |                    |                     |j        d                              t          |j                  dk    r|S | j                             d          }|                    |           |                     | j        |j        dd                      |S )Nr^  rH  r   r   rE  )rC   r   r   rI   rN   r   r   r  )r4   r   rZ   rX  rH  rE  s         r9   _print_number_functionz0MathMLPresentationPrinter._print_number_function  s     h$$V,,X##D))
tx..t44555AF1I..///qv;;!Jx%%f--44afQRRjABBBr;   c                .    |                      |d          S )NBr  r  s     r9   _print_bernoulliz*MathMLPresentationPrinter._print_bernoulli      **1c222r;   c                .    |                      |d          S )Nr  r"  r  s     r9   _print_catalanz(MathMLPresentationPrinter._print_catalan  r$  r;   c                .    |                      |d          S )NEr"  r  s     r9   _print_eulerz&MathMLPresentationPrinter._print_euler  r$  r;   c                .    |                      |d          S )NFr"  r  s     r9   _print_fibonacciz*MathMLPresentationPrinter._print_fibonacci  r$  r;   c                .    |                      |d          S )NLr"  r  s     r9   _print_lucasz&MathMLPresentationPrinter._print_lucas  r$  r;   c                .    |                      |d          S )Nz&#x03B3;r"  r  s     r9   _print_stieltjesz*MathMLPresentationPrinter._print_stieltjes  s    **1j999r;   c                .    |                      |d          S )NTr"  r  s     r9   _print_tribonacciz+MathMLPresentationPrinter._print_tribonacci  r$  r;   c                   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           | j                             d          }|                    | j                             d                     |                    |           |S )Nr  rG  r  ~r  )r4   r   r   rG  s       r9   _print_ComplexInfinityz0MathMLPresentationPrinter._print_ComplexInfinity  s    H""7++X##D))
tx..z::;;;	bX##D))
tx..s33444	br;   c                    | j                             d          }|                    | j                             d                     |S )NrG  z&#x2205;r  r  s      r9   r&  z)MathMLPresentationPrinter._print_EmptySet  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrG  z	&#x1D54C;r  r  s      r9   _print_UniversalSetz-MathMLPresentationPrinter._print_UniversalSet  >    H""4((	dh--k::;;;r;   c                   ddl m} |j        }| j                            d          }t          ||          s| j                            d          }|                    |                                            |                    |                     |                     |                    | 	                                           |                    |           n(|                    |                     |                     | j                            d          }|                    | j        
                    d                     |                    |           |S )Nr   r   r_  rE  rG  r!  sympy.matricesr   r   rC   r   r  r   r  rN   r  rI   r4   rR   r   matrS  rZ  rG  s          r9   _print_Adjointz(MathMLPresentationPrinter._print_Adjoint  s0   //////hh$$V,,#|,, 	.8))&11DT]]__---T[[--...T]]__---OOD!!!!OODKK,,---X##D))
tx..z::;;;
r;   c                   ddl m} |j        }| j                            d          }t          ||          s| j                            d          }|                    |                                            |                    |                     |                     |                    | 	                                           |                    |           n(|                    |                     |                     | j                            d          }|                    | j        
                    d                     |                    |           |S )Nr   r=  r_  rE  rG  r3  r>  r@  s          r9   _print_Transposez*MathMLPresentationPrinter._print_Transpose  s0   //////hh$$V,,#|,, 	.8))&11DT]]__---T[[--...T]]__---OOD!!!!OODKK,,---X##D))
tx..s33444
r;   c                `   ddl m} |j        }| j                            d          }t          ||          s| j                            d          }|                    |                                            |                    |                     |                     |                    | 	                                           |                    |           n(|                    |                     |                     |                    |                     d                     |S )Nr   r=  r_  rE  r   )
r?  r   r   rC   r   r  r   r  rN   r  )r4   rR   r   rA  rS  rZ  s         r9   _print_Inversez(MathMLPresentationPrinter._print_Inverse  s   //////hh$$V,,#|,, 	.8))&11DT]]__---T[[--...T]]__---OOD!!!!OODKK,,---B(((
r;   c           	        ddl m} | j                            d          }|j        }t          |d         t                    r3|d                                         t          |dd                    z   }nt          |          }t          ||          r|	                                r|d         dk    r|dd          }n|d          |d<   | j                            d          }|
                    | j                            d                     |
                    |           |d d         D ]}|
                    |                     |t          |          d                     | j                            d          }|
                    | j                            d	                     |
                    |           |
                    |                     |d         t          |          d                     |S )
Nr   )MatMulrE  r   r   rG  r  Fr  )!sympy.matrices.expressions.matmulrH  rC   r   r   r  r   r   r9  r   r   rI   r  r   )r4   rR   rH  r   r   rG  r   s          r9   _print_MatMulz'MathMLPresentationPrinter._print_MatMul  s   <<<<<<H""6**yd1gs## 	7--//$tABBx..@DD::DdF## 	(E(E(G(G 	Aw"}}ABBx7(Q''--BNN4822377888MM"9 	 	CMM$++C1G1M1M,13 3 4 4 4''--BNN48223EFFGGGMM"	d''R2H2N2N(-/ / 	0 	0 	0r;   c                n   ddl m} |j        |j        }}| j                            d          }t          ||          s| j                            d          }|                    |                                            |                    | 	                    |                     |                    | 
                                           |                    |           n(|                    | 	                    |                     |                    | 	                    |                     |S )Nr   r=  r_  rE  )r?  r   rf  rd  rC   r   r  r   r  rN   r  )r4   rR   r   rf  rd  rS  rZ  s          r9   _print_MatPowz'MathMLPresentationPrinter._print_MatPow1  s   //////Itxch$$V,,$-- 	/8))&11DT]]__---T[[..///T]]__---OOD!!!!OODKK--...C(()))
r;   c           	        | j                             d          }|j        }|d d         D ]}|                    |                     |t          |          d                     | j                             d          }|                    | j                             d                     |                    |           |                    |                     |d         t          |          d                     |S )NrE  r   FrG  z&#x2218;)rC   r   r   r   r  r   rI   )r4   rR   r   r   r   rG  s         r9   _print_HadamardProductz0MathMLPresentationPrinter._print_HadamardProduct@  s    H""6**y9 	 	CMM!!#'=d'C'CUKKM M M''--BNN4822:>>???MM"	d2h(>t(D(DeLL	N 	N 	Nr;   c                    | j                             d          }|                    | j                             d                     |S )Nr  z&#x1D7D8r  r4   Zr   s      r9   _print_ZeroMatrixz+MathMLPresentationPrinter._print_ZeroMatrixM  r  r;   c                    | j                             d          }|                    | j                             d                     |S )Nr  z&#x1D7D9r  rP  s      r9   _print_OneMatrixz*MathMLPresentationPrinter._print_OneMatrixR  r  r;   c                    | j                             d          }|                    | j                             d                     |S )NrH  z	&#x1D540;r  )r4   Ir   s      r9   _print_Identityz)MathMLPresentationPrinter._print_IdentityW  r;  r;   c                   | j                             d          }|                    | j                             d                     | j                             d          }|                    | j                             d                     | j                             d          }|                    |           |                    |                     |j        d                              |                    |           |S )NrG  u   ⌊u   ⌋rE  r   r*  r4   r   r  r  rE  s        r9   _print_floorz&MathMLPresentationPrinter._print_floor\      x%%d++00::;;;&&t,,$(11(;;<<<x%%f--QVAY//000r;   c                   | j                             d          }|                    | j                             d                     | j                             d          }|                    | j                             d                     | j                             d          }|                    |           |                    |                     |j        d                              |                    |           |S )NrG  u   ⌈u   ⌉rE  r   r*  rY  s        r9   _print_ceilingz(MathMLPresentationPrinter._print_ceilingg  r[  r;   c                   | j                             d          }|j        d         }t          |          dk    r|                     |d                   }n|                     |          }|                    |                                            |                    |           | j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |                                            |S )NrE  r   r   rG  z&#x21A6;)	rC   r   r   r   rN   r   r  rI   r  )r4   r   rE  symbolsrG  s        r9   r  z'MathMLPresentationPrinter._print_Lambdar  s   x%%f--&)w<<1kk'!*--GGkk'**G)))!!!X##D))
tx..z::;;;QVAY//000)))r;   c                     | j         | S rB   )r  r  s     r9   _print_tuplez&MathMLPresentationPrinter._print_tuple  s    *t*A..r;   c                6    |                      |j                  S rB   )rN   labelr  s     r9   _print_IndexedBasez,MathMLPresentationPrinter._print_IndexedBase  s    {{17###r;   c                   | j                             d          }|                    |                     |j                             t          |j                  dk    r5|                    |                     |j        d                              |S |                    |                     |j                             |S )Nr^  r   r   )rC   r   r   rN   rf  r   indicesr  s      r9   _print_Indexedz(MathMLPresentationPrinter._print_Indexed  s    H""6**	dkk!&))***qy>>QMM$++ail33444H	dkk!),,---r;   c                   | j                             d          }|                    |                     |j        t
          d         d                     | j                             d          }t          |j                  D ]V\  }}|r'|                    |                                            |                    | 	                    |                     W|                    |           |S )Nr^  AtomTr1  rE  )
rC   r   r   r  parentr   r   rf  r  rN   )r4   r   r   rZ  r   r   s         r9   _print_MatrixElementz.MathMLPresentationPrinter._print_MatrixElement  s    H""6**	d''*V2Dt'TTUUUx%%f--	** 	/ 	/FAs 0  ///T[[--....	dr;   c                6   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                     | j        |j                    |S )NrE  rH  z	&#x1d5a5;rC   r   r   rI   r  r   r4   r   r   rH  s       r9   _print_elliptic_fz+MathMLPresentationPrinter._print_elliptic_f      H""6**X##D))
tx..{;;<<<	b	/d/8999r;   c                6   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                     | j        |j                    |S )NrE  rH  z	&#x1d5a4;rm  rn  s       r9   _print_elliptic_ez+MathMLPresentationPrinter._print_elliptic_e  rp  r;   c                   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           | j                             d          }|                    |                                            t          |j                  dk    r|j        \  }}|                    |                     |                     |                    |                                            |                    |                     |                     n|j        \  }}}|                    |                     |                     |                    | 	                                           |                    |                     |                     |                    |                                            |                    |                     |                     |                    | 
                                           |                    |           |S )NrE  rH  z	&#x1d6f1;r  )rC   r   r   rI   r  r   r   rN   r  r  r  )r4   r   r   rH  r  r   r   zs           r9   _print_elliptic_piz,MathMLPresentationPrinter._print_elliptic_pi  s   H""6**X##D))
tx..{;;<<<	bH""6**	dmmoo&&&qv;;!6DAqMM$++a..)))MM$))++&&&MM$++a..))))fGAq!MM$++a..)))MM$//++,,,MM$++a..)))MM$))++&&&MM$++a..)))	dmmoo&&&	ar;   c                L   | j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j                             |S )NrE  rH  Eir*  rn  s       r9   	_print_Eiz#MathMLPresentationPrinter._print_Ei  s    H""6**X##D))
tx..t44555	b	dkk!&))***r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  r(  r   r   r*  r4   r   r   r  rG  s        r9   _print_expintz'MathMLPresentationPrinter._print_expint      H""6**H""6**X##D))
tx..s33444	b	dkk!&),,---	a	dkk!&*--...r;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |                     |j        dd                              |                    |           |                    |                     |j        dd                               |S )NrE  r`  rG  Pr   r   r1  r*  rz  s        r9   _print_jacobiz'MathMLPresentationPrinter._print_jacobi      H""6**H""9--X##D))
tx..s33444	b	dkk!&),,---	dkk!&1+..///	a	dkk!&*--...r;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |                     |j        dd                              |                    |           |                    |                     |j        dd                               |S )NrE  r`  rG  r  r   r   r  r*  rz  s        r9   _print_gegenbauerz+MathMLPresentationPrinter._print_gegenbauer  r  r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  r3  r   r   r*  rz  s        r9   _print_chebyshevtz+MathMLPresentationPrinter._print_chebyshevt  r|  r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  Ur   r   r*  rz  s        r9   _print_chebyshevuz+MathMLPresentationPrinter._print_chebyshevu  r|  r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  r~  r   r   r*  rz  s        r9   _print_legendrez)MathMLPresentationPrinter._print_legendre  r|  r;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |                     |j        dd                              |                    |           |                    |                     |j        dd                               |S )NrE  r`  rG  r~  r   r   r  r*  rz  s        r9   _print_assoc_legendrez/MathMLPresentationPrinter._print_assoc_legendre  r  r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  r.  r   r   r*  rz  s        r9   _print_laguerrez)MathMLPresentationPrinter._print_laguerre  r|  r;   c                   | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |                     |j        dd                              |                    |           |                    |                     |j        dd                               |S )NrE  r`  rG  r.  r   r   r  r*  rz  s        r9   _print_assoc_laguerrez/MathMLPresentationPrinter._print_assoc_laguerre&  r  r;   c                    | j                             d          }| j                             d          }| j                             d          }|                    | j                             d                     |                    |           |                    |                     |j        d                              |                    |           |                    |                     |j        dd                               |S )NrE  r^  rG  Hr   r   r*  rz  s        r9   _print_hermitez(MathMLPresentationPrinter._print_hermite2  r|  r;   )FrB   )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=  ra  r  r  rJ  rO  rT  rV  r[  ri  rl  rd  ry  r}  rs  ru  r  ry  r  r  _print_Determinantr  r  r  r  r  r  r  r  r  r  r  r  _print_frozensetr  r  r  r  r  r  r  r  r  r)  r,  r  r  r  
_print_Min
_print_Maxr  r  r  r  r  r  r  r   r  r  r  r
  r  r  r  r  r  r  r#  r  r#  _print_bellr&  r)  r,  r/  r1  r4  r7  r&  r:  rB  rD  rF  rJ  rL  rN  rR  rT  rW  rZ  r]  r  ra  rd  rg  rk  ro  rr  ru  rx  r{  r  r  r  r  r  r  r  r  r  r?   r;   r9   r  r  #  s{         )KK K KZ  
  
  
  
  
  
  
    ! ! ! !- - -^   (  4   (P P P  ,  
  
  
  
  
    
  
  
      
    $ $ $L  24 4 4 4lL L L (    = = => > >	 	 	4 4 4l  
  . . .`	 	 	% % %N     4 4 4  &    $
 
 
9 9 9 99 9 9 9  	 	 	9 9 99 9 99 9 99 9 99 9 9' ' '	 	 	 "  0) ) )X3 3 33 3 33 3 38 8 83 3 3    
 %%  
  >   87J      
    $	 	 		 	 		 	 		 	 		 	 	                   
  3 3 3 #K3 3 33 3 33 3 33 3 3: : :3 3 3    
  
  "  "    :      
  
  
	 	 		 	 	   / / /$ $ $  	 	 	      .  	 	 	
 
 

 
 
	 	 		 	 		 	 	
 
 
	 	 	
 
 
	 	 	 	 	r;   r  contentc                    |dk    r"t          |                              |           S t          |                              |           S )zReturns the MathML representation of expr. If printer is presentation
    then prints Presentation MathML else prints content MathML.
    presentation)r  rW   r_   )rR   printerrJ   s      r9   mathmlr  >  sG    
 .  (22::4@@@#H--55d;;;r;   c                    |dk    rt          |          }nt          |          }|                    t          |                     }|                                }t          |           dS )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
    <apply>
        <plus/>
        <ci>x</ci>
        <cn>1</cn>
    </apply>
    >>> print_mathml(x+1, printer='presentation')
    <mrow>
        <mi>x</mi>
        <mo>+</mo>
        <mn>1</mn>
    </mrow>

    r  N)r  r_   rN   r   toprettyxmlprint)rR   r  rJ   rN  xml
pretty_xmls         r9   print_mathmlr  I  se    2 .  %h// **
((74==
!
!C""J	*r;   N)r  )$r\   
__future__r   typingr   sympy.core.mulr   sympy.core.singletonr   sympy.core.sortingr   sympy.core.sympifyr   sympy.printing.conventionsr	   r
   sympy.printing.precedencer   r   r   &sympy.printing.pretty.pretty_symbologyr   sympy.printing.printerr   r   mpmath.libmpr   r   r   ro  r   r_   r  r  r  MathMLPrinterr?   r;   r9   <module>r     s    # " " " " "             " " " " " " / / / / / / & & & & & & H H H H H H H H? ? ? ? ? ? ? ? ? ? @ @ @ @ @ @ : : : : : : : : E E E E E E E E E E<) <) <) <) <) <) <) <)~J J J J J, J J J^X X X X X 1 X X Xv0 !""< < < #"<       H %r;   