In [1]:
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
display(Math('x = a \\cos(t)^3'))
display(Math('y = a \\sin(t)^3'))
display(Math('a = t'))
$\displaystyle x = a \cos(t)^3$
$\displaystyle y = a \sin(t)^3$
$\displaystyle a = t$
In [3]:
t = np.linspace(-6*np.pi,6*np.pi,1000)

a = t

x = a * np.cos(t)**3
y = a * np.sin(t)**3

plt.plot(x,y,'m',linewidth=2)
plt.axis('off')
plt.axis('square')
plt.show()

Exercise

In [4]:
display(Math('a = t^n'))
display(Math('n \\quad \\epsilon \\quad \\{ 0,2,...,8 \\}'))
$\displaystyle a = t^n$
$\displaystyle n \quad \epsilon \quad \{ 0,2,...,8 \}$
In [5]:
row,col = np.indices((3,3))
print(row)
print('')
print(col)
print('')
print(row.ravel())
print(col.ravel())
[[0 0 0]
 [1 1 1]
 [2 2 2]]

[[0 1 2]
 [0 1 2]
 [0 1 2]]

[0 0 0 1 1 1 2 2 2]
[0 1 2 0 1 2 0 1 2]
In [6]:
fig,ax = plt.subplots(3,3,figsize=(10,6))
row,col = np.indices((3,3))

for i in range(9):
    a = t**i

    x = a * np.cos(t)**3
    y = a * np.sin(t)**3
    
    r = row.ravel()[i]
    c = col.ravel()[i]
    
    ax[r,c].plot(x,y,'k')
    ax[r,c].axis('off')
    ax[r,c].axis('square')

plt.show()