A particle.
Particles have a non-zero mass and lack spatial extension; they take up no space.
Values need to be supplied on initialization, but can be changed later.
Parameters : | name : str
point : Point
mass : sympifyable
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point
>>> from sympy import Symbol
>>> po = Point('po')
>>> m = Symbol('m')
>>> pa = Particle('pa', po, m)
>>> # Or you could change these later
>>> pa.mass = m
>>> pa.point = po
Angular momentum of the particle about the point.
The angular momentum H, about some point O of a particle, P, is given by:
H = r x m * v
where r is the position vector from point O to the particle P, m is the mass of the particle, and v is the velocity of the particle in the inertial frame, N.
Parameters : | point : Point
frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point, ReferenceFrame
>>> from sympy.physics.mechanics import dynamicsymbols
>>> m, v, r = dynamicsymbols('m v r')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> A = O.locatenew('A', r * N.x)
>>> P = Particle('P', A, m)
>>> P.point.set_vel(N, v * N.y)
>>> P.angular_momentum(O, N)
m*r*v*N.z
Kinetic energy of the particle
The kinetic energy, T, of a particle, P, is given by
‘T = 1/2 m v^2’
where m is the mass of particle P, and v is the velocity of the particle in the supplied ReferenceFrame.
Parameters : | frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point, ReferenceFrame
>>> from sympy import symbols
>>> m, v, r = symbols('m v r')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> P = Particle('P', O, m)
>>> P.point.set_vel(N, v * N.y)
>>> P.kinetic_energy(N)
m*v**2/2
Linear momentum of the particle.
The linear momentum L, of a particle P, with respect to frame N is given by
L = m * v
where m is the mass of the particle, and v is the velocity of the particle in the frame N.
Parameters : | frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point, ReferenceFrame
>>> from sympy.physics.mechanics import dynamicsymbols
>>> m, v = dynamicsymbols('m v')
>>> N = ReferenceFrame('N')
>>> P = Point('P')
>>> A = Particle('A', P, m)
>>> P.set_vel(N, v * N.x)
>>> A.linear_momentum(N)
m*v*N.x
Mass of the particle.
Point of the particle.
The potential energy of the Particle.
Examples
>>> from sympy.physics.mechanics import Particle, Point
>>> from sympy import symbols
>>> m, g, h = symbols('m g h')
>>> O = Point('O')
>>> P = Particle('P', O, m)
>>> P.set_potential_energy(m * g * h)
>>> P.potential_energy
g*h*m
Used to set the potential energy of the Particle.
Parameters : | scalar : Sympifyable
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point
>>> from sympy import symbols
>>> m, g, h = symbols('m g h')
>>> O = Point('O')
>>> P = Particle('P', O, m)
>>> P.set_potential_energy(m * g * h)
An idealized rigid body.
This is essentially a container which holds the various components which describe a rigid body: a name, mass, center of mass, reference frame, and inertia.
All of these need to be supplied on creation, but can be changed afterwards.
Examples
>>> from sympy import Symbol
>>> from sympy.physics.mechanics import ReferenceFrame, Point, RigidBody
>>> from sympy.physics.mechanics import outer
>>> m = Symbol('m')
>>> A = ReferenceFrame('A')
>>> P = Point('P')
>>> I = outer (A.x, A.x)
>>> inertia_tuple = (I, P)
>>> B = RigidBody('B', P, A, m, inertia_tuple)
>>> # Or you could change them afterwards
>>> m2 = Symbol('m2')
>>> B.mass = m2
Attributes
name | string | The body’s name. |
masscenter | Point | The point which represents the center of mass of the rigid body. |
frame | ReferenceFrame | The ReferenceFrame which the rigid body is fixed in. |
mass | Sympifyable | The body’s mass. |
inertia | (Dyadic, Point) | The body’s inertia about a point; stored in a tuple as shown above. |
Angular momentum of the rigid body.
The angular momentum H, about some point O, of a rigid body B, in a frame N is given by
H = I* . omega + r* x (M * v)
where I* is the central inertia dyadic of B, omega is the angular velocity of body B in the frame, N, r* is the position vector from point O to the mass center of B, and v is the velocity of point O in the frame, N.
Parameters : | point : Point
frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Point, ReferenceFrame, outer
>>> from sympy.physics.mechanics import RigidBody, dynamicsymbols
>>> M, v, r, omega = dynamicsymbols('M v r omega')
>>> N = ReferenceFrame('N')
>>> b = ReferenceFrame('b')
>>> b.set_ang_vel(N, omega * b.x)
>>> P = Point('P')
>>> P.set_vel(N, 1 * N.x)
>>> I = outer (b.x, b.x)
>>> Inertia_tuple = (I, P)
>>> B = RigidBody('B', P, b, M, Inertia_tuple)
>>> B.angular_momentum(P, N)
omega*b.x
Kinetic energy of the rigid body
The kinetic energy, T, of a rigid body, B, is given by
‘T = 1/2 (I omega^2 + m v^2)’
where I and m are the central inertia dyadic and mass of rigid body B, respectively, omega is the body’s angular velocity and v is the velocity of the body’s mass center in the supplied ReferenceFrame.
Parameters : | frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Point, ReferenceFrame, outer
>>> from sympy.physics.mechanics import RigidBody
>>> from sympy import symbols
>>> M, v, r, omega = symbols('M v r omega')
>>> N = ReferenceFrame('N')
>>> b = ReferenceFrame('b')
>>> b.set_ang_vel(N, omega * b.x)
>>> P = Point('P')
>>> P.set_vel(N, v * N.x)
>>> I = outer (b.x, b.x)
>>> inertia_tuple = (I, P)
>>> B = RigidBody('B', P, b, M, inertia_tuple)
>>> B.kinetic_energy(N)
M*v**2/2 + omega**2/2
Linear momentum of the rigid body.
The linear momentum L, of a rigid body B, with respect to frame N is given by
L = M * v*
where M is the mass of the rigid body and v* is the velocity of the mass center of B in the frame, N.
Parameters : | frame : ReferenceFrame
|
---|
Examples
>>> from sympy.physics.mechanics import Point, ReferenceFrame, outer
>>> from sympy.physics.mechanics import RigidBody, dynamicsymbols
>>> M, v = dynamicsymbols('M v')
>>> N = ReferenceFrame('N')
>>> P = Point('P')
>>> P.set_vel(N, v * N.x)
>>> I = outer (N.x, N.x)
>>> Inertia_tuple = (I, P)
>>> B = RigidBody('B', P, N, M, Inertia_tuple)
>>> B.linear_momentum(N)
M*v*N.x
The potential energy of the RigidBody.
Examples
>>> from sympy.physics.mechanics import RigidBody, Point, outer, ReferenceFrame
>>> from sympy import symbols
>>> M, g, h = symbols('M g h')
>>> b = ReferenceFrame('b')
>>> P = Point('P')
>>> I = outer (b.x, b.x)
>>> Inertia_tuple = (I, P)
>>> B = RigidBody('B', P, b, M, Inertia_tuple)
>>> B.set_potential_energy(M * g * h)
>>> B.potential_energy
M*g*h
Used to set the potential energy of this RigidBody.
Parameters : | scalar: Sympifyable :
|
---|
Examples
>>> from sympy.physics.mechanics import Particle, Point, outer
>>> from sympy.physics.mechanics import RigidBody, ReferenceFrame
>>> from sympy import symbols
>>> b = ReferenceFrame('b')
>>> M, g, h = symbols('M g h')
>>> P = Point('P')
>>> I = outer (b.x, b.x)
>>> Inertia_tuple = (I, P)
>>> B = RigidBody('B', P, b, M, Inertia_tuple)
>>> B.set_potential_energy(M * g * h)
Simple way to create inertia Dyadic object.
If you don’t know what a Dyadic is, just treat this like the inertia tensor. Then, do the easy thing and define it in a body-fixed frame.
Parameters : | frame : ReferenceFrame
ixx : Sympifyable
iyy : Sympifyable
izz : Sympifyable
ixy : Sympifyable
iyz : Sympifyable
izx : Sympifyable
|
---|
Examples
>>> from sympy.physics.mechanics import ReferenceFrame, inertia
>>> N = ReferenceFrame('N')
>>> inertia(N, 1, 2, 3)
(N.x|N.x) + 2*(N.y|N.y) + 3*(N.z|N.z)
Inertia dyadic of a point mass realtive to point O.
Parameters : | mass : Sympifyable
pos_vec : Vector
frame : ReferenceFrame
|
---|
Examples
>>> from sympy import symbols
>>> from sympy.physics.mechanics import ReferenceFrame, inertia_of_point_mass
>>> N = ReferenceFrame('N')
>>> r, m = symbols('r m')
>>> px = r * N.x
>>> inertia_of_point_mass(m, px, N)
m*r**2*(N.y|N.y) + m*r**2*(N.z|N.z)
Linear momentum of the system.
This function returns the linear momentum of a system of Particle’s and/or RigidBody’s. The linear momentum of a system is equal to the vector sum of the linear momentum of its constituents. Consider a system, S, comprised of a rigid body, A, and a particle, P. The linear momentum of the system, L, is equal to the vector sum of the linear momentum of the particle, L1, and the linear momentum of the rigid body, L2, i.e-
L = L1 + L2
Parameters : | frame : ReferenceFrame
body1, body2, body3... : Particle and/or RigidBody
|
---|
Examples
>>> from sympy.physics.mechanics import Point, Particle, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, outer, linear_momentum
>>> N = ReferenceFrame('N')
>>> P = Point('P')
>>> P.set_vel(N, 10 * N.x)
>>> Pa = Particle('Pa', P, 1)
>>> Ac = Point('Ac')
>>> Ac.set_vel(N, 25 * N.y)
>>> I = outer(N.x, N.x)
>>> A = RigidBody('A', Ac, N, 20, (I, Ac))
>>> linear_momentum(N, A, Pa)
10*N.x + 500*N.y
Angular momentum of a system
This function returns the angular momentum of a system of Particle’s and/or RigidBody’s. The angular momentum of such a system is equal to the vector sum of the angular momentum of its constituents. Consider a system, S, comprised of a rigid body, A, and a particle, P. The angular momentum of the system, H, is equal to the vector sum of the linear momentum of the particle, H1, and the linear momentum of the rigid body, H2, i.e-
H = H1 + H2
Parameters : | point : Point
frame : ReferenceFrame
body1, body2, body3... : Particle and/or RigidBody
|
---|
Examples
>>> from sympy.physics.mechanics import Point, Particle, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, outer, angular_momentum
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> P = O.locatenew('P', 1 * N.x)
>>> P.set_vel(N, 10 * N.x)
>>> Pa = Particle('Pa', P, 1)
>>> Ac = O.locatenew('Ac', 2 * N.y)
>>> Ac.set_vel(N, 5 * N.y)
>>> a = ReferenceFrame('a')
>>> a.set_ang_vel(N, 10 * N.z)
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, 20, (I, Ac))
>>> angular_momentum(O, N, Pa, A)
10*N.z
Kinetic energy of a multibody system.
This function returns the kinetic energy of a system of Particle’s and/or RigidBody’s. The kinetic energy of such a system is equal to the sum of the kinetic energies of its constituents. Consider a system, S, comprising a rigid body, A, and a particle, P. The kinetic energy of the system, T, is equal to the vector sum of the kinetic energy of the particle, T1, and the kinetic energy of the rigid body, T2, i.e.
T = T1 + T2
Kinetic energy is a scalar.
Parameters : | frame : ReferenceFrame
body1, body2, body3... : Particle and/or RigidBody
|
---|
Examples
>>> from sympy.physics.mechanics import Point, Particle, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, outer, kinetic_energy
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> P = O.locatenew('P', 1 * N.x)
>>> P.set_vel(N, 10 * N.x)
>>> Pa = Particle('Pa', P, 1)
>>> Ac = O.locatenew('Ac', 2 * N.y)
>>> Ac.set_vel(N, 5 * N.y)
>>> a = ReferenceFrame('a')
>>> a.set_ang_vel(N, 10 * N.z)
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, 20, (I, Ac))
>>> kinetic_energy(N, Pa, A)
350
Potential energy of a multibody system.
This function returns the potential energy of a system of Particle’s and/or RigidBody’s. The potential energy of such a system is equal to the sum of the potential energy of its constituents. Consider a system, S, comprising a rigid body, A, and a particle, P. The potential energy of the system, V, is equal to the vector sum of the potential energy of the particle, V1, and the potential energy of the rigid body, V2, i.e.
V = V1 + V2
Potential energy is a scalar.
Parameters : | body1, body2, body3... : Particle and/or RigidBody
|
---|
Examples
>>> from sympy.physics.mechanics import Point, Particle, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, outer, potential_energy
>>> from sympy import symbols
>>> M, m, g, h = symbols('M m g h')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> P = O.locatenew('P', 1 * N.x)
>>> Pa = Particle('Pa', P, m)
>>> Ac = O.locatenew('Ac', 2 * N.y)
>>> a = ReferenceFrame('a')
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, M, (I, Ac))
>>> Pa.set_potential_energy(m * g * h)
>>> A.set_potential_energy(M * g * h)
>>> potential_energy(Pa, A)
M*g*h + g*h*m
Lagrangian of a multibody system.
This function returns the Lagrangian of a system of Particle’s and/or RigidBody’s. The Lagrangian of such a system is equal to the difference between the kinetic energies and potential energies of its constituents. If T and V are the kinetic and potential energies of a system then it’s Lagrangian, L, is defined as
L = T - V
The Lagrangian is a scalar.
Parameters : | frame : ReferenceFrame
body1, body2, body3... : Particle and/or RigidBody
|
---|
Examples
>>> from sympy.physics.mechanics import Point, Particle, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, outer, Lagrangian
>>> from sympy import symbols
>>> M, m, g, h = symbols('M m g h')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> P = O.locatenew('P', 1 * N.x)
>>> P.set_vel(N, 10 * N.x)
>>> Pa = Particle('Pa', P, 1)
>>> Ac = O.locatenew('Ac', 2 * N.y)
>>> Ac.set_vel(N, 5 * N.y)
>>> a = ReferenceFrame('a')
>>> a.set_ang_vel(N, 10 * N.z)
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, 20, (I, Ac))
>>> Pa.set_potential_energy(m * g * h)
>>> A.set_potential_energy(M * g * h)
>>> Lagrangian(N, Pa, A)
-M*g*h - g*h*m + 350