Ejemplo n.º 1
0
pDs.v2pt_theory(pP1, B, E)
pDs.v2pt_theory(pP1, A, E)

# define generalized speeds and constraints
kde = [u1 - dot(pP1.vel(A), E.x), u2 - dot(pP1.vel(A), E.y), u3 - q3d]
kde_map = solve(kde, qd)
# include second derivatives in kde map
for k, v in kde_map.items():
    kde_map[k.diff(t)] = v.diff(t)

vc = [dot(pDs.vel(B), E.y)]
vc_map = solve(subs(vc, kde_map), [u3])

# define system of particles
system = [Particle('P1', pP1, m1), Particle('P2', pDs, m2)]

# calculate kinetic energy, generalized inertia forces
K = sum(map(lambda x: x.kinetic_energy(A), system))
Fr_tilde_star = generalized_inertia_forces_K(K, q, [u1, u2], kde_map, vc_map)

for i, f in enumerate(Fr_tilde_star, 1):
    print("F{0}* = {1}".format(i, msprint(simplify(f))))

Fr_tilde_star_expected = [
    ((m1 + m2) * (omega**2 * q1 * cos(q3) - u1.diff(t)) - m1 * u2**2 / L +
     m2 * L * omega**2 * cos(q3)**2),
    (-m1 * (u2.diff(t) + omega**2 * q1 * sin(q3) - u1 * u2 / L))
]
for x, y in zip(Fr_tilde_star, Fr_tilde_star_expected):
    assert simplify(x - y) == 0
Ejemplo n.º 2
0
forces = [(pP1, 6 * m * g * N.x), (pP2, S * N.y + 5 * m * g * N.x),
          (pP3, 6 * m * g * N.x), (pP4, -Q * N.y + 5 * m * g * N.x),
          (pP5, 6 * m * g * N.x), (pP6, R * N.y + 5 * m * g * N.x)]

partials = partial_velocities(points, u, N, kde_map)
system = [
    Particle('P{0}'.format(i), p, x * m * g)
    for i, p, x in zip(range(1, 7), points, [6, 5] * 3)
]

# part a
Fr_star_a, _ = generalized_inertia_forces(partials, system, kde_map)

# part b
K = sum(map(lambda x: x.kinetic_energy(N), system))
Fr_star_b = generalized_inertia_forces_K(K, q, u, kde_map)

# part c
G = sum(P.mass * dot(P.point.acc(N), P.point.acc(N))
        for P in system).subs(kde_map) / 2
Fr_star_c = map(lambda u_r: -G.diff(u_r.diff(t)), u)


def print_fr_star(fr_star):
    for i, f in enumerate(fr_star, 1):
        print("F{0}* = {1}".format(i, msprint(trigsimp(together(f)))))


print('part a')
print_fr_star(Fr_star_a)
Ejemplo n.º 3
0
          (pP2, S*N.y + 5*m*g*N.x),
          (pP3, 6*m*g*N.x),
          (pP4, -Q*N.y + 5*m*g*N.x),
          (pP5, 6*m*g*N.x),
          (pP6, R*N.y + 5*m*g*N.x)]

partials = partial_velocities(points, u, N, kde_map)
system = [Particle('P{0}'.format(i), p, x*m*g)
          for i, p, x in zip(range(1, 7), points, [6, 5] * 3)]

# part a
Fr_star_a, _ = generalized_inertia_forces(partials, system, kde_map)

# part b
K = sum(map(lambda x: x.kinetic_energy(N), system))
Fr_star_b = generalized_inertia_forces_K(K, q, u, kde_map)

# part c
G = sum(P.mass * dot(P.point.acc(N), P.point.acc(N))
        for P in system).subs(kde_map) / 2
Fr_star_c = map(lambda u_r: -G.diff(u_r.diff(t)), u)


def print_fr_star(fr_star):
    for i, f in enumerate(fr_star, 1):
        print("F{0}* = {1}".format(i, msprint(trigsimp(together(f)))))


print('part a')
print_fr_star(Fr_star_a)
Ejemplo n.º 4
0
pDs.set_vel(E, 0)
pDs.v2pt_theory(pP1, B, E)
pDs.v2pt_theory(pP1, A, E)

# define generalized speeds and constraints
kde = [u1 - dot(pP1.vel(A), E.x), u2 - dot(pP1.vel(A), E.y), u3 - q3d]
kde_map = solve(kde, qd)
# include second derivatives in kde map
for k, v in kde_map.items():
    kde_map[k.diff(t)] = v.diff(t)

vc = [dot(pDs.vel(B), E.y)]
vc_map = solve(subs(vc, kde_map), [u3])

# define system of particles
system = [Particle('P1', pP1, m1), Particle('P2', pDs, m2)]

# calculate kinetic energy, generalized inertia forces
K = sum(map(lambda x: x.kinetic_energy(A), system))
Fr_tilde_star = generalized_inertia_forces_K(K, q, [u1, u2], kde_map, vc_map)

for i, f in enumerate(Fr_tilde_star, 1):
    print("F{0}* = {1}".format(i, msprint(simplify(f))))

Fr_tilde_star_expected = [((m1 + m2)*(omega**2*q1*cos(q3) - u1.diff(t)) -
                           m1*u2**2/L + m2*L*omega**2*cos(q3)**2),
                          (-m1*(u2.diff(t) + omega**2*q1*sin(q3) -
                                u1*u2/L))]
for x, y in zip(Fr_tilde_star, Fr_tilde_star_expected):
    assert simplify(x - y) == 0