From 0201728be568157e7cd5c49141ab78608354494f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 18 Mar 2007 23:41:54 +0000 Subject: pst-func 0.48 (18mar07) git-svn-id: svn://tug.org/texlive/trunk@4049 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-func/Changes | 2 + Master/texmf-dist/doc/generic/pst-func/README | 5 +- .../doc/generic/pst-func/pst-func-doc.bib | 8 +- .../doc/generic/pst-func/pst-func-doc.pdf | Bin 2139045 -> 2177985 bytes .../doc/generic/pst-func/pst-func-doc.tex | 192 ++++++++++++++------- Master/texmf-dist/source/generic/pst-func/Makefile | 49 ++++++ .../texmf-dist/tex/generic/pst-func/pst-func.tex | 44 ++++- Master/texmf-dist/tpm/pst-func.tpm | 7 +- Master/texmf/lists/pst-func | 2 +- 9 files changed, 228 insertions(+), 81 deletions(-) create mode 100644 Master/texmf-dist/source/generic/pst-func/Makefile diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes index ea80f23b4c8..15482a342be 100644 --- a/Master/texmf-dist/doc/generic/pst-func/Changes +++ b/Master/texmf-dist/doc/generic/pst-func/Changes @@ -1,4 +1,6 @@ ..... pst-func.tex +0.48 2007-03-17 - add another distribution function: psPoisson +0.47 2007-02-01 - add support of arrows for psPolynomial 0.46 2006-09-06 - using the bool key from xkeyval - adding the superellipse function (Lame curve) - uses pstricks-add for algebraic plot diff --git a/Master/texmf-dist/doc/generic/pst-func/README b/Master/texmf-dist/doc/generic/pst-func/README index 7aabf8766ee..0989cb41c24 100644 --- a/Master/texmf-dist/doc/generic/pst-func/README +++ b/Master/texmf-dist/doc/generic/pst-func/README @@ -2,13 +2,14 @@ pst-func: plotting special mathematical functions: -- psPolynomial (with derivations) -- psFourier -- psBessel --- psGauss --- psGaussI (integral) -- psSi and pssi (integral sin) -- psCi (integral cosin) -- psIntegral -- psCumIntegral -- psConv +-- psGauss +-- psGaussI (integral) +-- psPoisson -- psBinomial -- psBinomialN -- psLame (Lam\`e\ Curve -- a superellipse) diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.bib b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.bib index e9393cce5f0..b69387bdb29 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.bib +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.bib @@ -62,8 +62,8 @@ Samarin}, title = {The {\LaTeX} {G}raphics {C}ompanion}, publisher = {{Addison-Wesley Publishing Company}}, - year = {1994}, - edition = {1.}, + year = {2004}, + edition = {2.}, address = {Reading, Mass.} } @@ -135,9 +135,9 @@ @Book{PSTricks2, author = {Herbert Vo\ss}, title = {\texttt{PSTricks} -- {G}rafik f\"ur \TeX{} und \LaTeX}, - edition = {third}, + edition = {4.}, publisher = {DANTE -- Lehmanns}, - year = {2006}, + year = {2007}, address = {Heidelberg/Hamburg} } diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf index 06166d0f462..eae559b4ce2 100644 Binary files a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf and b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex index 200ea4439f9..92255041f8e 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex @@ -358,68 +358,6 @@ way, at the cost of some reduction in graphics resolution. } \end{LTXexample} -\clearpage -\section{\CMD{psGauss} and \CMD{psGaussI}} -The Gauss function is defined as -% -\begin{align} -f(x) &= \dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{\left(x-\mu\right)^2}{2\sigma{}^2}} -\end{align} -% -\noindent The syntax of the macros is -\begin{verbatim} -\psGauss[options]{xStart}{xEnd} -\psGaussI[options]{xStart}{xEnd} -\end{verbatim} - -%%JF -%% comment, the angle brackets below, around "value", make sense -%% as a convention, so I left them in -% -%\noindent where the only new parameter is \verb+sigma=+, with -%the default of \verb+0.5+ and can also be set in the usual way with -%\verb+\psset+. It is only valid for the \verb+psGauss+-macro. -\noindent where the only new parameter are \verb+sigma=+ and \verb+mue=+ for the -horizontal shift, -which can also be set in the usual way with \verb+\psset+. It is -significant only for the \verb+psGauss+- and \verb+\psGaussI+-macro. The default is -\verb+sigma=0.5+ and \verb+mue=0+. The integral is caclulated wuth the Simson algorithm -and has one special option, called \verb+Simpson+, which defines the number of intervalls per step -and is predefined with 5. - -\bgroup -\psset{yunit=4cm,xunit=3} -\begin{pspicture}(-2,-0.2)(2,1.4) -% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0] - \psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1.25) - \uput[-90](6,0){x}\uput[0](0,1){y} - \rput[lb](1,0.75){\textcolor{red}{$\sigma =0.5$}} - \rput[lb](1,0.5){\textcolor{blue}{$\sigma =1$}} - \rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{(x-\mu)^2}{2\sigma{}^2}}$} - \psGauss[linecolor=red, linewidth=2pt]{-1.75}{1.75}% - \psGaussI[linewidth=1pt,yunit=0.75]{-2}{2}% - \psGauss[linecolor=cyan, mue=0.5, linewidth=2pt]{-1.75}{1.75}% - \psGauss[sigma=1, linecolor=blue, linewidth=2pt]{-1.75}{1.75} -\end{pspicture} -\egroup - - -\begin{lstlisting}[xrightmargin=-2cm] -\psset{yunit=4cm,xunit=3} -\begin{pspicture}(-2,-0.5)(2,1.25) -% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0] - \psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1.25) - \uput[-90](6,0){x}\uput[0](0,1){y} - \rput[lb](1,0.75){\textcolor{red}{$\sigma =0.5$}} - \rput[lb](1,0.5){\textcolor{blue}{$\sigma =1$}} - \rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{(x-x_0)^2}{2\sigma{}^2}}$} - \psGauss[linecolor=red, linewidth=2pt]{-1.75}{1.75}% - \psGaussI[linewidth=1pt,yunit=0.75cm]{-2}{2}% - \psGauss[linecolor=cyan, mue=0.5, linewidth=2pt]{-1.75}{1.75}% - \psGauss[sigma=1, linecolor=blue, linewidth=2pt]{-1.75}{1.75} -\end{pspicture} -\end{lstlisting} - \clearpage \section{\CMD{psSi}, \CMD{pssi} and \CMD{psCi}} @@ -535,8 +473,70 @@ In the second example, a convolution is performed using two rectangle functions. The result (in red) is a trapezoid function. \clearpage +\section{Distributions} +\subsection{Normal Distribution (Gauss)} +The Gauss function is defined as +% +\begin{align} +f(x) &= \dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{\left(x-\mu\right)^2}{2\sigma{}^2}} +\end{align} +% +\noindent The syntax of the macros is +\begin{verbatim} +\psGauss[options]{xStart}{xEnd} +\psGaussI[options]{xStart}{xEnd} +\end{verbatim} + +%%JF +%% comment, the angle brackets below, around "value", make sense +%% as a convention, so I left them in +% +%\noindent where the only new parameter is \verb+sigma=+, with +%the default of \verb+0.5+ and can also be set in the usual way with +%\verb+\psset+. It is only valid for the \verb+psGauss+-macro. +\noindent where the only new parameter are \verb+sigma=+ and \verb+mue=+ for the +horizontal shift, +which can also be set in the usual way with \verb+\psset+. It is +significant only for the \verb+psGauss+- and \verb+\psGaussI+-macro. The default is +\verb+sigma=0.5+ and \verb+mue=0+. The integral is caclulated wuth the Simson algorithm +and has one special option, called \verb+Simpson+, which defines the number of intervalls per step +and is predefined with 5. + +\bgroup +\psset{yunit=4cm,xunit=3} +\begin{pspicture}(-2,-0.2)(2,1.4) +% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0] + \psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1.25) + \uput[-90](6,0){x}\uput[0](0,1){y} + \rput[lb](1,0.75){\textcolor{red}{$\sigma =0.5$}} + \rput[lb](1,0.5){\textcolor{blue}{$\sigma =1$}} + \rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{(x-\mu)^2}{2\sigma{}^2}}$} + \psGauss[linecolor=red, linewidth=2pt]{-1.75}{1.75}% + \psGaussI[linewidth=1pt,yunit=0.75]{-2}{2}% + \psGauss[linecolor=cyan, mue=0.5, linewidth=2pt]{-1.75}{1.75}% + \psGauss[sigma=1, linecolor=blue, linewidth=2pt]{-1.75}{1.75} +\end{pspicture} +\egroup -\section{\CMD{psBinomial} and \CMD{psBinomialN}} + +\begin{lstlisting}[xrightmargin=-2cm] +\psset{yunit=4cm,xunit=3} +\begin{pspicture}(-2,-0.5)(2,1.25) +% \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0] + \psaxes[Dy=0.25]{->}(0,0)(-2,0)(2,1.25) + \uput[-90](6,0){x}\uput[0](0,1){y} + \rput[lb](1,0.75){\textcolor{red}{$\sigma =0.5$}} + \rput[lb](1,0.5){\textcolor{blue}{$\sigma =1$}} + \rput[lb](-2,0.5){$f(x)=\dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{(x-x_0)^2}{2\sigma{}^2}}$} + \psGauss[linecolor=red, linewidth=2pt]{-1.75}{1.75}% + \psGaussI[linewidth=1pt,yunit=0.75cm]{-2}{2}% + \psGauss[linecolor=cyan, mue=0.5, linewidth=2pt]{-1.75}{1.75}% + \psGauss[sigma=1, linecolor=blue, linewidth=2pt]{-1.75}{1.75} +\end{pspicture} +\end{lstlisting} + + +\subsection{Binomial Distribution}\label{sec:bindistri} These two macros plot binomial distribution, \CMD{psBinomialN} the normalized one. It is always done in the $x$-Intervall $[0;1]$. @@ -672,9 +672,67 @@ valid vor \CMD{psBinomialN}. The option \verb+showpoints+ is valid if \verb+curv \end{pspicture*} \end{LTXexample} -\clearpage + +\subsection{Poisson Distribution} +Given a Poisson process\footnote{\url{http://mathworld.wolfram.com/PoissonProcess.html}}, the probability of obtaining exactly $n$ successes in $N$ trials is given by the limit of a binomial distribution (see Section~\ref{sec:bindistri}) +% +\begin{align} +P_p(n|N) &= \frac{N!}{n!(N-n)!}\cdot p^n(1-p)^{N-n}\label{eq:normaldistri} +\end{align} +% +Viewing the distribution as a function of the expected number of successes +% +\begin{align}\label{eq:nu} +\lambda &= n\cdot p +\end{align} +% +instead of the sample size $N$ for fixed $p$, equation (2) then becomes +eq.~\ref{normaldistri} +% +\begin{align}\label{eq:nuN} +P_{\frac{\lambda}{n}}(n|N) &= \frac{N!}{n!(N-n)!}{\frac{\lambda}{N}}^n {\frac{1-\lambda}{N}}^{N-n} +\end{align} +% +Viewing the distribution as a function of the expected number of successes +% +\[ P_\lambda(X=k)=\frac{\lambda^k}{k!}\,e^{-\lambda} \] +% +Letting the sample size become large ($N\to\infty$), the distribution then approaches (with $p=\frac{\lambda}{n}$) +% +\begin{align} +\lim_{n\to\infty} P(X=k) &= \lim_{n\to\infty}\frac{n!}{(n-k)!\,k!} + \left(\frac{\lambda}{n}\right)^k \left(1-\frac{\lambda}{n}\right)^{n-k} \\ + &= \lim_{n\to\infty} \left(\frac{(n-k)!\cdot (n-k+1)\cdots(n-2)(n-1)n}{(n-k)!\,n^k}\right)\cdot\\ + &\qquad \left(\frac{\lambda^k}{k!}\right)\left(1-\frac{\lambda}{n}\right)^n + \left(1-\frac{\lambda}{n}\right)^{-k}\\ + &= \frac{\lambda^k}{k!}\cdot \lim_{n\to\infty} + \underbrace{\left(\frac{n}{n}\cdot \frac{n-1}{n}\cdot\frac{n-2}{n}\cdot\ldots\cdot + \frac{n-k+1}{n}\right)}_{\to 1} \cdot\\ + &\qquad \underbrace{\left(1-\frac{\lambda}{n}\right)^n}_{\to{e^{-\lambda}}} + \underbrace{\left(1-\frac{\lambda}{n}\right)^{-k}}_{\to 1}\\ + &= \lambda^k e^{\frac{-\lambda}{k!}} +\end{align} +% +which is known as the Poisson distribution and has the follwing syntax: + +{\ttfamily +\textbackslash psPoisson[settings]\{N\}\{$\lambda$\} +} +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=1cm,yunit=20cm}% +\begin{pspicture}(-1,-0.05)(14,0.25)% +\uput[-90](14,0){$k$} \uput[90](0,0.2){$P(X=k)$} +\psPoisson[linecolor=red,markZeros,fillstyle=solid, + fillcolor=blue!10,printValue,valuewidth=20]{13}{6} % N lambda +\psaxes[Dy=0.1,dy=0.1\psyunit]{->}(0,0)(-1,0)(14,0.2) +\end{pspicture} +\end{LTXexample} + + + +\clearpage \section{\CMD{psLame} -- Lamé Curve, a superellipse} A superellipse is a curve with Cartesian equation % @@ -714,9 +772,9 @@ $\frac{5}{2}$ & Piet Hein's ,,superellipse`` \end{tabular} \end{center} -If is a rational, then a superellipse is algebraic. However, for irrational, -it is transcendental. For even integers, the curve becomes closer to a -rectangle as increases. The syntax of the \verb+\psLame+ macro is: +If $r$ is a rational, then a superellipse is algebraic. However, for irrational $r$, +it is transcendental. For even integers $r=n$, the curve becomes closer to a +rectangle as $n$ increases. The syntax of the \verb+\psLame+ macro is: \begin{verbatim} \psLame[settings]{r} diff --git a/Master/texmf-dist/source/generic/pst-func/Makefile b/Master/texmf-dist/source/generic/pst-func/Makefile new file mode 100644 index 00000000000..0d982891a7e --- /dev/null +++ b/Master/texmf-dist/source/generic/pst-func/Makefile @@ -0,0 +1,49 @@ + +# `Makefile' for `pst-coil.pdf', hv, 2006/08/11 + +.SUFFIXES : .tex .ltx .dvi .ps .pdf .eps + +PACKAGE = pst-func + +MAIN = $(PACKAGE)-doc + +LATEX = latex + +ARCHNAME = $(MAIN)-$(shell date +%y%m%d) + +ARCHFILES = $(PACKAGE).sty $(PACKAGE).tex $(PACKAGE).pro $(MAIN).tex README Changes Makefile + +all : doc +# clean +doc: $(MAIN).pdf + +$(MAIN).pdf : $(MAIN).ps + GS_OPTIONS=-dAutoRotatePages=/None ps2pdf $< + +$(MAIN).ps : $(MAIN).dvi + dvips $< + +$(MAIN).dvi : $(MAIN).tex + $(LATEX) $< + $(LATEX) $< + if ! test -f $(basename $<).glo ; then touch $(basename $<).glo; fi + if ! test -f $(basename $<).idx ; then touch $(basename $<).idx; fi + makeindex -s gglo.ist -t $(basename $<).glg -o $(basename $<).gls \ + $(basename $<).glo + makeindex -t $(basename $<).ilg -o $(basename $<).ind \ + $(basename $<).idx + bibtex $(basename $<) + $(LATEX) $< + $(LATEX) $< + +clean : + $(RM) $(addprefix $(MAIN), .log .aux .glg .glo .gls .ilg .idx .ind .tmp .toc .out ) + $(RM) $(addprefix $(MAIN), .dvi .ps) + +veryclean : clean + $(RM) $(addprefix $(MAIN), .pdf .bbl .blg) + +arch : + zip $(ARCHNAME).zip $(ARCHFILES) + +# EOF diff --git a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex index b1a4b5c99f1..ce583f7fc77 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -28,8 +28,8 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} -\def\fileversion{0.46} -\def\filedate{2006/09/06} +\def\fileversion{0.48} +\def\filedate{2006/11/20} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -404,7 +404,7 @@ { /Y q N exp def } { /Y Y N k sub 1 add mul k div p mul q div def } ifelse % recursive definition - kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L + kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L \ifPst@markZeros k dx add scx 0 L \fi \ifPst@printValue gsave \psk@PSfont findfont \psk@fontscale scalefont setfont @@ -415,6 +415,7 @@ \fi /kOld kOld 1 add def } for + \ifPst@markZeros\else k dx add scx 0 L \fi % last line down to x-axis }% \psk@fillstyle \pst@stroke @@ -467,7 +468,7 @@ } for Curve { [ xEnd 0 Coors aload pop} if % showpoints on top of the stack }% - \ifx\psplotstyle\cplotstyle \@nameuse{endplot@\psplotstyle} \else% + \ifx\psplotstyle\cplotstyle\@nameuse{endplot@\psplotstyle}\else% \psk@fillstyle% \pst@stroke% \fi% @@ -475,6 +476,41 @@ \ignorespaces% } % +\def\psPoisson{\pst@object{psPoisson}} +\def\psPoisson@i#1#2{% + \begin@SpecialObj% + \addto@pscode{ + /scx { \pst@number\psxunit mul } def + /scy { \pst@number\psyunit mul } def + /N #1 def + /lambda #2 def + /elambda Euler #2 neg exp def % e^-lambda + /dx \psFunc@barwidth 2 div def + /kOld dx neg def + kOld scx 0 moveto % starting point + /Y elambda def % start value + 0 1 N { % N times + /k exch def % save loop variable + k 0 eq { /kFaculty 1 def }{ /kFaculty kFaculty k mul def } ifelse + /Y lambda k exp kFaculty div elambda mul def + kOld scx 0 L kOld scx Y scy L k dx add scx Y scy L + \ifPst@markZeros k dx add scx 0 L \fi + \ifPst@printValue + gsave \psk@PSfont findfont \psk@fontscale scalefont setfont + Y \psk@valuewidth string cvs + k scx \psk@fontscale 2 div add + Y scy \pst@number\pslabelsep add moveto + 90 rotate show grestore + \fi + /kOld kOld 1 add def + } for + \ifPst@markZeros\else k dx add scx 0 L \fi % last line down to x-axis + }% + \psk@fillstyle + \pst@stroke + \end@SpecialObj% +} +% % Superellipese / Lamefunction \define@key[psset]{pst-func}{radiusA}{\pst@getlength{#1}\pst@radiusA} \define@key[psset]{pst-func}{radiusB}{\pst@getlength{#1}\pst@radiusB} diff --git a/Master/texmf-dist/tpm/pst-func.tpm b/Master/texmf-dist/tpm/pst-func.tpm index bcf6105669d..46354c16c7b 100644 --- a/Master/texmf-dist/tpm/pst-func.tpm +++ b/Master/texmf-dist/tpm/pst-func.tpm @@ -3,7 +3,7 @@ pst-func Package - 2006/09/17 21:53:16 + 2007/03/18 08:05:35 1.0 rahtz @@ -25,19 +25,20 @@ defined by sigma 2207204 - + texmf-dist/dvips/pst-func/pst-func.pro texmf-dist/tex/generic/pst-func/pst-func.tex texmf-dist/tex/latex/pst-func/pst-func.sty texmf-dist/tpm/pst-func.tpm - + texmf-dist/doc/generic/pst-func/Changes texmf-dist/doc/generic/pst-func/README texmf-dist/doc/generic/pst-func/pst-func-doc.bib texmf-dist/doc/generic/pst-func/pst-func-doc.pdf texmf-dist/doc/generic/pst-func/pst-func-doc.tex + texmf-dist/source/generic/pst-func/Makefile Package/pst-func diff --git a/Master/texmf/lists/pst-func b/Master/texmf/lists/pst-func index 2a0c9b3d161..fc6f27fa21e 100644 --- a/Master/texmf/lists/pst-func +++ b/Master/texmf/lists/pst-func @@ -3,7 +3,7 @@ texmf-dist/doc/generic/pst-func/README texmf-dist/doc/generic/pst-func/pst-func-doc.bib texmf-dist/doc/generic/pst-func/pst-func-doc.pdf texmf-dist/doc/generic/pst-func/pst-func-doc.tex - +texmf-dist/source/generic/pst-func/Makefile texmf-dist/dvips/pst-func/pst-func.pro texmf-dist/tex/generic/pst-func/pst-func.tex texmf-dist/tex/latex/pst-func/pst-func.sty -- cgit v1.2.3