# [pstricks] [Fwd: Re: binom_distribution]

John Campbell jcdotcalm at shaw.ca
Mon Apr 17 17:39:54 CEST 2006

Thanks very much for your reply.  It was very helpful.

J. Campbell
----- Original Message -----
From: "Poul Riis" <Poul.Riis at skolekom.dk>
To: "Graphics with PSTricks" <pstricks at tug.org>
Sent: Monday, April 17, 2006 2:22 AM
Subject: Re: [pstricks] [Fwd: Re: binom_distribution]

> To my knowledge a binomial distribution is defined for integral values
> only.
> I don't fully understand why the following seems to work...
> - And furthermore, I don't understand why it doesn't work for all values
> of n and p!?
> Who can improve it?
>
> Yours,
> Poul Riis
>
>
>
> \documentclass[a4paper,12pt]{article}
> \usepackage{pst-func}
> \usepackage{multido}
> \pagestyle{empty}
>
> \newcommand{\binomialdistr}[2]{%
> \pstVerb{%
> /nn #1 def%
> /pp #2 def%
> /prob 1 pp sub nn exp def%
> }%
> \psset{xunit=1cm,yunit=5cm}%
> \begin{pspicture}(0,0)(#1,1)%
> \SpecialCoor%
> \psaxes[ticksize=-2pt 0,Dy=0.1]{->}(0,0)(0,0)(#1,1)%
> \psline[linecolor=red,linewidth=3pt](!0 0)(!0 prob)%
> \uput[90]{90}(!0
> prob){\psPrintValue[valuewidth=10,fontscale=8,linecolor=blue]{prob}}%
> \multido{\nj=0+1}{#1}{%
> \pstVerb{%
> /probold prob def%
> /prob pp 1 pp sub div nn \nj\space sub mul \nj\space 1 add div probold mul
> def%
> }%
> prob)%
> prob){\psPrintValue[valuewidth=10,fontscale=8,linecolor=blue]{prob}}%
> }%
> \end{pspicture}%
> }%
>
> \begin{document}
> Binomial distribution with pstricks....\\[1cm]
> \binomialdistr{6}{0.4}
> \end{document}
>
>

--------------------------------------------------------------------------------

>
>
> ###########################################
> Denne meddelelse med evt. vedlæg  er scannet af SkoleKom ved hjælp af
> F-Secure virusscanner.
>
> Meddelelsen kan læses sikkert. Det kán i sjældne tilfælde være kritisk at
> hente vedlæg.
> Kontakt din systemadministrator, hvis du er i tvivl.
>
> For yderligere information,
> http://forside.skolekom.dk/indhold/punkt1/viruspolitik
>

--------------------------------------------------------------------------------

> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>