Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Moon orbits Earth, Earth orbits Sun
- # Juhani Kaukoranta 7.6.2018
- import matplotlib.pyplot as plt
- from math import pi
- import numpy as np
- u = np.arange(0,2*pi,0.01)
- # Moon orbit
- xM = 8*np.cos(u) + np.cos(13.4*u)
- yM = 8*np.sin(u) + np.sin(13.4*u)
- plt.plot(xM,yM, label = "Moon")
- # Earth orbit Sun
- xE = 8*np.cos(u)
- yE = 8*np.sin(u)
- plt.plot(xE,yE, label = "Earth")
- # Sun plot
- plt.plot(0,0,'yo')
- plt.title('Moon orbit Earth, Earth orbit Sun')
- plt.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement