In [1]:
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
display(Math('x = \\cos(r_1\\theta)'))
display(Math('y = \\sin(r_2\\theta)'))
display(Math('r_1,r_2 = \\text {random}(0,1)'))
$\displaystyle x = \cos(r_1\theta)$
$\displaystyle y = \sin(r_2\theta)$
$\displaystyle r_1,r_2 = \text {random}(0,1)$
In [14]:
t = np.linspace(0,8*np.pi,1000)

r1 = np.random.rand()
r2 = np.random.rand()

# r1 = 1
# r2 = 1

x = np.cos(r1*t)
y = np.sin(r2*t)

plt.plot(t,x, t,y)
plt.show()

x = np.append(x,x[0])
y = np.append(y,y[0])

plt.plot(x,y)
plt.axis('square')
plt.axis([-1.1,1.1,-1.1,1.1])
plt.axis('off')
plt.title('r$_1$=%s,r$_2$=%s' %(np.round(r1,2),np.round(r2,2)))
plt.show()