Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#BUG: wrong formula & missing collision and boundary check in HW3 #2

Open
ccjeff opened this issue Nov 22, 2020 · 2 comments
Open

#BUG: wrong formula & missing collision and boundary check in HW3 #2

ccjeff opened this issue Nov 22, 2020 · 2 comments

Comments

@ccjeff
Copy link

ccjeff commented Nov 22, 2020

Firstly, thanks a lot for sharing the repo. There are some 挑刺 issue i found in the code:

In the code for Nbody simulation, the newton's law formula is missing the M2:
F = G * Nbody[j].w / (distancedistance);
should be replace by:
F = G * Nbody[j].w * Nbody[i].w / (distance
distance);

And since there is no boundary check, if the iteration number is large, there will be few bodies within the display area.🙈

谢谢学长!

@Gullintani
Copy link
Owner

感谢斧正!🙇🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@Gullintani @ccjeff and others