More N-body stuff

Whatever is on your mind, whether Lisp related or not.
Post Reply
jstoddard
Posts: 20
Joined: Fri Jan 28, 2011 6:13 pm

More N-body stuff

Post by jstoddard » Sat Feb 26, 2011 3:14 pm

Okay, I've kept playing around with the idea of numerical simulations in Common Lisp. I've put together a Lisp version of Aarseth's N-body code at http://www.jeremiahstoddard.com/docs/nbody0.lisp. To use:

Code: Select all

> (load "nbody0.lisp")
> (in-package :nbody0)
> (nbody0 "input-file" "output-file")
From the input file is read num-particles, eta, time-step, final-time, and epsilon-squared. Afterwards num-particles particles are read as: "mass x y z vx vy vz". Output is written to output-file as "mass x y z". See http://bima.astro.umd.edu/nemo/man_html/nbody0.1.html for details.

I've done some test runs & compared output w/ C version, and it seems to be working in SBCL. I've tested in CLISP also, but it errors out. In other Lisp environments, YMMV. I'm looking into other integration algorithms as well, & I'd like to get together a simple visualization package to animate the results. Comments/patches welcome from any interested parties.

Post Reply