Skip to content Skip to sidebar Skip to footer

Simulating Orbits

So I'm trying to simulate the earth travelling around the sun where the velocity of the earth is determined by the angle its at to the origin and the horizontal. I did this by crea

Solution 1:

I don't know python, but I know physics.

At each step you move the Earth a fixed distance along a tangent to the orbit, rather than along the orbit itself. That gives you an outward spiral (which will actually get less severe as you go out).

Try making the time increment smaller (e.g. by dividing the position adjustment by 100), and the spiral effect will get much smaller.

If you want to do better than that, you'll need a different formula. You could either impose a circular orbit, or do something based on conserved quantities (which requires a considerable understanding of basic physics).


Post a Comment for "Simulating Orbits"