Skip to content

Instantly share code, notes, and snippets.

@electronut
Created November 24, 2017 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save electronut/ee46d455233f167ad4c7fdde8e2504ae to your computer and use it in GitHub Desktop.
Save electronut/ee46d455233f167ad4c7fdde8e2504ae to your computer and use it in GitHub Desktop.
lorenz1.py
# parameters
P = 10
A = 28
B = 8.0/3.0
dt = 0.01
# initial conditions
x = 1.0
y = 1.0
z = 1.0
self.scale = 5
def lorenz():
nonlocal x, y, z
x = x + dt*P*(y - x)
y = y + dt*(x*(A - z) - y)
z = z + dt*(x*y - B*z)
return (x, y, z)
return lorenz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment