
    MZd@M                        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Zd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)acosacoshasinasinhatanatan2atanhr   r   r   r   epieuler_gammananPINFNINF)Exp1Pi
EulerGammaNaNInfinityNegativeInfinityznumpy.c                   j    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 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(d# Z)d$Z*d%Z+d&Z,d'Z-d(Z.e/j`                  Z1e/j`                  Z2e/j`                  Z3e/j`                  Z4 xZ5S )+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__selfr1   	__class__s     6/usr/lib/python3/dist-packages/sympy/printing/numpy.pyr8   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itemr:   s     r<   	<genexpr>z*NumPyPrinter._print_seq.<locals>.<genexpr>@   s     ,O4T[[->,O   )r2   join)r:   seq	delimiters   `  r<   
_print_seqzNumPyPrinter._print_seq;   s(     	~~inn,O3,OOPPr=   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rA   rB   rD   ir:   s     r<   rF   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>F   s     .Q!t{{1~.QrG   c              3   @   K   | ]  }j                  |        y wrA   rB   rO   s     r<   rF   z-NumPyPrinter._print_MatMul.<locals>.<genexpr>G   s     *Ma4;;q>*MrG   )as_coeff_matricesr   Oner2   rH   args)r:   expr	expr_lists   `  r<   _print_MatMulzNumPyPrinter._print_MatMulB   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   r2   _module_formatr3   rC   rT   r:   rU   s     r<   _print_MatPowzNumPyPrinter._print_MatPowI   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   rY   r[   s     r<   _print_InversezNumPyPrinter._print_InverseN   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?   ))rT   shapeTrZ   r3   rC   )r:   rU   arg1arg2s       r<   _print_DotProductzNumPyPrinter._print_DotProductS   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.solvera   r?   rb   )rZ   r3   rC   matrixvectorr[   s     r<   _print_MatrixSolvezNumPyPrinter._print_MatrixSolve`   sC    #224<</3QR#{{4;;7#{{4;;79 	9r=   c                     dj                  | j                  | j                  dz         | j                  |j                              S )Nr^   z.zerosr2   rZ   r3   rC   rc   r[   s     r<   _print_ZeroMatrixzNumPyPrinter._print_ZeroMatrixe   s9    t224<<(3JKKK

#% 	%r=   c                     dj                  | j                  | j                  dz         | j                  |j                              S )Nr^   z.onesrm   r[   s     r<   _print_OneMatrixzNumPyPrinter._print_OneMatrixi   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   )rP   jz{}(lambda {}: {}, {})z.fromfunctionr?   c              3   @   K   | ]  }j                  |        y wrA   rB   rD   argr:   s     r<   rF   z5NumPyPrinter._print_FunctionMatrix.<locals>.<genexpr>s   s     @3dkk#&@rG   r   )	sympy.abcrP   rr   lamda
isinstancer   r2   rZ   r3   rH   rT   rC   rc   )r:   rU   rP   rr   rw   s   `    r<   _print_FunctionMatrixz"NumPyPrinter._print_FunctionMatrixm   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r2   rC   rD   ru   funcr:   s     r<   rF   z6NumPyPrinter._print_HadamardProduct.<locals>.<genexpr>x   /      ' !''dkk#.>? '   +.{}{}rb   r   rZ   r3   rH   rT   r2   rC   lenr:   rU   r   s   ` @r<   _print_HadamardProductz#NumPyPrinter._print_HadamardProductv   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<   rF   z7NumPyPrinter._print_KroneckerProduct.<locals>.<genexpr>~   r   r   r   r   rb   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   rY   r[   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)r2   rZ   r3   rC   ru   )r:   rU   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   rY   r[   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   )r2   rZ   r3   rC   ru   rc   r[   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. )hasrC   )condr   r:   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rA   )rC   rU   rt   s     r<   rF   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s     &Rt{{388'<&Rs   %(c              3   B   K   | ]  } |j                           y wrA   )r   )rD   ru   r   s     r<   rF   z0NumPyPrinter._print_Piecewise.<locals>.<genexpr>   s     &Qz#((';&Qs   z{}({}, {}, default={})z.select)sympy.logic.boolalgr   r   r2   rH   rT   rZ   r3   rC   r   r)   )r:   rU   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_oprC   r   r   r2   rZ   r3   r7   _print_Relational)r:   rU   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rA   rB   rO   s     r<   rF   z*NumPyPrinter._print_And.<locals>.<genexpr>   s'       eHxyeiepepqres  eHrG   r2   rZ   r3   rH   rT   r[   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rA   rB   rO   s     r<   rF   z)NumPyPrinter._print_Or.<locals>.<genexpr>   s'       dGwxdhdodopqdr  dGrG   r   r[   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rA   rB   rO   s     r<   rF   z*NumPyPrinter._print_Not.<locals>.<genexpr>   s     [~op\`\g\ghi\j[~rG   r   r[   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_Powr3   )r:   rU   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         dj                   fd|j                  D                    S )N{}(({}), axis=0)z.aminr   c              3   @   K   | ]  }j                  |        y wrA   rB   rO   s     r<   rF   z*NumPyPrinter._print_Min.<locals>.<genexpr>   '       _Brs_c_j_jkl_m  _BrG   r   r[   s   ` r<   
_print_MinzNumPyPrinter._print_Min   ]    !(()<)<T\\G=S)TVYV^V^  _Bw{  xA  xA  _B  WB  C  	Cr=   c                      dj                   j                   j                  dz         dj                   fd|j                  D                    S )Nr   z.amaxr   c              3   @   K   | ]  }j                  |        y wrA   rB   rO   s     r<   rF   z*NumPyPrinter._print_Max.<locals>.<genexpr>   r   rG   r   r[   s   ` r<   
_print_MaxzNumPyPrinter._print_Max   r   r=   c                     | j                  | j                  dz         d| j                  |j                  d         dS )Nz.anglera   r   rb   rZ   r3   rC   rT   r[   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.imagra   r   rb   r   r[   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.modra   r?   c              3   @   K   | ]  }j                  |        y wrA   rB   rt   s     r<   rF   z*NumPyPrinter._print_Mod.<locals>.<genexpr>   s     3#T[[3rG   rb   )rZ   r3   rH   rT   r[   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.realra   r   rb   r   r[   s     r<   	_print_rezNumPyPrinter._print_re   r   r=   c                     | j                  | j                  dz         d| j                  |j                  d   t        j
                  z        dS )Nz.sincra   r   rb   )rZ   r3   rC   rT   r   r'   r[   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.arrayra   rb   )known_functionsgetr;   __name__rZ   r3   rC   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rA   )
is_Integer)rD   dims     r<   rF   z/NumPyPrinter._print_Identity.<locals>.<genexpr>   s     /#s~~/s   r   ra   r   rb   zFSymbolic matrix dimensions are not yet supported for identity matrices)rc   allrZ   r3   rC   NotImplementedError)r:   rU   rc   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   )r2   rZ   r3   rC   rT   r   r[   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        j                  | |      S )Nr   z.array(r   rb      )r   rc   r3   rC   rT   tomatrixr   _print_not_supportedr[   s     r<   _print_NDimArrayzNumPyPrinter._print_NDimArray   st    tzz?a<<)+dkk$))A,.GG#MMtzz?a;;t}}////d;;r=   addeinsum	transposeoneszerosrA   )F)6r   
__module____qualname____doc__r3   _numpy_known_functionsr6   _numpy_known_constants_kcr8   rK   rW   r\   r_   rg   rk   rn   rp   ry   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CCdc6ch=pE< 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_laguerrer.  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 )Nr0   zPython with SciPy and NumPy)r7   r8   r4   r9   s     r<   r8   zSciPyPrinter.__init__@  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datarP   rr   rc   )todokitemsappendr2   rZ   rc   )r:   rU   rP   rr   r>  rcvs           r<   _print_SparseRepMatrixz#SciPyPrinter._print_SparseRepMatrixD  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   r2   rZ   rC   rT   r[   s     r<   _print_assoc_legendrez"SciPyPrinter._print_assoc_legendreS  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   rG  r[   s     r<   r  zSciPyPrinter._print_lowergammaZ  s[    '.. 56 89KK		!%KK		!%	' 	'r=   c           	          dj                  | j                  d      | j                  d      | j                  |j                  d         | j                  |j                  d               S )NrJ  rK  zscipy.special.gammainccr   r   rG  r[   s     r<   r  zSciPyPrinter._print_uppergammaa  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.betara   r   r?   r      z) - r   z))             * rb   )rZ   rT   rC   )r:   rU   betaincr.  ru   rT   s         r<   _print_betainczSciPyPrinter._print_betainch  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})rN  r   r   r   rO  rG  r[   s     r<   _print_betainc_regularizedz'SciPyPrinter._print_betainc_regularizedo  st    8?? 78KK		!%KK		!%KK		!%KK		!%' 	'r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )N	{}({})[0]scipy.special.fresnelr   rG  r[   s     r<   r	  zSciPyPrinter._print_fresnelsw  8    !!##$;<DIIaL)+ 	+r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )N	{}({})[1]rV  r   rG  r[   s     r<   r  zSciPyPrinter._print_fresnelc|  rW  r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )NrU  scipy.special.airyr   rG  r[   s     r<   _print_airyaizSciPyPrinter._print_airyai  8    !!##$89DIIaL)+ 	+r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )NrY  r[  r   rG  r[   s     r<   _print_airyaiprimezSciPyPrinter._print_airyaiprime  r]  r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nz	{}({})[2]r[  r   rG  r[   s     r<   _print_airybizSciPyPrinter._print_airybi  r]  r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )Nz	{}({})[3]r[  r   rG  r[   s     r<   _print_airybiprimezSciPyPrinter._print_airybiprime  r]  r=   c                 R    | j                   |j                  |j                         S rA   rC   _eval_rewrite_as_zetarT   r[   s     r<   _print_bernoullizSciPyPrinter._print_bernoulli  s#    {{5455tyyABBr=   c                 R    | j                   |j                  |j                         S rA   re  r[   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.nquadrM   r?   c              3   b   K   | ]&  }d t        t        j                  |            z   ( yw)z(%s, %s)N)tuplemaprC   )rD   lr:   s     r<   rF   z/SciPyPrinter._print_Integral.<locals>.<genexpr>  s-      0I<=
U3t{{A#6770Is   ,/z{}(lambda {}: {}, {})[0])	r   r   rZ   rl  rm  rC   r2   rH   rT   )r:   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 )NrU  scipy.special.sicir   rG  r[   s     r<   	_print_SizSciPyPrinter._print_Si  r]  r=   c                 |    dj                  | j                  d      | j                  |j                  d               S )NrY  ru  r   rG  r[   s     r<   	_print_CizSciPyPrinter._print_Ci  r]  r=   rA   )r   r   r   r-   r6   _scipy_known_functionsr   _scipy_known_constantsr8   rE  _print_ImmutableSparseMatrixrH  r  r  rQ  rS  r	  r  r\  r_  ra  rc  rg  ri  rs  rv  rx  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 Nr0   r7   r8   r9   s     r<   r8   zCuPyPrinter.__init__      (+r=   rA   )r   r   r   r   r3   _cupy_known_functionsr6   _cupy_known_constantsr   r8   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                 &    t         |   |       y r  r  r9   s     r<   r8   zJaxPrinter.__init__  r  r=   c                      dj                   j                   j                  dz          j                   j                        dj                   fd|j                  D                    S )r   {}({}.asarray([{}]), axis=0)z.allr   c              3   @   K   | ]  }j                  |        y wrA   rB   rO   s     r<   rF   z(JaxPrinter._print_And.<locals>.<genexpr>       7T[[^7rG   r   r[   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rA   rB   rO   s     r<   rF   z'JaxPrinter._print_Or.<locals>.<genexpr>  r  rG   r   r[   s   ` r<   r   zJaxPrinter._print_Or  r  r=   rA   )r   r   r   r   r3   _jax_known_functionsr6   _jax_known_constantsr   r8   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_numpyr@  	_in_numpydict_known_functions_numpy_known_constants_numpyr   r   r-   r   setattrconst_known_functions_scipy_special _known_constants_scipy_constantsry  rz  r:  r  r  r}  r  r  r  )krD  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 l7<!2 l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'%)+=>?c Y. VUn gjL UT, XWs<   KKK<KKK%K+K1K7K=