+
    i_                     p    ^ RI Ht ^ RIHtHtHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt  ! R R]4      tR	# )
    )ExprBuilder)FunctionFunctionClassLambda)Dummy)sympify_sympify)
MatrixExpr)
MatrixBasec                   ~   a  ] tR t^	t o RtR t]R 4       t]R 4       t]R 4       t	R t
R tR tR	 tR
 tR tRtV tR# )ElementwiseApplyFunctiona  
Apply function to a matrix elementwise without evaluating.

Examples
========

It can be created by calling ``.applyfunc(<function>)`` on a matrix
expression:

>>> from sympy import MatrixSymbol
>>> from sympy.matrices.expressions.applyfunc import ElementwiseApplyFunction
>>> from sympy import exp
>>> X = MatrixSymbol("X", 3, 3)
>>> X.applyfunc(exp)
Lambda(_d, exp(_d)).(X)

Otherwise using the class constructor:

>>> from sympy import eye
>>> expr = ElementwiseApplyFunction(exp, eye(3))
>>> expr
Lambda(_d, exp(_d)).(Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]))
>>> expr.doit()
Matrix([
[E, 1, 1],
[1, E, 1],
[1, 1, E]])

Notice the difference with the real mathematical functions:

>>> exp(eye(3))
Matrix([
[E, 0, 0],
[0, E, 0],
[0, 0, E]])
c                   \        V4      pVP                  '       g   \        R P                  V4      4      hVP                  R8X  d!   V! V4      p\        V\        4      '       d   V# \        V\        \        34      '       g   \        R4      p\        WA! V4      4      p\        V4      p\        V\        \        34      '       g   \        RP                  V4      4      h^VP                  9  d   \        RP                  V4      4      h\        V\        4      '       g   \        R4      p\        WA! V4      4      p\        P                  ! WV4      pV# )z{} must be a matrix instance.dz4{} should be compatible with SymPy function classes.z({} should be able to accept 1 arguments.)   r   )r	   	is_Matrix
ValueErrorformatshape
isinstancer
   r   r   r   r   nargs__new__)clsfunctionexprretr   objs   &&&   ڄ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/matrices/expressions/applyfunc.pyr    ElementwiseApplyFunction.__new__2   s   ~~~~<CCDIJJ:: 4.C#z**
(]F$;<<c
Aa!-H8$(]F$;<<F!# # HNN":AA(KM M (F++c
Aa!-H  5
    c                (    V P                   ^ ,          # )r   argsselfs   &r   r   !ElementwiseApplyFunction.functionS       yy|r   c                (    V P                   ^,          # )r   r!   r#   s   &r   r   ElementwiseApplyFunction.exprW   r&   r   c                .    V P                   P                  # N)r   r   r#   s   &r   r   ElementwiseApplyFunction.shape[   s    yyr   c                  a a VP                  R R4      pS P                  oV'       d   SP                  ! R/ VB oS P                  p\	        V\
        4      '       d   VP                  '       d   S# \	        S\        4      '       d   SP                  S P                  4      # \	        S\        4      '       d,   \        VV 3R lSP                  4      P                  ! R/ VB # S # )deepTc                 D   < SP                  SP                  V 4      4      # r*   )r   )xr   r$   s   &r   <lambda>/ElementwiseApplyFunction.doit.<locals>.<lambda>l   s    $--a(89r    )
getr   doitr   r   r   is_identityr   	applyfuncr   )r$   hintsr-   r   r   s   f,  @r   r4   ElementwiseApplyFunction.doit_   s    yy&yy99%u%D==h''H,@,@,@KdJ''>>$--00677+9		 d   
 Kr   c                Z    V P                  V P                  P                  ! W3/ VB 4      # r*   )r   r   _entry)r$   ijkwargss   &&&,r   r:   ElementwiseApplyFunction._entryr   s%    }}TYY--a=f=>>r   c                    \        R 4      pV P                  V4      pVP                  V4      p\        V\        4      '       d   \        V4      pV# \        W4      pV# )r   )r   r   diffr   r   typer   )r$   r   r   fdiffs   &   r   _get_function_fdiff,ElementwiseApplyFunction._get_function_fdiffu   sU    #J==#a eX&&KE  1$Er   c                    ^ RI Hp V P                  P                  V4      pV P	                  4       pV! V\        W@P                  4      4      # )r   )hadamard_product)#sympy.matrices.expressions.hadamardrF   r   r@   rC   r   )r$   r/   rF   dexprrB   s   &&   r   _eval_derivative)ElementwiseApplyFunction._eval_derivative   sA    H		q!((*$UII6
 	
r   c                   ^ RI Hp ^ RIHp ^ RIHp ^ RIHp V P                  4       pV P                  P                  V4      p\        W`P                  4      p^VP                  9   Ed    V P                  ^,          ^8H  p	V F  p
V	'       d'   V
P                  pV! V P                  ^,          4      pM%V! V P                  ^ ,          4      pV
P                  p\        T\        VVVV.4      V	'       d   RMR.VP                  R7      pV.V
n        VP                   ^ ,          P                   V
n        ^V
n        VP                   ^ ,          P                   V
n        ^V
n        K  	  V# V F  p
V
P                  pV
P                  pV! VP                  ^,          4      pV! VP                  ^,          4      p\        V\        VWWV.4      RR	.VP                  R7      pVP                   ^ ,          P                   V
n        ^V
n        VP                   ^ ,          P                   V
n        ^V
n        V.V
n        K  	  V# )
r   )Identity)ArrayContraction)ArrayDiagonal)ArrayTensorProduct)	validator)r      )r      )r   rQ   rR   )         )"sympy.matrices.expressions.specialrL   0sympy.tensor.array.expressions.array_expressionsrM   rN   rO   rC   r   _eval_derivative_matrix_linesr   r   first_pointersecond_pointerr   	_validate_linesr"   _first_pointer_parent_first_pointer_index_second_pointer_parent_second_pointer_index)r$   r/   rL   rM   rN   rO   rB   lrewdiffiscolumnr;   ptr1ptr2subexprnewptr1newptr2s   &&              r   rX   6ElementwiseApplyFunction._eval_derivative_matrix_lines   s   ?URW((*YY44Q7)%;<zz!})H??D#DJJqM2D#DJJqM2D++D%!#. & $ $ #+
 ,55 $9*1,,q/*>*>')*&+2<<?+?+?(*+'7 h 	- ''"4::a=1"4::a=1%$#.!F'B "! /88 +2,,q/*>*>')*&+2<<?+?+?(*+'#9+ , 	r   c                    ^ RI Hp V P                  V P                  V! V P                  4      P                  4       4      # )r   )	Transpose)$sympy.matrices.expressions.transposerk   funcr   r   r4   )r$   rk   s   & r   _eval_transpose(ElementwiseApplyFunction._eval_transpose   s,    Byy	$))(<(A(A(CDDr   r2   N)__name__
__module____qualname____firstlineno____doc__r   propertyr   r   r   r4   r:   rC   rI   rX   rn   __static_attributes____classdictcell__)__classdict__s   @r   r   r   	   st     &PB      &?
@DE Er   r   N)sympy.core.exprr   sympy.core.functionr   r   r   sympy.core.symbolr   sympy.core.sympifyr   r	   sympy.matrices.expressionsr
   sympy.matrices.matrixbaser   r   r2   r   r   <module>r      s*    ' A A # 0 1 0CEz CEr   