Question: Python Write a function integrate _ earth ( tmax, d t = 1 e - 3 that returns the trajectory of the Earth, assuming that

Python Write a function integrate_earth ( tmax,dt=1e-3 that returns the trajectory of the Earth, assuming that the Earth only feels the attraction from the Sun.
Produce a trajectory for time 0t tmax in steps of dt.
dt is an optional argument with default value 110-3yr.
Return a (N,3 numpy array for the x,y,z coordinates of the earth.
(Note: numpy arrays are containers, so if you are changing a numpy array r in place with r+=v***dt in your code then you need to copy them when appending to your results list, e.g.,
r_values.append (r.copy())
Otherwise you'll find that your list contains N times the same three numbers. If you don't use inplace operations then that's not a problem for you, but the copy is still safe.)
TEST: 1-year Trajectory
Compute and visualize the trajectory for 1 yr:
Run integrate_earth(1).
Plot the x and y coordinates.
Label the axes "x(AU)" and "y(AU)".
Write the figure to the file 'orbit_earth_only.png'.
 Python Write a function integrate_earth ( tmax,dt=1e-3 that returns the trajectory

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!