This is a short notebook on plotting some beautiful polar graphs in python using very simple functions and code. This something that can be taken as an exercise as well as a piece of art to admire and to learn.
This is one of the first curves I discovered when I was reading a book on differential calculus. It was an old book and was full of curve tracing. Cardioid as you might have guessed has it's roots in the greek word for heart. The equation is
$$r = a + b*cos(\theta)$$
where
$$\theta \in [\ 0, 2 \pi]\ $$
Of course it is plotted as a Polar Graph. If you wanna read up more on Cardioid and I suggest you should head over to the wikipedia page
In [12]:
%matplotlib inline
import matplotlib.pyplot as plt
from numpy import *
In [13]:
theta = arange(0.0, 2*pi , 0.1)
In [14]:
a = 1.0
b = 1.0
In [15]:
r = map(lambda x:a + b*cos(x),theta)
Now we plot it as a polar plot
In [16]:
plt.polar(theta, r)
Out[16]:
In [ ]: