Could anyone help with the Stars example in Vpython

瀏覽次數:23 次
跳到第一則未讀訊息

Benjamin Anderson

未讀,
2016年8月9日 凌晨3:57:252016/8/9
收件者: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

未讀,
2016年8月9日 上午9:37:572016/8/9
收件者: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.
回覆所有人
回覆作者
轉寄
0 則新訊息