K iYPRddlmZmZddlmZddlmZddlmZdgZ GddZ y) )Vector _check_vector) _check_frame)warn) filldedentPointcteZdZdZdZdZeZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZy)r adThis object represents a point in a dynamic system. It stores the: position, velocity, and acceleration of a point. The position is a vector defined as the vector distance from a parent point to this point. Parameters ========== name : string The display name of the Point Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> N = ReferenceFrame('N') >>> O = Point('O') >>> P = Point('P') >>> u1, u2, u3 = dynamicsymbols('u1 u2 u3') >>> O.set_vel(N, u1 * N.x + u2 * N.y + u3 * N.z) >>> O.acc(N) u1'*N.x + u2'*N.y + u3'*N.z ``symbols()`` can be used to create multiple Points in a single step, for example: >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> from sympy import symbols >>> N = ReferenceFrame('N') >>> u1, u2 = dynamicsymbols('u1 u2') >>> A, B = symbols('A B', cls=Point) >>> type(A) >>> A.set_vel(N, u1 * N.x + u2 * N.y) >>> B.set_vel(N, u2 * N.x + u1 * N.y) >>> A.acc(N) - B.acc(N) (u1' - u2')*N.x + (-u1' + u2')*N.y c||_i|_i|_i|_|j|j|jg|_y)z"Initialization of a Point object. N)name _pos_dict _vel_dict _acc_dict_pdlist)selfr s `/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/physics/vector/point.py__init__zPoint.__init__7s8 G c|jS)N)r )rs r__str__z Point.__str__?s yyrc:t|ts tdy)NzA Point must be supplied) isinstancer TypeError)rothers r _check_pointzPoint._check_pointDs%'67 7(rc|gg}gg}||k7r|j}|D]d}|dj|j}|D]=}|j|r||gz}|j|r-|j |?f||k7r|D]}|d|k7s |j ||j tt|dk7r|dStd|jzdz|jz)aMReturns a list of points that gives the shortest path with respect to position, velocity, or acceleration from this point to the provided point. Parameters ========== other : Point A point that may be related to this point by position, velocity, or acceleration. num : integer 0 for searching the position tree, 1 for searching the velocity tree, and 2 for searching the acceleration tree. Returns ======= list of Points A sequence of points from self to other. Notes ===== It is not clear if num = 1 or num = 2 actually works because the keys to ``_vel_dict`` and ``_acc_dict`` are :class:`ReferenceFrame` objects which do not have the ``_pdlist`` attribute. )keyrz!No Connecting Path found between z and ) copyrkeys __contains__appendremovesortlen ValueErrorr ) rrnumoutlistoldlistvtemplistv2littletemplists r _pdict_listzPoint._pdict_listHs66($ llnG ;R5==-224";B>>"-)*bT&33NC#NN>: ; ;  "Au~q! "    w<1 1: >> from sympy.physics.vector import Point, ReferenceFrame >>> from sympy.physics.vector import dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> q = dynamicsymbols('q') >>> q2 = dynamicsymbols('q2') >>> qd = dynamicsymbols('q', 1) >>> q2d = dynamicsymbols('q2', 1) >>> N = ReferenceFrame('N') >>> B = ReferenceFrame('B') >>> B.set_ang_vel(N, 5 * B.y) >>> O = Point('O') >>> P = O.locatenew('P', q * B.x + q2 * B.y) >>> P.set_vel(B, qd * B.x + q2d * B.y) >>> O.set_vel(N, 0) >>> P.a1pt_theory(O, N, B) (-25*q + q'')*B.x + q2''*B.y - 10*q'*B.z ) rrpos_fromvelacc ang_vel_in ang_acc_inset_acccross) r otherpointoutframe interframedistr*a1a2omegaalphas r a1pt_theoryzPoint.a1pt_theorywsX XZ  *%}}Z( HHZ  ^^H % XXj !%%h/%%h/ XrAQ$882=kk$' ),1KK D8I,J L Mxx!!rc t|t||j||j|}|j|}|j |}|j |}|j |||j|z|j|j|z|j|S)aSets the acceleration of this point with the 2-point theory. The 2-point theory for point acceleration looks like this: ^N a^P = ^N a^O + ^N alpha^B x r^OP + ^N omega^B x (^N omega^B x r^OP) where O and P are both points fixed in frame B, which is rotating in frame N. Parameters ========== otherpoint : Point The first point of the 2-point theory (O) outframe : ReferenceFrame The frame we want this point's acceleration defined in (N) fixedframe : ReferenceFrame The frame in which both points are fixed (B) Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> q = dynamicsymbols('q') >>> qd = dynamicsymbols('q', 1) >>> N = ReferenceFrame('N') >>> B = N.orientnew('B', 'Axis', [q, N.z]) >>> O = Point('O') >>> P = O.locatenew('P', 10 * B.x) >>> O.set_vel(N, 5 * N.x) >>> P.a2pt_theory(O, N, B) - 10*q'**2*B.x + 10*q''*B.y )rrr1r3r4r5r6r7)rr8r9 fixedframer;ar>r?s r a2pt_theoryzPoint.a2pt_theorysL XZ  *%}}Z( NN8 $%%h/%%h/ XqEKK$56kk%++d"34 6 7xx!!rct|||jvr=|j|dk7r|j|j |St dS|j|S)aThe acceleration Vector of this Point in a ReferenceFrame. Parameters ========== frame : ReferenceFrame The frame in which the returned acceleration vector will be defined in. Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p1.set_acc(N, 10 * N.x) >>> p1.acc(N) 10*N.x r)rrr2rdtr)rframes rr3z Point.accs[, U'xx!#u-11%88ay ~~e$$rct|ts td|dk(r td}t |}t |}|j |||j || |S)aCreates a new point with a position defined from this point. Parameters ========== name : str The name for the new point value : Vector The position of the new point relative to this point Examples ======== >>> from sympy.physics.vector import ReferenceFrame, Point >>> N = ReferenceFrame('N') >>> P1 = Point('P1') >>> P2 = P1.locatenew('P2', 10 * N.x) zMust supply a valid namer)rstrrrrr set_pos)rr valueps r locatenewzPoint.locatenews`*$$67 7 A:1IEe$ $K $ Qrctd}|j|d}tt|dz D]}|||j||dzz }|S)aReturns a Vector distance between this Point and the other Point. Parameters ========== otherpoint : Point The otherpoint we are locating this one relative to Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p2 = Point('p2') >>> p1.set_pos(p2, 10 * N.x) >>> p1.pos_from(p2) 10*N.x rr)rr.ranger%r )rr8outvecplistis rr1zPoint.pos_fromsa,  Q/s5zA~& 7A eAh((q1u6 6F 7 rc|dk(r td}t|}t||jj ||iy)a#Used to set the acceleration of this Point in a ReferenceFrame. Parameters ========== frame : ReferenceFrame The frame in which this point's acceleration is defined value : Vector The vector value of this point's acceleration in the frame Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p1.set_acc(N, 10 * N.x) >>> p1.acc(N) 10*N.x rN)rrrrupdaterrGrKs rr6z Point.set_acc:<. A:1IEe$U uen-rc|dk(r td}t|}|j||jj ||i|jj || iy)aDUsed to set the position of this point w.r.t. another point. Parameters ========== otherpoint : Point The other point which this point's location is defined relative to value : Vector The vector which defines the location of this point Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p2 = Point('p2') >>> p1.set_pos(p2, 10 * N.x) >>> p1.pos_from(p2) 10*N.x rN)rrrr rT)rr8rKs rrJz Point.set_posWs]0 A:1IEe$ *% z512##TE6N3rc|dk(r td}t|}t||jj ||iy)aSets the velocity Vector of this Point in a ReferenceFrame. Parameters ========== frame : ReferenceFrame The frame in which this point's velocity is defined value : Vector The vector value of this point's velocity in the frame Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p1.set_vel(N, 10 * N.x) >>> p1.vel(N) 10*N.x rN)rrrrrTrUs rset_velz Point.set_velvrVrcHt|t||j||j|}|j|}|j|}|j |}|j |||z|j |z|j|S)aVSets the velocity of this point with the 1-point theory. The 1-point theory for point velocity looks like this: ^N v^P = ^B v^P + ^N v^O + ^N omega^B x r^OP where O is a point fixed in B, P is a point moving in B, and B is rotating in frame N. Parameters ========== otherpoint : Point The first point of the 1-point theory (O) outframe : ReferenceFrame The frame we want this point's velocity defined in (N) interframe : ReferenceFrame The intermediate frame in this calculation (B) Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame >>> from sympy.physics.vector import dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> q = dynamicsymbols('q') >>> q2 = dynamicsymbols('q2') >>> qd = dynamicsymbols('q', 1) >>> q2d = dynamicsymbols('q2', 1) >>> N = ReferenceFrame('N') >>> B = ReferenceFrame('B') >>> B.set_ang_vel(N, 5 * B.y) >>> O = Point('O') >>> P = O.locatenew('P', q * B.x + q2 * B.y) >>> P.set_vel(B, qd * B.x + q2d * B.y) >>> O.set_vel(N, 0) >>> P.v1pt_theory(O, N, B) q'*B.x + q2'*B.y - 5*q*B.z rrr1r2r4rYr7)rr8r9r:r;v1r,r>s r v1pt_theoryzPoint.v1pt_theorysV XZ  *%}}Z( XXj ! ^^H %%%h/ XrBw%++d*;<=xx!!rc t|t||j||j|}|j|}|j |}|j |||j |z|j|S)asSets the velocity of this point with the 2-point theory. The 2-point theory for point velocity looks like this: ^N v^P = ^N v^O + ^N omega^B x r^OP where O and P are both points fixed in frame B, which is rotating in frame N. Parameters ========== otherpoint : Point The first point of the 2-point theory (O) outframe : ReferenceFrame The frame we want this point's velocity defined in (N) fixedframe : ReferenceFrame The frame in which both points are fixed (B) Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols >>> from sympy.physics.vector import init_vprinting >>> init_vprinting(pretty_print=False) >>> q = dynamicsymbols('q') >>> qd = dynamicsymbols('q', 1) >>> N = ReferenceFrame('N') >>> B = N.orientnew('B', 'Axis', [q, N.z]) >>> O = Point('O') >>> P = O.locatenew('P', 10 * B.x) >>> O.set_vel(N, 5 * N.x) >>> P.v2pt_theory(O, N, B) 5*N.x + 10*q'*B.y r[)rr8r9rBr;r*r>s r v2pt_theoryzPoint.v2pt_theoryszL XZ  *%}}Z( NN8 $%%h/ XqEKK$567xx!!rct|||jvrsd}d}g}|g}g}|r|jd}||vr|j||jj D]{\}} ||vr | j |||vrd} |j|} |j||rG|j||j|j|| zd}}|r|rttdt|dkDrAttd|jd|djdt!|dd d |r|j|Sttd |jd |jd |j|S#t$rYAwxYw#t$r|j|YbwxYw)aThe velocity Vector of this Point in the ReferenceFrame. Parameters ========== frame : ReferenceFrame The frame in which the returned velocity vector will be defined in Examples ======== >>> from sympy.physics.vector import Point, ReferenceFrame, dynamicsymbols >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p1.set_vel(N, 10 * N.x) >>> p1.vel(N) 10*N.x Velocities will be automatically calculated if possible, otherwise a ``ValueError`` will be returned. If it is possible to calculate multiple different velocities from the relative points, the points defined most directly relative to this point will be used. In the case of inconsistent relative positions of points, incorrect velocities may be returned. It is up to the user to define prior relative positions and velocities of points in a self-consistent way. >>> p = Point('p') >>> q = dynamicsymbols('q') >>> p.set_vel(N, 10 * N.x) >>> p2 = Point('p2') >>> p2.set_pos(p, q*N.x) >>> p2.vel(N) (Derivative(q(t), t) + 10)*N.x FrTz Kinematic loops are defined among the positions of points. This is likely not desired and may cause errors in your calculations. rz Velocity of z9 automatically calculated based on point z9 but it is also possible from points(s): Nz. Velocities from these points are not necessarily the same. This may cause errors in your calculations.z# Velocity of point z8 has not been defined in ReferenceFrame .)rrpopr"r itemsexpressr&KeyErrorrYr1rFrrr%r rI) rrGvalid_neighbor_found is_cyclicvisitedqueuecandidate_neighbornodeneighbor neighbor_posneighbor_velocitys rr2z Point.velsJ U'#( IGFE!# yy|w&NN4(26..2F2F2H8.,#w.$%(007$u,(,I%080B0B50I-+11(;3 LL h0G0J0J50QTe0ef370'8 0Z!%&*Z%!YYK(#A&++,- 212 6789#!&'( $~~e,, 1##'99+. % |1-0"122~~e$$C *%$% (%!LL2$%s$4F F- F*)F*-G  G cddlm}|j|}||g||d}t|dk(r|dSt |S)aReturns the partial velocities of the linear velocity vector of this point in the given frame with respect to one or more provided generalized speeds. Parameters ========== frame : ReferenceFrame The frame with which the velocity is defined in. gen_speeds : functions of time The generalized speeds. Returns ======= partial_velocities : tuple of Vector The partial velocity vectors corresponding to the provided generalized speeds. Examples ======== >>> from sympy.physics.vector import ReferenceFrame, Point >>> from sympy.physics.vector import dynamicsymbols >>> N = ReferenceFrame('N') >>> A = ReferenceFrame('A') >>> p = Point('p') >>> u1, u2 = dynamicsymbols('u1, u2') >>> p.set_vel(N, u1 * N.x + u2 * A.y) >>> p.partial_velocity(N, u1) N.x >>> p.partial_velocity(N, u1, u2) (N.x, A.y) r)partial_velocityr)sympy.physics.vector.functionsrpr2r%tuple)rrG gen_speedsrpr2partialss rrpzPoint.partial_velocityPsKF Dhhuo#SE:u=a@ x=A A; ? "rN)__name__ __module__ __qualname____doc__rr__repr__rr.r@rDr3rMr1r6rJrYr]r_r2rprrr r sg+ZHH8-.^7"r/"b%<>8.:4>.:3"j-"^W%r+#rN) vectorrrrGrwarningsrsympy.utilities.miscr__all__r rzrrrs$)+ )r #r #r