-
Notifications
You must be signed in to change notification settings - Fork 0
Solar System
Nawaf Abdullah edited this page Feb 12, 2019
·
3 revisions
The System class, contained in SIM_SolarSys.py script, allows the user to create an N-body solar system simulation using one or multiple instances of Planet.
# Create a solar system instance
sys = System(500000)
# Create a Planet instance
pl1 = Planet(4, 1, -1, 0, 2)
# Add the planet to the system
sys.add_planet(pl1)
pl2 = Planet(2, -2, -2, -0.8, 0.2)
sys.add_planet(pl2)
pl3 = Planet(3, -1, -1, 2, 0)
sys.add_planet(pl3)
pl4 = Planet(10, 1.5, 1.5, 1.5, -0.5)
sys.add_planet(pl4)
# Calculate the trajectory of the planets in the system
sys.calc_system(10000, 0.001)
# Plot the system trajectories
sys.plot()

Yep... this is the plot that was used as a logo for the project because it is pretty cool.