Universe Sandbox
General Category => Astronomy & Science => Topic started by: atomic7732 on April 10, 2011, 12:55:08 PM
-
Right now, I'm working on a Perl gravitational simulator. It takes 3 bodies characteristics and creates an output file. The visual output is your favorite graphing program! Excel, Google Docs, or whatever. The output file just outputs the locations. I'll probably change it to include acceleration or other data. Collisions aren't in the program yet. It should be easy by simply adding radii to the objects. It's conventionally a Star-Planet-Moon simulator, but with a little calculation you can make a 2 planet system. :P
-
I finished it... and tested it... It wrote the file... but it only said:
StarX StarY PlanetX PlanetY MoonX MoonY
when it should have had that AND a bunch of data
It said "Illegal division by zero at line 164"
-
I think I fixed it but then all I got was:
2.45230724281467e+024 1.63605369640936e+024 2.39322572687155e+026 -1.6524812430857e+027 -4.25878464967556e+030 -7.94160599526426e+031
-
Fixed it, but now it just gives the same number repetitively, for each one.
-
I got it to work! I can't tell if the sun is working... it's the only one giving the same numbers. Anyhow... Here's a chart. 48 iterations 6 hours each. Due to the way the numbers output and google reads it... You should view it upside down. :P
The star is located... not at 0 for whatever reason. I have no clue. I tell it that it is located there, but it doesn't seem to care.
-
Very cool.
You've seen my early gravity simulation work, right?
http://dandixon.us/programming/planets.htm
-
Yeah, I have. :)