|
From: Allin C. <cot...@wf...> - 2007-09-04 20:15:47
|
I can get the normal and the binomial superimposed via:
comb(n,k) = n!/(k!*(n-k)!)
binom(k,n,p) = comb(int(n),int(k))*p**k*(1-p)**(n-k)
normal(x,mu,s2) = 1/(sqrt(2*pi*s2))*exp(-(x-mu)**2/(2*s2))
set parametric
p=0.5
n=8
mu=n*p
s2=n*p*(1-p)
set trange[0:n]
set samples n+1
plot t,binom(t,n,p) title 'Binomial' w lp, \
t,normal(t,mu,s2) title 'Normal'
Question: is there any way to get the normal curve to be smooth
while the binomial one is properly discrete? It seems to me this
implies conflicting settings for "samples", but maybe there's a
clever trick?
Allin Cottrell
|