[Shootout-list] n-body anomalies

Jon Harrop jon@ffconsultancy.com
Fri, 6 May 2005 03:13:15 +0100


On Friday 06 May 2005 02:49, Will M. Farr wrote:
> > I haven't looked carefully but it looks like the code is missing "G"
> > and a
> > factor of "2" (as it only counts (i, j) pairs satisfying i > j). Also,
> > the
> > sun doesn't weigh 39kg. ;-)
>
> Actually, the code is correct.  The potential energy for each *pair* of
> particles is - G m_i m_j / r_ij; ...

Right, ok.

> The sun's mass is 
> arbitrary; in effect, you are choosing units for G by saying solar_mass
> = 4 * pi * pi (an odd choice, I think; 1 would have been more natural).

Yes. I'd either put the correct solar mass in or remove it altogether.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists