我有这个代码:
import random
import matplotlib.pyplot as plotttt
def simular (N):
Nd=N
c=0
while Nd>(N/2-1):
r=random.uniform(0,1)
if r<Nd/float(N):
Nd=Nd-1
else:
Nd=Nd+1
c+=1
return c
def main ():
Nmax=400
repeticiones=100
x=[]
y=[]
for j in range (2,Nmax):
promedio=0
for i in range (0,repeticiones):
promedio+=simular(j)
y.append(promedio/repeticiones)
x.append(j)
plotttt.plot (x,y,"bo")
plotttt.show()
main()
但当我试图通过终端运行时,下一个错误出现了:
^{pr2}$不过,当我在空闲状态下运行它时,不会出现任何问题。思想?在
目前没有回答
相关问题 更多 >
编程相关推荐