A cardioid is a two-dimensional plane figure that has a heart-shaped curve described in polar coordinates by the equation r = 2a(1 + cos θ) for 0 ≤ θ ≤ 2π:
import numpy as np import matplotlib.pyplot as plt theta = np.linspace(0, 2.*np.pi, 1000) a = 1.0 r = 2 * a * (1. + np.cos(theta)) plt.polar(theta , r) plt.savefig("ex405.png", dpi=100) plt.show()
Recent Comments