Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. dt = 0.0005
  2.  
  3. # params
  4. a = 15
  5. b = 3
  6. c = 4
  7. d = 24
  8.  
  9. # funcs
  10. def f(x, y):
  11.     return (a*x - b*x*y)*dt + x
  12.  
  13. def g(x, y):
  14.     return (c*x*y - d*y)*dt + y
  15.  
  16. x0 = 20
  17. y0 = 4
  18.  
  19. x = [x0]
  20. y = [y0]
  21. for i in range(5000):
  22.     _x = x[i]
  23.     _y = y[i]
  24.     x.append(f(_x, _y))
  25.     y.append(g(_x, _y))
  26.    
  27. # print(x)
  28. # print(y)
  29.  
  30. from matplotlib import pyplot as plt
  31.  
  32. plt.plot(x, y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement