Visualisation of many initial condition for 3d ODE

In [1]:
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
/Users/marcin/anaconda3/lib/python3.7/site-packages/traittypes/traittypes.py:101: UserWarning: Given trait value dtype "float64" does not match required type "float32". A coerced copy has been created.
  np.dtype(self.dtype).name))
/Users/marcin/anaconda3/lib/python3.7/site-packages/traittypes/traittypes.py:101: UserWarning: Given trait value dtype "int64" does not match required type "uint32". A coerced copy has been created.
  np.dtype(self.dtype).name))
In [2]:
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 [3]:
plot.display()
In [ ]:
plot.camera_auto_fit = False
plot.grid_auto_fit = False

X = p.positions
for i in range(10000):
    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 [ ]: