In [43]:
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from scipy.integrate import odeint
from mpl_toolkits.mplot3d import Axes3D
rho = 28.0
sigma = 10.0
beta = 8.0 / 3.0
def f(state, t):
x, y, z = state # unpack the state vector
return sigma * (y - x), x * (rho - z) - y, x * y - beta * z # derivatives
state0 = [14,
np.sqrt(8.0*27/3),
np.sqrt(8.0*27/3),
]
state0 = [6.48, 8.48, 27]
t = np.arange(0.0, 110.0, 0.1)
states = odeint(f, state0, t)
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot(states[:,0], states[:,1], states[:,2])
plt.show()
In [44]:
states
Out[44]:
In [45]:
plt.plot(states)
Out[45]: