vpython) How to simulate kepler's 2nd law?

922 views Asked by At

I'm very new to python but I need to simulate kepler's second law through vpython! I've got the orbit going so far but I don't know how to code the sweeping motion and how to code the r, theta etc. Can anyone help?

http://en.wikipedia.org/wiki/File:Kepler-second-law.gif this is the kind of thing I want to make! Thank you for your help!

1

There are 1 answers

0
DeltaG On

I would define an area variable before the loop along with a time interval (bigger than the dt from the loop's iteration). During the loop, add the small bit of area accumulated during that pass through the loop to the area variable (treat it like a triangle or a circular segment) and wait until the time is evenly divisible by the time interval. At that point, print the area, reset the area variable, and keep going. You should get a list of area values, all close to each other. Vary the time interval to take "bigger chunks" of the orbit, which should also all agree with each other.