Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #3.13
- import random
- from random import randint
- import matplotlib
- import matplotlib.pyplot as plt
- N=10000
- a,b,aa,bb,aaa,bbb=[],[],[],[],[],[]
- n,m,z = 0,0,0
- for i in range (N):
- x=random.uniform(100, 1000)
- y=random.uniform(100, x)
- if (1000-y)<(x-100):
- n+=1
- a.append(x)
- b.append(y)
- if (x-y)<450:
- m+=1
- aa.append(x)
- bb.append(y)
- if (x-y)<(1000-x):
- z+=1
- aaa.append(x)
- bbb.append(y)
- print(n/N, m/N, z/N)
- xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
- plt.plot(a,b, linestyle="",marker="o")
- plt.title('PLOT')
- plt.show()
- xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
- plt.plot(aa,bb, linestyle="",marker="o")
- plt.title('PLOT')
- plt.show()
- xmin, xmax, ymin, ymax = plt.axis([0, 1000, 0, 1000])
- plt.plot(aaa,bbb, linestyle="",marker="o")
- plt.title('PLOT')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement