Could anyone help with the Stars example in Vpython

23 views
Skip to first unread message

Benjamin Anderson

unread,
Aug 9, 2016, 3:57:25 AM8/9/16
to VPython-users
I'm trying to decipher what the programme is doing at each stage, i'm not that experienced with simulations so i would like some help with a step by step explanation, i realise this is more physics than Computing but if anyone is really good at this sort of thing their help would be greatly appreciated. Thank you

Bruce Sherwood

unread,
Aug 9, 2016, 9:37:57 AM8/9/16
to VPython-users
Study the example program "BinaryStar-VPython", which contains the essence of "Stars-VPython", namely that one calculates the (vector) force that one star exerts on another, increments the momentum of each star by adding the vector impulse (F*dt), then increments the vector position of each star by adding the displacement (v*dt, where the velocity v is the momentum p divided by the mass).

There are two additional aspects of the stars program: the creation in a loop of all the sphere objects used to represent the stars, and the check for collisions (the criterion being that the center-to-center distance is less than the sum of the two stars' radii), with calculations to give the merged stars the sum of the momenta of the colliding stars.
Reply all
Reply to author
Forward
0 new messages