In [4]:
from __future__ import division

import numpy as np
from bokeh.io import output_notebook, show
from bokeh.plotting import figure

output_notebook()


BokehJS successfully loaded.

Warning: BokehJS previously loaded


In [11]:
n_fast = 20000

# Skip the first point because it can be troublesome
theta = np.linspace(0, 8*np.pi, n_fast)[1:]

# Compute the radial coordinates for some different spirals
lituus = theta**(-1/2)          # lituus
golden = np.exp(0.306349*theta) # golden
arch   = theta                  # Archimedean
fermat = theta**(1/2)           # Fermat's

# Now compute the X and Y coordinates
arch_x   = arch*np.cos(theta)
arch_y   = arch*np.sin(theta)
golden_x = golden*np.cos(theta)
golden_y = golden*np.sin(theta)

p = figure(title='Archimean')

p.line(arch_x, arch_y, color="red", line_width=2, legend="arch")

p.line(golden_x, golden_y, color="blue", line_width=2, legend="golden")

show(p)



In [12]:
n_slow = 5000

def r(l):
    return np.random.normal(0, 1, l)

# Skip the first point because it can be troublesome
theta = np.linspace(0, 8*np.pi, n_slow)[1:]

# Compute the radial coordinates for some different spirals
lituus = theta**(-1/2)          # lituus
golden = np.exp(0.306349*theta) # golden
arch   = theta                  # Archimedean
fermat = theta**(1/2)           # Fermat's

# Now compute the X and Y coordinates (polar mappers planned for Bokeh later)
golden_x = golden*np.cos(theta)
golden_y = golden*np.sin(theta)
arch_x   = arch*np.cos(theta)
arch_y   = arch*np.sin(theta)

ps = figure(title='Slow Archimean') 

ps.line(arch_x + r(len(arch_x)), arch_y + r(len(arch_x)), color="red", line_width=2, legend="arch")
ps.line(golden_x + r(len(golden_x)), golden_y + r(len(arch_x)), color="blue", line_width=2, legend="golden")

show(ps)