Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #4.2
- import random
- from random import randint
- import matplotlib
- import matplotlib.pyplot as plt
- omega=[2,4,6]
- a=[]
- n,N=0,100000
- x1=[x for x in range(0,N,100)]
- x1.remove(x1[0])
- y1=[]
- for _ in range(N):
- for i in range(3):
- a.append(random.choice(omega))
- if 6 in a:
- n+=1
- if _ in x1:
- y1.append(n/_)
- a=[]
- print(n / N)
- plt.plot(x1, y1)
- plt.title('PLOT')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment