MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Poisson random numbers

  • Subject: [mg3232] Re: Poisson random numbers
  • From: txp at pi.net (JanHolland)
  • Date: 19 Feb 1996 11:04:13 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: txp
  • Sender: daemon at wri.com




onm010 at uni-essen.de (Dr. Stefan P. Mueller) wrote:

>Does anybody have a Poisson random number generator or do I have to write
>my own? I could not find anything on MathSource.

>Stefan

>-- 
>Dr. Stefan P. Mueller, Nuklearmedizin, Universitaetsklinikum, Essen,
> e-mail: onm010 at uni-essen.de, phone: <49> 201/ 723-4179, FAX: -5964

May be this is what you mean:

average=2;
p=PoissonDistribution[average];
d=Table[Random[p],{100}];
Short[d]
xmax=Max[d,2*average,2]
q=NormalDistribution[average,average^.5] 
e=BinCounts[d,{0,xmax,1}]    (* which results from Poisson with freq y  *)
f=Sum[e[[y]],{y,1,xmax}]     (* totaal of the frequenties *)
g=N[e/f,2]		  (* relatieve frequenties, 2 cijfers precision *)
ymax=Max[g]
gauss=Plot[Evaluate[PDF[q,x]],{x,0,xmax}
	,PlotRange->{0,1.5 ymax}]
	(*,Axes-> Automatic]*)  (* Plot of the Gauss-distr[av,root(av)] *)
poiss=BarChart[g, PlotRange -> {0,1.5 ymax}] (* idem of the Poisson[av] *)
Show[poiss,gauss
	,PlotLabel->"Poisson[2],Gauss[2,Root[2]]"
	(* ,AxesLabel->"Klaswaarde,Klasfrequentie" *)

,Ticks->{{{1,"0"},{6,"5"},{11,"10"},{16,"15"},{21,"20"},{26,"25"},{30,"30"},{35,"35"}}
		,Automatic} ]

It is inspired by: "Applied Mathematica" by Shaw/Tigg, Addison Wesley page 361


---------------------------------------------------------------
Jan Holland txp at pi.net 
Individual/society/state/environment never existed separately. They needed each other to survive, so ...
Mutual assistance helps to survive=adapt=develop.
I send personal e-mail-copy for information, 
but prefer reaction in the group.



  • Prev by Date: Re: Poisson random numbers
  • Next by Date: Re: How to change ( the blue ) frame color on X front-end ?
  • Previous by thread: Re: Poisson random numbers
  • Next by thread: Should I buy 2.2.4?