예제 #1
0
파일: binomial.py 프로젝트: Darkade/udlap
from distribuciones import discretas

X=discretas()

average=lambda o:float(sum(o))/len(o)



observaciones=(lambda m,p,n:[X.binomial(p,n) for i in range(0,m)])(10000000,0.5,10)

print average(observaciones)
예제 #2
0
파일: ej7.py 프로젝트: Darkade/udlap
# -*- coding: utf-8 -*-
#!/usr/bin/python

from distribuciones import discretas
from math import sqrt
import numpy as np
import pylab as P

X=discretas()
Y=discretas()


def suma_dados():
	observaciones=[]
	i=0
	while len(observaciones) < 11:
		i+=1
		observacion=X.uniforme_d(6)+Y.uniforme_d(6)
		if not (observacion in observaciones):
			observaciones.append(observacion)
	return i

observar=lambda m:[suma_dados() for i in range(m)]
av=lambda o: float(sum(o))/len(o)

m=10000

observaciones=observar(10000)
promedio=av(observaciones)

print "\n\nEjercicio 7 pagina 58"