
    oVhy                     T   d Z ddlZddlmZmZmZmZmZmZm	Z	m
Z
mZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZ   ed      Z! ed      Z" G d d	      Z# G d
 d      Z$ G d d      Z% G d d      Z& G d d      Z' G d d      Z( G d d      Z) G d d      Z*y)z=Tests for the ``sympy.physics.mechanics.actuator.py`` module.    N)	SMatrixSymbolSympifyErrorsqrtAbssymbolsexpsign)ActuatorBaseForceForceActuatorKanesMethodLinearDamperLinearPathwayLinearSpringParticlePinJointPointReferenceFrame	RigidBodyTorqueActuatorVectordynamicsymbolsDuffingSpringCoulombKineticFriction)Exprtargetreactionc                   t   e Zd Z ej                  d      d        Zd Zej                  j                  dde	j                  fe	j                  e	j                  f ed       ed      f ed       ed      f ed      dz   ed      z    ed      dz   ed      z   fg      d	        Zej                  j                  d
ddg      d        Zej                  j                  d e ed       ed            g      d        Zd Zej                  j                  dddg      d        Zd Zd Zd Zd Zy)TestForceActuatorTautousec                    t        d      | _        t        d      | _        t        d      | _        t        | j                  | j                        | _        t        d      | _        t        d      | _	        t        d      | _
        t        dd      | _        t        dd      | _        t        dd      | _        t        d      | _        y )	NFpApBq1q2q3   N)r   forcer   r&   r'   r   pathwayr   r(   r)   r*   q1dq2dq3dr   r,   selfs    [/home/dcms/DCMS/lib/python3.12/site-packages/sympy/physics/mechanics/tests/test_actuator.py_linear_pathway_fixturez)TestForceActuator._linear_pathway_fixture,   s    C[
++$TWWdgg6 & & &!$*!$*!$*$    c                 0    t        t        t              sJ y N)
issubclassr   r   r2   s    r4   test_is_actuator_base_subclassz0TestForceActuator.test_is_actuator_base_subclass:       -666r6   zforce, expected_forcer+   r%      c                     t        || j                        }t        |t               sJ t        |d      sJ t        |j                  t
              sJ |j                  |k(  sJ y )Nr-   )r   r.   
isinstancehasattrr-   ExprType)r3   r-   expected_forceinstances       r4   test_valid_constructor_forcez.TestForceActuator.test_valid_constructor_force=   sZ     !5(M222x)))(..(333~~///r6   r-   Nc                     t        j                  t              5  t        || j                        }d d d        y # 1 sw Y   y xY wr8   )pytestraisesr   r   r.   )r3   r-   _s      r4   .test_invalid_constructor_force_not_sympifyablez@TestForceActuator.test_invalid_constructor_force_not_sympifyableN   s3    ]]<( 	3eT\\2A	3 	3 	3	   :Ar.   r&   r'   c                     t        | j                  |      }t        |t               sJ t        |d      sJ t        |j                  t
              sJ |j                  |k(  sJ y )Nr.   )r   r-   r>   r?   r.   r   )r3   r.   rB   s      r4   test_valid_constructor_pathwayz0TestForceActuator.test_valid_constructor_pathwayS   s^     !W5(M222x+++(**M:::7***r6   c                     t        j                  t              5  t        | j                  d       }d d d        y # 1 sw Y   y xY wr8   )rE   rF   	TypeErrorr   r-   r3   rG   s     r4   1test_invalid_constructor_pathway_not_pathway_basezCTestForceActuator.test_invalid_constructor_pathway_not_pathway_base`   s3    ]]9% 	0djj$/A	0 	0 	0rI    property_name, fixture_attr_name)r-   r-   r.   r.   c                     t        | j                  | j                        }t        | |      }t	        j
                  t              5  t        |||       d d d        y # 1 sw Y   y xY wr8   )r   r-   r.   getattrrE   rF   AttributeErrorsetattr)r3   property_namefixture_attr_namerB   values        r4   test_properties_are_immutablez/TestForceActuator.test_properties_are_immutabled   sR     !T\\:/0]]>* 	4HmU3	4 	4 	4   AA&c                 h    t        | j                  | j                        }d}t        |      |k(  sJ y )Nz'ForceActuator(F, LinearPathway(pA, pB)))r   r-   r.   reprr3   actuatorexpecteds      r4   	test_reprzTestForceActuator.test_reprq   s-     T\\:<H~)))r6   c                    | j                   j                  | j                  d| j                  j                  z         t        | j                  | j                        }| j                  | j                   | j                  j                  z  f| j                   | j                  | j                  j                  z  fg}|j                         |k(  sJ y Nr<   )	r'   set_posr&   r,   xr   r-   r.   to_loadsr]   s      r4   test_to_loads_static_pathwayz.TestForceActuator.test_to_loads_static_pathwayv   s    46688, T\\:WW

l46688+,WWdjj)*
   "h...r6   c                 X   | j                   j                  | j                  d| j                  z  | j                  j
                  z         t        | j                  | j                        }| j                  | j                   | j                  t        | j                  dz        z  z  | j                  j
                  z  f| j                   | j                  | j                  t        | j                  dz        z  z  | j                  j
                  z  fg}|j                         |k(  sJ y rb   )r'   rc   r&   r(   r,   rd   r   r-   r.   r   re   r]   s      r4   test_to_loads_2D_pathwayz*TestForceActuator.test_to_loads_2D_pathway   s    47746688!34 T\\:WW

lDGGD!,<$<=dffhhFGWWdjj$''$twwz*:":;DFFHHDE
   "h...r6   c                    | j                   j                  | j                  | j                  | j                  j
                  z  | j                  | j                  j                  z  z
  d| j                  z  | j                  j                  z  z          t        | j                  | j                        }t        | j                  dz  | j                  dz  z   d| j                  dz  z  z         }| j                   | j                  z  | j                  j
                  z  |z  | j                  | j                  z  | j                  j                  z  |z  z   d| j                  z  | j                  z  | j                  j                  z  |z  z
  }| j                  | j                  z  | j                  j
                  z  |z  | j                  | j                  z  | j                  j                  z  |z  z
  d| j                  z  | j                  z  | j                  j                  z  |z  z   }| j                  |f| j                   |fg}|j                         |k(  sJ y )Nr<      )r'   rc   r&   r(   r,   rd   r)   yr*   zr   r-   r.   r   re   )r3   r^   lengthpO_forcepI_forcer_   s         r4   test_to_loads_3D_pathwayz*TestForceActuator.test_to_loads_3D_pathway   s   GGGGDFFHHtwwtvvxx//!DGG)DFFHH2DD	
 !T\\:dggqj477A:-$''1*<=jjL )&0jj )&01

l477"46688+F23 	 JJtwwtvvxx'.jj )&01

l477"46688+F23 	 WWhWWh
   "h...r6   )__name__
__module____qualname__rE   fixturer5   r:   markparametrizer   Oner   r   rC   rH   r   r   rK   rO   rY   r`   rf   rh   rp    r6   r4   r!   r!   *   se   V^^D!% "%7 [[JUUAEENC[&+&C ."56C[!^fSk)6#;>F3K+GH	
	0	0 [[WtSk23 33 [[%+uT{3	
++0 [[*"	
44*
///r6   r!   c                      e Zd Z ej                  d      d        Zd Zd Zej                  j                  dde
j                  de
j                   e ed	      d
z         f ed       ed      de
j                   ed        e ed	      d
z        z  f ed       ed      e
j                  e
j                   ed        e ed	      d
z        z  f ed       ed       ed       ed       ed        e ed	      d
z         ed      z
  z  fg      d        Zej                  j                  dddg      d        Zd Zej                  j                  dddg      d        Zej                  j                  dg d      d        Zej                  j                  de
j                  df ed      dfg      d        Zd Zy)TestLinearSpringTr"   c                    t        d      | _        t        d      | _        t        d      | _        t        d      | _        t        | j                  | j
                        | _        t        d      | _	        t        d      | _        y )Nklr&   r'   qr,   )r   	stiffnessr}   r   r&   r'   r   r.   r   r~   r   r,   r2   s    r4   _linear_spring_fixturez'TestLinearSpring._linear_spring_fixture   s\    ++$TWWdgg6$$r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   test_is_force_actuator_subclassz0TestLinearSpring.test_is_force_actuator_subclass       ,666r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r:   z/TestLinearSpring.test_is_actuator_base_subclass       ,555r6   zUstiffness, expected_stiffness, equilibrium_length, expected_equilibrium_length, forcer+   r   r~   r<   r|   r}   c                    | j                   j                  | j                  | j                  | j                  j
                  z         t        || j                  |      }t        |t              sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ y )Nr   r.   equilibrium_lengthr-   )r'   rc   r&   r~   r,   rd   r   r.   r>   r?   r   r@   r   r   r-   )r3   r   expected_stiffnessr   expected_equilibrium_lengthr-   springs          r4   test_valid_constructorz'TestLinearSpring.test_valid_constructor   s5   ^ 	1i7IJ&,///v{+++&**H555#5555vy)))&..-888~~---v3444&33X>>>((,GGGGvw'''&,,111||u$$$r6   r   Nc                     t        j                  t              5  t        || j                  | j
                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r.   r}   )r3   r   rG   s      r4   2test_invalid_constructor_stiffness_not_sympifyablezCTestLinearSpring.test_invalid_constructor_stiffness_not_sympifyable   s9    ]]<( 	>Ydff=A	> 	> 	>   "AAc                     t        j                  t              5  t        | j                  d | j
                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   rM   r   r   r}   rN   s     r4   rO   zBTestLinearSpring.test_invalid_constructor_pathway_not_pathway_base   s9    ]]9% 	;T^^T466:A	; 	; 	;r   r   c                     t        j                  t              5  t        | j                  | j
                  |      }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r   r.   r3   r   rG   s      r4   ;test_invalid_constructor_equilibrium_length_not_sympifyablezLTestLinearSpring.test_invalid_constructor_equilibrium_length_not_sympifyable   s@    
 ]]<( 	OT^^T\\;MNA	O 	O 	Or   rP   ))r   r   rQ   )r   r}   c                     t        | j                  | j                  | j                        }t	        | |      }t        j                  t              5  t        |||       d d d        y # 1 sw Y   y xY wr8   )	r   r   r.   r}   rS   rE   rF   rT   rU   )r3   rV   rW   r   rX   s        r4   rY   z.TestLinearSpring.test_properties_are_immutable  sX     dnndllDFFC/0]]>* 	2FM51	2 	2 	2s   A((A1equilibrium_length, expectedz&LinearSpring(k, LinearPathway(pA, pB))z<LinearSpring(k, LinearPathway(pA, pB), equilibrium_length=l)c                     | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                  |      }t        |      |k(  sJ y r8   )
r'   rc   r&   r~   r,   rd   r   r   r.   r\   r3   r   r_   r   s       r4   r`   zTestLinearSpring.test_repr  sS     	1dnndll<NOF|x'''r6   c                 f   | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                  | j                        }| j                  t        | j                  dz        z  | j                  j
                  z  }| j                  t        | j                  dz        | j                  z
  z  |z  }| j                   t        | j                  dz        | j                  z
  z  |z  }t        | j                  |      t        | j                   |      g}|j                         }t        ||      D ]M  \  }\  }}	t        |t              sJ |j                  |k(  sJ |j                   |	z
  j#                         dk(  rMJ  y )Nr<   r   )r'   rc   r&   r~   r,   rd   r   r   r.   r}   r   r   re   zipr>   pointvectorsimplify)
r3   r   normalpA_forcepB_forcer_   loadsloadr   r   s
             r4   test_to_loadszTestLinearSpring.test_to_loads$  sH   1dnndllDFFCTVVQY'0>>4	?TVV#;<VCNN?DOdff$<=fD$''8,eDGGX.FG!%(%9 	:!D/5&dE***::&&&KK&(224999	:r6   )rq   rr   rs   rE   rt   r   r   r:   ru   rv   r   rw   Zeror   r   r   r   r   rO   r   rY   r`   r   rx   r6   r4   rz   rz      s    V^^D!% "%76 [[ nS)1,-- ssT."5q"899 ssT."5q"899 ssssd>##6#9:VC[HI-	
&N%O&N%: [[[4+6> 7>; [[1D#;?O @O [[*	
22 [[&VV=>sN	
	(	(
:r6   rz   c                       e Zd Z ej                  d      d        Zd Zd Zd Zd Z	ej                  j                  dd	d
g      d        Zd Zej                  j                  dddg      d        Zd Zd Zy	)TestLinearDamperTr"   c                 P   t        d      | _        t        d      | _        t        d      | _        t        d      | _        t        | j                  | j
                        | _        t        d      | _	        t        dd      | _
        t        d      | _        t        d      | _        y )	Ncr}   r&   r'   r~   r+   ur,   )r   dampingr}   r   r&   r'   r   r.   r   r~   dqr   r   r,   r2   s    r4   _linear_damper_fixturez'TestLinearDamper._linear_damper_fixture5  sv    c{++$TWWdgg6$ a($$r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r   z0TestLinearDamper.test_is_force_actuator_subclassA  r   r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r:   z/TestLinearDamper.test_is_actuator_base_subclassD  r   r6   c                 
   | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                        }t        |t              sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ y )Nr   r.   )r'   rc   r&   r~   r,   rd   r   r   r.   r>   r?   r@   r   )r3   dampers     r4   r   z'TestLinearDamper.test_valid_constructorG  s    1dllDLL9&,///vy)))&..(333~~---vy)))&..-888~~---r6   c                    | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                        }| j                   t        | j                  dz        z  | j                  z  | j                  z  }t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ y )Nr<   r-   )r'   rc   r&   r~   r,   rd   r   r   r.   r   r   r?   r>   r-   r@   )r3   r   rA   s      r4   rC   z-TestLinearDamper.test_valid_constructor_forceU  s    1dllDLL9,,tDFFAI6tww>tvvEvw'''&,,111||~---r6   r   Nr   c                     t        j                  t              5  t        || j                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r.   )r3   r   rG   s      r4   0test_invalid_constructor_damping_not_sympifyablezATestLinearDamper.test_invalid_constructor_damping_not_sympifyable^  s3    ]]<( 	4Wdll3A	4 	4 	4rI   c                     t        j                  t              5  t        | j                  d       }d d d        y # 1 sw Y   y xY wr8   )rE   rF   rM   r   r   rN   s     r4   rO   zBTestLinearDamper.test_invalid_constructor_pathway_not_pathway_basec  s3    ]]9% 	1T\\40A	1 	1 	1rI   rP   )r   r   rQ   c                     t        | j                  | j                        }t        | |      }t	        j
                  t              5  t        |||       d d d        y # 1 sw Y   y xY wr8   )r   r   r.   rS   rE   rF   rT   rU   )r3   rV   rW   r   rX   s        r4   rY   z.TestLinearDamper.test_properties_are_immutableg  sR     dllDLL9/0]]>* 	2FM51	2 	2 	2rZ   c                     | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                        }d}t        |      |k(  sJ y )Nz&LinearDamper(c, LinearPathway(pA, pB)))
r'   rc   r&   r~   r,   rd   r   r   r.   r\   )r3   r   r_   s      r4   r`   zTestLinearDamper.test_reprt  sS    1dllDLL9;F|x'''r6   c                 2   | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                        }| j                  dz  | j                  dz  z  | j                  j
                  z  }| j                  | j                  z  |z  }| j                   | j                  z  |z  }t        | j                  |      t        | j                   |      g}|j                         |k(  sJ y rb   )r'   rc   r&   r~   r,   rd   r   r   r.   r   r   re   )r3   r   	directionr   r   r_   s         r4   r   zTestLinearDamper.test_to_loadsz  s    1dllDLL9FFAIdffai'0	<<'	1LL=(2$''8,eDGGX.FG H,,,r6   )rq   rr   rs   rE   rt   r   r   r:   r   rC   ru   rv   r   rO   rY   r`   r   rx   r6   r4   r   r   3  s    V^^D!	% "	%76.. [[Ys44 541 [[*""	
22(-r6   r   c                   N    e Zd ZdZ ej
                  d      d        Zd Zd Zy)TestForcedMassSpringDamperModela  A single degree of freedom translational forced mass-spring-damper.

    Notes
    =====

    This system is well known to have the governing equation:

    .. math::
        m \ddot{x} = F - k x - c \dot{x}

    where $F$ is an externally applied force, $m$ is the mass of the particle
    to which the spring and damper are attached, $k$ is the spring's stiffness,
    $c$ is the dampers damping coefficient, and $x$ is the generalized
    coordinate representing the system's single (translational) degree of
    freedom.

    Tr"   c                 J   t        d      | _        t        d      | _        t        d      | _        t        d      | _        t        d      | _        t        dd      | _        t        d      | _        t        d      | _
        t        d	      | _        | j                  j                  | j                  d
       t        d      | _        | j                  j                  | j                  | j                  | j                  j                   z         t#        d| j                  | j                        | _        t'        | j                  | j                        | _        t+        | j                  | j                  g| j                  g| j                  | j                  z
  g      | _        | j$                  g| _        t1        | j                  gg      | _        t1        | j                  | j                  | j                  z  z
  | j                  | j                  z  z
  gg      | _        y )Nmr|   r   r%   r~   r+   r   r,   pOr   r&   mass)q_indu_indkd_eqs)r   r   r|   r   r%   r   r~   r   r   r   framer   originset_vel
attachmentrc   rd   r   r   r   r.   r   kanes_methodbodiesr   mass_matrixforcingr2   s    r4   '_force_mass_spring_damper_model_fixturezGTestForcedMassSpringDamperModel._force_mass_spring_damper_model_fixture  sz   $ a($#C(
DkDJJ*+TVVDJJLL-@AVT__dff=	$T[[$//B'JJ66(66(GGdff$%	
 yyk!DFF8*- 6 FGHIr6   c                 l   | j                    | j                  j                  z  }t        || j                        }| j                   | j                  j
                  z  }t        || j                        }| j                  | j                  | j                  j                  z  fg|j                         |j                         }| j                  j                  | j                  |       | j                  j                  | j                  k(  sJ | j                  j                  | j                  k(  sJ y r8   )r|   r.   rm   r   r   extension_velocityr   r%   r   rd   re   r   kanes_equationsr   r   r   )r3   r   r   r   r   r   s         r4   test_force_acuatorz2TestForcedMassSpringDamperModel.test_force_acuator  s    VVGDLL///	y$,,766'$,,999w5 __dffTZZ\\12
__
 __

 	))$++u=  ,,0@0@@@@  ((DLL888r6   c                    t        | j                  | j                        }t        | j                  | j                        }| j
                  | j                  | j                  j                  z  fg|j                         |j                         }| j                  j                  | j                  |       | j                  j                  | j                  k(  sJ | j                  j                  | j                  k(  sJ y r8   )r   r|   r.   r   r   r   r%   r   rd   re   r   r   r   r   r   )r3   r   r   r   s       r4    test_linear_spring_linear_damperz@TestForcedMassSpringDamperModel.test_linear_spring_linear_damper  s    dffdll3dffdll3 __dffTZZ\\12
__
 __

 	))$++u=  ,,0@0@@@@  ((DLL888r6   N)	rq   rr   rs   __doc__rE   rt   r   r   r   rx   r6   r4   r   r     s2    $ V^^D!J "J>9 9r6   r   c            	          e Zd Z ej                  d      d        Zd Zej                  j                  d e	d       e
d       e	d      dz   e	d      z   g      ej                  j                  dej                  ej                  feej                  fej                  efeefg      d	               Zej                  j                  d e	d       e
d       e	d      dz   e	d      z   g      ej                  j                  d
ej                  eg      d               Zej                  j                  dddg      d        Zej                  j                  d e	d       e
d      g      d        Zej                  j                  dd ed      f ed      dfd ed      f ed      dfg      d        Zej                  j                  dg d      d        Zd Zd Zd Zd Zd Zd Zy)TestTorqueActuatorTr"   c                 
   t        d      | _        t        d      | _        t        d      | _        | j                  j
                  | _        t        d| j                        | _        t        d| j                        | _	        y )NTr,   Ar   )r   r   )
r   torquer   r,   r   rl   axisr   r   r   r2   s    r4   _torque_actuator_fixturez+TestTorqueActuator._torque_actuator_fixture  sX    Sk$$FFHH	7!*DFF;r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r:   z1TestTorqueActuator.test_is_actuator_base_subclass  s    .,777r6   r   r   r<   ztarget_frame, reaction_framec                 |   t        || j                  ||      }t        |t               sJ t        |d      sJ t        |j                  t
              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  t        j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  t        j                  k(  sJ y Nr   r   target_framereaction_frame)r   r   r>   r?   r   r@   r   r   r   r   r   r   r   )r3   r   r   r   rB   s        r4   $test_valid_constructor_with_reactionz7TestTorqueActuator.test_valid_constructor_with_reaction  s   . "II	
 (N333x***(//8444&(((x((((--000}}		)))x000(//@@@$$444x!1222(11>BBB&&(..888r6   r   c                     t        || j                  |      }t        |t               sJ t        |d      sJ t        |j                  t
              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  t        j                  k(  sJ t        |d      sJ |j                  J y r   )r   r   r>   r?   r   r@   r   r   r   r   r   r   )r3   r   r   rB   s       r4   'test_valid_constructor_without_reactionz:TestTorqueActuator.test_valid_constructor_without_reaction  s     "&$))\B(N333x***(//8444&(((x((((--000}}		)))x000(//@@@$$444x!1222&&...r6   Nc                     t        j                  t              5  t        || j                  | j
                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r   r   )r3   r   rG   s      r4   /test_invalid_constructor_torque_not_sympifyablezBTestTorqueActuator.test_invalid_constructor_torque_not_sympifyable/  s9    ]]<( 	?vtyy$++>A	? 	? 	?r   r   ac                     t        j                  t              5  t        | j                  || j
                  | j                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   rM   r   r   r   r   )r3   r   rG   s      r4   (test_invalid_constructor_axis_not_vectorz;TestTorqueActuator.test_invalid_constructor_axis_not_vector4  sC    ]]9% 	Nt{{D$++t}}MA	N 	N 	N   -AAframeschildparentc                     t        j                  t              5  t        | j                  | j
                  g| }d d d        y # 1 sw Y   y xY wr8   )rE   rF   rM   r   r   r   )r3   r   rG   s      r4   )test_invalid_constructor_frames_not_framez<TestTorqueActuator.test_invalid_constructor_frames_not_frame9  sB     ]]9% 	@t{{DII??A	@ 	@ 	@r   rP   ))r   r   )r   r   )r   r   )r   r   c                     t        | j                  | j                  | j                  | j                        }t        | |      }t        j                  t              5  t        |||       d d d        y # 1 sw Y   y xY wr8   )
r   r   r   r   r   rS   rE   rF   rT   rU   )r3   rV   rW   r^   rX   s        r4   rY   z0TestTorqueActuator.test_properties_are_immutableF  sf     "KKIIKKMM	
 /0]]>* 	4HmU3	4 	4 	4s   A33A<c                 ~    t        | j                  | j                  | j                        }d}t	        |      |k(  sJ y )Nz+TorqueActuator(T, axis=N.z, target_frame=N))r   r   r   r   r\   r]   s      r4   test_repr_without_reactionz-TestTorqueActuator.test_repr_without_reactionZ  s3    !$++tyy$++F@H~)))r6   c                     t        | j                  | j                  | j                  | j                        }d}t        |      |k(  sJ y )Nz=TorqueActuator(T, axis=N.z, target_frame=N, reaction_frame=A))r   r   r   r   r   r\   r]   s      r4   test_repr_with_reactionz*TestTorqueActuator.test_repr_with_reaction_  sB    !KKIIKKMM	
 SH~)))r6   c           	      (   t        d| j                  | j                  t        d      t        d      | j                  | j
                        }t        j                  | j                  |      }t        |t              sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j
                  t              sJ |j
                  | j
                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                   t              sJ |j                   | j                  k(  sJ y )	Npinr~   r   )coordinatesspeedsparent_interframe
joint_axisr   r   r   r   )r   r   r   r   r,   r   r   at_pin_jointr   r>   r?   r@   r   r   r   r   r   )r3   	pin_jointrB   s      r4   test_at_pin_joint_constructorz0TestTorqueActuator.test_at_pin_joint_constructori  sT   KKMM&s+!#&"ffyy
	 "..t{{IF(N333x***(//8444$++---x((((--000}}		)))x000(//@@@$$...x!1222(11>BBB&&$&&000r6   c                     t        j                  t              5  t        j                  | j
                  t        d            }d d d        y # 1 sw Y   y xY w)Nr   )rE   rF   rM   r   r   r   r   rN   s     r4   1test_at_pin_joint_pin_joint_not_pin_joint_invalidzDTestTorqueActuator.test_at_pin_joint_pin_joint_not_pin_joint_invalid  sA    ]]9% 	H++DKKGA	H 	H 	Hs   *AAc                     t        | j                  | j                  | j                        }| j                  | j                  | j                  z  fg}|j                         |k(  sJ y r8   )r   r   r   r   r,   re   r]   s      r4   test_to_loads_without_reactionz1TestTorqueActuator.test_to_loads_without_reaction  sU    !$++tyy$++FVVT[[*+
   "h...r6   c                 0   t        | j                  | j                  | j                  | j                        }| j
                  | j                  | j                  z  f| j                  | j                   | j                  z  fg}|j                         |k(  sJ y r8   )r   r   r   r   r   r,   r   re   r]   s      r4   test_to_loads_with_reactionz.TestTorqueActuator.test_to_loads_with_reaction  s~    !KKIIKKMM	
 VVT[[*+VVt{{]499,-
   "h...r6   )rq   rr   rs   rE   rt   r   r:   ru   rv   r   r   r   r   r   r   r   r   r   r   r   r   rY   r   r   r   r   r   r   rx   r6   r4   r   r     s@   V^^D!< "<8 [[3K33KNVC[(	
 [[&\\8>>*X^^$\\8$X		
9"9< [[3K33KNVC[(	
 [[^fllF-CD/ E/& [[Xc{3? 4? [[VfSk>#3F%GHN IN [[>'*+H%t,9W%&x $'		
@@ [[*	
	4	4*
*1:H//r6   r   c                       e Zd Zy)NonSympifyableN)rq   rr   rs   rx   r6   r4   r   r     s    r6   r   c                   H   e Zd Z ej                  d      d        Zd Zd Zej                  j                  dde
j                  de
j                  de
j                   e ed	      d
z          e ed	      d
z        dz  z
  f ed       ed       ed       ed      de
j                   ed        e ed	      d
z        z   ed       e ed	      d
z        dz  z  z
  f ed       ed       ed       ed      e
j                  e
j                   ed        e ed	      d
z        z   ed       e ed	      d
z        dz  z  z
  f ed       ed       ed       ed       ed       ed       ed        e ed	      d
z         ed      z
  z   ed       e ed	      d
z         ed      z
  dz  z  z
  fg      d        Zej                  j                  dd e       g      d        Zej                  j                  dd e       g      d        Zd Zej                  j                  dd e       g      d        Zej                  j                  dg d      d        Zej                  j                  dd ed      dfg      d        Zd Zy) TestDuffingSpringTr"   c                 .   t        d      | _        t        d      | _        t        d      | _        t	        d      | _        t	        d      | _        t        | j
                  | j                        | _        t        d      | _
        t        d      | _        y )Nbetaalphar}   r&   r'   r~   r,   )r   linear_stiffnessnonlinear_stiffnessr   r   r&   r'   r   r.   r   r~   r   r,   r2   s    r4   _duffing_spring_fixturez)TestDuffingSpring._duffing_spring_fixture  sl     !'v#)'? "(+++$TWWdgg6$$r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r   z1TestDuffingSpring.test_is_force_actuator_subclass  s    -777r6   c                 0    t        t        t              sJ y r8   )r9   r   r   r2   s    r4   r:   z0TestDuffingSpring.test_is_actuator_base_subclass  r;   r6   zlinear_stiffness,  expected_linear_stiffness,  nonlinear_stiffness,   expected_nonlinear_stiffness,  equilibrium_length,    expected_equilibrium_length,   forcer+   r   r~   r<      r  r  r}   c                 H   | j                   j                  | j                  | j                  | j                  j
                  z         t        ||| j                  |      }t        |t              sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  | j                  k(  sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ t        |d      sJ t        |j                  t              sJ |j                  |k(  sJ y )Nr  r  r.   r   r-   )r'   rc   r&   r~   r,   rd   r   r.   r>   r?   r  r@   r  r   r   r-   )	r3   r  expected_linear_stiffnessr  expected_nonlinear_stiffnessr   r   r-   r   s	            r4   r   z(TestDuffingSpring.test_valid_constructor  sv   ~ 	1/1DdllTfg&-000v1222&118<<<&&*CCCCv4555&44h???))-IIIIvy)))&..-888~~---v3444&33X>>>((,GGGGvw'''&,,111||u$$$r6   r  Nc                     t        j                  t              5  t        || j                  | j
                  | j                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r  r.   r   )r3   r  rG   s      r4   9test_invalid_constructor_linear_stiffness_not_sympifyablezKTestDuffingSpring.test_invalid_constructor_linear_stiffness_not_sympifyable  sI    ]]<( 	q.0H0H$,,X\XoXopA	q 	q 	qr   r  c                     t        j                  t              5  t        | j                  || j
                  | j                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r  r.   r   )r3   r  rG   s      r4   <test_invalid_constructor_nonlinear_stiffness_not_sympifyablezNTestDuffingSpring.test_invalid_constructor_nonlinear_stiffness_not_sympifyable  sI    ]]<( 	qd335H$,,X\XoXopA	q 	q 	qr   c                     t        j                  t              5  t        | j                  | j
                  t               | j                        }d d d        y # 1 sw Y   y xY wr8   )rE   rF   rM   r   r  r  r   r   rN   s     r4   rO   zCTestDuffingSpring.test_invalid_constructor_pathway_not_pathway_base  sM    ]]9% 	zd33T5M5M~O_aeaxaxyA	z 	z 	zs   5AA!r   c                     t        j                  t              5  t        | j                  | j
                  | j                  |      }d d d        y # 1 sw Y   y xY wr8   )rE   rF   r   r   r  r  r.   r   s      r4   r   zMTestDuffingSpring.test_invalid_constructor_equilibrium_length_not_sympifyable  sH    ]]<( 	qd33T5M5Mt||]opA	q 	q 	qr   rP   ))r  r  )r  r  rQ   )r   r   c           	          t        | j                  | j                  | j                  | j                        }t        j                  t              5  t        ||t        | |             d d d        y # 1 sw Y   y xY wr8   )
r   r  r  r.   r   rE   rF   rT   rU   rS   )r3   rV   rW   r   s       r4   rY   z/TestDuffingSpring.test_properties_are_immutable"  sg     t44d6N6NPTP\P\^b^u^uv]]>* 	MFM749J+KL	M 	M 	Ms   A11A:r   )r   zGDuffingSpring(beta, alpha, LinearPathway(pA, pB), equilibrium_length=0)zGDuffingSpring(beta, alpha, LinearPathway(pA, pB), equilibrium_length=l)c                 |    t        | j                  | j                  | j                  |      }t	        |      |k(  sJ y r8   )r   r  r  r.   r\   r   s       r4   r`   zTestDuffingSpring.test_repr2  s:     t44d6N6NPTP\P\^pqF|x'''r6   c                 
   | j                   j                  | j                  | j                  | j                  j
                  z         t        | j                  | j                  | j                  | j                        }| j                  | j                  z
  }| j                   |z  | j                  |dz  z  z
  }t        | j                  || j                  j
                  z        t        | j                   | | j                  j
                  z        g}|j                         }t        ||      D ]  \  }}|j                  |j                  k(  sJ | j                  D ]  }|j                  j!                  |      }	|j                  j!                  |      }
| j                  dt#        d      dt#        d      dt#        d      di}|	|
z
  j%                  |      j'                         }t)        |      dk  rJ d|          y )Nr  r+   r}   r  r  g&.>z%The forces do not match. Difference: )r'   rc   r&   r~   r,   rd   r   r  r  r.   r   r   re   r   r   r   dotr   subsevalfr   )r3   r   displacementr-   expected_loadscalculated_loads
calculatedr_   dimcalculated_componentexpected_componentsubstitutionsdiffs                r4   r   zTestDuffingSpring.test_to_loads?  s   1t44d6N6NPTP\P\^b^u^uv vv 7 77 &&&58P8PS_abSb8bb  )9:E$''E6TXTZTZT\T\K\<]^ "??,$'(8.$I 		X J##x~~555vv X'1'8'8'<'<S'A$%-__%8%8%="!%F3KF7OQPVW]P^`a b,/AAGGV\\^4y4'W+PQUPV)WW'X		Xr6   )rq   rr   rs   rE   rt   r  r   r:   ru   rv   r   rw   r   r   r   r   r   r   r  r  rO   r   rY   r`   r   rx   r6   r4   r  r    sH   V^^D!% "%87 [[	 nS)1,--tN34G4J/Ka.OO vvww^C%8!%; <<VG_dSabeSfhiSiNjmnMn=nn vvww^C%8!%; <<VG_dSabeSfhiSiNjmnMn=nn vvwwss4s(;Q(>#?&+#MNQWX_Q`dhiwx{i|~i  eA  DJ  KN  DO  eO  RS  dS  RS  S9%
1j!%k1j!%F [[/$8H1IJq Kq [[2T>;K4LMq Nqz [[1D.:J3KLq Mq [[*	
MM
 [[&ZC[cd	
((Xr6   r  c                   \    e Zd Z ej                  d      d        Zd Zd Zd Zd Z	d Z
y	)
TestCoulombKineticFrictionTr"   c                 t    t        dd      \  | _        | _        | _        | _        | _        | _        | _        y)a8  A block sliding on a surface.

        Notes
        =====
        This test validates the correctness of the CoulombKineticFriction by simulating
        a block sliding on a surface with the Coulomb kinetic friction force.
        The test covers scenarios with both positive and negative velocities.

        zm g mu_k mu_s v_s sigma FT)realN)r	   r   gmu_kmu_sv_ssigmar%   r2   s    r4   _block_on_surfacez,TestCoulombKineticFriction._block_on_surfaceZ  s1     NUUpw{M|J	49dh
DFr6   c                 &
   t        d      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  |      }t        || j                  | j                  z  | j                  z  |z  t        t        |dz        |j                         z  |z        z  t        |dz        z  |j                  z        t        || j                   | j                  z  | j                  z  |z  t        t        |dz        |j                         z  |z        z  t        |dz        z  |j                  z        g}|j                         |k(  sJ t        dd	      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  |      }t        || j                  | j                  z  | j                  z  t        |j                               z  |j                  z        t        || j                   | j                  z  | j                  z  t        |j                               z  |j                  z        g}|j                         |k(  sJ t        dd
	      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  |      }t        || j                  | j                  z  | j                  z  |z  t        t        |dz        |j                         z  |z        z  t        |dz        z  |j                  z        t        || j                   | j                  z  | j                  z  |z  t        t        |dz        |j                         z  |z        z  t        |dz        z  |j                  z        g}	|j                         |	k(  sJ y )Nr~   r,   OPr   r<   r   r-   TpositiveF)r   r   r   	locatenewrd   r   r#  r   r   r)  r   r(  r   r   r   re   
r3   r~   r,   r/  r0  r.   frictionexpected_generalexpected_positiveexpected_negatives
             r4   test_block_on_surface_defaultz8TestCoulombKineticFriction.test_block_on_surface_defaulti  s   33#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gN!$&&4991Lq1PSWX\]^`a]aXbefekekemXmnoXoSp1pquvwyzvzq{1{~  B  B  2B  C!$&&4661ADII1MPQ1QTXY]^_ab^bYcfgflflfnYnopYpTq1qrvwxz{w{r|1|  @A  @C  @C  2C  DE   "&6666 3.3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gN"$&&466/DII2MPTUVU[U[U]P^2^abadad2de"466'DFF2BTYY2NQUVWV\V\V^Q_2_bcbebe2efh   "&7777 3/3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gN"$&&466/DII2MPQ2QTXY]^_ab^bYcfgflflfnYnopYpTq2qrvwxz{w{r|2|}~  ~A  ~A  3A  B"466'DFF2BTYY2NQR2RUYZ^_`bc_cZdghgmgmgoZopqZqUr2rswxy{|x|s}2}~  B  B  3B  CD   "&7777r6   c                 f   t        d      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                        }t        || j                  | j                  z  | j                  z  t        t        |dz        |j                         z  |z        z  | j                  t        |dz        z  |j                         z  |z  z   |z  t        |dz        z  |j                  z        t        || j                   | j                  z  | j                  z  t        t        |dz        |j                         z  |z        z  | j                  t        |dz        z  |j                         z  |z  z
  |z  t        |dz        z  |j                  z        g}|j!                         |k(  sJ t        dd	
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                        }t        || j                  | j                  z  | j                  z  t        |j                               z  | j                  |j                         z  z   |j                  z        t        || j                   | j                  z  | j                  z  t        |j                               z  | j                  |j                         z  z
  |j                  z        g}|j!                         |k(  sJ t        dd
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                        }t        || j                  | j                  z  | j                  z  t        t        |dz        |j                         z  |z        z  | j                  t        |dz        z  |j                         z  |z  z   |z  t        |dz        z  |j                  z        t        || j                   | j                  z  | j                  z  t        t        |dz        |j                         z  |z        z  | j                  t        |dz        z  |j                         z  |z  z
  |z  t        |dz        z  |j                  z        g}	|j!                         |	k(  sJ y )Nr~   r,   r/  r0  r   )r,  r<   r1  Tr2  F)r   r   r   r4  rd   r   r#  r   r   r)  r   r(  r,  r   r   r   re   r5  s
             r4   test_block_on_surface_viscousz8TestCoulombKineticFriction.test_block_on_surface_viscous  s   33#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gUYU_U_`!$&&466/DII2MPTUYZ[]^Z^U_bcbhbhbjUjklUlPm2mptpzpz  ~B  CD  FG  CG  ~H  qH  KL  KQ  KQ  KS  qS  TU  qU  3U  YZ  2Z  [_  `a  cd  `d  [e  2e  hi  hk  hk  2k  l!466'DFF2BTYY2NQUVZ[\^_[_V`cdcicickVklmVmQn2nquq{q{  C  DE  GH  DH  I  rI  LM  LR  LR  LT  rT  UV  rV  3V  Z[  2[  \`  ab  de  ae  \f  2f  ij  il  il  2l  mn   "&6666 3.3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gUYU_U_`"466DFF?TYY3NQUVWV\V\V^Q_3_bfblblopououowbw3w{|{~{~2~"DFF7TVV3Cdii3ORVWXW]W]W_R`3`cgcmcmpqpvpvpxcx3x|}||2  AB   "&7777 3/3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gUYU_U_`"466DFF?TYY3NQUVZ[\^_[_V`cdcicickVklmVmQn3nquq{q{  C  DE  GH  DH  I  rI  LM  LR  LR  LT  rT  UV  rV  4V  Z[  3[  \`  ab  de  ae  \f  3f  ij  il  il  3l  m"DFF7TVV3Cdii3ORVW[\]_`\`WadedjdjdlWlmnWnRo3orvr|r|  @D  EF  HI  EI  @J  sJ  MN  MS  MS  MU  sU  VW  sW  4W  [\  3\  ]a  bc  ef  bf  ]g  3g  jk  jm  jm  3m  no   "&7777r6   c                    t        d      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                        }t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z   |z  t!        t#        |dz        |j                         z  |z        z  t#        |dz        z  |j                  z        t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z    |z  t!        t#        |dz        |j                         z  |z        z  t#        |dz        z  |j                  z        g}|j%                         |k(  sJ t        dd	
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                        }t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z   t!        |j                               z  |j                  z        t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z    t!        |j                               z  |j                  z        g}|j%                         |k(  sJ t        dd
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                        }t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z   |z  t!        t#        |dz        |j                         z  |z        z  t#        |dz        z  |j                  z        t        || j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t        |j                         dz   | j                  dz  z        z  z    |z  t!        t#        |dz        |j                         z  |z        z  t#        |dz        z  |j                  z        g}	|j%                         |	k(  sJ y )Nr~   r,   r/  r0  r   )r+  r*  r<   r1  Tr2  F)r   r   r   r4  rd   r   r#  r   r   r)  r   r(  r+  r*  r   r
   r   r   re   r5  s
             r4   test_block_on_surface_stribeckz9TestCoulombKineticFriction.test_block_on_surface_stribeck  s   33#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[bfbkbkl!$&&466/DII2MRVRXRXQX[_[a[aQadhdmdmQmptpvpvy}yyp  CG  CL  CL  qL  RL  PS  UV  U[  U[  U]  _`  U`  T`  ae  ai  ai  kl  al  Tl  Pm  Qm  3m  qr  2r  uy  z~  @  BC  C  zD  GH  GM  GM  GO  zO  PQ  zQ  uR  2R  SW  XY  [\  X\  S]  2]  `a  `c  `c  2c  d!DFFTVVOdii4OTXTZTZSZ]a]c]cScfjfofoSorvrxrx{  |B  |B  sB  EI  EN  EN  sN  TN  RU  WX  W]  W]  W_  ab  Wb  Vb  cg  ck  ck  mn  cn  Vn  Ro  So  5o  2p  st  2t  w{  |@  AB  DE  AE  |F  IJ  IO  IO  IQ  |Q  RS  |S  wT  2T  UY  Z[  ]^  Z^  U_  2_  bc  be  be  2e  fg   "&6666 3.3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[bfbkbkl"466DFF?TYY3NSWSYSYRY\`\b\bRbeienenRnquqwqwz~  {A  {A  rA  DH  DM  DM  rM  SM  QT  VW  V\  V\  V^  `a  Va  Ua  bf  bj  bj  lm  bm  Um  Qn  Rn  4n  rv  wx  w}  w}  w  r@  3@  CD  CF  CF  3F  G"TVVdff_tyy5PUYU[U[T[^b^d^dTdgkgpgpTpswsysy  }A  }C  }C  tC  FJ  FO  FO  tO  UO  SV  XY  X^  X^  X`  bc  Xc  Wc  dh  dl  dl  no  do  Wo  Sp  Tp  6p  3q  tx  yz  y  y  yA  tB  3B  EF  EH  EH  3H  IJ   "&7777 3/3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[bfbkbkl"466DFF?TYY3NSWSYSYRY\`\b\bRbeienenRnquqwqwz~  {A  {A  rA  DH  DM  DM  rM  SM  QT  VW  V\  V\  V^  `a  Va  Ua  bf  bj  bj  lm  bm  Um  Qn  Rn  4n  rs  3s  vz  {  @A  CD  @D  {E  HI  HN  HN  HP  {P  QR  {R  vS  3S  TX  YZ  \]  Y]  T^  3^  ab  ad  ad  3d  e"TVVdff_tyy5PUYU[U[T[^b^d^dTdgkgpgpTpswsysy  }A  }C  }C  tC  FJ  FO  FO  tO  UO  SV  XY  X^  X^  X`  bc  Xc  Wc  dh  dl  dl  no  do  Wo  Sp  Tp  6p  3q  tu  3u  x|  }A  BC  EF  BF  }G  JK  JP  JP  JR  }R  ST  }T  xU  3U  VZ  [\  ^_  [_  V`  3`  cd  cf  cf  3f  gh   "&7777r6   c                    t        d      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                  | j                        }t        || j                  t!        |dz        z  |j                         z  |z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        t!        |dz        |j                         z  |z        z  z   |z  t!        |dz        z  |j                  z        t        || j                   t!        |dz        z  |j                         z  |z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        t!        |dz        |j                         z  |z        z  z
  |z  t!        |dz        z  |j                  z        g}|j'                         |k(  sJ t        dd	
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                  | j                        }t        || j                  |j                         z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        |j                               z  z   |j                  z        t        || j                   |j                         z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        |j                               z  z
  |j                  z        g}|j'                         |k(  sJ t        dd
      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  | j                  | j                  z  || j                  | j                  | j                        }t        || j                  t!        |dz        z  |j                         z  |z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        t!        |dz        |j                         z  |z        z  z   |z  t!        |dz        z  |j                  z        t        || j                   t!        |dz        z  |j                         z  |z  | j                  | j                  z  | j                  z  | j                   | j                  z  | j                  z  | j                  | j                  z  | j                  z  z   t#        |j                         dz   | j                  dz  z        z  z   t%        t!        |dz        |j                         z  |z        z  z
  |z  t!        |dz        z  |j                  z        g}	|j'                         |	k(  sJ y )Nr~   r,   r/  r0  r   )r+  r,  r*  r<   r1  Tr2  F)r   r   r   r4  rd   r   r#  r   r   r)  r   r(  r+  r,  r*  r   r   r
   r   re   r5  s
             r4   test_block_on_surface_allz4TestCoulombKineticFriction.test_block_on_surface_all  s&   33#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[cgcmcmtxt}t}~!$**tAqDz2IAFFH2TUV2VZ^Z`Z`cgciciZilpluluZuz~  {A  {A  zA  DH  DJ  DJ  zJ  MQ  MV  MV  zV  Y]  Y_  Y_  bf  bh  bh  Yh  ko  kt  kt  Yt  zt  x{  }~  }C  }C  }E  GH  }H  |H  IM  IQ  IQ  ST  IT  |T  xU  yU  [U  Y]  ^b  cd  fg  cg  ^h  kl  kq  kq  ks  ^s  tu  ^u  Yv  Zv  3v  z{  2{  |@  AB  DE  AE  |F  2F  IJ  IL  IL  2L  M!4::+QT
2JQVVX2UVW2W[_[a[adhdjdj[jmqmvmv[v{  |B  |B  {B  EI  EK  EK  {K  NR  NW  NW  {W  Z^  Z`  Z`  cg  ci  ci  Zi  lp  lu  lu  Zu  {u  y|  ~  ~D  ~D  ~F  HI  ~I  }I  JN  JR  JR  TU  JU  }U  yV  zV  \V  Z^  _c  de  gh  dh  _i  lm  lr  lr  lt  _t  uv  _v  Zw  [w  3w  {|  2|  }A  BC  EF  BF  }G  2G  JK  JM  JM  2M  NO   "&6666 3.3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[cgcmcmtxt}t}~"4::3HDFFUYU[U[O^b^g^gLglplrlrkruyu{u{k{  C  H  H  lH  KO  KQ  KQ  TX  TZ  TZ  KZ  ]a  ]f  ]f  Kf  lf  jm  op  ou  ou  ow  yz  oz  nz  {  {C  {C  EF  {F  nF  jG  kG  MG  KO  PQ  PV  PV  PX  KY  LY  4Y  ]^  ]`  ]`  3`  a"DJJ;3ITVVVZV\V\__c_h_hMhmqmsmslsvzv|v|l|  @D  @I  @I  mI  LP  LR  LR  UY  U[  U[  L[  ^b  ^g  ^g  Lg  mg  kn  pq  pv  pv  px  z{  p{  o{  |@  |D  |D  FG  |G  oG  kH  lH  NH  LP  QR  QW  QW  QY  LZ  MZ  4Z  ^_  ^a  ^a  3a  bc   "&7777 3/3#JKKQW%			!Q			!QVVX^$1%)$))TVVdff_gSWS[S[cgcmcmtxt}t}~"4::QT
3JQVVX3UVW3W[_[a[adhdjdj[jmqmvmv[v{  |B  |B  {B  EI  EK  EK  {K  NR  NW  NW  {W  Z^  Z`  Z`  cg  ci  ci  Zi  lp  lu  lu  Zu  {u  y|  ~  ~D  ~D  ~F  HI  ~I  }I  JN  JR  JR  TU  JU  }U  yV  zV  \V  Z^  _c  de  gh  dh  _i  lm  lr  lr  lt  _t  uv  _v  Zw  [w  4w  {|  3|  }A  BC  EF  BF  }G  3G  JK  JM  JM  3M  N"DJJ;ad3Kaffh3VWX3X\`\b\beiekek\knrnwnw\w  }A  }C  }C  |C  FJ  FL  FL  |L  OS  OX  OX  |X  [_  [a  [a  dh  dj  dj  [j  mq  mv  mv  [v  |v  z}  @  E  E  G  IJ  J  ~J  KO  KS  KS  UV  KV  ~V  zW  {W  ]W  [_  `d  ef  hi  ei  `j  mn  ms  ms  mu  `u  vw  `w  [x  \x  4x  |}  3}  ~B  CD  FG  CG  ~H  3H  KL  KN  KN  3N  OP   "&7777r6   c                 j   t        d      }t        d      }t        d      }|j                  d||j                  z        }|j                  |d       |j                  ||j                         |j                  z         t        ||      }t        | j                  d|      }|j                  dk(  sJ y )Nr~   r,   r/  r0  r   )r   r   r   r4  rd   r   r#  r   r   r)  r-   )r3   r~   r,   r/  r0  r.   r6  s          r4   test_normal_force_zeroz1TestCoulombKineticFriction.test_normal_force_zero-  s    33#JKKQW%			!Q			!QVVX^$1%)II

 ~~"""r6   N)rq   rr   rs   rE   rt   r-  r:  r<  r>  r@  rB  rx   r6   r4   r%  r%  Y  s>    V^^D!} "}/8b/8b/8b/8b#r6   r%  )+r   rE   sympyr   r   r   r   r   r   r	   r
   r   sympy.physics.mechanicsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sympy.core.exprr   r@   r   r   r!   rz   r   r   r   r   r  r%  rx   r6   r4   <module>rF     s    C 
 
 
    ( -	8	Z s/ s/lP: P:fN- N-bO9 O9dF/ F/R	 	tX tXlc# c#r6   