Kinematics (Docstrings)

Point

class sympy.physics.mechanics.point.Point(name)

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)

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.mechanics import Point, ReferenceFrame
>>> from sympy.physics.mechanics 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)

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.mechanics 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)

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.mechanics 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)

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.mechanics import ReferenceFrame, Point
>>> N = ReferenceFrame('N')
>>> P1 = Point('P1')
>>> P2 = P1.locatenew('P2', 10 * N.x)
pos_from(otherpoint)

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.mechanics 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)

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.mechanics 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)

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.mechanics 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)

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.mechanics 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)

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.mechanics import Point, ReferenceFrame
>>> from sympy.physics.mechanics 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)

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.mechanics 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)

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.mechanics 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.mechanics.functions.kinematic_equations(speeds, coords, rot_type, rot_order='')

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.mechanics import dynamicsymbols
>>> from sympy.physics.mechanics import kinematic_equations, mprint
>>> u1, u2, u3 = dynamicsymbols('u1 u2 u3')
>>> q1, q2, q3 = dynamicsymbols('q1 q2 q3')
>>> mprint(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']