Created
June 6, 2015 04:14
-
-
Save vanzaj/fb02668fd8ee07275d47 to your computer and use it in GitHub Desktop.
mystery_curve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.johndcook.com/blog/2015/06/03/mystery-curve/ | |
import matplotlib.pyplot as plt | |
from numpy import pi, exp, real, imag, linspace | |
def f(t): | |
'''$\exp^{it} – \exp^{6it}/2 + i \exp^{-14it}/3$ with $t$ running from 0 to 2$\pi$.''' | |
return exp(1j*t) - exp(6j*t)/2 + 1j*exp(-14j*t)/3 | |
t = linspace(0, 2*pi, 1000) | |
plt.plot(real(f(t)), imag(f(t))) | |
# These two lines make the aspect ratio square | |
fig = plt.gcf() | |
fig.gca().set_aspect('equal') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment