K i UdZddlmZddlmZmZmZddlZddlm Z m Z m Z m Z m Z mZmZmZddlmZddlmZddlmZmZmZdd lmZdd lmZdd lmZdd lm Z dd l!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,ddl%m-Z-m.Z.ddl/m0Z0m1Z2ddl3m4Z4m5Z5ddl6Z6er ddl7m8Z8ddl9m:Z:gdZ;idddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8id9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKd,dLdMdNdDdOdPdQdRdSdTdUdVdWdXdYdZd[Zde?d<e@eZAe6jde6jdfZCddZDGdde(ZEddZFe)eEdZGdZHddZIy)zC A Printer which converts an expression into its LaTeX equivalent. ) annotations)AnyCallable TYPE_CHECKINGN)AddFloatModMulNumberSSymbolExpr)greeks)Tuple)Function AppliedUndef Derivative)AssocOp)Pow)default_sort_key) SympifyError)true BooleanTrue BooleanFalse)precedence_traditional)Printerprint_function)split_super_subrequires_partial) precedence PRECEDENCE) prec_to_dpsto_str) has_varietysift) NDimArray)BasisDependent)arcsinarccosarctansincostansinhcoshtanhsqrtlnlogseccsccotcothreimfracrootargAlphaz \mathrm{A}Betaz \mathrm{B}Gamma\GammaDeltaz\DeltaEpsilonz \mathrm{E}Zetaz \mathrm{Z}Etaz \mathrm{H}Thetaz\ThetaIotaz \mathrm{I}Kappaz \mathrm{K}Lambdaz\LambdaMuz \mathrm{M}Nuz \mathrm{N}Xiz\XiomicronoOmicronz \mathrm{O}Piz\PiRhoz \mathrm{P}Sigmaz\SigmaTauz \mathrm{T}Upsilonz\UpsilonPhiz\PhiChiz \mathrm{X}Psiz\PsiOmegaz\Omegalamdaz\lambdaLamdakhiz\chiKhi varepsilonz \varepsilonvarkappaz \varkappavarphiz\varphivarpiz\varpivarrhoz\varrhoz \varsigmaz \vartheta)varsigmavartheta> wpellethmhobethhbaralephgimeldalethhslashmathringcd|zdzS)Nz \mathring{}ss Z/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/printing/latex.pyrt[s-/$.ddddotcd|zdzS)Nz\ddddot{rorprqs rsrtrt\s A d*rudddotcd|zdzS)Nz\dddot{rorprqs rsrtrt]z!|D(ruddotcd|zdzS)Nz\ddot{rorprqs rsrtrt^sik$&rudotcd|zdzS)Nz\dot{rorprqs rsrtrt_XaZ_rucheckcd|zdzS)Nz\check{rorprqs rsrtrt`rzrubrevecd|zdzS)Nz\breve{rorprqs rsrtrtarzruacutecd|zdzS)Nz\acute{rorprqs rsrtrtbrzrugravecd|zdzS)Nz\grave{rorprqs rsrtrtcrzrutildecd|zdzS)Nz\tilde{rorprqs rsrtrtdrzruhatcd|zdzS)Nz\hat{rorprqs rsrtrterrubarcd|zdzS)Nz\bar{rorprqs rsrtrtfrruveccd|zdzS)Nz\vec{rorprqs rsrtrtgrruprimecd|zdzSN{z}'rprqs rsrtrthss1uTzruprmcd|zdzSrrprqs rsrtrtisSU4Zruboldcd|zdzSNz \boldsymbol{rorprqs rsrtrtksoa',rubmcd|zdzSrrprqs rsrtrtlsOA%d*rucd|zdzS)Nz \mathcal{rorprqs rsrtrtm\!^D(rucd|zdzS)Nz \mathscr{rorprqs rsrtrtnrrucd|zdzS)Nz \mathfrak{rorprqs rsrtrtosmAod*rucd|zdzS)Nz\left\|{z }\right\|rprqs rsrtrtqsk!mL0rucd|zdzS)Nz \left\langle{z}\right\ranglerprqs rsrtrtrs%a'(99rucd|zdzSNz\left|{z}\right|rprqs rsrtrtsZ\+-rucd|zdzSrrprqs rsrtrttrru)calscrfraknormavgabsmagzdict[str, Callable[[str], str]] modifier_dictz [0-9][} ]*$z(\d|\\frac{\d+}{\d+})c|jdd}dD]}|j|d|z}|jdd}|jdd}|S)z Escape a string such that latex interprets it as plaintext. We cannot use verbatim easily with mathjax, so escaping is easier. Rules from https://tex.stackexchange.com/a/34586/41112. \z\textbackslashz&%$#_{}~z\textasciitilde^z\textasciicircum)replace)rrcs rs latex_escapers_ $)*A # IIa "# #)*A #*+A Hruc < eZdZUdZidddddddddd d dd dd dd ddddddddddidddddddddddddddd Zded<dPd ZdQd!ZdQd"ZdRdQd#Z d$Z dQd%Z dSd&Z dSd'Z dRdSd(ZdSd)ZdSd*ZdSd+ZdTd,Zd-ZdUd.ZeZeZd/ZdPd0Zd1Zd2Zd3Zd4Zd5Zd6Zd7Zd8Z d9Z!d:Z"dVd;Z#d<Z$d=Z%dWd>Z&dXd?Z'd@Z(dAZ)dBZ*dYdCZ+dDZ,dEZ-dFZ.dGZ/dHZ0dIZ1dJZ2dZdKZ3dPd[dLZ4dMZ5dNZ6e7dOZ8dPZ9dQZ:dRZ;dPdQdSZdPdTZ?dPdUZ@dPdVZAdPdWZBdPdXZCdPdYZDdZZEd[ZFd\ZGd]ZHd^ZIdPd_ZJdPd`ZKdPdaZLdPdbZMdPdcZNdPddZOdPdeZPdPdfZQdPdgZRdPdhZSdPdiZTd\djZUdPdkZVdPdlZWdPdmZXdPdQdnZYeYZZdPdoZ[dPdpZ\dPdqZ]dPdrZ^dPdsZ_dPdtZ`dPduZadPdvZbdPdwZcdPdxZdd]dyZedQdzZfdPd{ZgdPd|ZhdPd}ZidPd~ZjdPdZkdPdZldPdZmdPdZndPdZodPdZpd^dQdZqd^dQdZrdPdZsdPdZtdPdZudPdZvdPdZwdPdZxdPdZydPdZzdPdZ{dPdZ|dPdZ}dPdZ~dPdZdPdZdPdZdPdZdPdZdPdZdPdZdPdZdPdZdPdZd_dZdPdZdPdZdPdZdPdZdZdZd`dadZeZdbdZd`dcdZdZdZdZdZdZdZdZdZdZdZdZdZdZdPdZdZdZdZdZdZdZdZdZdZdddZdedZdZdZd„ZdÄZdĄZdńZdƄZdDŽZdȄZdPdɄZdʄZd˄Zd̄Zd̈́Zd΄ZdτZdЄZdPdфZdPd҄ZdPdӄZdPdԄZdPdՄZdքZdׄZd؄ZeZdلZǐdPdڄZȐdPdۄZɐdPd܄ZʐdPd݄ZːdPdބZ̐dPd߄Z͐dPdZΐdPdZdZeZeZeZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdPdZdPd Zdfd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdPdZ dZ dZ dZ dZ dZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&ZeZd'Zd(Zd)Zd*Zd+Zd,Zd-Zd.Z d/Z!d0Z"d1Z#d2Z$d3Z%d4Z&d5Z'd6Z(d7Z)d8Z*d9Z+d:Z,d;Z-d<Z.d=Z/d>Z0d?Z1dPd@Z2dPdAZ3dPdBZ4dPdCZ5dPdDZ6dPdEZ7dFZ8dGZ9dHZ:dIZ;dJZ<dKZ=dLZ>dMZ?dNZ@fdOZAxZBS(g LatexPrinter_latex full_precFfold_frac_powersfold_func_bracketsfold_short_fracNinv_trig_style abbreviateditex ln_notationlong_frac_ratio mat_delim[mat_strmodeplain mul_symbolorder symbol_names root_notationTmat_symbol_styleimaginary_unitiperiodddagger) gothic_re_imdecimal_separator perm_cyclicparenthesize_superminmax diff_operator adjoint_styledisable_split_super_subzdict[str, Any]_default_settingsctj||d|jvr gd}|jd|vr td|jd!|jddk(rd|jd<ddd d d } ||jd |jd < ||jd xsd|jd<ddd|_dddddddd}|jd}|j|||jd<ddddd }|jd!}|j|||jd"<y#t$r|jd |jd <YwxYw#t$rQ|jd j dvr|d|jd<n|jd |jd<YwxYw)#Nr)inlinerequationz equation*zB'mode' must be one of 'inline', 'plain', 'equation' or 'equation*'rrT z \,.\,  \cdot  \times )Nldotr}timesrmul_symbol_latexr}mul_symbol_latex_numbers)rrz\,z\:\;z\quad)])(rrz \mathrm{i}z\text{i}jz \mathrm{j}z\text{j})Nrritirrjtjrimaginary_unit_latexrz \mathrm{d}z\text{d})Nrrdtdrdiff_operator_latex)r__init__ _settings ValueErrorKeyErrorstrip _delim_dictget)selfsettings valid_modesmul_symbol_tableimaginary_unit_table imag_unitdiff_operator_tablers rsrzLatexPrinter.__init__sx( T^^ #(K~~f%[8 "=>> >>+ , 4v&(204DNN, -    -  !=> NN- . 1  !=!FG NN5 6"%3/ NN#34 1E1I1I)U^1_-.   7 0C0G0G Wd0e,-I -|, NN- . -  1|,224BC%U+9:NN<09:  1s%=D8#E#8%E E #AF=<F=c$dj|S)Nz\left({}\right)formatrrrs rs _add_parenszLatexPrinter._add_parenss!((++ruc$dj|S)Nz\left( {}\right)rrs rs_add_parens_lspacezLatexPrinter._add_parens_lspaces"))!,,ruct|}|r"|r |j|j|S||ks|s%||kr |j|j|S|j|SN)rr_print)ritemlevelis_negstrictprec_vals rs parenthesizezLatexPrinter.parenthesizese)$/ f##DKK$56 6 u v8u3D##DKK$56 6;;t$ $rucpd|vr1|jdr|j|Sdj|S|S)z Protect superscripts in s If the parenthesize_super option is set, protect with parentheses, else wrap in braces. rrz{{{}}})rrrrs rsrzLatexPrinter.parenthesize_supers= !8~~23''**q))ructj||}|jddk(r|S|jddk(rd|zS|jdrd|zS|jd}d|d|d |dS) Nrrrz$%s$rz$$%s$$z\begin{roz\end{)rdoprintr)rexprtexenv_strs rsrzLatexPrinter.doprint stoodD) >>& !W ,J ^^F #x /S= ^^F #s? "nnV,G.5sGD Druc|jxr |jxs0|jxr"|tjuxr|j du S)z Returns True if the expression needs to be wrapped in brackets when printed, False otherwise. For example: a + b => True; a => False; 10 => False; -10 => True. F) is_Integeris_nonnegativeis_Atomr NegativeOne is_Rationalrrs rs_needs_bracketszLatexPrinter._needs_bracketssT __<)<)<J I$amm*C+H.2.>.>%.GK Kruc|j|sy|jr|j|sy|jr|j |sy|j s |j ryy)a Returns True if the expression needs to be wrapped in brackets when passed as an argument to a function, False otherwise. This is a more liberal version of _needs_brackets, in that many expressions which need to be wrapped in brackets when added/subtracted/raised to a power do not need them when passed to a function. Such an example is a*b. FT)ris_Mul _mul_is_cleanis_Pow _pow_is_cleanis_Add is_Functionrs rs_needs_function_bracketsz%LatexPrinter._needs_function_brackets!sZ##D){{4#5#5d#;T%7%7%= 0 0ruc0ddlm}ddlm}ddlm}j r|s4jr$yttdkryjryjrytfdtfDry|stfd|||fDryy ) a Returns True if the expression needs to be wrapped in brackets when printed as part of a Mul, False otherwise. This is True for Add, but also for some container objects that would not need brackets when appearing last in a Mul, e.g. an Integral. ``last=True`` specifies that this expr is the last to appear in a Mul. ``first=True`` specifies that this expr is the first to appear in a Mul. r)Product)Sum)IntegralTr c3@K|]}j|ywrhas.0xrs rs z3LatexPrinter._needs_mul_brackets..O+qtxx{+c3@K|]}j|ywrr*r,s rsr/z3LatexPrinter._needs_mul_brackets..RsBADHHQKBr1F)sympy.concrete.productsr&sympy.concrete.summationsr'sympy.integrals.integralsr(rcould_extract_minus_signrr! is_Relational is_Piecewiseanyr )rrfirstlastr&r'r(s ` rs_needs_mul_bracketsz LatexPrinter._needs_mul_brackets8s 416 ;;T::< #D )Ju,= =       +SF+ +B(GS)ABBrucnjrytfdtfDryjryy)z Returns True if the expression needs to be wrapped in brackets when printed as part of an Add, False otherwise. This is False for most things. Tc3@K|]}j|ywrr*r,s rsr/z3LatexPrinter._needs_add_brackets.._r0r1F)r7r9r r"rs `rs_needs_add_bracketsz LatexPrinter._needs_add_bracketsWs1    +SF+ + ;;rucB|jD]}|jsyy)NFT)argsr#rrr<s rsrzLatexPrinter._mul_is_cleanes$99 C ruc:|j|j Sr)rbasers rsr!zLatexPrinter._pow_is_cleanks'' 222ruc| d|d|dS|S)N\left( \right)^{rorprrexps rs _do_exponentzLatexPrinter._do_exponentns ?.2C8 8Kruc&|j|jj}|jrK|jDcgc]}|j |}}d}|j |dj |Sdj |Scc}w)Nz"\operatorname{{{}}}\left({}\right), z \text{{{}}})_deal_with_super_sub __class____name__rArrjoin)rrnamerMlsrrs rs _print_BasiczLatexPrinter._print_Basictsv(()@)@A 99*.))4Q$++a.4B45A88D$))B-0 0!((. . 5sBc d|zSN \text{%s}rpres rs _print_boolzLatexPrinter._print_bool} aruc d|zSrUrprWs rs_print_NoneTypezLatexPrinter._print_NoneTyperZruc|j||}d}t|D]U\}}|dk(rn|jr |dz }| }n|dz }|j|}|j |rd|z}||z }W|S)N)rrr -  + \left(%s\right))_as_ordered_terms enumerater6rr?)rrrtermsrrtermterm_texs rs _print_AddzLatexPrinter._print_Adds&&t5&9 ' GAtAv..0u uu {{4(H''--8 8OC  rucFddlm}|jdk(ry||}|j}|j}|jd|dz k(r ||dz ggz}d}|D] }|t |j ddz }"|j d d }|j d d }|S) Nr Permutation\left( \right)r,rr\left( r\right)) sympy.combinatorics.permutationsrisize cyclic_form array_formstrr)rrri expr_permsizrers rs _print_CyclezLatexPrinter._print_Cycles@ 99>$4 $$ ii ??2 #' )!cAgYK/I 3A AsE2 2H 3##C4##C4rucddlm}ddlm}|j}||d|dddd n|j j d d }|r|j|S|jdk(ry |jDcgc]}|j|}}tt|Dcgc]}|j|}}d j|}d j|} dj|| f} d| zScc}wcc}w)Nrrh)sympy_deprecation_warningzw Setting Permutation.print_cyclic is deprecated. Instead use init_printing(perm_cyclic=z). z1.6z#deprecated-permutation-print_cyclic)deprecated_since_versionactive_deprecations_target stacklevelrTrj &  \\ z \begin{pmatrix} %s \end{pmatrix})rprisympy.utilities.exceptionsry print_cyclicrrrwrqrsrrangelenrP) rrriryrr<lowerupperrow1row2mats rs_print_PermutationzLatexPrinter._print_Permutations@H!..  " %++6-8*/+P ..,,]DAK $$T* * 99>$-1__=cS!==-23u:->?cS!??zz% zz% llD$<(2S88 >?s 9C=)Dcn|j\}}d|j|d|j|dS)Nz\sigma_{z}(rrAr)rrpermvars rs_print_AppliedPermutationz&LatexPrinter._print_AppliedPermutations,II c%)[[%6 C8HIIruc*t|j}|jdrdnd}d|jvr|jdnd}d|jvr|jdnd}t|j||||}|jd}d|vrO|j d\}} | d d k(r| d d} |jd d k(r|j dd}||d| dS|dk(ry|dk(ry|jd d k(r|j dd}|S)NrFTrr) strip_zeros min_fixed max_fixedrrXr+rlrcomma.z{,}z10^{roz+infz\inftyz-infz- \infty)r"_precr mlib_to_str_mpf_splitr) rrdpsrlowhighstr_real separatormantrIs rs _print_FloatzLatexPrinter._print_Floats$**% 4$','>dnnU#D(-(?t~~e$Ttzz3ES\`aNN#=> (?"..-KT31v}!"g~~12g=||C.%)9c: :    ~~12g=#++C6Oruc|j}|j}|j|tdd|j|tdS)Nr r_expr1_expr2rr!rrvec1vec2s rs _print_CrosszLatexPrinter._print_CrosssJ{{{{"&"3"3D*U:K"L"&"3"3D*U:K"LN NrucR|j}d|j|tdzS)Nz\nabla\times %sr _exprrr!rrrs rs _print_CurlzLatexPrinter._print_Curls(jj!D$5$5c:e;L$MMMrucR|j}d|j|tdzS)Nz\nabla\cdot %sr rrs rs_print_DivergencezLatexPrinter._print_Divergences(jj 4#4#4S*U:K#LLLruc|j}|j}|j|tdd|j|tdS)Nr rrrs rs _print_DotzLatexPrinter._print_DotsJ{{{{!%!2!24E9J!K!%!2!24E9J!KM MrucR|j}d|j|tdzS)Nz \nabla %sr rrrfuncs rs_print_GradientzLatexPrinter._print_Gradient(zzd//j6GHHHrucR|j}d|j|tdzS)Nz \Delta %sr rrs rs_print_LaplacianzLatexPrinter._print_Laplacianrruc ddlm}jdjddfd }dfd t|tr>|j }|dt justd|ddDr|Sd }|jr| }d }|jr |d z }d }nd }||d \}}|t jur'tddd |j vr |||z }n||} ||} t| j} jd} jdr5| dkr0d| vr,j|d r |d| d| z }n_|| d| z }nS| Dt| j| | zkDr$j|d r|d| dd| dz }n |jrt j} t j}|j D]h}j|d sHt|| |zj| | zkDs |j |j cxurd ur nn||z}d| |z} jj|d r|d|| d| dd||d z }n7|d|| d| d||z }n|d| d| z }n |d| d| dz }|r|dz }|S) Nr)fractionrrc|jstj|Sjdvr|j }nt |j }t|dd\}}t|dd\}}||z|zS)N)oldnonect|dxs t|dxs(t|txrt|jdS)N _scale_factoris_physical_constant)hasattr isinstancerrDr.s rsrtz:LatexPrinter._print_Mul..convert..sD?8S8yW^_`bxWy8H)!S1 G&qvv/EFruT)binaryct|dS)Nr)rrs rsrtz:LatexPrinter._print_Mul..convert..s ?8Sru)rrtrras_ordered_factorslistrAr%)rrAunitsnonunitsprefixes convert_argsrs rsconvertz(LatexPrinter._print_Mul..convert s;;4;;t,--::_4224D ?D#'t.HPT#Vx#'u.S\`"a%#Hx$7%$?@@ruc vdx}}t|D]\}}j|}t|dsut|dsij||dk(|t |dz k(rd|z}t dj |rt dj|r|z }n|r |z }n|r|z }||z }|}|S)Nrrrrrl)r:r;r`)rbrrr<r_between_two_numbers_psearchmatch) rA_tex last_term_texrrdre numberseprrs rsrz-LatexPrinter._print_Mul..convert_argss#% %D=$T? )4;;t,o6'$H^:_//Q!V673t9q=6H0K#5#@.q188G.q177A ) )I%D  ( # )$Kruc3<K|]}t|tywr)rr )r-r<s rsr/z*LatexPrinter._print_Mul..;s&S3z#v'>&SrlF- rTr)exactrk)evaluaterrr)r;rFz \right) / z / z \frac{1}{roro\frac{}{rreturnrt)sympy.simplifyrrrr rAr Oner9r6r"rrrr<ris_commutative)rrrrrAinclude_parensrnumerdenomsnumersdenomldenomratioabr.rrrs` @@@rs _print_MulzLatexPrinter._print_Muls+(:; (BC  A  8 dC 99DAw!%%3&S$qr(&S#S#D))  ( ( *5DC{{s !%CD1 u AEE>c!R%8 I 74= CU^FU^F(FNN#45E~~/0Vq[v%++E+>ffEEC88C" '%,6++E+=!9f66C\\AA"ZZ#33AE3B #GAaCL$6$6$8 9E&L H!"!1!1Q5E5E!N!NFAFA #///=&qz69gaj JJ&qz69gaj JJ&)VLLC66::  3JC ruc|jr-|j|jjS|j|jSr) is_aliasedras_polyas_exprrs rs_print_AlgebraicNumberz#LatexPrinter._print_AlgebraicNumber{s< ??;;t||~5578 8;;t||~. .ruc|j|j}|jrd|dS|j|jj }d|d|dS)NrFrorL)rpis_inertalphar)rrrrs rs_print_PrimeIdealzLatexPrinter._print_PrimeIdealsZ KK  ==QCw' ' DJJ..012eWG,,ruct|jjrB|jj}|jj}t |dk(ru|dk7rp|j dra|j |j}|dk(rd|z}n|j drd||fz}nd||fz}|jjrd|zS|S|j d r|dk7r|j|jtd }|jjr|j|}|jjr"|j |j|d | S|d |d |dS|jjr|jjr|jdk(r|jd |jdS|jjrt|jj}|jj}||zt |k(r7|jdk(r d|d|dSd|d|dt |jdS|j|S|jjr6|j |j|j |j Sd}|j!||S)Nrlrrz \sqrt{%s}rz \root{%d}{%s}z \sqrt[%d]{%s}z \frac{1}{%s}rr/rI^{rorkz\frac{1}{\frac{r}}z\frac{1}{(\frac{z})^{z%s^{%s})rIrrqrrrrD is_negativerr! is_Symbolrr#rr_helper_print_standard_power)rrrrrDrbase_pbase_qs rs _print_PowzLatexPrinter._print_Pows. 88  XXZZAXXZZA1v{qAv$..*I{{499-6&-C^^F+*aY6C*aY6C88''*S00J 23Q((Ju4EF99&&2248D99((;;tyyA6F;GG(,a33%%$))*B*B99>)-DHH==99(("&))++F"&))++F#f+588r>AG#PP*IOPVX[\`\d\dXe#fft,, 99 ;;tyydkk$((.C;D D00s;;ruc|j|j}|j|jtd}|jj r|j |}ns|jjrd|z}nWt|jtr=|jdr,tjd|r|jdr|dd}|||fzS)Nrz{%s}rFz\\left\(\\d?d?dotroi)rrIrrDr!rris_Floatrr startswithr8rendswith)rrtemplaterIrDs rsrz)LatexPrinter._helper_print_standard_powerskk$((#  Ju,=> 99  **40D YY  T>DJ/ *-t4 j)2;D4+%%ruc>|j|jdSNrrrArs rs_print_UnevaluatedExprz#LatexPrinter._print_UnevaluatedExprs{{499Q<((ruc t|jdk(r9dt|jdDcgc]}j|c}z}n<fd}dtj d|jDcgc] }|| c}z}t |jtr#|dj|jzz }|S|j|jz }|Scc}wcc}w)Nrlz\sum_{%s=%s}^{%s} rc |dt|d|d|dfDcgc]}j|c}zScc}wNz%s \leq %s \leq %srlrrtuplerlrrrs rs _format_ineqz-LatexPrinter._print_Sum.._format_ineqC,AaD!A$!3EFa4;;q>FGHHF9 z\sum_{\substack{%s}} \\r` rlimitsrrrtrPrfunctionrrrrrrrs` rs _print_SumzLatexPrinter._print_Sums t{{ q 't{{1~>!t{{1~>?@C H+4;;!Ga,q/!GHIC dmmS ) % DMM(BB BC  4;;t}}- -C ?"H C, 7C1 c t|jdk(r9dt|jdDcgc]}j|c}z}n<fd}dtj d|jDcgc] }|| c}z}t |jtr#|dj|jzz }|S|j|jz }|Scc}wcc}w)Nrlz\prod_{%s=%s}^{%s} rc |dt|d|d|dfDcgc]}j|c}zScc}wr rrs rsrz1LatexPrinter._print_Product.._format_ineqrrz\prod_{\substack{%s}} rr`rrs` rs_print_ProductzLatexPrinter._print_Products t{{ q (t{{1~>!t{{1~>?@C H,4;;!Ga,q/!GHIC dmmS ) % DMM(BB BC  4;;t}}- -C ?"Hrcddlm}g}||jk(r|jjSt ||r|j j }nd|fg}|D]\}}t|jj }|jd|D]\}} | dk(r|jd|jz*| dk(r|jd|jzNd |j| zd z} |jd| z|jzd j|} | dd k7r| d d} | S| dd} | S)Nr)Vectorc(|djSr)__str__rs rsrtz4LatexPrinter._print_BasisDependent..s!A$,,.rukeyrlr_rkr^rFror-) sympy.vectorr zero _latex_formrseparateitemsr componentssortappendrrP) rrr o1r+systemvect inneritemskvarg_stroutstrs rs_print_BasisDependentz"LatexPrinter._print_BasisDependentsB' 499 99(( ( dF #MMO))+EYKE! ?LFDdoo3356J OO 8O 9" ?16IIeamm34"WIIeamm34'$++a.8:EGIIego => ? ?''"+ !9 ABZF ABZF ruc|j|j}d|zdzddjt|j|jzz}|S)Nrro_{%s}rm)rrDrPmapindices)rrtex_basers rs_print_IndexedzLatexPrinter._print_Indexed sP;;tyy)(l3w  T\\ **, ,, ruc8|j|jSr)rlabelrs rs_print_IndexedBasezLatexPrinter._print_IndexedBases{{4::&&rucd|j|j}|j|j|j}|j|j|j}n|jtj }dj ||}dj ||S|S)Nz%{lower}\mathrel{{..}}\nobreak {upper})rrz{{{label}}}_{{{interval}}})r?interval)rr?rrr Zeror)rrr?rrrBs rs _print_IdxzLatexPrinter._print_Idxs DJJ' :: !KK +Ezz% DJJ/ AFF+@GG!5H2H/66(74 4 ruc t|jrd}n|jd}d}d}t|jD]d\}}||z }|dk(r||d|j |z }*||d|j |j |d|j |dz }f|dk(r d |d |d}nd |d|j |d |d}td |jDr+|d|j|jtd ddS|d|j|jtd ddS)Nz\partialrrrrlrrrorr}}{c3<K|]}|jywrr6r-rs rsr/z1LatexPrinter._print_Derivative..;s?q))+?rr Tr r F) rrrreversedvariable_countrrr9rArr!)rr diff_symbolrdimr.nums rs_print_DerivativezLatexPrinter._print_Derivative%sQ DII &%K..)>?Kt223 :FAs 3JCax; A?? (,(?(? A(O(, C(8::  : !8&137C ,7 C8H#NC ?TYY? ?"D$5$5dii29=!2!?@ @ruc|j\}}}j|}fd|D}fd|D}djdt||D}d|d|dS)Nc3@K|]}j|ywrrr-rXrs rsr/z+LatexPrinter._print_Subs..I1T[[^1r1c3@K|]}j|ywrrSrTs rsr/z+LatexPrinter._print_Subs..JrUr1z\\ c38K|]}|ddz|dzyw)r=rlNrp)r-rXs rsr/z+LatexPrinter._print_Subs..Ks(!B"#AaD3J1 !Bz\left. z \right|_{\substack{ z }})rArrPzip) rsubsrrnew latex_expr latex_old latex_new latex_subss ` rs _print_SubszLatexPrinter._print_SubsFskc3[[& 1S1 1S1 [[!B'*9i'@!BB 9C9CE Eruc dg}}|jd}t|jdkrntd|jDrRddt|jdz zzdz}|jDcgc]}d ||j |d }}nt |jD]}|d }|d z }t|dkDr|jd d k7r|jds|dz }t|dk(r0|d|j |dd|j |ddz }t|dk(r|d|j |dzz }|j d d ||j ||d|j|jtdtd|jDddj|Scc}w)Nrrc38K|]}t|dk(yw)rlN)r)r-lims rsr/z/LatexPrinter._print_Integral..Us(N3SQ(NrYz\irrlntz\, rz\intrrrz\limitsr&_{}^{rro^{%s}rr c3<K|]}|jywrrHrIs rsr/z/LatexPrinter._print_Integral..ps>o`aq?Y?Y?[>orTrJ) rrrallrrKinsertrrr!r9rArP)rrrsymbolsrMsymbolres rs_print_IntegralzLatexPrinter._print_IntegralPs2Wnn%:;  t{{ q S(N$++(N%N#s4;;/!344t;C%)[[2!&1$++fQi2HI2G2  , SQws8a<~~f-9$(NN6$:z)3x1}t{{3q6/B/3{{3q6/B DD3x1}w$++c!f*=>>q T[[=P"QR S"!$"3"3DMM4>u4E;>>oeienen>o;o;?#4#A WWW- / /+2s7 Gc|j\}}}}d|j|z}t|dk(s"|tjtj fvr|d|j|zz }n)||j|d|j|dz }t |tr|d|j|dS|d|j|S) Nz \lim_{%s \to z+-z%s}rrorFror)rArrtr InfinityNegativeInfinityrr)rrrXzz0dirrs rs _print_LimitzLatexPrinter._print_Limitts 1b#Q/ s8t rajj!2D2D%EE 6DKKO+ +C  BS1AB BC a !+. A? ?"DKKN3 3ruc|j|}|jd}|jd}|tvrd|z}|St|dk(s|j ds |dk(s|dk(r|}|S|dkDr)|dkDr$d|dt ||d |t ||d}|S|dkDrd|d|d ||d}|S|dkDrd|d|d ||d}|Sd |z}|S) ak Logic to decide how to render a function to latex - if it is a recognized latex name, use the appropriate latex command - if it is a single letter, excluding sub- and superscripts, just use that letter - if it is a longer name, then put \operatorname{} around it and be mindful of undercores in the name r_z\%srlrr\operatorname{Nroz\operatorname{%s})rMfindaccepted_latex_functionsrrr)rrsuperscriptidx subscriptidxrQs rs_hprint_FunctionzLatexPrinter._hprint_Functions&((.3yy~ + +D=D$ #Y!^tt4 8I^_`M`D  !lQ&6:#l>:;\.9:;=  !#.))+ !,'')  ,d2 ruc0|jj}t|d|zr&t|tst |d|z||S|j Dcgc]}t|j|}}|jd}d}|jdxr/t|dk(xr|j|j d }gd} || vr.|dk(rn(|d k(r|d d k(rd nd |ddz}n|dk(r |dd}d}|d}|r|tvrd|z} nDd|z} n>|+|j|} |j| } | d|d} n|j|} |r|tvr| dz } n | dz } n| dz } |r || d|zz } | dj|zScc}w)a# Render functions to LaTeX, handling functions that LaTeX knows about e.g., sin, cos, ... by using the proper LaTeX command (\sin, \cos, ...). For single-letter function names, render them as regular LaTeX math symbols. For multi-letter function names that LaTeX does not know about, (e.g., Li, sech) use \operatorname{} so that the function name is rendered in Roman font and LaTeX handles spacing properly. expr is the expression involving the function exp is an exponent _print_rFrrlr) asinacosatanacscasecacotasinhacoshatanhacschasechacothrfullrkhararcNpowerTz\%s^{-1}z\operatorname{%s}^{-1}rroz {%s}%s{\left(%s \right)}rirm)rrOrrrgetattrrArtrrrr$r{r~rrP) rrrIrr<rArinv_trig_power_casecan_fold_bracketsinv_trig_tablerQfunc_texs rs_print_FunctionzLatexPrinter._print_Functionsyy!! 4T) *t\2274T!124= =59YY?cC C()?D?"^^,<=N"'  $/C D!@D Q!@11$))A,?? N~%!]2#v-$(HOD$qr(JD#w.8D*.',1)"33&-D4t;D006228<%-s3,,T2 33H$DEMD--"s3&#((4.( (s@s!Fc6|jt|Sr)r~rtrs rs_print_UndefinedFunctionz%LatexPrinter._print_UndefinedFunctions$$SY//rucxd|j|jd|j|jdS)Nrz}_{\circ}\left({z}\right))rrrrs rs_print_ElementwiseApplyFunctionz,LatexPrinter._print_ElementwiseApplyFunctions, KK & KK "  ruc ^ddlm}ddlm}m}ddlm}ddlm}ddl m }|d|d|d |d |d|d iS) Nr)KroneckerDelta)gamma lowergamma)beta) DiracDelta)rUz\deltar@\gammaz\operatorname{B}z\operatorname{Chi}) (sympy.functions.special.tensor_functionsr'sympy.functions.special.gamma_functionsrr&sympy.functions.special.beta_functionsr'sympy.functions.special.delta_functionsr'sympy.functions.special.error_functionsrU)rrrrrrrUs rs_special_function_classesz&LatexPrinter._special_function_classess;KM?F?  I)I* , ,ruc|jD]9}t||s|j|jk(s*|j|cS|jt |Sr)r issubclassrOr~rt)rrclss rs_print_FunctionClassz!LatexPrinter._print_FunctionClasssX11 ;C$$#,,)F55c:: ;$$SY//ruc|j\}}t|dk(r|j|d}n|jt|}d|d|j|d}|S)Nrlrrnz \mapsto  \right))rArrr)rrrmrs rs _print_LambdazLatexPrinter._print_Lambda sX  w<1 kk'!*-Gkk%.1G18$++d:KL rucy)Nz\left( x \mapsto x \right)rprs rs_print_IdentityFunctionz$LatexPrinter._print_IdentityFunctions,ruct|jt}|Dcgc]}d|j|z}}dt |j j ddj|d}||d|dS|Scc}w) Nr#rrrFrLrorro)sortedrArrrtrrrP)rrrIrArntexargsrs rs_hprint_variadic_functionz&LatexPrinter._hprint_variadic_functionsvdii%56=AB654;;v..BB'*499~';';'='+yy'9; ?!$c* *J CsBc\d|j|jdz}||d|dS|S)Nz\left\lfloor{%s}\right\rfloorrrror rrrIrs rs _print_floorzLatexPrinter._print_floor&s2.TYYq\1JJ ?!$c* *Jruc\d|j|jdz}||d|dS|S)Nz\left\lceil{%s}\right\rceilrrror rs rs_print_ceilingzLatexPrinter._print_ceiling.s2,t{{499Q> ?!$c* *Jruc|jdr*d|j|jdtdz}n5dj |j|jdtd}|j ||S)Nrz\Re{%s}rAtomz\operatorname{{re}}{{{}}}rrrAr!rrJrs rs _print_rezLatexPrinter._print_reIr >>. )t001z&?QRRC.55d6G6G RS V`agVh6ijC  c**ruc|jdr*d|j|jdtdz}n5dj |j|jdtd}|j ||S)Nrz\Im{%s}rrz\operatorname{{im}}{{{}}}rrs rs _print_imzLatexPrinter._print_imQrrucddlm}m}t|jd|r|j |jddSt|jd|r|j |jddS|jdjr!d|j|jdzSd|j|jdzS)Nr) EquivalentImpliesz\not\Leftrightarrowz\not\Rightarrowz\neg \left(%s\right)z\neg %s) sympy.logic.boolalgrrrrA_print_Equivalent_print_Implies is_Booleanr)rrXrrs rs _print_NotzLatexPrinter._print_NotYs= affQi ,))!&&)5KL L affQi )&&qvvay2DE E FF1I *T[[-CC C AFF1I 66 6rucB|d}|jr!|jsd|j|z}nd|j|z}|ddD]P}|jr(|js|d|d|j|dz }7|d|d|j|z }R|S)Nrr`rrlrz \left(ro)ris_Notr)rrAcharr<rs rs _print_LogOpzLatexPrinter._print_LogOpds1g >>#**$t{{3'77C$++c**C8 Q TYYq\*DKK ! ,EGC%t{{499Q<'@@C ?"%s+ +C< ruc t|jdk(rad|j|jdd|j|jdd|j|jdd}nAd|j|jdd|j|jdd}|d |d |Sd |zS) Nr&rFr; rlrrroz\Pi^{roz\Pi%srrs rs_print_elliptic_pizLatexPrinter._print_elliptic_pis tyy>Q TYYq\*DKK ! ,ETYYq\*,C  TYYq\*DKK ! ,EGC ?$'- -c> !ruc|jd}t|jdk(r|jdn|jd}d|d|d}|d|d|Sd|zS) NrrlrFrLroz\operatorname{B}^{roz\operatorname{B}%s)rAr)rrrIr.yrs rs _print_betazLatexPrinter._print_betasd IIaL Na/DIIaLTYYq\s"QCw' ?14c: :(3. .ruc |jDcgc]}|j|}}d|dd|dd}|d|d|dd|d d |d | Sd|d|dd|d d |Scc}w) NrFrrLrlroryz}_{(rr&z)}^{roz)}r)rrrIoperatorr<largsrs rs_print_betainczLatexPrinter._print_betaincs}-1YY7cS!77(-a%(; ?=EuQxQVWXQY[^`cd d 9A%(ERSHVYZ Z 8sA%c*|j||dS)NI)r)rrHs rs_print_betainc_regularizedz'LatexPrinter._print_betainc_regularizeds""4s";;rucd|j|jdd|j|jdd}|d|d|Sd|zS) NrFrrLrlroz\Gamma^{roz\Gamma%sr rs rs_print_uppergammazLatexPrinter._print_uppergammaO(, DIIaL(A(, DIIaL(AC ?'*C0 0$ $rucd|j|jdd|j|jdd}|d|d|Sd|zS) NrFrrLrlroz\gamma^{ro\gamma%sr rs rs_print_lowergammazLatexPrinter._print_lowergammarrucd|j|jdz}|#|j|jd|d|S|j|j|SNr`rrro)rrArrs rs_hprint_one_arg_funcz!LatexPrinter._hprint_one_arg_funcsT 4;;tyy|#<< ?#';;tyy#93D D"kk$))4c: :rucbd|j|jdz}|d|d|Sd|zS)Nr`rz\operatorname{Chi}^{roz\operatorname{Chi}%sr rs rs _print_ChizLatexPrinter._print_Chis8 4;;tyy|#<< ?36< <*S0 0rucd|j|jdz}|j|jd}| d|d|d|Sd|d|S)Nr`rlrz\operatorname{E}_{rhror )rrrIrnus rs _print_expintzLatexPrinter._print_expintsW 4;;tyy|#<< [[1 & ?68#sC C 24S9 9rucbd|j|jdz}|d|d|Sd|zS)Nr`rzS^{rozS%sr rs rs_print_fresnelszLatexPrinter._print_fresnels 7 4;;tyy|#<< ?"%s+ +C< rucbd|j|jdz}|d|d|Sd|zS)Nr`rzC^{rozC%sr rs rs_print_fresnelczLatexPrinter._print_fresnelcr rucnd|j|jdtdz}| d|d|dS|S)Nz!%srFuncrFrGrorrAr!rs rs_print_subfactorialz LatexPrinter._print_subfactorials;t((1z&7IJJ ?.137 7Jrucld|j|jdtdz}||d|dS|S)Nz%s!rrrrorrs rs_print_factorialzLatexPrinter._print_factorial#s;t((1z&7IJJ ?!$c* *Jrucld|j|jdtdz}||d|dS|S)Nz%s!!rrrrorrs rs_print_factorial2zLatexPrinter._print_factorial2+s;))$))A, 68JKK ?!$c* *Jrucd|j|jdd|j|jdd}||d|dS|S)Nz{\binom{rrrlrrror rs rs_print_binomialzLatexPrinter._print_binomial3sI%)[[1%>%)[[1%>@ ?!$c* *Jruc|j\}}d|j|tdz}d|d|j|d}|j ||S)Nrrr }^{\left(\right)}rArr!rrJ)rrrInr3rDrs rs_print_RisingFactorialz#LatexPrinter._print_RisingFactorial<sPyy1t((Jv,>??+/Q@  c**ruc|j\}}d|j|tdz}d|j|d|d}|j ||S)Nrrz{\left(z \right)}_{ror)rrrIrr3subrs rs_print_FallingFactorialz$LatexPrinter._print_FallingFactorialDsPyy1d'':f+=>>+/;;q>3?  c**rucd|z}d}||jddk(r |d|d}nd}|d|j|jd |j|jd }|r|j ||}|S) NrFrrkrroTrg}\left(ro)rzrrargumentrJ)rrrIsymrneed_exps rs_hprint_BesselBasezLatexPrinter._hprint_BesselBaseLszsm ?xx}"$'-+. DJJ0G+/;;t}}+EG ##C-C ruc|syd}|ddD]}|d|j|zz }||j|dz }|S)Nrrkz%s, rS)rrrrrs rs _hprint_veczLatexPrinter._hprint_vec]sU Sb )A $++a.( (A ) T[[R !!ruc(|j||dS)NJr(rHs rs_print_besseljzLatexPrinter._print_besseljf&&tS#66ruc(|j||dS)Nrr-rHs rs_print_besselizLatexPrinter._print_besseliir/ruc(|j||dS)NKr-rHs rs_print_besselkzLatexPrinter._print_besselklr/ruc(|j||dS)NYr-rHs rs_print_besselyzLatexPrinter._print_besselyor/ruc(|j||dS)Nrr-rHs rs _print_ynzLatexPrinter._print_ynrr/ruc(|j||dS)Nrr-rHs rs _print_jnzLatexPrinter._print_jnur/ruc(|j||dS)NzH^{(1)}r-rHs rs_print_hankel1zLatexPrinter._print_hankel1x&&tS)<ruc(|j||dS)Nzh^{(1)}r-rHs rs _print_hn1zLatexPrinter._print_hn1~r>ruc(|j||dS)Nzh^{(2)}r-rHs rs _print_hn2zLatexPrinter._print_hn2r>ruchd|j|jdz}| |d|d|S||Srr rrrInotationrs rs _hprint_airyzLatexPrinter._hprint_airys: 4;;tyy|#<< ?#+S#6 6&, ,rucld|j|jdz}| d|d|d|S|d|S)Nr`rrz ^\prime}^{roz^\primer rFs rs_hprint_airy_primezLatexPrinter._hprint_airy_primes: 4;;tyy|#<< ?,4c3? ?%-s3 3ruc(|j||dSNAirHrHs rs _print_airyaizLatexPrinter._print_airyai  sD11ruc(|j||dSNBirNrHs rs _print_airybizLatexPrinter._print_airybirPruc(|j||dSrLrJrHs rs_print_airyaiprimezLatexPrinter._print_airyaiprime&&tS$77ruc(|j||dSrRrVrHs rs_print_airybiprimezLatexPrinter._print_airybiprimerXruc ^d|jt|jd|jt|jd|j |jd|j |jd|j|j d }| d|d|d }|S) Nz{{}_{z}F_{}\left(\begin{matrix} rz \end{matrix}\middle| { } \right)}rrhro)rrapbqr*r%rs rs _print_hyperzLatexPrinter._print_hypers{[[TWW & CL(Atww')9)9$'')Bkk$--( * ?"%s+C rucbd|jt|jd|jt|jd|jt|jd|jt|j d|j |j d|j |jd|j |jd|j |jd|j|jd}| d |d|d }|S) Nz{G_{rLrhr\r~ \\z \end{matrix} \middle| {r]rro) rrr^r_ranr*aotherbotherr%rs rs_print_meijergzLatexPrinter._print_meijergs[[TWW & CL(Akk#dgg,'S\)Btww')9)9$++)Ftww')9)9$++)Fkk$--( * ?"%s+C rucbd|j|jdz}|d|d|Sd|zS)Nr`rz\eta^{roz\eta%sr rs rs_print_dirichlet_etaz!LatexPrinter._print_dirichlet_etas7 4;;tyy|#<< ?%(#. .3ruct|jdk(r-dtt|j|jz}n!d|j |jdz}|d|d|Sd|zS)Nrz\left(%s, %s\right)r`rz\zeta^{roz\zeta%srrArr:rrs rs _print_zetazLatexPrinter._print_zetasf tyy>Q (5T[[$))1L+MMC$t{{499Q<'@@C ?&)3/ /Cruct|jdk(r-dtt|j|jz}n!d|j |jdz}| d|d|dSd|zS) Nrz_{%s}\left(%s\right)r9rrrrorrjrs rs_print_stieltjeszLatexPrinter._print_stieltjessf tyy>Q )E#dkk4992M,NNCT[[166C ?'*C0 0S  rucxdtt|j|jz}|d|zSd|d|S)Nz\left(%s, %s, %s\right)z\Phi%sz\Phi^{ro)rr:rrArs rs_print_lerchphizLatexPrinter._print_lerchphis?(5T[[$))1L+MM ;s? " !$c**ruc|t|j|j\}}d|z}|d|d|Sd|d|d|S)Nr`z\operatorname{Li}_{rorhr:rrA)rrrIrrrsrs rs_print_polylogzLatexPrinter._print_polylogsF4;; *1 1$ ;23S9 9 34c3??ruc t|j|j\}}}}d|d|d|d|d }| d|zd|zz}|S)NP_{rrm\right)}\left(rorF \right)^{%s}rq)rrrIrrrr.rs rs _print_jacobizLatexPrinter._print_jacobisIdii0 1a?@!QJ ?c/Os$;;C ruct|j|j\}}}d|d|d|d}| d|zd|zz}|S)NzC_{rrurorFrvrqrrrIrrr.rs rs_print_gegenbauerzLatexPrinter._print_gegenbauerEdkk499-1a<=q!D ?c/Os$;;C rucxt|j|j\}}d|d|d}| d|zd|zz}|S)NzT_{r$rorFrvrqrrrIrr.rs rs_print_chebyshevtzLatexPrinter._print_chebyshevtA4;; *1*+Q/ ?c/Os$;;C rucxt|j|j\}}d|d|d}| d|zd|zz}|S)NzU_{r$rorFrvrqr}s rs_print_chebyshevuzLatexPrinter._print_chebyshevurrucxt|j|j\}}d|d|d}| d|zd|zz}|S)Nrtr$rorFrvrqr}s rs_print_legendrezLatexPrinter._print_legendrerruct|j|j\}}}d|d|d|d}| d|zd|zz}|S)NrtrrurorFrvrqrys rs_print_assoc_legendrez"LatexPrinter._print_assoc_legendrer{rucxt|j|j\}}d|d|d}| d|zd|zz}|S)NzH_{r$rorFrvrqr}s rs_print_hermitezLatexPrinter._print_hermiterrucxt|j|j\}}d|d|d}| d|zd|zz}|S)NL_{r$rorFrvrqr}s rs_print_laguerrezLatexPrinter._print_laguerrerruct|j|j\}}}d|d|d|d}| d|zd|zz}|S)NrrrurorFrvrqrys rs_print_assoc_laguerrez"LatexPrinter._print_assoc_laguerrer{ruc t|j|j\}}}}d|d|d|d|d }| d|zd|zz}|S)NzY_{rhr$rmrorFrvrqrrrIrmthetaphirs rs _print_YnmzLatexPrinter._print_YnmJt{{DII61eS23QsC ?c/Os$;;C ruc t|j|j\}}}}d|d|d|d|d }| d|zd|zz}|S)NzZ_{rhr$rmrorFrvrqrs rs _print_ZnmzLatexPrinter._print_Znm#rruc xt|j|\}}}|rdnd}|sdnd|z}||d|d|d|d| S)Nz ^{\prime}rrirFrLro)r:r) r characterrArrIrrrssups rs__print_mathieu_functionsz&LatexPrinter.__print_mathieu_functions*sAdkk4(1a#lb33|jd|j|S)NCr&_LatexPrinter__print_mathieu_functionsrArHs rs_print_mathieuczLatexPrinter._print_mathieuc0--c499#-FFruc>|jd|j|S)Nr rrrHs rs_print_mathieuszLatexPrinter._print_mathieus3rruc@|jd|jd|S)NrTrrIrrHs rs_print_mathieucprimez!LatexPrinter._print_mathieucprime6 --c499Dc-RRruc@|jd|jd|S)Nr TrrrHs rs_print_mathieusprimez!LatexPrinter._print_mathieusprime9rruc|jdk7rUd}|j}|jdkrd}| }|jdrd|||jfzSd|||jfzS|j|jS)Nrlrrrrz %s%d / %dz%s\frac{%d}{%d})rrrr)rrsignrs rs_print_RationalzLatexPrinter._print_Rational<s~ 66Q;DAvvzB~~/0#tQ&777%q$&&(99 9;;tvv& &rucV|j|j}|jrtd|jDst |j dkDr|dz }t |j dkDr||j|j z }n-|j r!||j|j dz }|dz }t |jdkDr#||j|jz }d|zS||j|jdz }d|zS)Nc3BK|]}|tjk7ywr)r rC)r-rs rsr/z,LatexPrinter._print_Order..Ks>aa166k>srlrr \rightarrow zO\left(%s\right))rrpointr9r variables)rrrrs rs _print_OrderzLatexPrinter._print_OrderIs KK " ::#>4::>> t~~  " IA4>>"Q&T[[00T[[!233  A4::"T[[,,#Q&&T[[A//"Q&&ruc|jdj|}||S|j|j|S)Nrstyle)rrrMrQ)rrrrQs rs _print_SymbolzLatexPrinter._print_SymbolYs@NN>266t<  K((%(@@ruc6|d|vr|ggfS|jdr'|jddjddgg}}}nt|\}}}t|}|Dcgc] }t|}}|Dcgc] }t|}}|||fScc}wcc}w)Nrrrxz\_rz\^)rrr translate)rrQsupersr[rr!s rs_split_super_subzLatexPrinter._split_super_subbs <3$;"b> ! ^^5 6"&,,sE":"B"B3"NPRTV$&D!0!6 D&$,23S)C.33*./3 #//fd##4/s B8Bc|j|\}}}|dk(rdj|}|r|ddj|zz }|r|ddj|zz }|S)Nr \mathbf{{{}}}rirr9)rrrP)rstringrrQrr[s rsrMz!LatexPrinter._deal_with_super_subnsn!226:fd F?#**40D  Gchhv.. .D  Gchhtn, ,D ruc|jdrd}d}nd}d}d||ddd d }|j|jd ||jd |j|jS) Nrz\gtz\lt>=z<=z!=r)rrlhsrel_oprhs)rrgtltcharmaps rs_print_RelationalzLatexPrinter._print_Relational}sv >>& !BBBB  "[[2$T[[14;;txx3HJ Jruc <|jddDcgc]*\}}|j|d|j|,}}}|jdjtk(r;|j d|j|jdj znb|j |j|jdj d|j|jdjd}|dj |zScc}}w)Nrkz & \text{for}\: z%s & \text{otherwise}z\begin{cases} %s \end{cases}rb)rArcondrr.rrP)rrrXrecpairsrs rs_print_PiecewisezLatexPrinter._print_Piecewises#yy"~/q!/3kk!ndkk!nM// 99R=   % NN3;;tyy}'9'9:; < NN KK " (:(:; KK " (:(:;= >.V[[)))/s/Dc g}t|jD]F}|jdj||ddfDcgc]}|j |c}H|j d}|+|j ddk(rd}n|j dkdurd}nd }d }|jd |}|d k(r%|jd d d|j zzdz}|dj|zScc}w)Nr~rrr smallmatrix Tmatrixarray \begin{%MATSTR%}%s\end{%MATSTR%}%MATSTR%rrr}%sr)rrowsr.rPrrcolsr)rrlineslinerrout_strs rs_print_matrix_contentsz#LatexPrinter._print_matrix_contentss$))$ ND LLT$']$KT[[^$KL M N..+ ?~~f%1'IIO,&G%G5//*g6 g oodC#dii-,?%,GHGE***!%LsC/c|j|}|jdr,|jd}|j|}d|z|zdz|z}|S)Nr\left\right)rrr)rrr left_delim right_delims rs_print_MatrixBasezLatexPrinter._print_MatrixBases`--d3 >>+ & 4J**:6K+g5 "-.Gruc|j|jtdd}|j|jd|j|j }d|d|dS)NrTr rmr}_{ro)rparentr!rrr)rr matrix_part index_parts rs_print_MatrixElementz!LatexPrinter._print_MatrixElementsd'' Z5GPT'U  DFF+,Adkk$&&.A-BC K=j\44ruc fd}j|jtdddz||j|jjzdz||j |jj zdzS)Nct|}|ddk(r|d=|ddk(rd|d<|d|k(rd|d<djfd|DS)Nrrlr:c3HK|]}|j|ndywNrrS)r-xirs rsr/zFLatexPrinter._print_MatrixSlice..latexslice..s"R"r~DKKO2ERs")rrP)r.rNrs rs latexslicez3LatexPrinter._print_MatrixSlice..latexslices\QAtqyaDtqy!ts{!88RPQRR RrurTr\left[rL\right])rrr!rowslicercolslicer)rrrs` rs_print_MatrixSlicezLatexPrinter._print_MatrixSlices S!!$++z&/A$!OR[[4==$++*:*:;<>BC4==$++*:*:;<>HI Jruc8|j|jSr)rblocksrs rs_print_BlockMatrixzLatexPrinter._print_BlockMatrixs{{4;;''ruc|j}ddlm}m}t ||s,t ||s |j rd|j |zS|j|t|d}d|vrd|zSd|zS)Nr MatrixSymbol BlockMatrixz\left(%s\right)^{T}Trz%s^{T}) r<sympy.matricesrrr is_MatrixExprrrr)rrrrrrrs rs_print_TransposezLatexPrinter._print_Transposesthh<3 -3 ,1B1B)DKK,<< <!!#'=d'CTJAax-11!|#rucB|j}d|j|zS)Nz!\operatorname{tr}\left(%s \right))r<rrrrs rs _print_TracezLatexPrinter._print_Traceshh3dkk#6FFFrucNdddd}|j|jdd}|j}ddlm}m}t ||s0t ||s$|jrd|j|d |d S|j|t|d }d |vr d|d |d S|d |d S)Nz\daggerz\astz \mathsf{H})rstar hermitianrrrrFrGroTrr) rrr<rrrrrrrr)rrstyle_to_latexrrrrrrs rs_print_AdjointzLatexPrinter._print_Adjoints# &  '**4>>/+JJW hh<3 -3 ,1B1B.2kk#.> N N!!#'=d'CTJAax23]CC%& 66ruc ddlmfd}tj}j r5|ddk(r|dd}n |d |d<ddj t ||zSdj t ||S)Nr)MatMulct|trt|sj|Sj|t dSNF)rr rrr)r.rrrs rsrtz,LatexPrinter._print_MatMul..s@Z3-? STV\H]4;;q>   a!7!=u Erurkrlrr)sympyrrrAr6rPr:)rrparensrArs`` @rs _print_MatMulzLatexPrinter._print_MatMuls FDII  ( ( *Aw"}ABx7(Q#((3vt#455 588C-. .ruct|}|j\}}|j||d|j||S)Nr)rrAr)rrr leftrights rs_print_DotProductzLatexPrinter._print_DotProductsG&t,ii e$$T512'$:K:KESX:Y9Z[[ruc|j}|jrDddlm}t ||rd|j |j zSd|j|zSd|j |zS)Nr)rr)r<r&sympy.matrices.expressions.blockmatrixrrrrr)rrrrs rs_print_DeterminantzLatexPrinter._print_Determinant sehh    J#{++d.I.I#**.UUU'$++c*:: :#d&A&A#&FFFruc\|Xd|j|jdtddd|j|jdtddd|d S|j|jdtddd|j|jdtddS) NrFrr Trz \bmod rlrGrorrHs rs _print_ModzLatexPrinter._print_Mods ?""499Q<E1B*.#0""499Q<E1B*.#0   "&!2!2499Q<3=e3D:>"3"@"&!2!2499Q<3=e3D:>"3"@A Aruc~|j}td|jdjfd|DS)Nrz \circ c34K|]}|dywTrNrpr-r<rprecs rsr/z6LatexPrinter._print_HadamardProduct.., <VCd + + <rAr!rrPrrrArrs @@rs_print_HadamardProductz#LatexPrinter._print_HadamardProduct&s:yy% ""  >rucnt|jtdkrd}nd}|j||S)Nr z%s^{\circ \left({%s}\right)}z%s^{\circ {%s}})rrIr!r)rrrs rs_print_HadamardPowerz!LatexPrinter._print_HadamardPower.s5 !$(( +j.? ?6H)H00x@@ruc~|j}td|jdjfd|DS)Nr \otimes c34K|]}|dywrrprs rsr/z7LatexPrinter._print_KroneckerProduct..;rrrrs @@rs_print_KroneckerProductz$LatexPrinter._print_KroneckerProduct5s<yy% ""   >rucD|j|j}}ddlm}t ||s3|j r'd|j |d|j |dS|j |}d|vrd|d|j |dS|d|j |dS)Nr)rrFrGrorr)rDrIrrrrr)rrrDrIrbase_strs rs _print_MatPowzLatexPrinter._print_MatPow=sIItxxc/$ -$2D2D/3{{4/@.2kk#.>@ @{{4(Hh2:DKK??rucB|j||jdS)Nrr)rrrs rs_print_MatrixSymbolz LatexPrinter._print_MatrixSymbolJs(!!$dnn / !! !ruc.|jddk(rdSdS)Nrr0z \mathbf{0}r)rZs rs_print_ZeroMatrixzLatexPrinter._print_ZeroMatrixN(nn  #*+s >0= >ruc.|jddk(rdSdS)Nrr1z \mathbf{1}r*)rOs rs_print_OneMatrixzLatexPrinter._print_OneMatrixRr-ruc.|jddk(rdSdS)Nrrz \mathbb{I}z \mathbf{I}r*)rrs rs_print_IdentityzLatexPrinter._print_IdentityVs( $ ! #*!+} >0= >rucH|j|jd}d|zS)NrzP_{%s}r )rPperm_strs rs_print_PermutationMatrixz%LatexPrinter._print_PermutationMatrixZs#;;qvvay)(""ruc >|jdk(r|j|dS|jd}|?|jddk(rd}n*|jdk(s|jddkrd }nd }d }|j d |}|d k(r(|j d dd|jdzzdz}|jdr,|jd}|j |}d|z|zdz|z}|jdk(r|dzSt |jdzDcgc]}g}}|jDcgc]}tt |}}tj|D]} |dj|j|| d} t |jdz ddD]} t|| dz|j| kro| r*|| jdj|| dznT|| j|dj|| dzzt|| dzdk(rd|| dzdz|| d<| } g|| dz<|dd} |jdzdk(r|| z} | Scc}wcc}w)NrrprrrrrkrrrrrrrrrrrrrrlTr~rrrr) rankrrshaperrrr itertoolsproductr.rrP) rrr block_strrrr level_str shape_rangesouter_ieven back_outer_irs rs_print_NDimArrayzLatexPrinter._print_NDimArray^s 99;! ;;tBx( (..+ ?~~f%1'IIK1$$**R.B*>&G%G7 %%j': g !))$c$**Q-6G0G%0OPI >>+ &"nn[9J**:6K :- 9!"$/0I 99;! r> !27 a2H%IQb%I %I04 ;1U1X; ; ((,7 /G bM T']!; <D %diik!mR < / ya01DJJ|4LLl+22 Il1n$=>@l+22!UZZ ,q.0I%JKM9\!^45:6?%l3B778:D7E ,/3x,. ,q.) / /$A,q/ 99;?a ')G3&J;s * JJcZ|j|}d}d}|D]}|j}||vs|r ||k(r|dz }||k7r||dz }|jr|dz }n|dz }||j|jdz }||vr|dz }||j||z }d}nd}|}||dz }|S) Nrmroz{}^{z{}_{rrXTF)ris_uprA) rrQr; index_mapr last_valenceprev_mapindex new_valences rs_printer_tensor_indicesz$LatexPrinter._printer_tensor_indicess++d#  'E++K)# K/3{*+sNG;;v%Gv%G t{{5::a=1 1G !34;;y'788 &L' '(  # sNGruc|jdjd}|j}|j||iSr)rA get_indicesrK)rrrQr;s rs _print_TensorzLatexPrinter._print_Tensors=yy|  #""$++D'2>>ruc|jjdjd}|jj}|j}|j |||Sr)rrArMrFrK)rrrQr;rFs rs_print_TensorElementz!LatexPrinter._print_TensorElementsOyy~~a %%a())'')NN ++D'9EEruc |j\}}|dj|Dcgc]}|j|t|c}zScc}wr)!_get_args_for_traditional_printerrPrr )rrrrAr<s rs_print_TensMulzLatexPrinter._print_TensMulsO;;= dbggAE F#T  sJt$4 5 F   Fs"A c g}|j}|D],}|j|j|t|.|j dj |}|j dd}|S)Nr_z+ -r)rAr.rr r-rPr)rrrrAr.rrs rs_print_TensAddzLatexPrinter._print_TensAddsh yy =A HHT&&q*T*:; < =  JJqM IIeT "ruchd|jrdndd|j|jddS)Nz{}rrxrrro)rErrArs rs_print_TensorIndexzLatexPrinter._print_TensorIndexs.::C3 & KK ! %  ruc t|jdk(rGd|j|jdd|j|jt dddSdt|jdd j |jDcgc]}d |j|zc}d |j|jt dddScc}w) Nrlz\frac{\partial}{\partial {rrFr Froz\frac{\partial^{rz \partial {%s}r)rrrrrr!rPrrrs rs_print_PartialDerivativez%LatexPrinter._print_PartialDerivatives t~~ ! # DNN1-.!!$))Z->F  $DNN#T^^T*T[[^;TU!!$))Z->F TsCc8|j|jSr)rrQrs rs_print_ArraySymbolzLatexPrinter._print_ArraySymbols{{499%%ruc d|j|jtddddj|jDcgc]}|j |c}dScc}w)Nz{{rTrrLr)rrQr!rPr;rrYs rs_print_ArrayElementz LatexPrinter._print_ArrayElementsU   diiF);T B IIDLLAq$++a.)*A BD DAsA#cy)Nz \mathbb{U}rprs rs_print_UniversalSetz LatexPrinter._print_UniversalSetruc|!d|j|jdzSd|j|jdd|dS)Nz$\operatorname{frac}{\left(%s\right)}rz\operatorname{frac}{\left(z \right)}^{ror rHs rs _print_fraczLatexPrinter._print_fracsK ;:T[[ST=VV V KK ! -s4 4ruc ^|jddk(rd}n |jddk(rd}n tdt|dk(r&|j|j |d|zS|j|d zj |Dcgc]}|j |c}Scc}w) Nrr;rrmUnknown Decimal Separatorrlrz \ )rrrrrrP)rrseprs rs _print_tuplezLatexPrinter._print_tuples >>- .' 9C ^^/ 0H <C89 9 t9>**4;;tAw+?#+EF F**w$$d%Cdkk!n%CDF F%CsB* c~|jDcgc]}|j|}}dj|Scc}w)Nr rArrPrrrelementss rs_print_TensorProductz!LatexPrinter._print_TensorProducts7,0II6qDKKN66  **7:c~|jDcgc]}|j|}}dj|Scc}w)N \wedge rjrks rs_print_WedgeProductz LatexPrinter._print_WedgeProducts7,0II6qDKKN66))7rnc$|j|Sr)rhrs rs _print_TuplezLatexPrinter._print_Tuple s  &&ruc 8|jddk(r1ddj|Dcgc]}|j|c}zS|jddk(r1ddj|Dcgc]}|j|c}zStdcc}wcc}w)Nrrz\left[ %s\right]z; \ r, \ rf)rrPrrrYs rs _print_listzLatexPrinter._print_list s >>- .' 9& t > ^^/ 0H <& t >89 9 ==s B &B ct|jt}g}|D];}||}|j|j |d|j |=ddj |zS)Nr#z : z\left\{ %s\right\}ru)rkeysrr.rrP)rrrxr+r$vals rs _print_dictzLatexPrinter._print_dictsmaffh$45 KCC&C LLdkk#&6 C8HI J K%x}}U';;;ruc$|j|Sr)rzrs rs _print_DictzLatexPrinter._print_Dict!s%%ruc6t|jdk(s|jddk(r"d|j|jdz}nAd|j|jdd|j|jdd}|r d|d|d }|S) Nrlrz\delta\left(%s\right)z\delta^{\left( z \right)}\left( rrFrGrorrs rs_print_DiracDeltazLatexPrinter._print_DiracDelta$s tyy>Q $))A,!"3*T[[1-FFC#4 DIIaL)4;;tyy|+DFC -0#6C ruc|j|jd|jdz }|j|jd}d|d|d}| d|d|d |d}|S) Nrrlrz{\left\langle z \right\rangle}^{roz{\left({\langle z \rangle}^{z }\right)}^{r )rrrIshiftrrs rs_print_SingularityFunctionz'LatexPrinter._print_SingularityFunction.s\ DIIaL499Q<78 DIIaL)9>F ?FKUTWXC rucpdjfd|jD}d|z}|r d|d|d}|S)NrLc3@K|]}j|ywrrSr-r<rs rsr/z0LatexPrinter._print_Heaviside..7sAs$++c*Ar1z\theta\left(%s\right)rFrGro)rPpargs)rrrIrrs` rs_print_HeavisidezLatexPrinter._print_Heaviside6s7 AdjjAA&. -0#6C ruc|j|jd}|j|jd}|jdjr#|jdjr d|d|d}n d|d|d}| d|d|d}|S) Nrrlz\delta_{rrorLrFrG)rrAr)rrrIrrrs rs_print_KroneckerDeltaz"LatexPrinter._print_KroneckerDelta=sx KK ! % KK ! % 99Q<  DIIaL$8$8'(!,C()1-C ?-0#6C ruct|j|j}td|jDrddj |z}nddj |z}|r d|d|d}|S)Nc34K|]}|jywr)r)r-r.s rsr/z1LatexPrinter._print_LeviCivita..Js,Qqyy,sz\varepsilon_{%s}rrLrFrGro)r:rrArkrP)rrrIr;rs rs_print_LeviCivitazLatexPrinter._print_LeviCivitaHs`dkk499- ,$)), ,%(99C% '(::C -0#6C rucft|dr"d|j|jzSt|dr=d|j|jzdz|j|jzSt|drd|j|jzS|jdS)N as_booleanz\text{Domain: }set \in rmz\text{Domain on })rrrrmr)rrs rs_print_RandomDomainz LatexPrinter._print_RandomDomainRs 1l #% ALLN(CC C Q &QYY)??(JKK&' ( Q "'$++aii*@@ @;;t$ $rucZt|jt}|j|S)Nr#)rrAr _print_setrrrr+s rs_print_FiniteSetzLatexPrinter._print_FiniteSet]s"qvv#34u%%ruc*t|t}|jddk(r*djt |j |}d|zS|jddk(r*djt |j |}d|zSt d) Nr#rrrrrLrf\left\{%s\right\})rrrrPr:rrrs rsrzLatexPrinter._print_setasq./ >>- .' 9IIc$++u56E $e++ ^^/ 0H <IIc$++u56E$e++89 9rucfd}tjjr<jjr&jj rdddf}nۉdddf}nӉjjrdjz df}njjr#t }t|t|f}nkjXjdkdk(r t}nAjr't }t|t|df}n|S|Sddjfd |Dzd zS) Ncjddk(rVjddk(rjjd}ndjfdjD}n^jddk(r(djfdjddD}n$djfdjD}d|d S) NrrrlrLc3@K|]}j|ywrrSrs rsr/zKLatexPrinter._print_Range.._print_symbolic_range..u$H#T[[%5$Hr1c3@K|]}j|ywrrSrs rsr/zKLatexPrinter._print_Range.._print_symbolic_range..xs$L#T[[%5$Lr1c3@K|]}j|ywrrSrs rsr/zKLatexPrinter._print_Range.._print_symbolic_range..zrr1z\text{Range}\left(rorj)contrrrs rs_print_symbolic_rangez8LatexPrinter._print_Range.._print_symbolic_rangeosvvayA~66!9>;;qvvay1D99$H$HHD66!9>99$L$LLD99$H$HHD+D6: ;rurkrrlrcT\left\{rLc3LK|]}|urj|ndywz\ldotsNrSr-eldotsrs rsr/z,LatexPrinter._print_Range..%_PRbn4;;r?)K_!$\right\}) objectstart is_infinitestopstep is_positiveiternextis_emptyrqr is_iterablerP)rrrrprintsetitrs`` @rs _print_RangezLatexPrinter._print_Rangens2 <x 77  166#5#5vv!!Q4/Ar4/ WW QrUQVV^QrU2H VV  aBBxb4/H ZZ # t# 8!W8T"XtQrU:,..(* * _V^__` ruc t|jdk(r|F|d|j|jdd|d|j|jddS|d|j|jdd|j|jddS|d|j|jdd}||d |d}|S) Nrrgrrhr$rlrororr)rrletterrIrs rs__print_number_polynomialz&LatexPrinter.__print_number_polynomials tyy>Q 9? KK ! 5s KK ! 57717 DIIaL14;;tyy|3LN N#DKK ! $=> ? #S)C ruc(|j|d|SNB&_LatexPrinter__print_number_polynomialrHs rs_print_bernoullizLatexPrinter._print_bernoulli--dC==ruc(|j|d|S)NGrrHs rs_print_genocchizLatexPrinter._print_genocchirrucZt|jdk(rdj|jddj|jdd}ddjfd|jd Dz}| |d |d|}|S||z}|Sj |d |S) Nr&zB_{rrLrlror`c3@K|]}j|ywrrS)r-rrs rsr/z+LatexPrinter._print_bell..s#3C/148;;r?3Cr1rrr)rrArrPr)rrrItex1tex2rs` rs _print_bellzLatexPrinter._print_bells tyy>Q $(KK ! $= $ DIIaL 9;D% 3C59YYq\3C)CCD&*C6JTkJ--dC==ruc(|j|d|SNFrrHs rs_print_fibonaccizLatexPrinter._print_fibonaccirruc\d|j|jdz}||d|d}|S)NzL_{%s}rrror rs rs _print_lucaszLatexPrinter._print_lucas1$++diil33 ? #S)C ruc(|j|d|S)NTrrHs rs_print_tribonaccizLatexPrinter._print_tribonaccirruc|!d|j|jdzSd|d|j|jddS)Nz\mu\left(%s\right)rz\mu^{r$ror rHs rs _print_mobiuszLatexPrinter._print_mobiussD ;(4;;tyy|+DD D -0$++diil2KLLruc Ttt|jjdkDs"t|jjdkDrvdj |j dj |jddj |jdj |jd S|jtjurY|j}|j|dz |j|dz |j|d z |j|f}nM|jtjus|jd kDr|dd }|jn t|}d d jfd |DzdzS)Nrrz \right\}_{rXrhror&rrlrcrrLc3LK|]}|urj|ndywrrSrs rsr/z1LatexPrinter._print_SeqFormula..rrr)rrr free_symbolsrrformularr rrcoeffrqlengthr.rrP)rrrrrrs` @rs_print_SeqFormulazLatexPrinter._print_SeqFormulasHx qww## $q (C0C0C,Dq,H AII& AKKN+ AGG$ AFF#   77a(( (66DaggdQh/1Bq)1774=:H VVqzz !QXX\!uH OOD !QxH _V^__` ruc2|j|jk(rd|j|jzS|jrd}nd}|jrd}nd}d||j|jd|j|jd|S) NrrrrrrrLr)rendr left_open right_open)rrr r s rs_print_IntervalzLatexPrinter._print_Intervals 77aee '$++agg*>> >{{||$++agg. AEE0BEK Krucxd|j|jd|j|jdS)Nz \left\langle rLz \right\rangle)rrrrrs rs_print_AccumulationBoundsz&LatexPrinter._print_AccumulationBoundss+QUU#T[[%79 9ruct|}|jDcgc]}|j||}}dj|Scc}w)Nz \cup rrArrPrurrargs_strs rs _print_UnionzLatexPrinter._print_UnionE%a(89?1D%%a.??~~h''@Act|}|jDcgc]}|j||}}dj|Scc}w)Nz \setminus rrs rs_print_ComplementzLatexPrinter._print_Complement G%a(89?1D%%a.??""8,,@rct|}|jDcgc]}|j||}}dj|Scc}w)Nz \cap rrs rs_print_Intersectionz LatexPrinter._print_Intersection rrct|}|jDcgc]}|j||}}dj|Scc}w)Nz \triangle rrs rs_print_SymmetricDifferencez'LatexPrinter._print_SymmetricDifference rrc0t|t|jdk\rMt|js8j |jddt|jzzSdj fd|jDS)Nrlrz^{%d}rc3BK|]}j|ywr)r)r-rrrs rsr/z1LatexPrinter._print_ProductSet.. s# <-0D  c4 ( .. s*RDAq A A/Rs/2rLc3&K|] }d|z yw) %s \in %sNrp)r-xys rsr/z/LatexPrinter._print_ImageSet../ s;<",;sr\; \middle|\; r)rXr signaturerZ base_setsrPr)rrrrsigxysxinyss` rs_print_ImageSetzLatexPrinter._print_ImageSet+ s\ww||ggRCQ[[ s)KK ! - .55i@@rucdj|jDcgc]}|j|c}}d|j|jd|d|j|jdScc}w)NrLrr rr)rPrrrrrs rs_print_ComplexRegionz!LatexPrinter._print_ComplexRegionB s[YYAKKHS C 0HI KK   KK ! ! IsA7cFdtfd|jDzS)Nr c3@K|]}j|ywrrS)r-rrs rsr/z/LatexPrinter._print_Contains..J s#CqDKKN#Cr1)rrArWs` rs_print_ContainszLatexPrinter._print_ContainsI se#CAFF#CCCCruc|jjtjurA|jjtjur|j |j S|j|jdzS)Nz + \ldots) rcrr rCbnra0rftruncaters rs_print_FourierSeriesz!LatexPrinter._print_FourierSeriesL sV 44<<166 !addllaff&<;;qtt$ $qzz|,|;;ruc8|j|jSr)rfinfiniters rs_print_FormalPowerSeriesz%LatexPrinter._print_FormalPowerSeriesQ sqzz**ruc d|jzS)Nz\mathbb{F}_{%s})modrs rs_print_FiniteFieldzLatexPrinter._print_FiniteFieldT s!DHH,,rucyrrprs rs_print_IntegerRingzLatexPrinter._print_IntegerRingW rarucyrrprs rs_print_RationalFieldz!LatexPrinter._print_RationalFieldZ rarucyrrprs rs_print_RealFieldzLatexPrinter._print_RealField] rarucyrrprs rs_print_ComplexFieldz LatexPrinter._print_ComplexField` raruc|j|j}djt|j|j}|d|dS)NrLrrrdomainrPr:rmrrr:rms rs_print_PolynomialRingz"LatexPrinter._print_PolynomialRingc <T[[)))C T\\:;'-w77ruc|j|j}djt|j|j}|d|dS)NrLrFror9r;s rs_print_FractionFieldz!LatexPrinter._print_FractionFieldh r=ruc|j|j}djt|j|j}d}|j sd}||d|dS)NrLrzS_<^{-1}rr)rr:rPr:rmis_Poly)rrr:rminvs rs_print_PolynomialRingBasez&LatexPrinter._print_PolynomialRingBasem sOT[[)))C T\\:;||C),fg>>ruc p|jj}g}|jD]P\}}d}t|D]]\}}|dkDs |dk(r"||j |j |z }3||j t |j ||z }_|jr)|rd|j |z} nq|j |} n_|rL|tjur|jd|g|tjur|jd|g|j |} |s| } n| dz|z} | jdr|jd| ddg>|jd| gS|ddvr!|jd} | dk(r d|dz|d<dj|} tt!|j|j } d |j |j#z}d j| g| z|gz}|t$vr d |d |d }|Sd|d|d }|S)Nrrrlr`rr%r)r%rz domain=%srLr {\left(z \right)}ryz }{\left( )rNrOrcrbrgenspowr"r rextendrrpoprPrr: get_domainr{)rpolyrrcmonomrs_monomrrIs_coeffs_termmodifierrrFr:rArs rs _print_PolyzLatexPrinter._print_Polyu s nn%% JJL" ,LE5G#E* G37ax4;;tyy|#<<4;;s499Q</E#FF  G||04;;u3EEG"kk%0G~ c7^4  - c7^4 ++e,  30  % c6!":./ c6]+E" ,H 8z !yy|H3q>axxC TYY/0t{{4??+<==yy$$&12 * */2D9C +>A$GC ruc|jj}|dk(rd}|j|j}|j}|t vrd|||fzSd|||fzS)N ComplexRootOfCRootOfz\%s {\left(%s, %d\right)}z'\operatorname{%s} {\left(%s, %d\right)})rNrOrrrIr{)rr;rrrIs rs_print_ComplexRootOfz!LatexPrinter._print_ComplexRootOf sqnn%% / !C{{499%  * */3e2DD D=dAFAHH Hrucb|jj}|j|jg}|jt j ur*|j|j|j|tvrd|ddj|dSd|ddj|dS)NrrErLrryz } {\left() rNrOrrfunr IdentityFunctionr.r{rP)rrrrAs rs_print_RootSumzLatexPrinter._print_RootSum snn%% DII&' 881-- - KK DHH- . * */2DIIdOD D +>A=AYYt_N Nrucy)N\omegarprs rs_print_OrdinalOmegaz LatexPrinter._print_OrdinalOmega sruc|j\}}|dk7r(|dk7rdj||Sdj|S|dk7rdj|Sy)Nrlz{} \omega^{{{}}}z {} \omegaz \omega^{{{}}}r[)rAr)rrrImuls rs_print_OmegaPowerzLatexPrinter._print_OmegaPower s\99S !8ax*11#s;;#**3//ax'..s33 ruc|dj|jDcgc]}|j|c}Scc}wNr_)rPrArrBs rs_print_OrdinalzLatexPrinter._print_Ordinal s,zztyyA4;;s+ABBAs9cP|jd}|j|td|S)Nrz {%s}^{%d})rrtr!)rrKrs rs_print_PolyElementzLatexPrinter._print_PolyElement s&^^$67 xxj+zBBruc|jdk(r|j|jS|j|j}|j|j}d|d|dS)Nrlrrro)rrr)rr:rrs rs_print_FracElementzLatexPrinter._print_FracElement sO ::?;;tzz* *KK +EKK +E',e4 4ruct|jdk(r|jddfn |j\}}d|j|z}||d|d}||d|j|d}|S)NrlrzE_{%s}rrorFror)rrrIrr.rs rs _print_eulerzLatexPrinter._print_euler sj'*499~': ! d# 1$++a.( ? #S)C =*-t{{1~>C ruc\d|j|jdz}||d|d}|S)NzC_{%s}rrror rs rs_print_catalanzLatexPrinter._print_catalan rruc dj||rdnd|j|jd|j|jd|j|jdS)Nz5\mathcal{{{}}}{}_{{{}}}\left[{}\right]\left({}\right)z^{-1}rrlrrrrrA)rrrrinverses rs_print_UnifiedTransformz$LatexPrinter._print_UnifiedTransform sGNNq]dRYjlnrnynyz~{D{DEF{GoHJNJUJUVZV_V_`aVbJceiepepquqzqz{|q}e~ ruc&|j|dS)NMrnrs rs_print_MellinTransformz#LatexPrinter._print_MellinTransform ++D#66ruc(|j|ddS)NrpTrqrs rs_print_InverseMellinTransformz*LatexPrinter._print_InverseMellinTransform ++D#t<>ruc&|j|dS)NCOSrqrs rs_print_CosineTransformz#LatexPrinter._print_CosineTransform rruc(|j|ddS)NrTrqrs rs_print_InverseCosineTransformz*LatexPrinter._print_InverseCosineTransform rruc |j*|j|jj|S |jt |S#t$rY%wxYwr)ringrto_sympyrreprrrs rs _print_DMPzLatexPrinter._print_DMP s[ vv!{{166??1#566" {{47##   s5A AAc$|j|Sr)rrs rs _print_DMFzLatexPrinter._print_DMF sq!!rucJ|jt|jSr)rr rQ)rrs rs _print_ObjectzLatexPrinter._print_Object" s{{6&++.//ruc|j|jd}|d|dnd}t|jdk(r d|d|d}|S|j|jd}d j|||}|S) NrrrorrlWrFrozW{0}_{{{1}}}\left({2}\right))rrArr)rrrIarg0resultarg1s rs_print_LambertWzLatexPrinter._print_LambertW% sx{{499Q<(#&?# tyy>Q .148F ;;tyy|,D5<.6 sFm\_t{{SVGWFmr1)rrPrArs` rs_print_CovariancezLatexPrinter._print_Covariance5 s*5<.F s4,,Q0Ft0L,13rur)rrArPr:)rrrArs`` rs _print_SerieszLatexPrinter._print_SeriesD s-DII3xxFD)**rucddlmtjddd}fd}dj t ||S)Nr) MIMOParallelrkcvt|rj|tdSj|Sr)rrrr)r.rrrs rsrtz0LatexPrinter._print_MIMOSeries..M s@7A!\7R ,,Q0Ft0L-24X\XcXcdeXfruz\cdot)sympy.physics.control.ltirrrArPr:)rrrArrs`` @rs_print_MIMOSerieszLatexPrinter._print_MIMOSeriesJ s::DIItt$g}}S.//ruc`djt|j|jSrarPr:rrArs rs_print_ParallelzLatexPrinter._print_ParallelQ zz#dkk499566ruc`djt|j|jSrarrs rs_print_MIMOParallelz LatexPrinter._print_MIMOParallelT rruc ddlm}m}|j|dd|j}}t ||rt |jn|g}t |j|rt |jjn |jg}|}t ||r!t |j|r |g||} nt ||rBt |j|r,|j|k(r||} nx||g||jf} nat ||r+t |j|r||k(r||} n4||g|} n*||k(r||} n|j|k(r||} n |g||} |j|} |j|} |j| } |jdk(rdnd} d| d| d | d | d S) Nr)TransferFunctionSeriesrlrkrr%rrrro) sympy.physics.controlrrsys1rrrrAsys2rr)rrrrrOtf num_arg_list den_arg_list den_term_1 den_term_2rdenom_1denom_2_signs rs_print_FeedbackzLatexPrinter._print_FeedbackW sB))-aDHH=R)3C)@tCHH~se tyy& )DIINN+04 {  c6 "z$))V'D== =J V $DII?O)PyyB#\2 !A!Atyy!AA - .:dii3Pby#\2 #C7,7 by#\2 b#\2 #A\ALA  C ++j)++j)yyBC).HHrucddlm}|j||j|j}|j|j}|j dk(rdnd}d|d|d|S) Nr) MIMOSeriesrkrr%z\left(I_{\tau} rz\right)^{-1} \cdot )rrrrrr)rrrinv_matrrs rs_print_MIMOFeedbackz LatexPrinter._print_MIMOFeedback{ sR4++jDII>?{{499%yyBC?DgtTTrucB|j|j}d|zS)Nz%s_\tau)r _expr_matrs rs_print_TransferFunctionMatrixz*LatexPrinter._print_TransferFunctionMatrix skk$..)Crucbdj|jj|jS)Nz\text{{{}}}_{{{}}})rrNrOrrs rs _print_DFTzLatexPrinter._print_DFT s#$++DNN,C,CTVVLLrucz|jt|j}|j|}|d|S)Nr)rr rQr)rr pretty_namepretty_morphisms rs_print_NamedMorphismz!LatexPrinter._print_NamedMorphism s4kk&"78 ..x8%77ruchddlm}|j||j|jdS)Nr) NamedMorphismid)sympy.categoriesrrr:r)rrrs rs_print_IdentityMorphismz$LatexPrinter._print_IdentityMorphism s02(( OOX..*67 7ruc|jDcgc]&}|jt|j(}}|j dj |dz}|j |}||zScc}w)Nz\circ r)r,rr rQreverserPr)rr componentcomponent_names_listcomponent_namesrs rs_print_CompositeMorphismz%LatexPrinter._print_CompositeMorphism s~.6-@-@ B )!% F9>>,B C B B$$&#..)=>D..x800  Bs+A6chdj|jt|jSNr)rrr rQ)rrs rs_print_CategoryzLatexPrinter._print_Category s%&&t{{6(--3H'IJJruc|js|jtjS|j|j}|jr!|d|j|jzz }|S)Nz\Longrightarrow %s)premisesrr EmptySet conclusions)rdiagram latex_results rs_print_DiagramzLatexPrinter._print_Diagram sg;;qzz* *{{7#3#34    1 KK(;(;<= =LrucBdd|jzz}t|jD]o}t|jD]9}|||fr|t|||fz }|dz }||jdz k7s5|dz };||jdz k7r|dz }|dz }q|dz }|S) Nz\begin{array}{%s} rrrl& r z \end{array} )widthrheightlatex)rgridrrrs rs_print_DiagramGridzLatexPrinter._print_DiagramGrid s-tzz1AB t{{# !A4::& )1: E$q!t*$55L#  Q& D(L  )DKK!O#& D L ! (( rucdj|j|j|j|jS)Nz {{{}}}^{{{}}})rrrr9rrps rs_print_FreeModulezLatexPrinter._print_FreeModule s/%%dkk!&&&94;;qvv;NOOrucVdjdjfd|DS)N\left[ {} \right]rmc3LK|]}dj|zdzywrroNrSr-r.rs rsr/z8LatexPrinter._print_FreeModuleElement.. s(43+,C$++a. 3 &43r)rrP)rrs` rs_print_FreeModuleElementz%LatexPrinter._print_FreeModuleElement s.#**388430143,34 4ruc "|jDcgc]:}|Dcgc],}|j|jj|.c}<}}}dddj fd|D}dj |Scc}wcc}}w)Ncd|zdzS)NrrorprMs rsrtz/LatexPrinter._print_SubModule.. s$(T/rucd|zdzS)Nz\left[ z \right]rprs rsrtz/LatexPrinter._print_SubModule.. s:>K7rurmc 3jK|]*}djfd|D,yw)rmc3.K|] }|ywrrp)r-r.curlys rsr/z:LatexPrinter._print_SubModule... s3HE!H3HsN)rP)r-grsquares rsr/z0LatexPrinter._print_SubModule.. s*YqeF3883Ha3H+H$IJYs03\left\langle {} \right\rangle)rFrrrrPr)rrrr.rF gens_latexrrs @@rs_print_SubModulezLatexPrinter._print_SubModule ssFGffM!. s#GQcDKKN2S8Grr)_modulerFrrrPr)rrr.rFrs` rs_print_ModuleImplementedIdealz*LatexPrinter._print_ModuleImplementedIdeal sW./iinn=s"==XXG$GG /66zBB>s$A+c|jDcgc]}|j|tdd}}|dgt|dddDcgc] \}}|dz|zc}}z}dj |Scc}wcc}}w) Nr Trrrlijkrr_)rArr!rZrP)rrrrrrrs rs_print_QuaternionzLatexPrinter._print_Quaternion sii !  q*U"3D  A ! ! qTF#aeU*;<$!QaeAg< <zz!} !Q\\*, ,ruc|j|jj|}dj||j|jjS)N{{{}}} + {{{}}})rrrrr)rr.x_latexs rs_print_QuotientRingElementz'LatexPrinter._print_QuotientRingElement sH++affooa01!((QVV../1 1rucB|jDcgc]'}|jjj|)}}dj dj fd|D}dj |j |jjScc}w)Nrrmc3LK|]}dj|zdzywrrSrs rsr/z. s(:6+,C$++a. 3 &:6rr)datamodulerrrrPr killed_module)rrr.r data_latexs` rs_print_QuotientModuleElementz)LatexPrinter._print_QuotientModuleElement s3466:a &&q)::)00:604:6267 !((QXX3346 6;s,Bcdj|j|j|j|jSr)rrrDrrs rs_print_QuotientModulez"LatexPrinter._print_QuotientModule s4#**4;;qvv+>Q__-/ /rucdj|j|j|j|j|j|jS)Nz{{{}}} : {{{}}} \to {{{}}})rr _sympy_matrixr:r)rrs rs_print_MatrixHomomorphismz&LatexPrinter._print_MatrixHomomorphism sF,33DKK@Q4R KK !4;;qzz#:< d|j|jzS)Nz\mathbb{\nabla}_{%s})r_wrt)rcvds rs_print_CovarDerivativeOpz%LatexPrinter._print_CovarDerivativeOp s&SXX)>>>ruc|jj|jj}dj |j t |Sr _coord_sysrm_indexrQrrr rfieldrs rs_print_BaseScalarFieldz#LatexPrinter._print_BaseScalarField s@!!))%,,7<<&&t{{6&>'BCCruc|jj|jj}dj |j t |S)Nz\partial_{{{}}}r6r9s rs_print_BaseVectorFieldz#LatexPrinter._print_BaseVectorField s@!!))%,,7<<!((VF^)DEEruc"|j}t|drV|jj|jj }dj |jt|S|j|}dj |S)Nr7z\operatorname{{d}}{}z!\operatorname{{d}}\left({}\right)) _form_fieldrr7rmr8rQrrr )rdiffr:rs rs_print_Differentialz LatexPrinter._print_Differential st   5, '%%--ell;@@F*11$++fVn2MN N[['F7>>vF Fruc`|j|jd}dj|S)Nrz"\operatorname{{tr}}\left({}\right)r)rrcontentss rs _print_TrzLatexPrinter._print_Tr! s);;qvvay)4;;HEEruc|%d|j|jdd|dSd|j|jdzS)Nz\left(\phi\left(r\right)\right)^{roz\phi\left(%s\right)r rHs rs_print_totientzLatexPrinter._print_totient& sC ?TYYq\*C1 1% DIIaL(AAAruc|%d|j|jdd|dSd|j|jdzS)Nz\left(\lambda\left(rrFroz\lambda\left(%s\right)r rHs rs_print_reduced_totientz#LatexPrinter._print_reduced_totient, sC ?TYYq\*C1 1(4;;tyy|+DDDruc t|jdk(r?dtt|j|jd|jdfz}n!d|j |jdz}|d|d|Sd|zS) Nr_%s\left(%s\right)rlrr`z\sigma^{roz\sigma%srjrs rs_print_divisor_sigmaz!LatexPrinter._print_divisor_sigma2 s tyy>Q '%DKK151tyy|0L1N+OOC%t{{499Q<'@@C ?'*C0 0S  ruc t|jdk(r?dtt|j|jd|jdfz}n!d|j |jdz}|d|d|Sd|zS) NrrKrlrr`z \sigma^*^{roz \sigma^*%srjrs rs_print_udivisor_sigmaz"LatexPrinter._print_udivisor_sigma< s tyy>Q '%DKK151tyy|0L1N+OOC%t{{499Q<'@@C ?),c2 2s""ruc|%d|j|jdd|dSd|j|jdzS)Nz\left(\nu\left(rrFroz\nu\left(%s\right)r rHs rs_print_primenuzLatexPrinter._print_primenuF sC ?TYYq\*C1 1$t{{499Q<'@@@ruc|%d|j|jdd|dSd|j|jdzS)Nz\left(\Omega\left(rrFroz\Omega\left(%s\right)r rHs rs_print_primeomegazLatexPrinter._print_primeomegaL sC ?TYYq\*C1 1'$++diil*CCCruc,t|jSr)rtrQrs rs _print_StrzLatexPrinter._print_StrR s166{ruc6|jt|Sr)rrrs rs _print_floatzLatexPrinter._print_floatU s{{5;''ruct|Srrtrs rs _print_intzLatexPrinter._print_intX 4yruct|SrrXrs rs _print_mpzzLatexPrinter._print_mpz[ rZruct|SrrXrs rs _print_mpqzLatexPrinter._print_mpq^ rZruct|SrrXrs rs _print_fmpzzLatexPrinter._print_fmpza rZruct|SrrXrs rs _print_fmpqzLatexPrinter._print_fmpqd rZruc\djtt|jS)Nz"\operatorname{{Q}}_{{\text{{{}}}}})rrrtrQrs rs_print_PredicatezLatexPrinter._print_Predicateg s 4;;LTYY %z22 >sA c>t||}dt|zS)Nz\mathtt{\text{%s}})super emptyPrinterr)rrrrrNs rsrmzLatexPrinter.emptyPrinterq s! G  &$|A66rurr)FF)rbool)rrt)rXz!bool | BooleanTrue | BooleanFalse)rr)rr)rrtrrt)rz'BasisDependent')rrtrrt)rrrrtr)r&rtrrtr)FN)r)rr )rQrtrz tuple[str, list[str], list[str]])rrtrrt)rr&)rFdict)F(CrO __module__ __qualname__ printmethodr__annotations__rrrrrrrr$r<r?rr!rJrSrY_print_BooleanTrue_print_BooleanFalser\rfrwrrrrrrrrrrrrrrr rrr7r=r@rDrPrarorvr~rrrpropertyrrrrr _print_Min _print_Maxrrrrrrrrrrrrrrrrrrrrrrrrrrr _print_gammarr r rrrrrrr"r(r*r.r1r4r7r9r;r=r@rBrDrHrJrOrTrWrZr`rfrhrkrmrorrrwrzr~rrrrrrrrrrrrrrrr_print_RandomSymbolrrMrrrrrrrrrrr r rrrrr"r%r'r,r1r3r7rCrKrNrPrSrUrWrZr\r^r`rcrhrmrqrsrvrzr|r~rrrrrrr_print_frozensetrrrrrrrrrr _print_SeqPer _print_SeqAdd _print_SeqMulrrrrrrrrrrrrrrrrrr!r$r)r,r/r1r3r5r7r<r?rCrQrUrYr\r_rbrdrfrhrjrnrrruryr{r}rrrrrrrrrrrrrrrrrrrrrrr _print_IDFTrrrrrrrrrr rrrrr!r#r&r)r-r0r4r;r=rArDrGrIrLrNrPrRrTrVrYr\r^r`rbrdrjrm __classcell__)rNs@rsrrsK)U)E) e) 4 ) - )  ) u) 4) S) 4) ) d) ) ) ) G!)" ##)$%"!#(5)~:;fz,-%  EK.>  3 / %% & 9BJ<N NMM IIqf/ -+A> @!>>>#5n8? F   &D 4 F+*':<&  %&,"(T >> >> >M .&M%M%MK$9( - ( - <Q &A!D< +-8 8 ?7r H N !CC5 7=7=7=9?9?$"0VXoV8 -+ 077"IHU MK8 7 1K $P4 CCC , 1 6/ < Z ?DFGF B E !#A D (Z377rurc tj|}|r|S|jtvrd|jzS|tvrd|zSt t jtdD]_}|jj|s#t|t|kDs;t |t|dt| cS|S)a Check for a modifier ending the string. If present, convert the modifier to latex and translate the rest recursively. Given a description of a Greek letter or other special character, return the appropriate latex. Let everything else pass as given. >>> from sympy.printing.latex import translate >>> translate('alphahatdotprime') "{\\dot{\\hat{\\alpha}}}'" rT)r$rN) tex_greek_dictionaryrrgreek_letters_set other_symbolsrrrxrrr)rrrr$s rsrrx s  " "1 %C  ' 'aggi m ax-,,.CF DCwwy!!#&3q6CH+<$S))AjCyM*BCC Druc 6t|j|S)a%Convert the given expression to LaTeX string representation. Parameters ========== full_prec: boolean, optional If set to True, a floating point number is printed with full precision. fold_frac_powers : boolean, optional Emit ``^{p/q}`` instead of ``^{\frac{p}{q}}`` for fractional powers. fold_func_brackets : boolean, optional Fold function brackets where applicable. fold_short_frac : boolean, optional Emit ``p / q`` instead of ``\frac{p}{q}`` when the denominator is simple enough (at most two terms and no powers). The default value is ``True`` for inline mode, ``False`` otherwise. inv_trig_style : string, optional How inverse trig functions should be displayed. Can be one of ``'abbreviated'``, ``'full'``, or ``'power'``. Defaults to ``'abbreviated'``. itex : boolean, optional Specifies if itex-specific syntax is used, including emitting ``$$...$$``. ln_notation : boolean, optional If set to ``True``, ``\ln`` is used instead of default ``\log``. long_frac_ratio : float or None, optional The allowed ratio of the width of the numerator to the width of the denominator before the printer breaks off long fractions. If ``None`` (the default value), long fractions are not broken up. mat_delim : string, optional The delimiter to wrap around matrices. Can be one of ``'['``, ``'('``, or the empty string ``''``. Defaults to ``'['``. mat_str : string, optional Which matrix environment string to emit. ``'smallmatrix'``, ``'matrix'``, ``'array'``, etc. Defaults to ``'smallmatrix'`` for inline mode, ``'matrix'`` for matrices of no more than 10 columns, and ``'array'`` otherwise. mode: string, optional Specifies how the generated code will be delimited. ``mode`` can be one of ``'plain'``, ``'inline'``, ``'equation'`` or ``'equation*'``. If ``mode`` is set to ``'plain'``, then the resulting code will not be delimited at all (this is the default). If ``mode`` is set to ``'inline'`` then inline LaTeX ``$...$`` will be used. If ``mode`` is set to ``'equation'`` or ``'equation*'``, the resulting code will be enclosed in the ``equation`` or ``equation*`` environment (remember to import ``amsmath`` for ``equation*``), unless the ``itex`` option is set. In the latter case, the ``$$...$$`` syntax is used. mul_symbol : string or None, optional The symbol to use for multiplication. Can be one of ``None``, ``'ldot'``, ``'dot'``, or ``'times'``. order: string, optional Any of the supported monomial orderings (currently ``'lex'``, ``'grlex'``, or ``'grevlex'``), ``'old'``, and ``'none'``. This parameter does nothing for `~.Mul` objects. Setting order to ``'old'`` uses the compatibility ordering for ``~.Add`` defined in Printer. For very large expressions, set the ``order`` keyword to ``'none'`` if speed is a concern. symbol_names : dictionary of strings mapped to symbols, optional Dictionary of symbols and the custom strings they should be emitted as. root_notation : boolean, optional If set to ``False``, exponents of the form 1/n are printed in fractonal form. Default is ``True``, to print exponent in root form. mat_symbol_style : string, optional Can be either ``'plain'`` (default) or ``'bold'``. If set to ``'bold'``, a `~.MatrixSymbol` A will be printed as ``\mathbf{A}``, otherwise as ``A``. imaginary_unit : string, optional String to use for the imaginary unit. Defined options are ``'i'`` (default) and ``'j'``. Adding ``r`` or ``t`` in front gives ``\mathrm`` or ``\text``, so ``'ri'`` leads to ``\mathrm{i}`` which gives `\mathrm{i}`. gothic_re_im : boolean, optional If set to ``True``, `\Re` and `\Im` is used for ``re`` and ``im``, respectively. The default is ``False`` leading to `\operatorname{re}` and `\operatorname{im}`. decimal_separator : string, optional Specifies what separator to use to separate the whole and fractional parts of a floating point number as in `2.5` for the default, ``period`` or `2{,}5` when ``comma`` is specified. Lists, sets, and tuple are printed with semicolon separating the elements when ``comma`` is chosen. For example, [1; 2; 3] when ``comma`` is chosen and [1,2,3] for when ``period`` is chosen. parenthesize_super : boolean, optional If set to ``False``, superscripted expressions will not be parenthesized when powered. Default is ``True``, which parenthesizes the expression when powered. min: Integer or None, optional Sets the lower bound for the exponent to print floating point numbers in fixed-point format. max: Integer or None, optional Sets the upper bound for the exponent to print floating point numbers in fixed-point format. diff_operator: string, optional String to use for differential operator. Default is ``'d'``, to print in italic form. ``'rd'``, ``'td'`` are shortcuts for ``\mathrm{d}`` and ``\text{d}``. adjoint_style: string, optional String to use for the adjoint symbol. Defined options are ``'dagger'`` (default),``'star'``, and ``'hermitian'``. Notes ===== Not using a print statement for printing, results in double backslashes for latex commands since that's the way Python escapes backslashes in strings. >>> from sympy import latex, Rational >>> from sympy.abc import tau >>> latex((2*tau)**Rational(7,2)) '8 \\sqrt{2} \\tau^{\\frac{7}{2}}' >>> print(latex((2*tau)**Rational(7,2))) 8 \sqrt{2} \tau^{\frac{7}{2}} Examples ======== >>> from sympy import latex, pi, sin, asin, Integral, Matrix, Rational, log >>> from sympy.abc import x, y, mu, r, tau Basic usage: >>> print(latex((2*tau)**Rational(7,2))) 8 \sqrt{2} \tau^{\frac{7}{2}} ``mode`` and ``itex`` options: >>> print(latex((2*mu)**Rational(7,2), mode='plain')) 8 \sqrt{2} \mu^{\frac{7}{2}} >>> print(latex((2*tau)**Rational(7,2), mode='inline')) $8 \sqrt{2} \tau^{7 / 2}$ >>> print(latex((2*mu)**Rational(7,2), mode='equation*')) \begin{equation*}8 \sqrt{2} \mu^{\frac{7}{2}}\end{equation*} >>> print(latex((2*mu)**Rational(7,2), mode='equation')) \begin{equation}8 \sqrt{2} \mu^{\frac{7}{2}}\end{equation} >>> print(latex((2*mu)**Rational(7,2), mode='equation', itex=True)) $$8 \sqrt{2} \mu^{\frac{7}{2}}$$ >>> print(latex((2*mu)**Rational(7,2), mode='plain')) 8 \sqrt{2} \mu^{\frac{7}{2}} >>> print(latex((2*tau)**Rational(7,2), mode='inline')) $8 \sqrt{2} \tau^{7 / 2}$ >>> print(latex((2*mu)**Rational(7,2), mode='equation*')) \begin{equation*}8 \sqrt{2} \mu^{\frac{7}{2}}\end{equation*} >>> print(latex((2*mu)**Rational(7,2), mode='equation')) \begin{equation}8 \sqrt{2} \mu^{\frac{7}{2}}\end{equation} >>> print(latex((2*mu)**Rational(7,2), mode='equation', itex=True)) $$8 \sqrt{2} \mu^{\frac{7}{2}}$$ Fraction options: >>> print(latex((2*tau)**Rational(7,2), fold_frac_powers=True)) 8 \sqrt{2} \tau^{7/2} >>> print(latex((2*tau)**sin(Rational(7,2)))) \left(2 \tau\right)^{\sin{\left(\frac{7}{2} \right)}} >>> print(latex((2*tau)**sin(Rational(7,2)), fold_func_brackets=True)) \left(2 \tau\right)^{\sin {\frac{7}{2}}} >>> print(latex(3*x**2/y)) \frac{3 x^{2}}{y} >>> print(latex(3*x**2/y, fold_short_frac=True)) 3 x^{2} / y >>> print(latex(Integral(r, r)/2/pi, long_frac_ratio=2)) \frac{\int r\, dr}{2 \pi} >>> print(latex(Integral(r, r)/2/pi, long_frac_ratio=0)) \frac{1}{2 \pi} \int r\, dr Multiplication options: >>> print(latex((2*tau)**sin(Rational(7,2)), mul_symbol="times")) \left(2 \times \tau\right)^{\sin{\left(\frac{7}{2} \right)}} Trig options: >>> print(latex(asin(Rational(7,2)))) \operatorname{asin}{\left(\frac{7}{2} \right)} >>> print(latex(asin(Rational(7,2)), inv_trig_style="full")) \arcsin{\left(\frac{7}{2} \right)} >>> print(latex(asin(Rational(7,2)), inv_trig_style="power")) \sin^{-1}{\left(\frac{7}{2} \right)} Matrix options: >>> print(latex(Matrix(2, 1, [x, y]))) \left[\begin{matrix}x\\y\end{matrix}\right] >>> print(latex(Matrix(2, 1, [x, y]), mat_str = "array")) \left[\begin{array}{c}x\\y\end{array}\right] >>> print(latex(Matrix(2, 1, [x, y]), mat_delim="(")) \left(\begin{matrix}x\\y\end{matrix}\right) Custom printing of symbols: >>> print(latex(x**2, symbol_names={x: 'x_i'})) x_i^{2} Logarithms: >>> print(latex(log(10))) \log{\left(10 \right)} >>> print(latex(log(10), ln_notation=True)) \ln{\left(10 \right)} ``latex()`` also supports the builtin container types :class:`list`, :class:`tuple`, and :class:`dict`: >>> print(latex([2/x, y], mode='inline')) $\left[ 2 / x, \ y\right]$ Unsupported types are rendered as monospaced plaintext: >>> print(latex(int)) \mathtt{\text{}} >>> print(latex("plain % text")) \mathtt{\text{plain \% text}} See :ref:`printer_method_example` for an example of how to override this behavior for your own types by implementing ``_latex``. .. versionchanged:: 1.7.0 Unsupported types no longer have their ``str`` representation treated as valid latex. )rrrrs rsrr sn  ! ) )$ //ruc .tt|fi|y)z`Prints LaTeX representation of the given expression. Takes the same settings as ``latex()``.N)printrrs rs print_latexrq s % ! !"ruc tdi|}|dk(r d}d}d} d} d} n:|dk(r d}d}d} d } d} n*|d k(r d }d }d } d} d} ntdj|d } |rd} |j} t | }d}t |D]}| |}d }d }d}||kDr | rd}nd}d}||k(r||dz kr | | zdzdz}nd }|j ddk(rd|z}d}|dk(r>|dk(rd }|dj|j||||j||z }n&|dj|||j||z }|dz }|| z }|S)a This function generates a LaTeX equation with a multiline right-hand side in an ``align*``, ``eqnarray`` or ``IEEEeqnarray`` environment. Parameters ========== lhs : Expr Left-hand side of equation rhs : Expr Right-hand side of equation terms_per_line : integer, optional Number of terms per line to print. Default is 1. environment : "string", optional Which LaTeX wnvironment to use for the output. Options are "align*" (default), "eqnarray", and "IEEEeqnarray". use_dots : boolean, optional If ``True``, ``\\dots`` is added to the end of each line. Default is ``False``. Examples ======== >>> from sympy import multiline_latex, symbols, sin, cos, exp, log, I >>> x, y, alpha = symbols('x y alpha') >>> expr = sin(alpha*y) + exp(I*alpha) - cos(log(y)) >>> print(multiline_latex(x, expr)) \begin{align*} x = & e^{i \alpha} \\ & + \sin{\left(\alpha y \right)} \\ & - \cos{\left(\log{\left(y \right)} \right)} \end{align*} Using at most two terms per line: >>> print(multiline_latex(x, expr, 2)) \begin{align*} x = & e^{i \alpha} + \sin{\left(\alpha y \right)} \\ & - \cos{\left(\log{\left(y \right)} \right)} \end{align*} Using ``eqnarray`` and dots: >>> print(multiline_latex(x, expr, terms_per_line=2, environment="eqnarray", use_dots=True)) \begin{eqnarray} x & = & e^{i \alpha} + \sin{\left(\alpha y \right)} \dots\nonumber\\ & & - \cos{\left(\log{\left(y \right)} \right)} \end{eqnarray} Using ``IEEEeqnarray``: >>> print(multiline_latex(x, expr, environment="IEEEeqnarray")) \begin{IEEEeqnarray}{rCl} x & = & e^{i \alpha} \nonumber\\ & & + \sin{\left(\alpha y \right)} \nonumber\\ & & - \cos{\left(\log{\left(y \right)} \right)} \end{IEEEeqnarray} Notes ===== All optional parameters from ``latex`` can also be used. eqnarrayz\begin{eqnarray} z& = &z \nonumberz \end{eqnarray}T IEEEeqnarrayz\begin{IEEEeqnarray}{rCl} z \end{IEEEeqnarray}align*z\begin{align*} z= &rz \end{align*}FzUnknown environment: {}z\dotsrlrz& & rrrrrkr%z{:s} {:s}{:s} {:s} {:s}z{:s}{:s} {:s} {:s}rp)rrras_ordered_termsrrrr)rrterms_per_line environmentuse_dotsrrr first_termnonumberend_termdoubleetrrcn_terms term_countrrd term_startterm_endrs rsmultiline_latexrx sF  x Aj + &  &4 *  ) %299+FGG D   "E%jGJ 7^Qx   &# ! J  '719}(?U2T9  " " $Q '2 -d7DD 6s{ 077 #"D!))D/8E EF +22:t $3 3Fa => hF Mru)rrrtrrt)rlrF)J__doc__ __future__rtypingrrrr; sympy.corerrr r r r r rsympy.core.alphabetsrsympy.core.containersrsympy.core.functionrrrsympy.core.operationsrsympy.core.powerrsympy.core.sortingrsympy.core.sympifyrrrrrsympy.printing.precedencersympy.printing.printerrrsympy.printing.conventionsrrr r!mpmath.libmp.libmpfr"r#rsympy.utilities.iterablesr$r%r8sympy.tensor.arrayr&sympy.vector.basisdependentr'r{rrrrs frozensetrcompilerrrrrrrrprursrs#//DDD''BB) /+??=:H<B7 ,:  % ]% M% Y% Y % } %  M % =% Y% M% ]% j% -% -% &%s% }!%" &#%$ =%%& Y'%( =)%*{+%, 7-%. =/%0 71%2 Y3%4 Z5%6 Z7%8 79%: =;%<.=%> ?%@ jA%B YC%D jE%FI%N, 2.2 *2 ( 2  & 2  $ 2 (2 (2 (2 (2 (2 $2 $2 $2 !2  !2$ ,%2& *'2( ) ( * 0 9 - -72 .<f%BJJ~BJJ'(  g+77g+7TW> V0V0r#~ru