
    \h(                     p    S SK JrJrJrJrJrJr  S SKJr  S SK	J
r
  S SKJr  S SKJr  S/r " S S\
5      rg)	    )Body
LagrangianKanesMethodLagrangesMethod	RigidBodyParticle)BodyBase)_Methods)Matrix)sympy_deprecation_warningJointsMethodc                       \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       rS rS rS rS rS rS r\4S jrSS jrSrg)r      a	  Method for formulating the equations of motion using a set of interconnected bodies with joints.

.. deprecated:: 1.13
    The JointsMethod class is deprecated. Its functionality has been
    replaced by the new :class:`~.System` class.

Parameters
==========

newtonion : Body or ReferenceFrame
    The newtonion(inertial) frame.
*joints : Joint
    The joints in the system

Attributes
==========

q, u : iterable
    Iterable of the generalized coordinates and speeds
bodies : iterable
    Iterable of Body objects in the system.
loads : iterable
    Iterable of (Point, vector) or (ReferenceFrame, vector) tuples
    describing the forces on the system.
mass_matrix : Matrix, shape(n, n)
    The system's mass matrix
forcing : Matrix, shape(n, 1)
    The system's forcing vector
mass_matrix_full : Matrix, shape(2*n, 2*n)
    The "mass matrix" for the u's and q's
forcing_full : Matrix, shape(2*n, 1)
    The "forcing vector" for the u's and q's
method : KanesMethod or Lagrange's method
    Method's object.
kdes : iterable
    Iterable of kde in they system.

Examples
========

As Body and JointsMethod have been deprecated, the following examples are
for illustrative purposes only. The functionality of Body is fully captured
by :class:`~.RigidBody` and :class:`~.Particle` and the functionality of
JointsMethod is fully captured by :class:`~.System`. To ignore the
deprecation warning we can use the ignore_warnings context manager.

>>> from sympy.utilities.exceptions import ignore_warnings

This is a simple example for a one degree of freedom translational
spring-mass-damper.

>>> from sympy import symbols
>>> from sympy.physics.mechanics import Body, JointsMethod, PrismaticJoint
>>> from sympy.physics.vector import dynamicsymbols
>>> c, k = symbols('c k')
>>> x, v = dynamicsymbols('x v')
>>> with ignore_warnings(DeprecationWarning):
...     wall = Body('W')
...     body = Body('B')
>>> J = PrismaticJoint('J', wall, body, coordinates=x, speeds=v)
>>> wall.apply_force(c*v*wall.x, reaction_body=body)
>>> wall.apply_force(k*x*wall.x, reaction_body=body)
>>> with ignore_warnings(DeprecationWarning):
...     method = JointsMethod(wall, J)
>>> method.form_eoms()
Matrix([[-B_mass*Derivative(v(t), t) - c*v(t) - k*x(t)]])
>>> M = method.mass_matrix_full
>>> F = method.forcing_full
>>> rhs = M.LUsolve(F)
>>> rhs
Matrix([
[                     v(t)],
[(-c*v(t) - k*x(t))/B_mass]])

Notes
=====

``JointsMethod`` currently only works with systems that do not have any
configuration or motion constraints.

c                 `   [        SSSS9  [        U[        5      (       a  UR                  U l        OXl        X l        U R                  5       U l        U R                  5       U l        U R                  5       U l
        U R                  5       U l        U R                  5       U l        S U l        g )Nz
            The JointsMethod class is deprecated.
            Its functionality has been replaced by the new System class.
            z1.13z!deprecated-mechanics-jointsmethod)deprecated_since_versionactive_deprecations_target)r   
isinstancer	   frame_joints_generate_bodylist_bodies_generate_loadlist_loads_generate_q_q_generate_u_u_generate_kdes_kdes_method)self	newtonionjointss      \/var/www/auris/envauris/lib/python3.13/site-packages/sympy/physics/mechanics/jointsmethod.py__init__JointsMethod.__init__^   s    ! &,'J	
 i**"DJ"J..0--/""$""$((*
    c                     U R                   $ )zList of bodies in they system.)r   r!   s    r$   bodiesJointsMethod.bodiesu        ||r'   c                     U R                   $ )zList of loads on the system.)r   r)   s    r$   loadsJointsMethod.loadsz   s     {{r'   c                     U R                   $ z$List of the generalized coordinates.)r   r)   s    r$   qJointsMethod.q        wwr'   c                     U R                   $ )zList of the generalized speeds.)r   r)   s    r$   uJointsMethod.u   r4   r'   c                     U R                   $ r1   )r   r)   s    r$   kdesJointsMethod.kdes   s     zzr'   c                 .    U R                   R                  $ )z)The "forcing vector" for the u's and q's.)methodforcing_fullr)   s    r$   r=   JointsMethod.forcing_full   s     {{'''r'   c                 .    U R                   R                  $ )z&The "mass matrix" for the u's and q's.)r<   mass_matrix_fullr)   s    r$   r@   JointsMethod.mass_matrix_full   s     {{+++r'   c                 .    U R                   R                  $ )zThe system's mass matrix.)r<   mass_matrixr)   s    r$   rC   JointsMethod.mass_matrix   s     {{&&&r'   c                 .    U R                   R                  $ )zThe system's forcing vector.)r<   forcingr)   s    r$   rF   JointsMethod.forcing   s     {{"""r'   c                     U R                   $ )z3Object of method used to form equations of systems.)r    r)   s    r$   r<   JointsMethod.method   r,   r'   c                     / nU R                    H[  nUR                  U;  a  UR                  UR                  5        UR                  U;  d  M@  UR                  UR                  5        M]     U$ N)r   childappendparent)r!   r*   joints      r$   r   JointsMethod._generate_bodylist   sT    \\E{{&(ekk*||6)ell+	 "
 r'   c                     / nU R                    H5  n[        U[        5      (       d  M  UR                  UR                  5        M7     U$ rK   )r*   r   r   extendr.   )r!   	load_listbodys      r$   r   JointsMethod._generate_loadlist   s<    	KKD$%%  ,   r'   c                     / nU R                    H7  nUR                   H$  nX1;   a  [        S5      eUR                  U5        M&     M9     [	        U5      $ )Nz'Coordinates of joints should be unique.)r   coordinates
ValueErrorrM   r   )r!   q_indrO   
coordinates       r$   r   JointsMethod._generate_q   sO    \\E#//
&$%NOOZ( 0 "
 e}r'   c                     / nU R                    H7  nUR                   H$  nX1;   a  [        S5      eUR                  U5        M&     M9     [	        U5      $ )Nz"Speeds of joints should be unique.)r   speedsrX   rM   r   )r!   u_indrO   speeds       r$   r   JointsMethod._generate_u   sL    \\E>$%IJJU# & "
 e}r'   c                     [        SS/ 5      R                  nU R                   H  nUR                  UR                  5      nM      U$ )N   r   )r   Tr   col_joinr9   )r!   kd_indrO   s      r$   r   JointsMethod._generate_kdes   s;    1b!##\\E__UZZ0F "r'   c           	         / nU R                    H  n[        U[        5      (       d  UR                  U5        M+  UR                  (       aq  [        UR                  UR                  UR                  UR                  UR                  UR                  45      nUR                  Ul        UR                  U5        M  [        UR                  UR                  UR                  5      nUR                  Ul        UR                  U5        M     U$ rK   )r*   r   r   rM   is_rigidbodyr   name
masscenterr   masscentral_inertiapotential_energyr   )r!   bodylistrT   rbparts        r$   _convert_bodiesJointsMethod._convert_bodies   s    KKDdD))%  tyy$//4::tyy))4??;=&*&;&;##		4??DIIF(,(=(=%%   r'   c           	         U R                  5       n[        U[        5      (       aD  [        U R                  /UQ76 nU" X0R
                  U R                  X R                  5      U l        OBU" U R                  U R
                  U R                  U R                  U R                  US9U l        U R                  R                  5       nU$ )aB  Method to form system's equation of motions.

Parameters
==========

method : Class
    Class name of method.

Returns
========

Matrix
    Vector of equations of motions.

Examples
========

As Body and JointsMethod have been deprecated, the following examples
are for illustrative purposes only. The functionality of Body is fully
captured by :class:`~.RigidBody` and :class:`~.Particle` and the
functionality of JointsMethod is fully captured by :class:`~.System`. To
ignore the deprecation warning we can use the ignore_warnings context
manager.

>>> from sympy.utilities.exceptions import ignore_warnings

This is a simple example for a one degree of freedom translational
spring-mass-damper.

>>> from sympy import S, symbols
>>> from sympy.physics.mechanics import LagrangesMethod, dynamicsymbols, Body
>>> from sympy.physics.mechanics import PrismaticJoint, JointsMethod
>>> q = dynamicsymbols('q')
>>> qd = dynamicsymbols('q', 1)
>>> m, k, b = symbols('m k b')
>>> with ignore_warnings(DeprecationWarning):
...     wall = Body('W')
...     part = Body('P', mass=m)
>>> part.potential_energy = k * q**2 / S(2)
>>> J = PrismaticJoint('J', wall, part, coordinates=q, speeds=qd)
>>> wall.apply_force(b * qd * wall.x, reaction_body=part)
>>> with ignore_warnings(DeprecationWarning):
...     method = JointsMethod(wall, J)
>>> method.form_eoms(LagrangesMethod)
Matrix([[b*Derivative(q(t), t) + k*q(t) + m*Derivative(q(t), (t, 2))]])

We can also solve for the states using the 'rhs' method.

>>> method.rhs()
Matrix([
[                Derivative(q(t), t)],
[(-b*Derivative(q(t), t) - k*q(t))/m]])

)rY   r^   kd_eqs	forcelistr*   )rq   
issubclassr   r   r   r2   r.   r    r6   r9   r<   
_form_eoms)r!   r<   rn   Lsolns        r$   	form_eomsJointsMethod.form_eoms   s    p '')fo..4::11A!!VVTZZ::NDL!$**DFF$&&QUQZQZ.2jjKDL{{%%'r'   Nc                 4    U R                   R                  US9$ )a  Returns equations that can be solved numerically.

Parameters
==========

inv_method : str
    The specific sympy inverse matrix calculation method to use. For a
    list of valid methods, see
    :meth:`~sympy.matrices.matrixbase.MatrixBase.inv`

Returns
========

Matrix
    Numerically solvable equations.

See Also
========

sympy.physics.mechanics.kane.KanesMethod.rhs:
    KanesMethod's rhs function.
sympy.physics.mechanics.lagrange.LagrangesMethod.rhs:
    LagrangesMethod's rhs function.

)
inv_method)r<   rhs)r!   r}   s     r$   r~   JointsMethod.rhs#  s    6 {{*55r'   )r   r   r   r   r    r   r   r   rK   )__name__
__module____qualname____firstlineno____doc__r%   propertyr*   r.   r2   r6   r9   r=   r@   rC   rF   r<   r   r   r   r   r   rq   r   rz   r~   __static_attributes__ r'   r$   r   r      s   Pd.           ( ( , , ' ' # #  $  + @D6r'   N)sympy.physics.mechanicsr   r   r   r   r   r   !sympy.physics.mechanics.body_baser	   sympy.physics.mechanics.methodr
   sympyr   sympy.utilities.exceptionsr   __all__r   r   r'   r$   <module>r      s1   9 9 6 3  @
s68 s6r'   