In [1]:
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
print('Logarithmic spiral')
display(Math('\\cos(t)'))
display(Math('e^{-t}'))
display(Math('x = \\cos(t)e^{t/k}'))
display(Math('y = \\sin(t)e^{t/k}'))
Logarithmic spiral
$\displaystyle \cos(t)$
$\displaystyle e^{-t}$
$\displaystyle x = \cos(t)e^{t/k}$
$\displaystyle y = \sin(t)e^{t/k}$
In [3]:
t = np.linspace(0,10*np.pi,1234)

k = -3

x = np.cos(t) * np.exp(t/k)
y = np.sin(t) * np.exp(t/k)

plt.plot(x,y)
plt.axis('square')
plt.axis('off')
plt.show()

Exercise

In [4]:
N = 150

ks = np.linspace(-6,-2,N)

for i in range(N):
    x = np.cos(t) * np.exp(t/ks[i])
    y = np.sin(t) * np.exp(t/ks[i])
    plt.plot(x,y,color=[i/N,0,i/N])

plt.axis('square')
plt.axis('off')
plt.show()