Skip to content
Advertisement

Orbit of the Earth – leapfrog Python

I am trying to do this homework exercise: Orbit of the Earth

My plot does not show the whole trajectory. I don’t know if it is something wrong with my equations or if it is a plotting matter.

Cheers!

Earth trajectory Plot

JavaScript

Advertisement

Answer

Okay, so there’s a pretty funny typo:

JavaScript

That’s 16 times larger than what you most likely wanted to write and just 20% short of the solar escape velocity.

t_stop is also written as if in hours, but the rest of the code assumes normal SI seconds (as can be verified by using t_stop = 24 * 365 * 0.99 * h, which results in almost a complete orbit). It needs multiplying by h. Sidenote: I like using astropy.units to keep track of physical quantities!

The code itself works nicely, though!

Advertisement