[pstricks] [Fwd: Re: binom_distribution]

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Sun Apr 16 14:11:56 CEST 2006

-------- Original Message --------
Subject: Re: binom_distribution
Date: Sun, 16 Apr 2006 13:28:23 +0200
From: Herbert Voss <Herbert.Voss at gmx.net>
Newsgroups: comp.text.tex
References: <Oud0g.25228$7a.4617 at pd7tw1no>

John Campbell wrote:
> Sorry if this a FAQ, but is there an simple way to use ps-plot to make a 
> binomial distribution, or should I just get the data, and use multido?

here is a PSTricks solution which gives this output:
If it really helps, I'll put into pst-func.


\def\psBinom{\pst at object{psBinom}}
\def\psBinom at i#1{%
   \begin at SpecialObj%
   \addto at pscode{
     /scx { \pst at number\psxunit mul } def
     /scy { \pst at number\psyunit mul } def
     /BinScale { scy 2 N exp div exch N div scx exch } def
     /N #1 def
     /Y 1 def
     0 0 moveto
     /kOld 0 def
     1 1 N {
       /k exch def
       /Y Y N k sub 1 add mul k div def
       kOld Y BinScale L k Y BinScale L
       \ifPst at markZeros k 0 BinScale L \fi
       /kOld k def
     } for
   \end at SpecialObj%


\psBinom[markZeros]{9}% option defined in pst-func


More information about the PSTricks mailing list