import matplotlib.pyplot as plt
import math


xtab = []
ytab = []

for i in range(0, 628):
    # Calculate polar coordinates for provided equation
    phi = float(i) / 100.0
    r = 4 * math.cos(2 * phi)
    # Convert to Cartesian and store in lists
    x = r * math.cos(phi)
    y = r * math.sin(phi)
    xtab.append(x)
    ytab.append(y)

plt.plot(xtab, ytab)
plt.show()
[((341, 361), 'matplotlib.pyplot.plot', 'plt.plot', (['xtab', 'ytab'], {}), '(xtab, ytab)\n', (349, 361), True, 'import matplotlib.pyplot as plt\n'), ((362, 372), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (370, 372), True, 'import matplotlib.pyplot as plt\n'), ((186, 203), 'math.cos', 'math.cos', (['(2 * phi)'], {}), '(2 * phi)\n', (194, 203), False, 'import math\n'), ((262, 275), 'math.cos', 'math.cos', (['phi'], {}), '(phi)\n', (270, 275), False, 'import math\n'), ((288, 301), 'math.sin', 'math.sin', (['phi'], {}), '(phi)\n', (296, 301), False, 'import math\n')]