
    wgN                        d dl mZ d dlmZ d dlmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZ dj                         Z ej"                         D  cg c]  \  } }| evs| |f c}} Z eefi dd	d
ddddddddddZddddddZej#                         D  ci c]  \  } }| d|z    c}} Zej#                         D  ci c]  \  } }| d|z    c}} Z G d dee      ZeD ]  Z eede e
        eD ]  Z eede e	        i 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d3d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBZdCddDZej#                         D  ci c]  \  } }| dE|z    c}} Zej#                         D  ci c]  \  } }| dF|z    c}} Z G dG dHe      Z eD ]  Z ee de e
        eD ]  Z ee de e	        ej#                         D  ci c]  \  } }| dI|z    c}} Z!ej#                         D  ci c]  \  } }| dI|z    c}} Z" G dJ dKe      Z#e!D ]  Z ee#de e
        e"D ]  Z ee#de e	        ej#                         D  ci c]  \  } }| dL|z    c}} Z$ej#                         D  ci c]  \  } }| dL|z    c}} Z% G dM dNe      Z&e$D ]  Z ee&de e
        e%D ]  Z ee&de e	        yOc c}} w c c}} w c c}} w c c}} w c c}} w c c}} w c c}} w c c}} w c c}} w )P    )S)Lambda)Pow   )PythonCodePrinter_known_functions_math_print_known_const_print_known_func_unpack_integral_limitsArrayPrinter)CodePrinterz!erf erfc factorial gamma loggammaarccosarccosharcsinarcsinharctanarctan2arctanhexp2sign	logaddexp
logaddexp2isnan)acosacoshasinasinhatanatan2atanhr   r   r   r   r   epieuler_gammananinf)Exp1Pi
EulerGammaNaNInfinityznumpy.c                   t    e Zd ZdZdZeZeZd* f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 f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) fd$Z*d%Z+d&Z,d'Z-d(Z.d)Z/e0jb                  Z2e0jb                  Z3e0jb                  Z4e0jb                  Z5 xZ6S ),NumPyPrinterza
    Numpy printer which handles vectorized piecewise functions,
    logical operators, etc.
    numpyc                     dj                  | j                        | _        dj                  | j                        | _        i t        j
                  | j
                  | _        t        |   |       y)z
        `settings` is passed to CodePrinter.__init__()
        `module` specifies the array module to use, currently 'NumPy', 'CuPy'
        or 'JAX'.
        zPython with {}z_{}codesettingsN)format_modulelanguageprintmethodr   _kfsuper__init__selfr0   	__class__s     Y/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/printing/numpy.pyr7   zNumPyPrinter.__init__-   s^     )//=$++DLL98'++8txx8(+    c                 Z     d}dj                  |j                   fd|D                    S )z+General sequence printer: converts to tuple, z({},)c              3   @   K   | ]  }j                  |        y wN_print).0itemr9   s     r;   	<genexpr>z*NumPyPrinter._print_seq.<locals>.<genexpr>@   s     ,O4T[[->,O   )r1   join)r9   seq	delimiters   `  r;   
_print_seqzNumPyPrinter._print_seq;   s(     	~~inn,O3,OOPPr<   c                 F    d| j                  t        j                        z   S )N-)rB   r   r*   r9   exprs     r;   _print_NegativeInfinityz$NumPyPrinter._print_NegativeInfinityB   s    T[[,,,r<   c                 R    |j                         d   t        j                  urQ|j                         d   |j                         d   gz   }dj                  dj	                   fd|D                    S dj                  dj	                   fd|j
                  D                    S )zMatrix multiplication printerr   r   ({})z).dot(c              3   @   K   | ]  }j                  |        y wr@   rA   rC   ir9   s     r;   rE   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>I   s     .Q!t{{1~.QrF   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>J   s     *Ma4;;q>*MrF   )as_coeff_matricesr   Oner1   rG   args)r9   rN   	expr_lists   `  r;   _print_MatMulzNumPyPrinter._print_MatMulE   s    !!#A&aee3..03d6L6L6Nq6Q4SSI==.Qy.Q!QRR}}X]]*M499*MMNNr<   c                     dj                  | j                  | j                  dz         | j                  |j                  d         | j                  |j                  d               S )zMatrix power printerz
{}({}, {})z.linalg.matrix_powerr   r   r1   _module_formatr2   rB   rX   rM   s     r;   _print_MatPowzNumPyPrinter._print_MatPowL   sU    ""4#6#6t||F\7\#]KK		!%t{{499Q<'@B 	Br<   c                     dj                  | j                  | j                  dz         | j                  |j                  d               S )zMatrix inverse printer{}({})z.linalg.invr   r\   rM   s     r;   _print_InversezNumPyPrinter._print_InverseQ   s=    t224<<-3OPKK		!%' 	'r<   c                 "   |j                   \  }}|j                  d   dk7  r|j                  }|j                  d   dk7  r|j                  }| j                  | j                  dz         d| j                  |      d| j                  |      dS )Nr   r   z.dot(r>   ))rX   shapeTr]   r2   rB   )r9   rN   arg1arg2s       r;   _print_DotProductzNumPyPrinter._print_DotProductV   s|     YY
d::a=A66D::a=A66D#224<<&3HI#{{40#{{402 	2r<   c                     | j                  | j                  dz         d| j                  |j                        d| j                  |j                        dS )Nz.linalg.solverc   r>   rd   )r]   r2   rB   matrixvectorrM   s     r;   _print_MatrixSolvezNumPyPrinter._print_MatrixSolvec   sC    #224<</3QR#{{4;;7#{{4;;79 	9r<   c                     dj                  | j                  | j                  dz         | j                  |j                              S )Nr`   z.zerosr1   r]   r2   rB   re   rM   s     r;   _print_ZeroMatrixzNumPyPrinter._print_ZeroMatrixh   s9    t224<<(3JKKK

#% 	%r<   c                     dj                  | j                  | j                  dz         | j                  |j                              S )Nr`   z.onesro   rM   s     r;   _print_OneMatrixzNumPyPrinter._print_OneMatrixl   s9    t224<<'3IJKK

#% 	%r<   c                     ddl m}m} |j                  }t	        |t
              st        ||f |||            }dj                   j                   j                  dz         dj                   fd|j                  d   D               j                  |j                  d          j                  |j                              S )Nr   )rT   jz{}(lambda {}: {}, {})z.fromfunctionr>   c              3   @   K   | ]  }j                  |        y wr@   rA   rC   argr9   s     r;   rE   z5NumPyPrinter._print_FunctionMatrix.<locals>.<genexpr>v   s     @3dkk#&@rF   r   )	sympy.abcrT   rt   lamda
isinstancer   r1   r]   r2   rG   rX   rB   re   )r9   rN   rT   rt   ry   s   `    r;   _print_FunctionMatrixz"NumPyPrinter._print_FunctionMatrixp   s    "

%(Aq65A;/E&--d.A.A$,,Q`B`.aII@%**Q-@@KK

1&DJJ(?A 	Ar<   c                 "     j                   j                  dz         dj                   fd|j                  d d D              dj	                   j                  |j                  d         dt        |j                        dz
  z        z   S )N	.multiply c              3   `   K   | ]%  }d j                  j                  |             ' ywz{}({}, Nr1   rB   rC   rw   funcr9   s     r;   rE   z6NumPyPrinter._print_HadamardProduct.<locals>.<genexpr>{   /      ' !''dkk#.>? '   +.{}{}rd   r   r]   r2   rG   rX   r1   rB   lenr9   rN   r   s   ` @r;   _print_HadamardProductz#NumPyPrinter._print_HadamardProducty   s}    ""4<<+#=>ww 'yy"~' ')/t{{499R=7Q3tyy>A%&*(( 	(r<   c                 "     j                   j                  dz         dj                   fd|j                  d d D              dj	                   j                  |j                  d         dt        |j                        dz
  z        z   S )Nz.kronr~   c              3   `   K   | ]%  }d j                  j                  |             ' ywr   r   r   s     r;   rE   z7NumPyPrinter._print_KroneckerProduct.<locals>.<genexpr>   r   r   r   r   rd   r   r   r   s   ` @r;   _print_KroneckerProductz$NumPyPrinter._print_KroneckerProduct   s}    ""4<<'#9:ww 'yy"~' ')/t{{499R=7Q3tyy>A%&*(( 	(r<   c                     dj                  | j                  | j                  dz         | j                  | j                  dz         | j                  |j                  d               S )Nz
{}({}({}))z
.conjugatez
.transposer   r\   rM   s     r;   _print_AdjointzNumPyPrinter._print_Adjoint   sW    ""| ;<| ;<KK		!%' 	'r<   c                     dj                  | j                  | j                  dz         | j                  |j                              }dj                  | j                  | j                  dz         |      S )Nr`   z.diagz{}({}, (-1, 1))z.reshape)r1   r]   r2   rB   rw   )r9   rN   vects      r;   _print_DiagonalOfzNumPyPrinter._print_DiagonalOf   sg    w 67KK!# !''z 9:DB 	Br<   c                     dj                  | j                  | j                  dz         | j                  |j                  d               S )Nr`   z	.diagflatr   r\   rM   s     r;   _print_DiagMatrixzNumPyPrinter._print_DiagMatrix   s=    t224<<+3MNKK		!%' 	'r<   c           
      >   dj                  | j                  | j                  dz         | j                  |j                        | j                  | j                  dz         | j                  |j
                  d         | j                  |j
                  d               S )Nz{}({}, {}({}, {}))r}   .eyer   r   )r1   r]   r2   rB   rw   re   rM   s     r;   _print_DiagonalMatrixz"NumPyPrinter._print_DiagonalMatrix   sz    #**4+>+>t||k?Y+ZKK!4#6#6t||f7L#MKK

1&DJJqM(BD 	Dr<   c                     ddl mm  fddj                  dj	                   fd|j
                  D                    }dj                  dj	                  fd|j
                  D                    }dj                   j                   j                  d	z         || j                  t        j                              S )
zPiecewise function printerr   )ITEsimplify_logicc                 v    | j                        rj                   |             S j                  |       S )z$ Problem having an ITE in the cond. )hasrB   )condr   r9   r   s    r;   
print_condz1NumPyPrinter._print_Piecewise.<locals>.print_cond   s1    xx}{{>$#788{{4((r<   z[{}],c              3   T   K   | ]  }j                  |j                         ! y wr@   )rB   rN   rv   s     r;   rE   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s     &Rt{{388'<&Rs   %(c              3   B   K   | ]  } |j                           y wr@   )r   )rC   rw   r   s     r;   rE   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s     &Qz#((';&Qs   z{}({}, {}, default={})z.select)sympy.logic.boolalgr   r   r1   rG   rX   r]   r2   rB   r   r)   )r9   rN   exprscondsr   r   r   s   `   @@@r;   _print_PiecewisezNumPyPrinter._print_Piecewise   s    ;	) chh&R		&RRSchh&Qtyy&QQR
 (..y 895%KK  	 r<   c                 <   ddddddd}|j                   |v rv| j                  |j                        }| j                  |j                        }dj	                  | j                  | j                  d	z   ||j                      z         ||
      S t        | !  |      S )z.Relational printer for Equality and Unequalityequal	not_equalless
less_equalgreatergreater_equal)z==z!=<z<=>z>=z{op}({lhs}, {rhs}).)oplhsrhs)	rel_oprB   r   r   r1   r]   r2   r6   _print_Relational)r9   rN   r   r   r   r:   s        r;   r   zNumPyPrinter._print_Relational   s     !
 ;;"++dhh'C++dhh'C'..$2E2EdllUXFXY[\`\g\gYhFh2i36C / A Aw(..r<   c                      dj                   j                   j                  dz         dj                   fd|j                  D                    S )Logical And printer{}.reduce(({}))z.logical_andr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z*NumPyPrinter._print_And.<locals>.<genexpr>   s'       eHxyeiepepqres  eHrF   r1   r]   r2   rG   rX   rM   s   ` r;   
_print_AndzNumPyPrinter._print_And   sc    
 !''(;(;DLL><Y(Z\_\d\d  eH  ~B  ~G  ~G  eH  ]H  I  	Ir<   c                      dj                   j                   j                  dz         dj                   fd|j                  D                    S )Logical Or printerr   z.logical_orr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z)NumPyPrinter._print_Or.<locals>.<genexpr>   s'       dGwxdhdodopqdr  dGrF   r   rM   s   ` r;   	_print_OrzNumPyPrinter._print_Or   sc    
 !''(;(;DLL=<X(Y[^[c[c  dG  }A  }F  }F  dG  \G  H  	Hr<   c                      dj                   j                   j                  dz         dj                   fd|j                  D                    S )zLogical Not printerr`   z.logical_notr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z*NumPyPrinter._print_Not.<locals>.<genexpr>   s     [~op\`\g\ghi\j[~rF   r   rM   s   ` r;   
_print_NotzNumPyPrinter._print_Not   sC    
 t224<<.3PQSVS[S[[~txt}t}[~S~r<   c                     |j                   j                  rF|j                   j                  r0t        |j                  |j                   j                         d      }| j                  ||| j                  dz         S )NF)evaluatez.sqrt)rationalsqrt)exp
is_integeris_negativer   baseevalf_hprint_Powr2   )r9   rN   r   s      r;   
_print_PowzNumPyPrinter._print_Pow   sY    88488#7#7tyy$((.."2UCDxdllW>TUUr<   c                      dj                   j                   j                  dz          j                   j                        dj                   fd|j                  D                    S )N{}({}.asarray([{}]), axis=0)z.aminr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z*NumPyPrinter._print_Min.<locals>.<genexpr>   ?       Nq  bc  OS  OZ  OZ  [\  O]  NqrF   r   rM   s   ` r;   
_print_MinzNumPyPrinter._print_Min       -44T5H5HX_I_5`bfbubuvz  wC  wC  cD  FI  FN  FN  Nq  gk  gp  gp  Nq  Fq  r  	rr<   c                      dj                   j                   j                  dz          j                   j                        dj                   fd|j                  D                    S )Nr   z.amaxr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z*NumPyPrinter._print_Max.<locals>.<genexpr>   r   rF   r   rM   s   ` r;   
_print_MaxzNumPyPrinter._print_Max   r   r<   c                     | j                  | j                  dz         d| j                  |j                  d         dS )Nz.anglerc   r   rd   r]   r2   rB   rX   rM   s     r;   
_print_argzNumPyPrinter._print_arg   s7    ..t||h/FGUYU^U^_`UaIbccr<   c                     | j                  | j                  dz         d| j                  |j                  d         dS )Nz.imagrc   r   rd   r   rM   s     r;   	_print_imzNumPyPrinter._print_im   7    ..t||g/EFTXT]T]^_T`Habbr<   c                       j                   j                  dz         ddj                   fd|j                  D              dS )Nz.modrc   r>   c              3   @   K   | ]  }j                  |        y wr@   rA   rv   s     r;   rE   z*NumPyPrinter._print_Mod.<locals>.<genexpr>   s     3#T[[3rF   rd   )r]   r2   rG   rX   rM   s   ` r;   
_print_ModzNumPyPrinter._print_Mod   s<    ..t||f/DEtyy33H5 6 	6r<   c                     | j                  | j                  dz         d| j                  |j                  d         dS )Nz.realrc   r   rd   r   rM   s     r;   	_print_rezNumPyPrinter._print_re   r   r<   c                     | j                  | j                  dz         d| j                  |j                  d   t        j
                  z        dS )Nz.sincrc   r   rd   )r]   r2   rB   rX   r   r'   rM   s     r;   _print_sinczNumPyPrinter._print_sinc   sC    ..t||g/EFTXT]T]^_T`abaeaeTeHfggr<   c                     | j                   j                  |j                  j                  d       }|| j	                  | j
                  dz         }|d| j                  |j                               dS )Nz.arrayrc   rd   )known_functionsgetr:   __name__r]   r2   rB   tolistr   s      r;   _print_MatrixBasezNumPyPrinter._print_MatrixBase   s\    ##''(?(?F<&&t||h'>?DT[[]!;<<r<   c                     |j                   }t        d |D              r@| j                  | j                  dz         d| j	                  |j                   d         dS t        d      )Nc              3   4   K   | ]  }|j                     y wr@   )
is_Integer)rC   dims     r;   rE   z/NumPyPrinter._print_Identity.<locals>.<genexpr>   s     /#s~~/s   r   rc   r   rd   zFSymbolic matrix dimensions are not yet supported for identity matrices)re   allr]   r2   rB   NotImplementedError)r9   rN   re   s      r;   _print_IdentityzNumPyPrinter._print_Identity   sZ    

///#224<<&3HI4;;W[WaWabcWdKeff%&noor<   c                     dj                  | j                  | j                  dz         | j                  |j                  d   j                                     S )Nr`   z.blockr   )r1   r]   r2   rB   rX   r   rM   s     r;   _print_BlockMatrixzNumPyPrinter._print_BlockMatrix   sH    t224<<(3JK!%TYYq\-@-@-B!CE 	Er<   c                 $   t        |j                        dk(  r1| j                  dz   | j                  |j                  d         z   dz   S t        |j                        dk(  r| j                  |j                               S t        |   | |      S )Nr   z.array(r   rd      )r   re   r2   rB   rX   tomatrixr6   _print_not_supported)r9   rN   r:   s     r;   _print_NDimArrayzNumPyPrinter._print_NDimArray   st    tzz?a<<)+dkk$))A,.GG#MMtzz?a;;t}}//w+D$77r<   addeinsum	transposeoneszerosr@   )F)7r   
__module____qualname____doc__r2   _numpy_known_functionsr5   _numpy_known_constants_kcr7   rJ   rO   rZ   r^   ra   ri   rm   rp   rr   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _add_einsum
_transpose_ones_zerosr   r   _print_lowergamma_print_uppergamma_print_fresnelc_print_fresnels__classcell__r:   s   @r;   r,   r,   #   s   
 G
 C
 C,Q-OB
'
29
%%A(('B'D
 &/"IH@Vrrdc6ch=pE8 DGJEF#88#88!66O!66Or<   r,   _print_Eiexpierferfcbesseljjvbesselyyvbesseliivbesselkkvcosm1powm1	factorialgammaloggammagammalndigammapsi	polygammaRisingFactorialpochjacobieval_jacobi
gegenbauereval_gegenbauereval_chebyteval_chebyueval_legendreeval_hermiteeval_laguerreeval_genlaguerrebetalambertw)
chebyshevt
chebyshevulegendrehermitelaguerreassoc_laguerrer0  LambertWgolden_ratio)GoldenRatior'   zscipy.special.zscipy.constants.c                        e Zd Zi ej                  eZi ej                  eZd fd	Zd Z	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d Zd Zd Z xZS )SciPyPrinterc                 4    t         |   |       d| _        y )Nr/   zPython with SciPy and NumPy)r6   r7   r3   r8   s     r;   r7   zSciPyPrinter.__init__B  s    (+5r<   c                 $   g g g }}}|j                         j                         D ];  \  \  }}}|j                  |       |j                  |       |j                  |       = dj                  | j	                  d      ||||j
                        S )Nz+{name}(({data}, ({i}, {j})), shape={shape})zscipy.sparse.coo_matrix)namedatarT   rt   re   )todokitemsappendr1   r]   re   )r9   rN   rT   rt   r@  rcvs           r;   _print_SparseRepMatrixz#SciPyPrinter._print_SparseRepMatrixF  s    Rd1++- 	IFQAHHQKHHQKKKN	
 =CC$$%>?atzz D 
 	
r<   c           	          dj                  | j                  d      | j                  |j                  d         | j                  |j                  d         | j                  |j                  d               S )Nz{0}({2}, {1}, {3})zscipy.special.lpmvr   r   r   r1   r]   rB   rX   rM   s     r;   _print_assoc_legendrez"SciPyPrinter._print_assoc_legendreU  s`    #** 45KK		!%KK		!%KK		!%	' 	'r<   c           	          dj                  | j                  d      | j                  d      | j                  |j                  d         | j                  |j                  d               S )N{0}({2})*{1}({2}, {3})scipy.special.gammazscipy.special.gammaincr   r   rI  rM   s     r;   r  zSciPyPrinter._print_lowergamma\  s[    '.. 56 89KK		!%KK		!%	' 	'r<   c           	          dj                  | j                  d      | j                  d      | j                  |j                  d         | j                  |j                  d               S )NrL  rM  zscipy.special.gammainccr   r   rI  rM   s     r;   r	  zSciPyPrinter._print_uppergammac  s[    '.. 56 9:KK		!%KK		!%	' 	'r<   c                    | j                  d      }| j                  d      }|j                  D cg c]  }| j                  |       }}d| d|d    d|d    d|d    d| d|d    d|d    d|d	    d
| d|d    d|d    dS c c}w )Nscipy.special.betainczscipy.special.betarc   r   r>   r      z) - r   z))             * rd   )r]   rX   rB   )r9   rN   betaincr0  rw   rX   s         r;   _print_betainczSciPyPrinter._print_betaincj  s    %%&=>""#78,0II6SC 667)1T!WIRQy47)4y$q'RTUYZ[U\T]]_`def`g_h ifAd1gYba	, 	, 7s   Bc           
      *   dj                  | j                  d      | j                  |j                  d         | j                  |j                  d         | j                  |j                  d         | j                  |j                  d               S )Nz'{0}({1}, {2}, {4}) - {0}({1}, {2}, {3})rP  r   r   r   rQ  rI  rM   s     r;   _print_betainc_regularizedz'SciPyPrinter._print_betainc_regularizedq  st    8?? 78KK		!%KK		!%KK		!%KK		!%' 	'r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )N	{}({})[0]scipy.special.fresnelr   rI  rM   s     r;   r  zSciPyPrinter._print_fresnelsy  8    !!##$;<DIIaL)+ 	+r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )N	{}({})[1]rX  r   rI  rM   s     r;   r
  zSciPyPrinter._print_fresnelc~  rY  r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )NrW  scipy.special.airyr   rI  rM   s     r;   _print_airyaizSciPyPrinter._print_airyai  8    !!##$89DIIaL)+ 	+r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nr[  r]  r   rI  rM   s     r;   _print_airyaiprimezSciPyPrinter._print_airyaiprime  r_  r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nz	{}({})[2]r]  r   rI  rM   s     r;   _print_airybizSciPyPrinter._print_airybi  r_  r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nz	{}({})[3]r]  r   rI  rM   s     r;   _print_airybiprimezSciPyPrinter._print_airybiprime  r_  r<   c                 R    | j                   |j                  |j                         S r@   rB   _eval_rewrite_as_zetarX   rM   s     r;   _print_bernoullizSciPyPrinter._print_bernoulli  s#    {{5455tyyABBr<   c                 R    | j                   |j                  |j                         S r@   rg  rM   s     r;   _print_harmoniczSciPyPrinter._print_harmonic  s#    {{5455tyyABBr<   c           	          t        |      \  }}t        |      dk(  r7 j                  d      }dt        t	         j
                  |d               z  }n: j                  d      }dj                  dj                   fd|D                    }d	j                  |dj                  t	         j
                  |             j                  |j                  d         |      S )
Nr   zscipy.integrate.quadz%s, %sr   zscipy.integrate.nquadrQ   r>   c              3   b   K   | ]&  }d t        t        j                  |            z   ( yw)z(%s, %s)N)tuplemaprB   )rC   lr9   s     r;   rE   z/SciPyPrinter._print_Integral.<locals>.<genexpr>  s-      0I<=
U3t{{A#6770Is   ,/z{}(lambda {}: {}, {})[0])	r   r   r]   rn  ro  rB   r1   rG   rX   )r9   r!   integration_varslimits
module_str	limit_strs   `     r;   _print_IntegralzSciPyPrinter._print_Integral  s    #:1#= &v;!,,-CDJ 5T[[&))D#EEI,,-DEJdii 0IAG0I 'I JI *00		#dkk+;<=AFF1I&	 	r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )NrW  scipy.special.sicir   rI  rM   s     r;   	_print_SizSciPyPrinter._print_Si  r_  r<   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nr[  rw  r   rI  rM   s     r;   	_print_CizSciPyPrinter._print_Ci  r_  r<   r@   )r   r   r   r,   r5   _scipy_known_functionsr  _scipy_known_constantsr7   rG  _print_ImmutableSparseMatrixrJ  r  r	  rS  rU  r  r
  r^  ra  rc  re  ri  rk  ru  rx  rz  r  r  s   @r;   r<  r<  =  s    
8\
8!7
8C
8\
8!7
8C6

 $: ''','+
+
+
+
+
+
CC$+
+r<   r<  zcupy.c                   0     e Zd ZdZdZeZeZd fd	Z	 xZ
S )CuPyPrinterz`
    CuPy printer which handles vectorized piecewise functions,
    logical operators, etc.
    cupyc                 &    t         |   |       y )Nr/   )r6   r7   r8   s     r;   r7   zCuPyPrinter.__init__  s    (+r<   r@   )r   r   r   r   r2   _cupy_known_functionsr5   _cupy_known_constantsr  r7   r  r  s   @r;   r  r    s#    
 G
C
C, ,r<   r  z
jax.numpy.c                   <     e Zd ZdZdZeZeZd fd	Z	d Z
d Z xZS )
JaxPrinterz_
    JAX printer which handles vectorized piecewise functions,
    logical operators, etc.
    z	jax.numpyc                 4    t         |   |       d| _        y )Nr/   _jaxcode)r6   r7   r4   r8   s     r;   r7   zJaxPrinter.__init__  s    (+%r<   c                      dj                   j                   j                  dz          j                   j                        dj                   fd|j                  D                    S )r   r   z.allr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z(JaxPrinter._print_And.<locals>.<genexpr>       7T[[^7rF   r   rM   s   ` r;   r   zJaxPrinter._print_And  U    -44v 56-HH7TYY77
 	
r<   c                      dj                   j                   j                  dz          j                   j                        dj                   fd|j                  D                    S )r   r   z.anyr   c              3   @   K   | ]  }j                  |        y wr@   rA   rS   s     r;   rE   z'JaxPrinter._print_Or.<locals>.<genexpr>  r  rF   r   rM   s   ` r;   r   zJaxPrinter._print_Or  r  r<   r@   )r   r   r   r   r2   _jax_known_functionsr5   _jax_known_constantsr  r7   r   r   r  r  s   @r;   r  r    s(     G
C
C&


r<   r  N)'
sympy.corer   sympy.core.functionr   sympy.core.powerr   pycoder   r   r	   r
   r   r   codeprinterr   split_not_in_numpyrB  	_in_numpydict_known_functions_numpy_known_constants_numpyr   r  r,   r   setattrconst_known_functions_scipy_special _known_constants_scipy_constantsr{  r|  r<  r  r  r  r  r  r  )krF  s   00r;   <module>r     s    &   K  K $ 499; ; 5 ; ; =X1-AWaVX	i ,   
  7M6R6R6TUda!X\/U 6L6R6R6TUda!X\/U n7<!2 n7` # ?DLGD6*,=>? $ AELGE7+-?@A"&"	5" F" t	"
 t" t" t" W" W" " W" 	" u" " v"  m!"" ##"$  (3" : "
$   @^?c?c?eftq!!.22f AaAgAgAijA!0144j {+< {+z # ?DLGD6*,=>? $ AELGE7+-?@A 6L5Q5Q5STTQWq[T 5K5Q5Q5STTQWq[T ,, , " >DK74&)+<=> # @EK75'*,>?@ 9O8T8T8VW1<!++W 8N8T8T8VW1<!++W 
 
> ! =DJ'$(*;<= " ?EJ'%)+=>?i Y. VUr gjL UT, XWs<   KKK<KKK%K+K1K7K=