Kinematics (Docstrings)¶
Point¶
-
class
sympy.physics.vector.point.
Point
(name)[source]¶ This 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.
-
a1pt_theory
(otherpoint, outframe, interframe)[source]¶ Sets the acceleration of this point with the 1-point theory.
The 1-point theory for point acceleration looks like this:
^N a^P = ^B a^P + ^N a^O + ^N alpha^B x r^OP + ^N omega^B x (^N omega^B x r^OP) + 2 ^N omega^B x ^B v^P
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 acceleration defined in (N)
fixedframe : ReferenceFrame
The intermediate frame in this calculation (B)
Examples
>>> from sympy.physics.vector import Point, ReferenceFrame >>> from sympy.physics.vector import Vector, dynamicsymbols >>> 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) >>> 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
-
a2pt_theory
(otherpoint, outframe, fixedframe)[source]¶ Sets 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 >>> 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
-
acc
(frame)[source]¶ The 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
-
locatenew
(name, value)[source]¶ Creates 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)
-
partial_velocity
(frame, *gen_speeds)[source]¶ Returns 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)
-
pos_from
(otherpoint)[source]¶ Returns 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
-
set_acc
(frame, value)[source]¶ Used to set the acceleration of this Point in a ReferenceFrame.
Parameters: value : Vector
The vector value of this point’s acceleration in the frame
frame : ReferenceFrame
The frame in which this point’s acceleration is defined
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
-
set_pos
(otherpoint, value)[source]¶ Used to set the position of this point w.r.t. another point.
Parameters: value : Vector
The vector which defines the location of this point
point : Point
The other point which this point’s location is defined 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
-
set_vel
(frame, value)[source]¶ Sets the velocity Vector of this Point in a ReferenceFrame.
Parameters: value : Vector
The vector value of this point’s velocity in the frame
frame : ReferenceFrame
The frame in which this point’s velocity is defined
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
-
v1pt_theory
(otherpoint, outframe, interframe)[source]¶ Sets 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 2-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 Vector, dynamicsymbols >>> 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) >>> 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
-
v2pt_theory
(otherpoint, outframe, fixedframe)[source]¶ Sets 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 >>> 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
-
vel
(frame)[source]¶ The 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 >>> N = ReferenceFrame('N') >>> p1 = Point('p1') >>> p1.set_vel(N, 10 * N.x) >>> p1.vel(N) 10*N.x
-
kinematic_equations¶
-
sympy.physics.vector.functions.
kinematic_equations
(speeds, coords, rot_type, rot_order='')[source]¶ Gives equations relating the qdot’s to u’s for a rotation type.
Supply rotation type and order as in orient. Speeds are assumed to be body-fixed; if we are defining the orientation of B in A using by rot_type, the angular velocity of B in A is assumed to be in the form: speed[0]*B.x + speed[1]*B.y + speed[2]*B.z
Parameters: speeds : list of length 3
The body fixed angular velocity measure numbers.
coords : list of length 3 or 4
The coordinates used to define the orientation of the two frames.
rot_type : str
The type of rotation used to create the equations. Body, Space, or Quaternion only
rot_order : str
If applicable, the order of a series of rotations.
Examples
>>> from sympy.physics.vector import dynamicsymbols >>> from sympy.physics.vector import kinematic_equations, vprint >>> u1, u2, u3 = dynamicsymbols('u1 u2 u3') >>> q1, q2, q3 = dynamicsymbols('q1 q2 q3') >>> vprint(kinematic_equations([u1,u2,u3], [q1,q2,q3], 'body', '313'), ... order=None) [-(u1*sin(q3) + u2*cos(q3))/sin(q2) + q1', -u1*cos(q3) + u2*sin(q3) + q2', (u1*sin(q3) + u2*cos(q3))*cos(q2)/sin(q2) - u3 + q3']
-
sympy.physics.vector.functions.
partial_velocity
(vel_vecs, gen_speeds, frame)[source]¶ Returns a list of partial velocities with respect to the provided generalized speeds in the given reference frame for each of the supplied velocity vectors.
The output is a list of lists. The outer list has a number of elements equal to the number of supplied velocity vectors. The inner lists are, for each velocity vector, the partial derivatives of that velocity vector with respect to the generalized speeds supplied.
Parameters: vel_vecs : iterable
An iterable of velocity vectors (angular or linear).
gen_speeds : iterable
An iterable of generalized speeds.
frame : ReferenceFrame
The reference frame that the partial derivatives are going to be taken in.
Examples
>>> from sympy.physics.vector import Point, ReferenceFrame >>> from sympy.physics.vector import dynamicsymbols >>> from sympy.physics.vector import partial_velocity >>> u = dynamicsymbols('u') >>> N = ReferenceFrame('N') >>> P = Point('P') >>> P.set_vel(N, u * N.x) >>> vel_vecs = [P.vel(N)] >>> gen_speeds = [u] >>> partial_velocity(vel_vecs, gen_speeds, N) [[N.x]]
-
sympy.physics.vector.functions.
get_motion_params
(frame, **kwargs)[source]¶ Returns the three motion parameters - (acceleration, velocity, and position) as vectorial functions of time in the given frame.
If a higher order differential function is provided, the lower order functions are used as boundary conditions. For example, given the acceleration, the velocity and position parameters are taken as boundary conditions.
The values of time at which the boundary conditions are specified are taken from timevalue1(for position boundary condition) and timevalue2(for velocity boundary condition).
If any of the boundary conditions are not provided, they are taken to be zero by default (zero vectors, in case of vectorial inputs). If the boundary conditions are also functions of time, they are converted to constants by substituting the time values in the dynamicsymbols._t time Symbol.
This function can also be used for calculating rotational motion parameters. Have a look at the Parameters and Examples for more clarity.
Parameters: frame : ReferenceFrame
The frame to express the motion parameters in
acceleration : Vector
Acceleration of the object/frame as a function of time
velocity : Vector
Velocity as function of time or as boundary condition of velocity at time = timevalue1
position : Vector
Velocity as function of time or as boundary condition of velocity at time = timevalue1
timevalue1 : sympyfiable
Value of time for position boundary condition
timevalue2 : sympyfiable
Value of time for velocity boundary condition
Examples
>>> from sympy.physics.vector import ReferenceFrame, get_motion_params, dynamicsymbols >>> from sympy import symbols >>> R = ReferenceFrame('R') >>> v1, v2, v3 = dynamicsymbols('v1 v2 v3') >>> v = v1*R.x + v2*R.y + v3*R.z >>> get_motion_params(R, position = v) (v1''*R.x + v2''*R.y + v3''*R.z, v1'*R.x + v2'*R.y + v3'*R.z, v1*R.x + v2*R.y + v3*R.z) >>> a, b, c = symbols('a b c') >>> v = a*R.x + b*R.y + c*R.z >>> get_motion_params(R, velocity = v) (0, a*R.x + b*R.y + c*R.z, a*t*R.x + b*t*R.y + c*t*R.z) >>> parameters = get_motion_params(R, acceleration = v) >>> parameters[1] a*t*R.x + b*t*R.y + c*t*R.z >>> parameters[2] a*t**2/2*R.x + b*t**2/2*R.y + c*t**2/2*R.z