""" Simple example demonstrating graphing with functions Topic: Newton's law of Universal Gravitation Models the relationship between gravitational force and distance between two bodies. """ import matplotlib.pyplot as plt G = 6.674 * (10 ** -11) def draw_graph(x, y): plt.plot(x, y, marker="o") plt.xlabel("Distance in Meters") plt.ylabel("Gravitational Force in Newtons") plt.title("Gravitational Force and Distance") plt.show() def generate_F_r(): """Generates values for r in the New""" r = range(100, 1001, 50) F = [] m1 = 0.5 m2 = 1.5 for dist in r: force = G * (m1 / m2) / (dist ** 2) F.append(force) draw_graph(r, F) if __name__ == "__main__": generate_F_r()