|
# within ipython --pylab
|
|
from scipy.special import factorial
|
|
|
|
top = 5
|
|
|
|
def p(x, mean):
|
|
return exp(-mean)*mean**x / factorial(x)
|
|
|
|
x, mean = meshgrid( arange(2*top+1), linspace(0.5,top,12) )
|
|
pp = p(x,mean)
|
|
|
|
gcf().clear()
|
|
plot(x.T,pp.T, alpha=0.5, marker='.');
|
|
legend([f"mean={m:.2f}" for m in unique(mean)]);
|
|
xlabel('x') ; ylabel('P(x)');
|