I'm in a beginning python class and I'm supposed to plot this cycloid using subplots. I was given the cycloid in parametric form and told to leave it in that form.
Here are the equations I was given:
x = r (θ − sin θ )
y = r (1 − cos θ )
r
is supposed to be a user input into my function.
I don't understand how to define theta, or how to plot parametrically. thank you so much!!
Here's the code I have so far:
import matplotlib.pyplot as plt
import sympy as sp
def cycloid(r):
x = r(theta - sp.sin(theta))
y = r(1 - sp.cos(theta))
sp.plot_parametric(x, y, (r, -2*sp.pi, 2*sp.pi))
plt.show()
cycloid(5)