Learn practical skills, build real-world projects, and advance your career

Create a Harmonograph

import numpy as np # linear algebra
import matplotlib.pyplot as plt # for plotting
n = 1000000
t = np.logspace(np.log10(10), np.log10(500), n)

A = [1, 1, 1.5, 1.5]
d = [.004, .001, .002, .0015]
f = [3, 1, 2, 2.5]

x = A[0]*np.sin(t*f[0])*np.exp(-d[0]*t) + A[1]*np.sin(t*f[1])*np.exp(-d[1]*t)
y = A[2]*np.sin(t*f[2])*np.exp(-d[2]*t) + A[3]*np.sin(t*f[3])*np.exp(-d[3]*t)

plt.plot(x,y,'k',linewidth=.1)
plt.axis('off')
plt.show
<function matplotlib.pyplot.show(*args, **kw)>
Notebook Image
!pip install jovian --upgrade -q
WARNING: You are using pip version 20.1; however, version 20.1.1 is available. You should consider upgrading via the '/opt/conda/bin/python3.7 -m pip install --upgrade pip' command.
import jovian