def potential_energy(*body):

    pe_sys = S(0)
    for e in body:
        if isinstance(e, (RigidBody, Particle)):
            pe_sys += e.potential_energy
        else:
            raise TypeError('*body must have only Particle or RigidBody')
    return pe_sys
Potential energy of a multibody system.
dataset/ETHPy150Open sympy/sympy/sympy/physics/mechanics/functions.py/potential_energy