def potential(y,x,v,m,twopiG=1.,omega=None):
"""
NAME:
potential
PURPOSE:
compute the gravitational potential at a set of points
INPUT:
y - positions at which to compute the potential
x - positions of N-body particles [N]
v - velocities of N-body particles [N]
m - masses of N-body particles [N]
twopiG= (1.) value of 2 \pi G
omega= (None) if set, frequency of external harmonic oscillator
OUTPUT:
potential(y)
HISTORY:
2017-05-12 - Written - Bovy (UofT/CCA)
"""
if not omega is None:
out= omega**2.*y**2./2.
else:
out= 0.
return out\
+twopiG\
*numpy.sum(m*numpy.fabs(x-numpy.atleast_2d(y).T),axis=1)
评论列表
文章目录