+
    ik                     R   R t ^ RIt^ RIHtHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHtHt ^ R
IHt ^ RIHtHt ^ RIHt ^ RIHtHtH t  ^ RI!H"t" ^ RI#H$t$ ]! R4      t%]! R4      t&]! R4      t']! R4      t(]! R4      w  t)t*t+]! R4      ! ]&]'4      t,]! R4      ! ],](4      t-]! ^ 4      t.]! ^4      t/]! ^4      t0]! R!4      t1]Pd                  Pg                  R]..]&.3]/.]&.3]0.]&.3]1.]&.3]&.]&.3]'.]&.3]&]',           .]&.3]&]',          .]&.3]&^,          .]&.3]&]',          .]&.3]! ]&4      .]&.3]! ]&4      .]&.3] ! ]&4      .]&.3].]/]&]']&]',          ]&]',           .]&]'.3]&]',          ]! ]&]',          4      ,           ]! ]'4      ,
          ]&]',          ]! ]'4      ,
          ,          .]&]'.3]%] ! ]'](,          4      ,          ]&] ! ]'](,          4      ,
          ,          ]%]&,          ] ! ]'](,          4      ,          ]&] ! ]'](,          4      ,
          ,          .]%]&]'](.3])^,          ]*,           ]*^,          ]+,           ]+^,          ]),           .])]*]+.3]-]
! ]-]&4      ,           ],,           ^]&,          ,           .]&.3.4      R 4       t4R t5R t6R t7R t8R t9R t:R t;R  t<R# )"z5Tests for the ``sympy.simplify._cse_diff.py`` module.N)Symbolsymbols)Integer)Function)
Derivative)exp)ImmutableDenseMatrix)dynamicsymbols)_forward_jacobian_remove_cse_from_derivative_forward_jacobian_cse!_forward_jacobian_norm_in_cse_out)simplify)Matrixeye)raises)cossintan)trigsimp)csewxyzzq1 q2 q3kfz	expr, wrtc                     \        V .4      P                  p \        V.4      P                  p\        W4      p\         P                  ! VP                  !  p\        W P                  V4      ,
          4      V8X  g   Q hR # N)r   Tr
   zerosshaper   jacobian)exprwrtr"   r    s   &&  `/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/simplify/tests/test_cse_diff.pytest_forward_jacobianr&   +   se    4  '))D
u
%
'
'C +H &&7EH}}S112e;;;    c                  z   \        R 4      w  rp\        R4      p\        R4      p\        V! V! W4      V4      \        V! V! W4      V4      V 4      ,           V! W4      ,           ^V ,          ,           .4      p\	        V4      w  rg\        Wg4      w  r\        R4      p
\        R4      pW! W4      3W! W4      3.\        ^V ,          V
,           V,           \        V! V! W4      V4      V 4      ,           .4      .3pW^ ,          8X  g   Q RV^ ,           RV 24       hW^,          8X  g   Q RV^,           RV	 24       hR# )x y zr   r   x0x1z	Expected z
, but got N)r   r   r   r   r   r   )r   r   r   r   r   r#   replreducedp_repl	p_reducedr*   r+   expected_outputs                r%   test_process_cser1   L   s4   gGA!AA1QqVQ<*Qqvq\1"==!F1LMNDIMD3DBF	B	B agQrX'	Qb:a!mQ#??@	ABO
 Q''[9_Q5G4H
SYRZ)[['**ai8J7K:V_U`,aa*r'   c                     \        R 4      w  rp\        W,          W,          ,           W,          V,          ,           V ^,          V^,          ,           V^,          ,           W,          W,          ,           W,          ,           .4      p\        WV.4      p\        V4      w  rV\        WVV4      w  rxp	\	        V^ ,          \        V^ ,          4      4      '       g   Q R4       h\        W44      w  rp\	        V^ ,          \        V^ ,          4      4      '       g   Q R4       h\        W44      p\	        V\        V4      4      '       g   Q R4       hR# )r)   z9Jacobian should be a Matrix of the same type as the inputN)r   r   r   r   
isinstancetyper   r
   )r   r   r   r#   r$   replacementsreduced_exprreplacements_corejacobian_coreprecomputed_fs_corereplacements_normjacobian_normprecomputed_fs_normr"   s                 r%   test_io_matrix_typer=   `   s!   gGA!		!	Qa!q& 	! D
 ay
)C!$TL =RR^nq<r9&9mA&\!_(=>>{@{{> =^=9&9mA&\!_(=>>{@{{> !+HhT
++h-hh+r'   c                  `   \        R 4      w  rp\        W,          W,          ,           W,          V,          ,           V ^,          V^,          ,           V^,          ,           W,          W,          ,           W,          ,           .4      p\        WV.4      p\        V4      w  rV\        WVV4      w  rxp	\	        V\        V4      4      '       g   Q R4       h\	        V\        V4      4      '       g   Q R4       h\	        V	\        4      '       g   Q R4       h\        V4      \        V4      8X  g   Q R4       h\        V4      ^8X  g   Q R4       h\        V	4      \        V4      8X  g   Q R4       h\        W44      w  rp\	        V
\        V4      4      '       g   Q R4       h\	        V\        V4      4      '       g   Q R4       h\	        V\        4      '       g   Q R4       h\        V
4      \        V4      8X  g   Q R4       h\        V4      ^8X  g   Q R4       h\        V4      \        V4      8X  g   Q R4       hR# )r)   zReplacements should be a listzJacobian should be a listz)Precomputed free symbols should be a listz%Length of replacements does not matchz Jacobian should have one elementz1Length of precomputed free symbols does not matchN)	r   r   r   r   r3   r4   listlenr   )r   r   r   r#   r$   r5   r6   r7   r8   r9   r:   r;   r<   s                r%   "test_forward_jacobian_input_outputrA   y   s   gGA!		!	Qa!q& 	 D
 !
C!$TL =RR^nq<r9&9'l);<<]>]]<mT,%788U:UU8)400]2]]0 !S%66_8__6}"F$FF""#s<'88m:mm8 =^^b<h9&9'l);<<]>]]<mT,%788U:UU8)400]2]]0 !S%66_8__6}"F$FF""#s<'88m:mm8r'   c                     \        ^^\        ^,          \        ,          ^\        ^,          ,          \        \        ,          ,           .4      p \        \        .p\        W4      \        ^\        ,          \        ,          \        ^,          .\        ^\        ,          \        ,           ..4      8X  g   Q h\        ^^\        \        ^,          \        ^,          ,          .4      p \        W4      \        ^^ .^\        ,          \        ^,          ,          \        ^,          ^,          \        ^,          ,          ..4      8X  g   Q hR# )   N)r   r   r   r
   )Lsymss     r%   test_jacobian_hessianrF      s    q!ad1fa1fqsl+,Aq6DQ%!A#a%AAaC!G0M)NNNNq!aAad^$AQ%!Q!A#ad(AqDF1a4K9P0Q)RRRRr'   c                  R   \        R 4      w  r\        V \        V4      ,          V \        V4      ,          .4      p\        W.4      p\	        W#4      pWBP                  VP                  4      8X  g   Q hWBP                  P                  V4      8X  g   Q hWBP                  P                  VP                  4      8X  g   Q hVP                  \        VP                  ^ ,          4      ,          V,          pVP                  \        4      pV\        ^^ .^ V ^,          ..4      8X  g   Q hR# zrho,phiN)r   r   r   r   r
   r"   r   r   r!   	applyfuncr   )rhophiXYJgs         r%   test_jacobian_metricsrP      s    y!HCc#hc#h/0AzA!A

133q!!!!qss####	c!''!*o!A	HAAC1H.////r'   c                  b   \        R 4      w  r\        V \        V4      ,          V \        V4      ,          V ^,          .4      p\        W.4      p\        \        V4      V ) \        V4      ,          .\        V4      V \        V4      ,          .^V ,          ^ ..4      p\	        W#4      V8X  g   Q hR# rH   )r   r   r   r   r
   )rJ   rK   rL   rM   rN   s        r%   test_jacobian2rR      s    y!HCc#hc#hq9:AzA	SC4#c(?#	S3S>"	
S! 	A
 Q"a'''r'   c                  R   \        \        \        \        ,           \        ,           4      \        \        \        ,           \        ,           4      \        \        \        ,           \        ,           4      .4      p \        \        \        \        .4      p\        ^^4       F  p\        ^^4       Fr  pV RV1R3,          pVRV1R3,          p\        WE4      pVP                  V8X  g   Q hVP                  V8X  g   Q h\        V4       F  pVRV3,          V8X  d   K  Q h	  Kt  	  K  	  R# )rC   NNNN)	r   r   r   r   r   ranger
   rowscols)rL   rM   ijX_sliceY_slicerN   r   s           r%   test_issue_4564r\      s    AEAIAEAIAEAI?@A1ayA1a[q!AAhGAhG!'3A66Q;;66Q;;1XAw')))   r'   c                    a a \        \        \        \        ,           \        ,           4      \        \        \        ,           \        ,           4      .\        \        \        ,           \        ,           4      \        \        \        ,           \        ,           4      ..4      o \        \        V 3R  l4       S R,          o \        \        \        .\        \        ..4      o\        \        V V3R l4       \        \        V 3R l4       R# )c                  L   < \        S \        \        \        \        .4      4      # r   r
   r   r   r   r   rL   s   r%   <lambda>(test_nonvectorJacobian.<locals>.<lambda>   s    /61a)3DEr'   c                     < \        S S4      # r   )r
   rL   rM   s   r%   ra   rb      s    /15r'   c                  Z   < \        S \        \        \        .\        \        ..4      4      # r   r_   r`   s   r%   ra   rb      s    /6Aq6Aq6:J3KLr'   N)    rT   )r   r   r   r   r   r   	TypeErrorrd   s   @@r%   test_nonvectorJacobianrh      s    QUQYQUQY0QUQYQUQY02 	3A
9EF	$AAA A
956
9LMr'   )=__doc__pytestsympy.core.symbolr   r   sympy.core.numbersr   sympy.core.functionr   
sympy.corer   &sympy.functions.elementary.exponentialr   sympy.matrices.immutabler   sympy.physics.mechanicsr	   sympy.simplify._cse_diffr
   r   r   r   sympy.simplify.simplifyr   sympy.matricesr   r   sympy.testing.pytestr   (sympy.functions.elementary.trigonometricr   r   r   sympy.simplify.trigsimpr   sympyr   r   r   r   r   q1q2q3r   r   zeroonetwoneg_onemarkparametrizer&   r1   r=   rA   rF   rP   rR   r\   rh    r'   r%   <module>r      s   ;  / & ( ! 6 9 2I I - & ' D D ,  3K
3K
3K
3KJ'
B SM!QSM!Qqzajaj
"+ 
!


QC
qc

qc

a%1#
A#
Q$!
Q$!
a&A3
a&A3
a&A3
Q1Q3A	&A/aC3qs8c!f$!s1v~
6	7!Q@
C!H*a#ac(l
#QqSQqS\1s1Q3x<%@	AAq!Q<P
a%"*b!ebj"a%"*	-B|<
jA

"QqS
(	)A3/%2<32<b(i2n<S
0	(*Nr'   