Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- person_x = 0.0
- universe_size = 100.0
- person_speed = 10.0
- universe_increment = universe_size
- seconds = 0
- history = []
- while person_x < universe_size:
- history.append((seconds, person_x/universe_size, universe_size-person_x))
- seconds += 1
- person_x += 10
- person_x += universe_increment*person_x/universe_size
- universe_size += universe_increment
- history.append((seconds,person_x/universe_size, universe_size-person_x))
- plt.plot([x[0] for x in history], [x[1] for x in history])
- plt.xlabel('seconds')
- plt.ylabel('percent of universe covered')
- plt.show()
- plt.plot([x[0] for x in history], [x[2] for x in history])
- plt.xlabel('seconds')
- plt.ylabel('absolute distance from end')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement