<font face="Arial, Helvetica, sans-serif">Dear Herbert<br>
<br>
May I submit a code modification to pst-func to bring \psPoisson in line with \psBinomial and allow a recursive<br>
implementation of the Poisson distribution. Here is the relevant code with the suggested changes:<br>
<br>
% pst-func.tex<br>
.<br>
.<br>
<br>
\def\fileversion{0.49}<br>
\def\filedate{2007/12/23}<br>
.<br>
.<br>
etc<br>
.<br>
\def\psPoisson@i#1#2{%<br>
&nbsp; \begin@SpecialObj%<br>
&nbsp; \addto@pscode{<br>
&nbsp;&nbsp;&nbsp; /scx { \pst@number\psxunit mul } def<br>
&nbsp;&nbsp;&nbsp; /scy { \pst@number\psyunit mul } def<br>
&nbsp;&nbsp;&nbsp; /N #1 def<br>
&nbsp;&nbsp;&nbsp; /lambda #2 def<br>
&nbsp;&nbsp;&nbsp; /elambda Euler #2 neg exp def&nbsp; % e^-lambda<br>
&nbsp;&nbsp;&nbsp; /dx \psFunc@barwidth 2 div def<br>
&nbsp;&nbsp;&nbsp; /kOld dx neg def<br>
&nbsp;&nbsp;&nbsp; kOld scx 0 moveto&nbsp;&nbsp; % starting point<br>
&nbsp;&nbsp;&nbsp; /Y elambda def&nbsp;&nbsp;&nbsp; % start value<br>
&nbsp;&nbsp;&nbsp; 0 1 N {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % N times<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /k exch def&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % save loop variable<br>
%%%%%%%% &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; GC modified 2007-08-24<br>
%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k 0 eq { /kFaculty 1 def }{ /kFaculty kFaculty k mul def } ifelse&nbsp; % &lt;- - - original<br>
%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /Y lambda k exp kFaculty div elambda mul def&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % &lt;- - - lines<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k 0 eq { /Y elambda def }{ /Y Y lambda mul k div def } ifelse&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; % &lt;- - - new code here<br>
%%%%%%%% &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; GC modified end<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \ifPst@markZeros k dx add scx 0 L \fi<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \ifPst@printValue<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gsave \psk@PSfont findfont \psk@fontscale scalefont setfont<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Y \psk@valuewidth string cvs<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; k scx \psk@fontscale 2 div add<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Y scy \pst@number\pslabelsep add moveto<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 90 rotate show grestore<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \fi<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /kOld kOld 1 add def<br>
&nbsp;&nbsp;&nbsp; } for<br>
&nbsp;&nbsp;&nbsp; \ifPst@markZeros\else k dx add scx 0 L \fi % last line down to x-axis<br>
&nbsp; }%<br>
&nbsp; \psk@fillstyle<br>
&nbsp; \pst@stroke<br>
&nbsp; \end@SpecialObj%<br>
}<br>
.<br>
.<br>
etc<br>
<br>
This now allows \psPoisson{N}{mu} to work with N&gt;26.<br>
<br>
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,&nbsp; for example <br>
<br>
&nbsp;&nbsp; \psPoisson{M}{N}{mu} which plots for M &lt;= x &lt;= N rather than 0 to N <br>
<br>
I am thinking of making changes myself. Would you allow this as useful?<br>
<br>
Gerry Coombes<br>
<br>
<br>
<br>
<br>
</font><div class="AOLPromoFooter">
<hr style="margin-top:10px;" />
Get a FREE AOL Email account with unlimited storage.  Plus, share and store photos and experience exclusively recorded live music Sessions from your favourite artists. <a href="http://info.aol.co.uk/joinnow/?ncid=548" target="_blank">Click Here</a> for more information.<br />
</div>