>  Docs Center  >  Libraries  >  Beaumont  >  POTEN_SLOW

POTEN_SLOW

POTEN_SLOW

Purpose


  This function computes the potential energy of a mass
  distribution. It directly sums the interactions between all
  particles, so it is exact (to within machine precision) but scales
  as N^2. The poten_tree routine is slightly (1%) less accurate, but
  scales as NlogN. This routine is faster for <<10^4 particles,
  because the algorithm is simpler. Furthermore, this routine can
  calculate the potential in any dimension, whereas poten_tree is
  restricted to 3 dimensions.

Inputs


  pos: A [ndim, n] array of n-dimensional particle locations
  mass: A n element vector of masses

Outputs


  The potential energy of the system. It is assumed that G=1, so that
  PE = sum_i (sum j > i (m_i * m_j / r_ij) )

Modification History


  July 2010: Written by Chris Beaumont.



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us