§
    OŠtj¯(  ã                   óx   — d dl mZmZmZmZmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ dgZ G d„ de
¦  «        ZdS )	é    )ÚBodyÚ
LagrangianÚKanesMethodÚLagrangesMethodÚ	RigidBodyÚParticle)ÚBodyBase)Ú_Methods)ÚMatrix)Úsympy_deprecation_warningÚJointsMethodc                   ó*  — e Zd ZdZd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	ed„ ¦   «         Z
ed„ ¦   «         Zed	„ ¦   «         Zed
„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zefd„Zdd„ZdS )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                 ó’  — t          ddd¬¦  «         t          |t          ¦  «        r|j        | _        n|| _        || _        |                      ¦   «         | _        |                      ¦   «         | _        |  	                    ¦   «         | _
        |                      ¦   «         | _        |                      ¦   «         | _        d | _        d S )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      úb/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/physics/mechanics/jointsmethod.pyÚ__init__zJointsMethod.__init__^   s½   € Ý!ðð &,Ø'Jð	
ñ 	
ô 	
ð 	
õ �i¥Ñ*Ô*ð 	#Ø"œˆDŒJˆJà"ˆDŒJàˆŒØ×.Ò.Ñ0Ô0ˆŒØ×-Ò-Ñ/Ô/ˆŒØ×"Ò"Ñ$Ô$ˆŒØ×"Ò"Ñ$Ô$ˆŒØ×(Ò(Ñ*Ô*ˆŒ
àˆŒˆˆó    c                 ó   — | j         S )zList of bodies in they system.)r   ©r    s    r#   ÚbodieszJointsMethod.bodiesu   ó   € ð Œ|Ðr%   c                 ó   — | j         S )zList of loads on the system.)r   r'   s    r#   ÚloadszJointsMethod.loadsz   s   € ð Œ{Ðr%   c                 ó   — | j         S ©z$List of the generalized coordinates.)r   r'   s    r#   ÚqzJointsMethod.q   ó   € ð Œwˆr%   c                 ó   — | j         S )zList of the generalized speeds.)r   r'   s    r#   ÚuzJointsMethod.u„   r/   r%   c                 ó   — | j         S r-   )r   r'   s    r#   ÚkdeszJointsMethod.kdes‰   s   € ð ŒzÐr%   c                 ó   — | j         j        S )z)The "forcing vector" for the u's and q's.)ÚmethodÚforcing_fullr'   s    r#   r6   zJointsMethod.forcing_fullŽ   s   € ð Œ{Ô'Ð'r%   c                 ó   — | j         j        S )z&The "mass matrix" for the u's and q's.)r5   Úmass_matrix_fullr'   s    r#   r8   zJointsMethod.mass_matrix_full“   s   € ð Œ{Ô+Ð+r%   c                 ó   — | j         j        S )zThe system's mass matrix.)r5   Úmass_matrixr'   s    r#   r:   zJointsMethod.mass_matrix˜   s   € ð Œ{Ô&Ð&r%   c                 ó   — | j         j        S )zThe system's forcing vector.)r5   Úforcingr'   s    r#   r<   zJointsMethod.forcing�   s   € ð Œ{Ô"Ð"r%   c                 ó   — | j         S )z3Object of method used to form equations of systems.)r   r'   s    r#   r5   zJointsMethod.method¢   r)   r%   c                 óª   — g }| j         D ]H}|j        |vr|                     |j        ¦  «         |j        |vr|                     |j        ¦  «         ŒI|S ©N)r   ÚchildÚappendÚparent)r    r(   Újoints      r#   r   zJointsMethod._generate_bodylist§   s`   € ØˆØ”\ð 	,ð 	,ˆEØŒ{ &Ð(Ð(Ø—’˜eœkÑ*Ô*Ð*ØŒ| 6Ð)Ð)Ø—’˜eœlÑ+Ô+Ð+øØˆr%   c                 ó|   — g }| j         D ]1}t          |t          ¦  «        r|                     |j        ¦  «         Œ2|S r?   )r(   r   r   Úextendr+   )r    Ú	load_listÚbodys      r#   r   zJointsMethod._generate_loadlist°   sG   € Øˆ	Ø”Kð 	-ð 	-ˆDÝ˜$¥Ñ%Ô%ð -Ø× Ò  ¤Ñ,Ô,Ð,øØÐr%   c                 óœ   — g }| j         D ]4}|j        D ]*}||v rt          d¦  «        ‚|                     |¦  «         Œ+Œ5t	          |¦  «        S )Nz'Coordinates of joints should be unique.)r   ÚcoordinatesÚ
ValueErrorrA   r   )r    Úq_indrC   Ú
coordinates       r#   r   zJointsMethod._generate_q·   sl   € ØˆØ”\ð 	)ð 	)ˆEØ#Ô/ð )ð )�
Ø Ð&Ð&Ý$Ð%NÑOÔOÐOØ—’˜ZÑ(Ô(Ð(Ð(ð)õ �e‰}Œ}Ðr%   c                 óœ   — g }| j         D ]4}|j        D ]*}||v rt          d¦  «        ‚|                     |¦  «         Œ+Œ5t	          |¦  «        S )Nz"Speeds of joints should be unique.)r   ÚspeedsrJ   rA   r   )r    Úu_indrC   Úspeeds       r#   r   zJointsMethod._generate_uÀ   si   € ØˆØ”\ð 	$ð 	$ˆEØœð $ð $�Ø˜E�>�>Ý$Ð%IÑJÔJÐJØ—’˜UÑ#Ô#Ð#Ð#ð$õ �e‰}Œ}Ðr%   c                 óz   — t          ddg ¦  «        j        }| j        D ]}|                     |j        ¦  «        }Œ|S )Né   r   )r   ÚTr   Úcol_joinr3   )r    Úkd_indrC   s      r#   r   zJointsMethod._generate_kdesÉ   sA   € Ý˜˜1˜bÑ!Ô!Ô#ˆØ”\ð 	1ð 	1ˆEØ—_’_ U¤ZÑ0Ô0ˆFˆFØˆr%   c           	      ó®  — g }| j         D ]Ê}t          |t          ¦  «        s|                     |¦  «         Œ-|j        rUt          |j        |j        |j        |j	        |j
        |j        f¦  «        }|j        |_        |                     |¦  «         Œ‰t          |j        |j        |j	        ¦  «        }|j        |_        |                     |¦  «         ŒË|S r?   )r(   r   r   rA   Úis_rigidbodyr   ÚnameÚ
masscenterr   ÚmassÚcentral_inertiaÚpotential_energyr   )r    ÚbodylistrG   ÚrbÚparts        r#   Ú_convert_bodieszJointsMethod._convert_bodiesÏ   sÒ   € àˆØ”Kð 	&ð 	&ˆDÝ˜d¥DÑ)Ô)ð Ø—’ Ñ%Ô%Ð%ØØÔ ð &Ý˜tœy¨$¬/¸4¼:ÀtÄyØÔ)¨4¬?Ð;ñ=ô =�à&*Ô&;�Ô#Ø—’ Ñ#Ô#Ð#Ð#å ¤	¨4¬?¸D¼IÑFÔF�Ø(,Ô(=�Ô%Ø—’ Ñ%Ô%Ð%Ð%Øˆr%   c                 óT  — |                       ¦   «         }t          |t          ¦  «        r6t          | j        g|¢R Ž } ||| j        | j        || j        ¦  «        | _        n/ || j        | j        | j        | j	        | j        |¬¦  «        | _        | j
                             ¦   «         }|S )aŠ  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]])

        )rK   rO   Úkd_eqsÚ	forcelistr(   )r`   Ú
issubclassr   r   r   r.   r+   r   r1   r3   r5   Ú
_form_eoms)r    r5   r]   ÚLÚsolns        r#   Ú	form_eomszJointsMethod.form_eomsá   s­   € ðp ×'Ò'Ñ)Ô)ˆÝ�f�oÑ.Ô.ð 	KÝ˜4œ:Ð1¨Ð1Ð1Ð1ˆAØ!˜6 ! T¤V¨T¬Z¸À4Ä:ÑNÔNˆDŒLˆLà!˜6 $¤*°D´FÀ$Ä&ÐQUÔQZØ.2¬jÀðKñ Kô KˆDŒLàŒ{×%Ò%Ñ'Ô'ˆØˆr%   Nc                 ó8   — | j                              |¬¦  «        S )az  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)r5   Úrhs)r    rj   s     r#   rk   zJointsMethod.rhs#  s   € ð6 Œ{�Š¨*ˆÑ5Ô5Ð5r%   r?   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r$   Úpropertyr(   r+   r.   r1   r3   r6   r8   r:   r<   r5   r   r   r   r   r   r`   r   rh   rk   © r%   r#   r   r      sÊ  € € € € € ðPð Pðdð ð ð. ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð(ð (ñ „Xð(ð ð,ð ,ñ „Xð,ð ð'ð 'ñ „Xð'ð ð#ð #ñ „Xð#ð ðð ñ „Xððð ð ðð ð ðð ð ðð ð ðð ð ðð ð ð$  +ð @ð @ð @ð @ðD6ð 6ð 6ð 6ð 6ð 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   rq   r%   r#   ú<module>rx      sã   ðð9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9ð 9à 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø Ð Ð Ð Ð Ð Ø @Ð @Ð @Ð @Ð @Ð @àÐ
€ðs6ð s6ð s6ð s6ð s6�8ñ s6ô s6ð s6ð s6ð s6r%   