Modeling a flat and spinning solar system using Python

preview_player
Показать описание
Modeling a flat spinning solar system with 100 masses using Web Vpython

Here is the python code

Related - how to build a solar system model (simple version)
Рекомендации по теме
Комментарии
Автор

Nice accounting for the interactions. This could easily be a good starting point from which to expand from, i.e. your homework questions, or beyond. Thanks for the vid.

fizixx
Автор

I now really want to implement these in Go using the G3N engine and play around to simulate planets formation and gas particles behavior in a closed volume, pendulums and and the good stuff! Thanks for giving me what to play with during the winter days :)

Urgleflogue
Автор

really nice description of the issues! The Gm1m2 is a constant for each pair of objects... you could take that calculation out of the loop, and have a loop iteration for each pair! You could put the calc result of Gm1m2 in an array to help with the loop - you'll have to calc each pair's attraction force once per round, so you only need to use half the array, since the attractive force is the same for each item in a pair.

brookestephen
Автор

I just noticed you're doing the calculation for the forces on b1 and b2 TWICE rather than ONCE, when they're exactly the same calculation, with the results simply in opposite directions.

brookestephen
Автор

I always wanted to write something like this, this can be a good starting point, I will program it in C++, when i find the time, thanks for the info. Just seen short code snippets from you, i would improve the naming of the variables and write some comments in your code, to make it more readable and more easy to continue working if you abandon the project for a longer time.

Amplituhedron
Автор

I am very sorry, but as I've stated in the past, this model is INCORRECT PHYSICS.!.
.
That "different model initial rotation" {time 2:25} can not persist with many individual particles UNLESS they are connected with some framework. Given their respective initial velocities they ALL will then rotate around the CENTER OF MASS in the very CENTER - NOT around the imaginary vertical axis.
That rotation will NOT occur. It is FALSE.!.
.

SteveNoskowicz
Автор

How can you possibly justify that all the free particles do not circle the center of mass in the center, but the imaginary vertical axis without some framework holding them into a fixed relationship to each other? Your "initial rotation" would only give an initial velocity, then they would all respond to the net gravity of all the others and be accelerated INWARD toward the CENTER.
.
What you have here violates fundamental laws.!.

SteveNoskowicz
Автор

I'm back and finished the simulation. Great fun. Thanks! Couple more questions on the code. On line 55, did you miss not squaring the mag(rt) in the denominator or was that intentional? Also, we never used the variable v0 in the code, set to 0.2. Was that supposed to be included somewhere?

pauldirac
Автор

Great video. I think I found a mistake in the code, though. On line 14 where you are trying to only include object within the sphere, you are actually including all 100 each time because your counter (n = n + 1) is inside the if statement. You need to pull it out of the if statement. Check "print(len(bs))" and you'll see that the count is 100 every time.

pauldirac
Автор

Live coding is better, no negotiable!

godphysics
visit shbcf.ru