#! /usr/bin/env python """ This program plots the so-called deltoid curve, which is defined parametrically by the equations: x = 2cos(theta) + cos(2theta), y = 2sin(theta) - sin(2theta) Paul Eugenio Florida State University PHZ4151C 29 Jan 2019 """ from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np # use latex rendering in lables plt.rc('text', usetex=True) # define parameters thetaMin, thetaMax = 0, 2*np.pi steps = 100 # Using the numpy vectorization, one can easily # create x & y arrays for plotting # theta = np.linspace(thetaMin, thetaMax, steps) x = 2*np.cos(theta) + np.cos(2*theta) y = 2*np.sin(theta) - np.sin(2*theta) # plot curve and decorate with latex equation plt.plot(x, y) plt.xlabel(r"$2cos(\theta) + cos(2\theta)$") plt.ylabel(r"$2sin(\theta) - sin(2\theta)$") plt.title("Deltroid curve") plt.savefig("deltroid.png") plt.show()