def test_potential_energy():
    (m, M, l1, g, h, H) = symbols('m M l1 g h H')
    omega = dynamicsymbols('omega')
    N = ReferenceFrame('N')
    O = Point('O')
    O.set_vel(N, (0 * N.x))
    Ac = O.locatenew('Ac', (l1 * N.x))
    P = Ac.locatenew('P', (l1 * N.x))
    a = ReferenceFrame('a')
    a.set_ang_vel(N, (omega * N.z))
    Ac.v2pt_theory(O, N, a)
    P.v2pt_theory(O, N, a)
    Pa = Particle('Pa', P, m)
    I = outer(N.z, N.z)
    A = RigidBody('A', Ac, a, M, (I, Ac))
    Pa.potential_energy = ((m * g) * h)
    A.potential_energy = ((M * g) * H)
    assert (potential_energy(A, Pa) == (((m * g) * h) + ((M * g) * H)))
def test_potential_energy():
    (m, M, l1, g, h, H) = symbols('m M l1 g h H')
    omega = dynamicsymbols('omega')
    N = ReferenceFrame('N')
    O = Point('O')
    O.set_vel(N, (0 * N.x))
    Ac = O.locatenew('Ac', (l1 * N.x))
    P = Ac.locatenew('P', (l1 * N.x))
    a = ReferenceFrame('a')
    a.set_ang_vel(N, (omega * N.z))
    Ac.v2pt_theory(O, N, a)
    P.v2pt_theory(O, N, a)
    Pa = Particle('Pa', P, m)
    I = outer(N.z, N.z)
    A = RigidBody('A', Ac, a, M, (I, Ac))
    Pa.potential_energy = ((m * g) * h)
    A.potential_energy = ((M * g) * H)
    assert (potential_energy(A, Pa) == (((m * g) * h) + ((M * g) * H)))