def epot(x, y, z, m, eps=0.0):
    '\n    Potential energy with python.\n\n    Parameters\n    ----------\n    x, y, z: `np.ndarray`, shape = (N_part, 1)\n        Positions\n    m : `np.ndarray`, shape = (N_part, 1)\n        Masses\n    eps: `float`\n        Softening radius\n\n    Returns\n    -------\n    Upot: `np.ndarray`, shape = (N_part, 1)\n        Potential energy of particles\n    '
    G = 4.299e-06
    N_part = len(m)
    U = np.zeros((N_part, N_part))
    (dx, dy, dz) = distance(x, y, z, m)
    dist = np.sqrt(((((dx ** 2) + (dy ** 2)) + (dz ** 2)) + (eps ** 2)))
    for i in range((N_part - 1)):
        for j in range((i + 1), N_part):
            U[(i, j)] = (((G * m[j]) * m[i]) / dist[(i, j)])
            U[(j, i)] = U[(i, j)]
    Upot = np.sum((U / m), axis=0)
    return Upot
Potential energy with python.

Parameters
----------
x, y, z: `np.ndarray`, shape = (N_part, 1)
    Positions
m : `np.ndarray`, shape = (N_part, 1)
    Masses
eps: `float`
    Softening radius

Returns
-------
Upot: `np.ndarray`, shape = (N_part, 1)
    Potential energy of particles
def epot(x, y, z, m, eps=0.0):
    '\n    Potential energy with python.\n\n    Parameters\n    ----------\n    x, y, z: `np.ndarray`, shape = (N_part, 1)\n        Positions\n    m : `np.ndarray`, shape = (N_part, 1)\n        Masses\n    eps: `float`\n        Softening radius\n\n    Returns\n    -------\n    Upot: `np.ndarray`, shape = (N_part, 1)\n        Potential energy of particles\n    '
    G = 4.299e-06
    N_part = len(m)
    U = np.zeros((N_part, N_part))
    (dx, dy, dz) = distance(x, y, z, m)
    dist = np.sqrt(((((dx ** 2) + (dy ** 2)) + (dz ** 2)) + (eps ** 2)))
    for i in range((N_part - 1)):
        for j in range((i + 1), N_part):
            U[(i, j)] = (((G * m[j]) * m[i]) / dist[(i, j)])
            U[(j, i)] = U[(i, j)]
    Upot = np.sum((U / m), axis=0)
    return Upot