jkitchin / pycse

Python computations in science and engineering
GNU General Public License v2.0
242 stars 67 forks source link

code that fails to publish #3

Closed jkitchin closed 11 years ago

jkitchin commented 11 years ago

this code silently fails to publish.

import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt

rho = 28. sigma = 10. beta = 8. / 3. x0 = y0 = z0 = 1.

def sys(f, t): x,y,z = f return np.array([sigma * (y - x), x * (rho - z) - y, x * y - beta * z])

tspan = np.linspace(0., 10., 1000)

ans = odeint(sys, np.array([x0, y0, z0]), tspan)

x = ans[:,0] y = ans[:,1] z = ans[:,2]

fig = plt.figure() res = fig.gca(projection='3d') res.plot(x, y, z) res.set_xlabel('x') res.set_ylabel('y') res.set_zlabel('z') res.set_title('Coupled ODE Solution Plot') plt.show()

jkitchin commented 11 years ago

this was an error in defining ode as sys, which overwrote the sys module.