Lorenz systemΒΆ

The Lorenz system. See deeptime.data.lorenz_system().

plot lorenz system
 8 import deeptime
 9 import numpy as np
10 import matplotlib.pyplot as plt
11 from mpl_toolkits.mplot3d.art3d import Line3DCollection
12
13 system = deeptime.data.lorenz_system()
14 x0 = np.array([[8, 7, 15]])
15 traj = system.trajectory(x0, 3500)
16
17 ax = plt.figure().add_subplot(projection='3d')
18 ax.scatter(*x0.T, color='blue', label=r"$t_\mathrm{start}$")
19 ax.scatter(*traj[-1].T, color='red', label=r"$t_\mathrm{final}$")
20
21 points = traj.reshape((-1, 1, 3))
22 segments = np.concatenate([points[:-1], points[1:]], axis=1)
23 coll = Line3DCollection(segments, cmap='coolwarm')
24 coll.set_array(np.linspace(0, 1, num=len(points), endpoint=True))
25 coll.set_linewidth(2)
26 ax.add_collection(coll)
27 ax.set_xlim3d((-19, 19))
28 ax.set_ylim3d((-26, 26))
29 ax.set_zlim3d((0, 45))
30 ax.set_box_aspect(np.ptp(traj, axis=0))
31 ax.legend()

Total running time of the script: ( 0 minutes 0.700 seconds)

Estimated memory usage: 8 MB