In [ ]:
import k3d
import numpy as np
points_number = 11200
positions = 50 * np.random.random_sample((points_number,3)) - 25
colors = np.random.randint(0, 0x777777, points_number)
plot = k3d.plot()
p = k3d.points(positions, colors, point_size=1)
plot += p
sigma=10.0
beta=8./3
rho=28.0
def lorenz_deriv(X, sigma=sigma, beta=beta, rho=rho):
"""Compute the time-derivative of a Lorenz system."""
x, y, z = X.T
return np.vstack([sigma * (y - x), x * (rho - z) - y, x * y - beta * z]).T
In [ ]:
X = p.positions
colors = p.colors
m = (X[:,0]-.5*X[:,1])>0
colors = np.random.randint(0, 0x777777, points_number)
colors[m]=1
colors[~m]=0xff0000
p.colors = colors
In [ ]:
plot.display()
In [ ]:
plot.camera_auto_fit = False
plot.grid_auto_fit = False
X = p.positions
for i in range(100):
X = X + lorenz_deriv(X, sigma=sigma, beta=beta, rho=rho)*0.005
if i%1==0 and i>0:
p.positions = X[::1,:]
p.positions = X
In [ ]:
%time X = X + lorenz_deriv(X, sigma=sigma, beta=beta, rho=rho)*0.005
%time p.positions = X
In [ ]:
%time p.positions = X[::10,:]
In [ ]:
p.point_size =1
In [ ]: