[pstricks] psPoisson improvement suggestion

Herbert Voss Herbert.Voss at fu-berlin.de
Sun Aug 26 00:03:23 CEST 2007


halbard7 at aol.com wrote:
> May I submit a code modification to pst-func to bring \psPoisson in line with \psBinomial and allow a recursive
> implementation of the Poisson distribution. Here is the relevant code with the suggested changes:
>
> % pst-func.tex
>   

Gerry,
that's a good idea

> Another suggestion if I may. To avoid having to use psclip, how about an implementation of \psBinomial and \psPoisson which limits the output of rectangles on both sides,? for example 
>
> ?? \psPoisson{M}{N}{mu} which plots for M <= x <= N rather than 0 to N 
>   

that should be something like

\psPoisson{M,N}{mu} where the M is an optional argument, so that
\psPoisson{N}{mu} works in the usual way.


\def\psPoisson{\pst at object{psPoisson}}
\def\psPoisson at i#1#2{\psPoisson at ii#1,,\@nil{#2}}
\def\psPoisson at ii#1,#2,#3\@nil#4{%
  \def\pst at tempA{#2}%
 
\ifx\pst at tempA\@empty\psPoisson at iii{0}{#1}{#4}\else\psPoisson at iii{#1}{#2}{#4}\fi}
\def\psPoisson at iii#1#2#3{%
1:#1
2:#2
3:#3
....}


\psPoisson{40}{0.5}% same as \psPoisson{0,40}{0.5}
\psPoisson{20,40}{0.5}


HErbert



More information about the PSTricks mailing list