Daniel Fischer wrote:
> The problem is that a prime crept in in Josef's code,
> so to calculate the positions and velocities, the updated versions of the 
> planets are used, it should be

    Ah, yes, thanks for the correction.
 
> Besides, offset_momentum does not use the parameter n at all and I think that 
> all the indexing in the computation of the potential energy is rather 
> inefficient.

    I wasn't too worried about the energy function, since it only gets
called twice, whereas the "advance" get called potentially millions of
times (and must be the source of the space leak).  You can see one
profile I ran (for n=1000 instead of 1000000) at...

    http://sleepingsquirrel.org/nbody/nbody.prof

Thanks,

Greg Buchholz 
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to