A reference frame in classical mechanics.
ReferenceFrame is a class used to represent a reference frame in classical mechanics. It has a standard basis of three unit vectors in the frame’s x, y, and z directions.
It also can have a rotation relative to a parent frame; this rotation is defined by a direction cosine matrix relating this frame’s basis vectors to the parent frame’s basis vectors. It can also have an angular velocity vector, defined in another frame.
Returns the angular acceleration Vector of the ReferenceFrame.
Effectively returns the Vector: ^N alpha ^B which represent the angular acceleration of B in N, where B is self, and N is otherframe.
Parameters :  otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> N = ReferenceFrame('N')
>>> A = ReferenceFrame('A')
>>> V = 10 * N.x
>>> A.set_ang_acc(N, V)
>>> A.ang_acc_in(N)
10*N.x
Returns the angular velocity Vector of the ReferenceFrame.
Effectively returns the Vector: ^N omega ^B which represent the angular velocity of B in N, where B is self, and N is otherframe.
Parameters :  otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> N = ReferenceFrame('N')
>>> A = ReferenceFrame('A')
>>> V = 10 * N.x
>>> A.set_ang_vel(N, V)
>>> A.ang_vel_in(N)
10*N.x
The direction cosine matrix between frames.
This gives the DCM between this frame and the otherframe. The format is N.xyz = N.dcm(B) * B.xyz A SymPy Matrix is returned.
Parameters :  otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> from sympy import symbols
>>> q1 = symbols('q1')
>>> N = ReferenceFrame('N')
>>> A = N.orientnew('A', 'Axis', [q1, N.x])
>>> N.dcm(A)
[1, 0, 0]
[0, cos(q1), sin(q1)]
[0, sin(q1), cos(q1)]
Defines the orientation of this frame relative to a parent frame.
Supported orientation types are Body, Space, Quaternion, Axis. Examples show correct usage.
Parameters :  parent : ReferenceFrame
rot_type : str
amounts : list OR value
rot_order : str


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> from sympy import symbols
>>> q0, q1, q2, q3, q4 = symbols('q0 q1 q2 q3 q4')
>>> N = ReferenceFrame('N')
>>> B = ReferenceFrame('B')
Now we have a choice of how to implement the orientation. First is Body. Body orientation takes this reference frame through three successive simple rotations. Acceptable rotation orders are of length 3, expressed in XYZ or 123, and cannot have a rotation about about an axis twice in a row.
>>> B.orient(N, 'Body', [q1, q2, q3], '123')
>>> B.orient(N, 'Body', [q1, q2, 0], 'ZXZ')
>>> B.orient(N, 'Body', [0, 0, 0], 'XYX')
Next is Space. Space is like Body, but the rotations are applied in the opposite order.
>>> B.orient(N, 'Space', [q1, q2, q3], '312')
Next is Quaternion. This orients the new ReferenceFrame with Quaternions, defined as a finite rotation about lambda, a unit vector, by some amount theta. This orientation is described by four parameters: q0 = cos(theta/2) q1 = lambda_x sin(theta/2) q2 = lambda_y sin(theta/2) q3 = lambda_z sin(theta/2) Quaternion does not take in a rotation order.
>>> B.orient(N, 'Quaternion', [q0, q1, q2, q3])
Last is Axis. This is a rotation about an arbitrary, nontimevarying axis by some angle. The axis is supplied as a Vector. This is how simple rotations are defined.
>>> B.orient(N, 'Axis', [q1, N.x + 2 * N.y])
Creates a new ReferenceFrame oriented with respect to this Frame.
See ReferenceFrame.orient() for acceptable rotation types, amounts, and orders. Parent is going to be self.
Parameters :  parent : ReferenceFrame
rot_type : str
amounts : list OR value
rot_order : str


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> from sympy import symbols
>>> q0, q1, q2, q3, q4 = symbols('q0 q1 q2 q3 q4')
>>> N = ReferenceFrame('N')
>>> B = ReferenceFrame('B')
Now we have a choice of how to implement the orientation. First is Body. Body orientation takes this reference frame through three successive simple rotations. Acceptable rotation orders are of length 3, expressed in XYZ or 123, and cannot have a rotation about about an axis twice in a row.
>>> B.orient(N, 'Body', [q1, q2, q3], '123')
>>> B.orient(N, 'Body', [q1, q2, 0], 'ZXZ')
>>> B.orient(N, 'Body', [0, 0, 0], 'XYX')
Next is Space. Space is like Body, but the rotations are applied in the opposite order.
>>> B.orient(N, 'Space', [q1, q2, q3], '312')
Next is Quaternion. This orients the new ReferenceFrame with Quaternions, defined as a finite rotation about lambda, a unit vector, by some amount theta. This orientation is described by four parameters: q0 = cos(theta/2) q1 = lambda_x sin(theta/2) q2 = lambda_y sin(theta/2) q3 = lambda_z sin(theta/2) Quaternion does not take in a rotation order.
>>> B.orient(N, 'Quaternion', [q0, q1, q2, q3])
Last is Axis. This is a rotation about an arbitrary, nontimevarying axis by some angle. The axis is supplied as a Vector. This is how simple rotations are defined.
>>> B.orient(N, 'Axis', [q1, N.x + 2 * N.y])
Define the angular acceleration Vector in a ReferenceFrame.
Defines the angular acceleration of this ReferenceFrame, in another. Angular acceleration can be defined with respect to multiple different ReferenceFrames. Care must be taken to not create loops which are inconsistent.
Parameters :  otherframe : ReferenceFrame
value : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> N = ReferenceFrame('N')
>>> A = ReferenceFrame('A')
>>> V = 10 * N.x
>>> A.set_ang_acc(N, V)
>>> A.ang_acc_in(N)
10*N.x
Define the angular velocity vector in a ReferenceFrame.
Defines the angular velocity of this ReferenceFrame, in another. Angular velocity can be defined with respect to multiple different ReferenceFrames. Care must be taken to not create loops which are inconsistent.
Parameters :  otherframe : ReferenceFrame
value : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> N = ReferenceFrame('N')
>>> A = ReferenceFrame('A')
>>> V = 10 * N.x
>>> A.set_ang_vel(N, V)
>>> A.ang_vel_in(N)
10*N.x
The class used to define vectors.
It along with ReferenceFrame are the building blocks of describing a classical mechanics system in PyDy.
Attributes
simp  Boolean  Let certain methods use trigsimp on their outputs 
The cross product operator for two Vectors.
Returns a Vector, expressed in the same ReferenceFrames as self.
Parameters :  other : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector
>>> from sympy import symbols
>>> q1 = symbols('q1')
>>> N = ReferenceFrame('N')
>>> N.x ^ N.y
N.z
>>> A = N.orientnew('A', 'Axis', [q1, N.x])
>>> A.x ^ N.y
N.z
>>> N.y ^ A.x
 sin(q1)*A.y  cos(q1)*A.z
Takes the partial derivative, with respect to a value, in a frame.
Returns a Vector.
Parameters :  wrt : Symbol
otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector, dynamicsymbols
>>> from sympy import Symbol
>>> Vector.simp = True
>>> t = Symbol('t')
>>> q1 = dynamicsymbols('q1')
>>> N = ReferenceFrame('N')
>>> A = N.orientnew('A', 'Axis', [q1, N.y])
>>> A.x.diff(t, N)
 q1'*A.z
Dot product of two vectors.
Returns a scalar, the dot product of the two Vectors
Parameters :  other : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector, dot
>>> from sympy import symbols
>>> q1 = symbols('q1')
>>> N = ReferenceFrame('N')
>>> dot(N.x, N.x)
1
>>> dot(N.x, N.y)
0
>>> A = N.orientnew('A', 'Axis', [q1, N.x])
>>> dot(N.y, A.y)
cos(q1)
Returns the time derivative of the Vector in a ReferenceFrame.
Returns a Vector which is the time derivative of the self Vector, taken in frame otherframe.
Parameters :  otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector, dynamicsymbols
>>> from sympy import Symbol
>>> q1 = Symbol('q1')
>>> u1 = dynamicsymbols('u1')
>>> N = ReferenceFrame('N')
>>> A = N.orientnew('A', 'Axis', [q1, N.x])
>>> v = u1 * N.x
>>> A.set_ang_vel(N, 10*A.x)
>>> A.x.dt(N) == 0
True
>>> v.dt(N)
u1'*N.x
Returns a vector, expressed in the other frame.
A new Vector is returned, equalivalent to this Vector, but its components are all defined in only the otherframe.
Parameters :  otherframe : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, Vector, dynamicsymbols
>>> q1 = dynamicsymbols('q1')
>>> N = ReferenceFrame('N')
>>> A = N.orientnew('A', 'Axis', [q1, N.y])
>>> A.x.express(N)
cos(q1)*N.x  sin(q1)*N.z
Outer product between two Vectors.
A rank increasing operation, which returns a Dyadic from two Vectors
Parameters :  other : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, outer
>>> N = ReferenceFrame('N')
>>> outer(N.x, N.x)
(N.xN.x)
A Dyadic object.
See: http://en.wikipedia.org/wiki/Dyadic_tensor Kane, T., Levinson, D. Dynamics Theory and Applications. 1985 McGrawHill
A more powerful way to represent a rigid body’s inertia. While it is more complex, by choosing Dyadic components to be in body fixed basis vectors, the resulting matrix is equivalent to the inertia tensor.
For a cross product in the form: Dyadic x Vector.
Parameters :  other : Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, outer, cross
>>> N = ReferenceFrame('N')
>>> d = outer(N.x, N.x)
>>> cross(d, N.y)
(N.xN.z)
The inner product operator for a Dyadic and a Dyadic or Vector.
Parameters :  other : Dyadic or Vector


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, outer
>>> N = ReferenceFrame('N')
>>> D1 = outer(N.x, N.y)
>>> D2 = outer(N.y, N.y)
>>> D1.dot(D2)
(N.xN.y)
>>> D1.dot(N.y)
N.x
Take the time derivative of this Dyadic in a frame.
Parameters :  frame : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, outer, dynamicsymbols
>>> N = ReferenceFrame('N')
>>> q = dynamicsymbols('q')
>>> B = N.orientnew('B', 'Axis', [q, N.z])
>>> d = outer(N.x, N.x)
>>> d.dt(B)
 q'*(N.yN.x)  q'*(N.xN.y)
Expresses this Dyadic in alternate frame(s)
The first frame is the list side expression, the second frame is the right side; if Dyadic is in form A.xB.y, you can express it in two different frames. If no second frame is given, the Dyadic is expressed in only one frame.
Parameters :  frame1 : ReferenceFrame
frame2 : ReferenceFrame


Examples
>>> from sympy.physics.mechanics import ReferenceFrame, outer, dynamicsymbols
>>> N = ReferenceFrame('N')
>>> q = dynamicsymbols('q')
>>> B = N.orientnew('B', 'Axis', [q, N.z])
>>> d = outer(N.x, N.x)
>>> d.express(B, N)
cos(q)*(B.xN.x)  sin(q)*(B.yN.x)