# [pstricks] [Fwd: Re: binom_distribution]

Herbert Voss LaTeX at zedat.fu-berlin.de
Mon Apr 17 12:57:50 CEST 2006

Poul Riis wrote:
> To my knowledge a binomial distribution is defined for integral values
> only.

you mean integer values.
that's correct, but the lines are connected to show that
the binomial distribution goes into the normal one for n->\infty

> 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!?

the starting value (k=0) is (1-p)^n, which is a problem for n>125,
e.g. 0.5^125\approx 2.35e-38, which is nearly the smallest value
PostScript can handle.

The latest pst-func.tex (from http://perce.de/LaTeX/pst-func/)
has two macros \psBinomial and \psBinomialN for the normalized
distribution. Attached an example image of this code:

\documentclass[12pt]{article}
\usepackage{pst-func}
\pagestyle{empty}

\begin{document}

\psset{xunit=1cm,yunit=10cm}%
\begin{pspicture}(-1,0)(7,0.55)%
\psaxes[Dy=0.2,dy=0.2\psyunit]{->}(0,0)(-1,0)(7,0.5)
\uput[-90](7,0){$k$} \uput(0,0.5){$P(X=k)$}
\psBinomial[linecolor=red,markZeros,printValue,fillstyle=vlines]{6}{0.4}
\end{pspicture}

\vspace{1cm}
\begin{pspicture}(-3,0)(4,0.55)%
\psaxes[Dy=0.2,dy=0.2\psyunit]{->}(0,0)(-3,0)(4,0.5)
\uput[-90](4,0){$z$} \uput(0,0.5){$P(Z=z)$}
\psBinomialN[linecolor=red,markZeros,fillstyle=vlines]{6}{0.4}
\end{pspicture}

\end{document}

Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bin.png
Type: image/png
Size: 8848 bytes
Desc: not available
Url : http://tug.org/pipermail/pstricks/attachments/20060417/5408254d/attachment.png