K i ddlmZddlmZddlmZddlmZmZm Z gdZ Gddeeddd gZ Gd d e Z Gd d e Z dZdZy))ABC) namedtuple)BodyBase)VectorReferenceFramePoint)LoadBaseForceTorquec$eZdZdZdZdZeZeZy)r z2Abstract base class for the various loading types.cvtd|jjd|jjd)Nz$unsupported operand type(s) for +: '' and '' TypeError __class____name__selfothers c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/physics/mechanics/loads.py__add__zLoadBase.__add__ @ NN3345!OO445Q89 9cvtd|jjd|jjd)Nz$unsupported operand type(s) for *: 'rrrrs r__mul__zLoadBase.__mul__rrN)r __module__ __qualname____doc__rr__radd____rmul__rrr r s<9 9 HHrr locationvectorcHeZdZdZfdZdZedZedZxZ S)r a+Force acting upon a point. Explanation =========== A force is a vector that is bound to a line of action. This class stores both a point, which lies on the line of action, and the vector. A tuple can also be used, with the location as the first entry and the vector as second entry. Examples ======== A force of magnitude 2 along N.x acting on a point Po can be created as follows: >>> from sympy.physics.mechanics import Point, ReferenceFrame, Force >>> N = ReferenceFrame('N') >>> Po = Point('Po') >>> Force(Po, 2 * N.x) (Po, 2*N.x) If a body is supplied, then the center of mass of that body is used. >>> from sympy.physics.mechanics import Particle >>> P = Particle('P', point=Po) >>> Force(P, 2 * N.x) (Po, 2*N.x) ct|tr |j}t|ts t dt|t s t dt ||||S)Nz!Force location should be a Point.z Force vector should be a Vector.) isinstancer masscenterrrrsuper__new__)clspointforcers rr*z Force.__new__:sW eX &$$E%'?@ @%(>? ?wsE511rch|jjd|jd|jdS)Nz(point=z, force=))rrr,r-rs r__repr__zForce.__repr__Cs6>>**+74::,? A' (rc|jSNr#r0s rr,z Force.pointG }}rc|jSr3r$r0s rr-z Force.forceK {{r) rrrrr*r1propertyr,r- __classcell__rs@rr r s:>2(rr cHeZdZdZfdZdZedZedZxZ S)r aTorque acting upon a frame. Explanation =========== A torque is a free vector that is acting on a reference frame, which is associated with a rigid body. This class stores both the frame and the vector. A tuple can also be used, with the location as the first item and the vector as second item. Examples ======== A torque of magnitude 2 about N.x acting on a frame N can be created as follows: >>> from sympy.physics.mechanics import ReferenceFrame, Torque >>> N = ReferenceFrame('N') >>> Torque(N, 2 * N.x) (N, 2*N.x) If a body is supplied, then the frame fixed to that body is used. >>> from sympy.physics.mechanics import RigidBody >>> rb = RigidBody('rb', frame=N) >>> Torque(rb, 2 * N.x) (N, 2*N.x) ct|tr |j}t|ts t dt|t s t dt ||||S)Nz+Torque location should be a ReferenceFrame.z!Torque vector should be a Vector.)r'rframerrrr)r*)r+r>torquers rr*zTorque.__new__osU eX &KKE%0IJ J&&)?@ @wsE622rch|jjd|jd|jdS)Nz(frame=z , torque=r/)rrr>r?r0s rr1zTorque.__repr__xs6>>**+74::,?++a) *rc|jSr3r4r0s rr>z Torque.frame|r5rc|jSr3r7r0s rr?z Torque.torquer8r) rrrrr*r1r9r>r?r:r;s@rr r Ps:<3*rr cg}|D][}t|tstt|d|j t |j |j|z]|S)a Returns a list of gravity forces given the acceleration due to gravity and any number of particles or rigidbodies. Example ======= >>> from sympy.physics.mechanics import ReferenceFrame, Particle, RigidBody >>> from sympy.physics.mechanics.loads import gravity >>> from sympy import symbols >>> N = ReferenceFrame('N') >>> g = symbols('g') >>> P = Particle('P') >>> B = RigidBody('B') >>> gravity(g*N.y, P, B) [(P_masscenter, P_mass*g*N.y), (B_masscenter, B_mass*g*N.y)] z is not a body type)r'rrtypeappendr r(mass) accelerationbodies gravity_forcebodys rgravityrKse*MO$)tDzl*=>? ?U4??DII 4LMNO rcht|tr|St|tryt|dk7rt d|dt|dt rt |d|dSt|dtrt|d|dSt d|ddtdt|d ) zBHelper function to parse loads and convert tuples to load objects.zLoad z should have a length of 2.rz'Load not recognized. The load location z. should either be a Point or a ReferenceFrame.z Load type zA not recognized as a load. It should be a Force, Torque or tuple.) r'r tuplelen ValueErrorrr rr rrD)loads r _parse_loadrSs$! D% t9>uTF*EFG G d1gu %a$q'* * Q 0$q'47+ +FtAwiMOP P jd -:; <rYsW"6>> )sJzJ+AB"3H3l2X2j: