+
    iK)                        R t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	H
t
Ht ^ RItRQt/ RRbRR	bR
RbRRbRRbRRbRRbRRbRRbRRbRRbRRbRRbR R!bR"R#bR$R%bR&R'bR(R)R*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRC/Ct] F  t]]]&   K
  	  ]P                   RD]P"                  RE]P$                  RF]P&                  RG]P(                  RH/tRIRJRKRL/t]P.                  .t ! RM RN]4      tRRRO ltRP tR# )Sa	  
Maple code printer

The MapleCodePrinter converts single SymPy expressions into single
Maple expressions, using the functions defined in the Maple objects where possible.


FIXME: This module is still under actively developed. Some functions may be not completed.
)S)IntegerIntegerConstantequal_valued)CodePrinter)
precedence
PRECEDENCENAbsabsloglnasinarcsinacosarccosatanarctanasecarcsecacscarccscacotarccotasinharcsinhacosharccoshatanharctanhasecharcsechacscharccschacotharccothceilingceilMaxmaxMinmin
factorial2doublefactorialRisingFactorial
pochhammerbesseliBesselIbesseljBesselJbesselkBesselKbesselyBesselYhankelh1HankelH1hankelh2HankelH2airyaiAiryAiairybiAiryBiappellf1AppellF1fresnelcFresnelCfresnelsFresnelSlerchphiLerchPhiPizexp(1)Catalangammaz(1/2 + (1/2)*sqrt(5))z===z!=z<>c                   &  a a ] tR t^Tt oRtRtRtRRRRRR/t]! ]	P                  3/ RR	R
R	/B t
R(V 3R lltR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR)R ltR tR  t R! t!R" t"R# t#R$ t$R% t%R& t&R't'Vt(V ;t)# )*MapleCodePrinterz>
Printer which converts a SymPy expression into a maple code.
_maplemapleandornotznot inlineTallow_unknown_functionsc                   < Vf   / p\         SV `  V4       \        \        4      V n        VP	                  R/ 4      pV P                  P                  V4       R # )Nuser_functions)super__init__dictknown_functionsgetupdate)selfsettings	userfuncs	__class__s   && R/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/printing/maple.pyrW   MapleCodePrinter.__init__f   sM    H"#O4LL!126	##I.    c                    R V,          # )z%s; )r\   
codestrings   &&r`   _get_statementMapleCodePrinter._get_statementn   s    z!!rb   c                $    R P                  V4      # )z# {})format)r\   texts   &&r`   _get_commentMapleCodePrinter._get_commentq   s    }}T""rb   c                f    R P                  VVP                  V P                  R,          4      4      # )z	{} := {};	precision)ri   evalf	_settings)r\   namevalues   &&&r`   _declare_number_const&MapleCodePrinter._declare_number_constt   s.    !!$$)KK{0K$LN 	Nrb   c                    V# Nrd   )r\   liness   &&r`   _format_codeMapleCodePrinter._format_codex   s    rb   c                6    V P                  \        V4      4      # rv   _printlistr\   exprs   &&r`   _print_tupleMapleCodePrinter._print_tuple{       {{4:&&rb   c                6    V P                  \        V4      4      # rv   r{   r~   s   &&r`   _print_TupleMapleCodePrinter._print_Tuple~   r   rb   c                    V P                  VP                  4      pV P                  VP                  4      pR P                  W#R7      # )z{lhs} := {rhs})lhsrhs)r|   r   r   ri   )r\   r   r   r   s   &&  r`   _print_Assignment"MapleCodePrinter._print_Assignment   s:    kk$((#kk$((#&&3&88rb   c                   \        V4      p\        VP                  R4      '       d$   RV P                  VP                  V4      ,          # \        VP                  R4      '       d#   RV P                  VP                  4      ,          # \        VP                  R4      '       d#   RV P                  VP                  4      ,          # RP                  V P                  VP                  V4      V P                  VP                  V4      R7      # )	   z1/%sg      ?zsqrt(%s)z
1/sqrt(%s)z{base}^{exp})baseexpg      )r   r   r   parenthesizer   r|   ri   )r\   r   kwargsPRECs   &&, r`   
_print_PowMapleCodePrinter._print_Pow   s    $"%%T..tyy$?@@$((C((DII 666$((D))$++dii"888!((&&tyy$7%%dhh5 ) 7 7rb   c           
        VP                   R
,          P                  RJd<   VP                   R
,          P                  \        P                  8w  d   \	        R4      hVP                    UUu. uFq  w  r#VRJdF   V\        P                  Jd2   RP                  V P                  V4      V P                  V4      R7      M RP                  V P                  V4      R7      NKs  	  pppRP                  V4      pRP                  VR	7      # u uppi )r   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.z{c}, {e})cez{e})r   z, zpiecewise({_inbrace}))_inbracer   )argscondr   BooleanTrue
ValueErrorri   r|   join)r\   r   r   r   
_coup_listr   s   &&    r`   _print_Piecewise!MapleCodePrinter._print_Piecewise   s    IIbMd*21C1Cq}}1T  / 0 0 			# " 56TMaq}}F\ Q!%Q  1bgbnbn++a. co c"" "	 	 #
 99Z(&--x-@@#s   ,A7D	c                    \        VP                  4      \        VP                  4      r2R P                  \	        V4      \	        V4      R7      # )z{p}/{q})pq)intr   r   ri   str)r\   r   r   r   s   &&  r`   _print_Rational MapleCodePrinter._print_Rational   s7    466{CK1#a&CF33rb   c                    \        V4      pV P                  VP                  V4      pV P                  VP                  V4      pVP                  pV\
        9   d   \
        V,          pR P                  W5VR7      # )z{lhs} {rel_op} {rhs})r   rel_opr   )r   r   r   r   r   spec_relational_opsri   )r\   r   r   lhs_coderhs_codeops   &&    r`   _print_Relational"MapleCodePrinter._print_Relational   sj    $$TXXt4$$TXXt4[[$$$R(B%,,(,SSrb   c                    \         V,          # rv   )number_symbolsr~   s   &&r`   _print_NumberSymbol$MapleCodePrinter._print_NumberSymbol   s    d##rb   c                    R # )z	-infinityrd   r~   s   &&r`   _print_NegativeInfinity(MapleCodePrinter._print_NegativeInfinity       rb   c                    R # )infinityrd   r~   s   &&r`   _print_Infinity MapleCodePrinter._print_Infinity   s    rb   c                    R # )truerd   r~   s   &&r`   _print_BooleanTrue#MapleCodePrinter._print_BooleanTrue   s    rb   c                    R # )falserd   r~   s   &&r`   _print_BooleanFalse$MapleCodePrinter._print_BooleanFalse   s    rb   c                    V'       d   R # R# )r   r   rd   r~   s   &&r`   _print_boolMapleCodePrinter._print_bool   s    v*7*rb   c                    R # )	undefinedrd   r~   s   &&r`   
_print_NaNMapleCodePrinter._print_NaN   r   rb   c                    \         P                  VP                  9   d   R P                  V'       d   RMRR7      pV# RP                  V P	                  VP                  4       4      V'       d   RMRR7      pV# )zMatrix([], storage = {storage})sparserectangular)storagez#Matrix({list}, storage = {storage}))r}   r   )r   Zeroshaperi   r|   tolist)r\   r   r   _strMs   &&& r`   _get_matrixMapleCodePrinter._get_matrix   sm    66TZZ5<<$* = ?E  :@@[[/$* A ?E rb   c                    R P                  V P                  VP                  \        R,          RR7      V P	                  VP
                  ^,           4      V P	                  VP                  ^,           4      R7      # )z{parent}[{i_maple}, {j_maple}]AtomT)strict)parenti_maplej_maple)ri   r   r   r   r|   ijr~   s   &&r`   _print_MatrixElement%MapleCodePrinter._print_MatrixElement   s`    /66$$T[[*V2DT$RKK
+KK
+ 7 - 	-rb   c                (    V P                  VR R7      # )Fr   r   r~   s   &&r`   _print_MatrixBase"MapleCodePrinter._print_MatrixBase   s    U33rb   c                (    V P                  VR R7      # )Tr   r   r~   s   &&r`   _print_SparseRepMatrix'MapleCodePrinter._print_SparseRepMatrix   s    T22rb   c                    \        VP                  \        \        34      '       d&   V P	                  \
        P                  ! V4      4      # R P                  V P	                  VP                  4      R7      # )z$Matrix({var_size}, shape = identity))var_size)
isinstancerowsr   r   r|   sympySparseMatrixri   r~   s   &&r`   _print_Identity MapleCodePrinter._print_Identity   sV    dii'?!;<<;;u11$7889@@$++VZV_V_J`@aarb   c                  a a \        V4      o\        VP                  4      pR p\        V^ ,          \        P
                  \        P                  \        P                  \        P                  34      '       g   V^ ,          VR,          r#Ve   V^8X  d   RP                  VV 3R lV 4       4      # RP                  VRP                  VV 3R lV 4       4      R7      # )N:r   NN.c              3   H   <"   T F  pSP                  VS4      x  K  	  R # 5irv   r   .0_mr   r\   s   & r`   	<genexpr>1MapleCodePrinter._print_MatMul.<locals>.<genexpr>   s!     M*BD--b$77*   "z{c}*{m}c              3   H   <"   T F  pSP                  VS4      x  K  	  R # 5irv   r   r   s   & r`   r   r      s$     8j_iY[9J9J2t9T9T_ir   )r   m)r   r}   r   r   r   
MatrixBase
MatrixExprMatrixSliceMatrixSymbolr   ri   )r\   r   
_fact_list_constr   s   f&  @r`   _print_MatMulMapleCodePrinter._print_MatMul   s    $))_
*Q-%*:*:E<L<L*/*;*;U=O=O*Q R R!+A
2J>Vq[88M*MMM##f8j_i8j0j#kkrb   c                    R P                  V P                  VP                  4      V P                  VP                  4      R7      # )zMatrixPower({A}, {n}))An)ri   r|   r   r   r~   s   &&r`   _print_MatPowMapleCodePrinter._print_MatPow   s5    &--DII0F$++VZV^V^J_-``rb   c                ~   a a \        V4      o\        VP                  4      pR P                  VV 3R lV 4       4      # )*c              3   H   <"   T F  pSP                  VS4      x  K  	  R # 5irv   r   r   s   & r`   r   :MapleCodePrinter._print_HadamardProduct.<locals>.<genexpr>   s!     Ij))"d33jr   )r   r}   r   r   )r\   r   r   r   s   f& @r`   _print_HadamardProduct'MapleCodePrinter._print_HadamardProduct   s/    $$))_
xxIjIIIrb   c                   VP                   w  pw  r4V^8w  d3   RP                  V P                  V4      V P                  V4      R7      pM!RP                  V P                  V4      R7      pRP                  V P                  V4      VR7      # )r   z{var}${order})varorderz{var})r  zdiff({func_expr}, {sec_arg}))	func_exprsec_arg)r   ri   r|   )r\   r   _f_var_order_second_args   &&    r`   _print_Derivative"MapleCodePrinter._print_Derivative   s    !YYNTQ;)00T[[5F7;{{67J 1 LK "..T[[->.?K-44t{{2Xc4ddrb   )rY   rv   )F)*__name__
__module____qualname____firstlineno____doc__printmethodlanguage
_operatorsrX   r   _default_settingsrW   rf   rk   rs   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  __static_attributes____classdictcell____classcell__)r_   __classdict__s   @@r`   rL   rL   T   s      KH 	udvJ [:: $!4? 
/"#N''9
7A"4T$+-43blaJ
e erb   rL   c                6    \        V4      P                  W4      # )a  Converts ``expr`` to a string of Maple code.

Parameters
==========

expr : Expr
    A SymPy expression to be converted.
assign_to : optional
    When given, the argument is used as the name of the variable to which
    the expression is assigned.  Can be a string, ``Symbol``,
    ``MatrixSymbol``, or ``Indexed`` type.  This can be helpful for
    expressions that generate multi-line statements.
precision : integer, optional
    The precision for numbers such as pi  [default=16].
user_functions : dict, optional
    A dictionary where keys are ``FunctionClass`` instances and values are
    their string representations.  Alternatively, the dictionary value can
    be a list of tuples i.e. [(argument_test, cfunction_string)].  See
    below for examples.
human : bool, optional
    If True, the result is a single string that may contain some constant
    declarations for the number symbols.  If False, the same information is
    returned in a tuple of (symbols_to_declare, not_supported_functions,
    code_text).  [default=True].
contract: bool, optional
    If True, ``Indexed`` instances are assumed to obey tensor contraction
    rules and the corresponding nested loops over indices are generated.
    Setting contract=False will not generate loops, instead the user is
    responsible to provide values for the indices in the code.
    [default=True].
inline: bool, optional
    If True, we try to create single-statement code instead of multiple
    statements.  [default=True].

)rL   doprint)r   	assign_tor]   s   &&,r`   
maple_coder)    s    H H%--d>>rb   c                0    \        \        V 3/ VB 4       R# )a  Prints the Maple representation of the given expression.

See :func:`maple_code` for the meaning of the optional arguments.

Examples
========

>>> from sympy import print_maple_code, symbols
>>> x, y = symbols('x y')
>>> print_maple_code(x, assign_to=y)
y := x
N)printr)  )r   r]   s   &,r`   print_maple_coder,  *  s     
*T
&X
&'rb   ) sincostanseccsccotsinhcoshtanhsechcschcothr   floor	factorial	bernoullieuler	fibonaccigcdlcm	conjugateCiChiEiLiSiShierferfcharmonicLambertWsqrtrv   )r  
sympy.corer   sympy.core.numbersr   r   r   sympy.printing.codeprinterr   sympy.printing.precedencer   r   r   _known_func_same_namerY   _funcrG   Exp1rH   
EulerGammaGoldenRatior   r   ComplexInfinitynot_supported_symbolrL   r)  r,  rd   rb   r`   <module>rW     s    E E 2 <  "	5" 
4" H	"
 H" H" H" H" H" Y" Y" Y" Y" Y" Y"  v!"" 
E#"$ 
E%"( #|yyyy

hh


C"H #E"OE #
 DD$FFHIIyLL'MM* 	#$   le{ le^$?N(rb   