Advertisement
TheAceHome

Untitled

Oct 14th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #3.13
  2. import random
  3. from random import randint
  4. import matplotlib
  5. import matplotlib.pyplot as plt
  6.  
  7. N=10000
  8. a,b,aa,bb,aaa,bbb=[],[],[],[],[],[]
  9. n,m,z = 0,0,0
  10. for i in range (N):
  11. x=random.uniform(100, 1000)
  12. y=random.uniform(100, x)
  13. if (1000-y)<(x-100):
  14. n+=1
  15. a.append(x)
  16. b.append(y)
  17. if (x-y)<450:
  18. m+=1
  19. aa.append(x)
  20. bb.append(y)
  21. if (x-y)<(1000-x):
  22. z+=1
  23. aaa.append(x)
  24. bbb.append(y)
  25. print(n/N, m/N, z/N)
  26.  
  27. xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
  28. plt.plot(a,b, linestyle="",marker="o")
  29. plt.title('PLOT')
  30. plt.show()
  31. xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
  32. plt.plot(aa,bb, linestyle="",marker="o")
  33. plt.title('PLOT')
  34. plt.show()
  35. xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
  36. plt.plot(aaa,bbb, linestyle="",marker="o")
  37. plt.title('PLOT')
  38. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement