3 ms·
Correct me if i am not wrong they probably defining initial conditions for the particles (such as positions (to create the spongebob (althought I wish there was
by noobcoder 3y ago
Correct me if i am not wrong they probably defining initial conditions for the particles (such as positions (to create the spongebob (althought I wish there was a way to convert an image to these n bodies), velocities, and masses)
Then you set up the gravitational interactions between them and futher iteratively update their positions and velocities over time using some numerical integration method (Euler's method/Runge-Kutta method?) to simulate their motion
- buescher 3y agoLooks like it. A.K. Dewdney did a computer recreations column in Scientific American back in the eighties with a nice exposition of how to do a basic star cluster simulation. Only practical with a lot fewer “stars” on the gear I had available then. It used Euler’s method iirc.
- jhbadger 3y agoSpeaking of which, Dewdney recently passed away on March 9th but I haven't seen any notice of it on HN or other CS-related sites. I know he alienated a lot of people with his unfortunate turn to conspiracy theory after 9/11, but he really contributed a lot to popular interest in CS and recreational mathematics in the 1980s and 1990s through his Scientific American articles and his books.
- buescher 3y agoI'm sorry to hear that. His columns and books were a big influence.
- epiccoleman 3y agoOh man, what a trip to see Dewdney mentioned. I have a copy of The Magic Machine on my shelf which I (unintentionally) stole from my university library at the end of my senior year. His work was pretty influential on me, inspiring me to keep exploring programming at a time when my day to day work in the subject was often painfully boring.
- comicjk 3y agoProbably a symplectic Verlet method instead of Euler or Runge-Kutta, since you want energy and momentum to be conserved in this simulation.
- gus_massa 3y agoI was going to link to the article about sympletic integration, but it's toooo technical. This other article explains the problem https://en.wikipedia.org/wiki/Energy_drift https://en.wikipedia.org/wiki/Energy_drift