[pstricks] [Fwd: Re: binom_distribution]

John Campbell jcdotcalm at shaw.ca
Wed Apr 19 06:11:34 CEST 2006


Not sure if you are aware that H. Voss has improved pst-func as of Apr. 17 
to include a macro for the bin. distr.

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


> Just want to show that I found my stupid errors! Of course Herberts
> version is much better and more general (except that I prefer thin rods in
> stead of unit-wide bars).
>
> Yours,
> Poul Riis
>
> \documentclass[a4paper,12pt]{article}
> \usepackage{pstricks-add}
> \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=5mm,yunit=10cm}%
> \SpecialCoor%
> \begin{pspicture}(0,0)(#1,1)%
> \psaxes[ticksize=-2pt 0,Dx=1,Dy=0.1]{->}(0,0)(0,0)(#1,1)%
> \psline[linecolor=red,linewidth=2pt](!0 0)(!0 prob)%
> \uput[90]{90}(!0
> prob){\psPrintValue[valuewidth=12,fontscale=8,linecolor=blue]{prob}}%
> \multido{\nj=1+1}{#1}{%
> \pstVerb{%
> /probold prob def%
> /prob pp 1 pp sub div nn \nj\space sub 1 add mul \nj\space div probold mul
> def%
> }%
> \psline[linecolor=red,linewidth=2pt](!\nj\space 0)(!\nj\space prob)%
> \uput[90]{90}(!\nj\space
> prob){\psPrintValue[valuewidth=12,fontscale=8,linecolor=blue]{prob}}%
> \uput[270]{0}(!#1 0){$j$}%
> \uput[0]{90}(!0 0.9){$P(X=j)$}%
> \uput[90]{0}(!#1 2 div
> 0.9){$n=\;$\psPrintValue[valuewidth=6,fontscale=12]{#1}}%
> \uput[90]{0}(!#1 2 div
> 0.85){$p=\;$\psPrintValue[valuewidth=6,fontscale=12]{#2}}%
> }%
> \end{pspicture}%
> }%
>
> \begin{document}
> Binomial distribution with pstricks....\\[1cm]
> \binomialdistr{12}{0.25}
> \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
> 




More information about the PSTricks mailing list