diff options
author | Karl Berry <karl@freefriends.org> | 2007-09-03 16:33:26 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-09-03 16:33:26 +0000 |
commit | 8e1addeb313836534d067bb5f1818d0b9a5c1dd7 (patch) | |
tree | a2027db9392e9fe75d7b32c0fdc77aab18a34b22 /Master/texmf-dist | |
parent | f1a51e596292491bcc441288a51aaec8af7dab1e (diff) |
pst-func 0.50
git-svn-id: svn://tug.org/texlive/trunk@4854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/Changes | 15 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/README | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.bib | 18 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf | bin | 2207705 -> 2335134 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex | 418 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-func/pst-func.pro | 17 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-func/pst-func.tex | 171 |
7 files changed, 529 insertions, 117 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes index d6e6663678e..2b1979de2d7 100644 --- a/Master/texmf-dist/doc/generic/pst-func/Changes +++ b/Master/texmf-dist/doc/generic/pst-func/Changes @@ -1,5 +1,17 @@ ..... pst-func.tex -0.49 2007-07-23 - add psVolume, rotating a function around the x-axis +0.50 2007-08-30 - modified \psPoisson{m,N}{Lambda} (Gerry Coombes) + - modified \psPolynomial{m,n,N}{Lambda} (Gerry Coombes) + - fixed bug in \psPoisson with markZeros + - fixed bug in \psBinomial with markZeros + - fixed bug in psPlotImp with \psyunit + - added new distribution functions + \psFDist for F-distribution + \psGammaDist + \psChiIIDist + \psTDist for Student's t-distribution + \psBetaDist for Beta distribution + - use pat-math.pro for GAMMALN function +0.49 2007-06-23 - add psVolume, rotating a function around the x-axis 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 @@ -36,6 +48,7 @@ ..... pst-func.pro +0.07 2007-08-30 new subroutine LogGamma 0.06 2006-04-16 new subroutine MoverN (binomial coefficient) 0.05 2005-12-19 new subroutine Si and si for the integral sin new subroutine for the integral cosin diff --git a/Master/texmf-dist/doc/generic/pst-func/README b/Master/texmf-dist/doc/generic/pst-func/README index eb7f599e47c..c1b86678790 100644 --- a/Master/texmf-dist/doc/generic/pst-func/README +++ b/Master/texmf-dist/doc/generic/pst-func/README @@ -12,6 +12,11 @@ pst-func: plotting special mathematical functions: -- psPoisson -- psBinomial -- psBinomialN +-- psFDist for F-distribution +-- psGammaDist +-- psChiIIDist +-- psTDist for Student's t-distribution +-- psBetaDist for Beta distribution -- psLame (Lam\`e\ Curve -- a superellipse) -- psplotImp (plotting implicit defined functions) -- psVolume (rotating f(x) around the x-axis) @@ -31,4 +36,4 @@ be part of your local TeX installation, otherwise get it from a CTAN server, f.ex. ftp://ftp.ctan.org PSTricks is PostScript Tricks, the documentation cannot be run -with pdftex, use the sequence latex->dvips->ps2pdf.
\ No newline at end of file +with pdftex, use the sequence latex->dvips->ps2pdf. 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 b69387bdb29..03605872ec3 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 @@ -57,16 +57,16 @@ gezeigt. } } -@Book{companion, - author = {Michel Goosens and Frank Mittelbach and Alexander - Samarin}, +@Book{tlgc2, + author = {Michel Goosens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Vo{\ss}}, title = {The {\LaTeX} {G}raphics {C}ompanion}, publisher = {{Addison-Wesley Publishing Company}}, - year = {2004}, - edition = {2.}, + edition = second, + year = {2007}, address = {Reading, Mass.} } + @Book{voss:chaos, author = {Herbert Vo{\ss}}, title = {Chaos und {F}raktale selbst programmieren: von {M}andelbrotmengen @@ -148,3 +148,11 @@ year = {2006}, address = {Poing} } + +@Manual{wolfram, + author = {Eric Weisstein}, + title = {Wolfram MathWorld}, + publisher = {{Wolfram}}, + year = {2007}, + address = {\url{http://mathworld.wolfram.com}} +} 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 Binary files differindex e4a9995332f..4f55989f8ed 100644 --- a/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf 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 a1be51a8928..30846a8a4ba 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 @@ -1,19 +1,25 @@ -\documentclass[a4paper,11pt]{article} +\documentclass[dvips,a4paper,11pt,english]{article} \usepackage[T1]{fontenc} \usepackage[latin1]{inputenc} -%\usepackage{pamathx} -\usepackage{mathpazo} +\usepackage{pamathx}% use this if you have the palatino math font +%\usepackage{mathpazo}% use this if you do not have the palatino math font \usepackage{url} \usepackage{amsmath} \usepackage{tabularx} \usepackage{longtable} +%\usepackage{fancyhdr} +%\pagestyle{fancy} \usepackage{pstricks} \usepackage{pst-func} \let\pstFuncFV\fileversion \usepackage{pst-math} \usepackage{pstricks-add}% for the alg parser +\usepackage{babel} \usepackage{showexpl} -\lstset{pos=t,wide=true} +\lstset{pos=t,wide=true,language=PSTricks, + morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl}} +\lstdefinestyle{syntax}{backgroundcolor=\color{blue!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt, + frame=single} % \usepackage{xspace} \def\PS{PostScript\xspace} @@ -25,21 +31,36 @@ \usepackage[colorlinks,linktocpage]{hyperref} % \begin{document} -\title{\texttt{pst-func}\\plotting special mathematical functions\\ - \small v.\pstFuncFV} +\title{\texttt{pst-func}\\[1cm] +plotting special mathematical functions\\[5mm] + {\small v.\pstFuncFV}} %\thanks{% % This document was written with \texttt{Kile: 1.6a (Qt: 3.1.1; KDE: 3.1.1;} % \protect\url{http://sourceforge.net/projects/kile/}) and the PDF output % was build with VTeX/Free (\protect\url{http://www.micropress-inc.com/linux})}\\ \author{Herbert Vo\ss\thanks{% -%%JF -%Thanks to: Attila Gati and to John Frampton. -Thanks to: Attila Gati, John Frampton and Lars Kotthoff, Jose-Emilio Vila-Forcen. +Thanks to: + \mbox{Martin Chicoine}, + \mbox{Gerry Coombes}, + \mbox{John Frampton}, + \mbox{Attila Gati}, + \mbox{Lars Kotthoff}, + and \mbox{Jose-Emilio Vila-Forcen}. }} \date{\today} \maketitle +\vfill +\begin{center} +\fbox{\parbox{0.8\textwidth}{% +\texttt{pst-func} loads by default the following packages: \texttt{pst-plot}, +\texttt{pstricks-add}, \texttt{pst-math}, \texttt{pst-xkey}, and, of course \texttt{pstricks}. +All should be already part of your local \TeX\ installation. If not, or in case +of having older versions, go to \url{http://www.CTAN.org/} and load the newest version.}} +\end{center} +\vfill +\clearpage \tableofcontents \clearpage @@ -54,9 +75,10 @@ f^{\prime\prime}(x) &= 2a_2 + 6a_3x + \ldots +(n-1)(n-2)a_{n-1}x^{n-3} + n(n-1)a \noindent so \verb+pst-func+ needs only the coefficients of the polynomial to calculate the function. The syntax is -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psPolynomial[<options>]{xStart}{xEnd} -\end{verbatim} +\end{lstlisting} With the option \verb+xShift+ one can do a horizontal shift to the graph of the function. With another than the predefined value the macro replaces $x$ by $x-x\mathrm{Shift}$; \verb+xShift=1+ @@ -236,9 +258,10 @@ s(x) = \frac{a_0}{2} & + a_1\cos{\omega x} + a_2\cos{2\omega x} + \noindent The macro \verb+psFourier+ plots Fourier sums. The syntax is similiar to \verb+psPolynomial+, except that there are two kinds of coefficients: -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psPolynomial[cosCoeff=a0 a1 a2 ..., sinCoeff=b1 b2 ...]{xStart}{xEnd} -\end{verbatim} +\end{lstlisting} The coefficients must have the orders $a_0\ a_1\ a_2\ \ldots$ and $b_1\ b_2\ b_3\ \ldots$ and be separated by \textbf{spaces}. The default is \verb+cosCoeff=0,sinCoeff=1+, @@ -288,19 +311,20 @@ J_n(x) &=\frac{1}{\pi}\int_0^\pi\cos(x\sin t-nt)\dt\\ \end{align} \noindent The syntax of the macro is -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psBessel[options]{order}{xStart}{xEnd} -\end{verbatim} +\end{lstlisting} There are two special parameters for the Bessel function, and also the settings of many \verb+pst-plot+ or \verb+pstricks+ parameters affect the plot. -\begin{verbatim} +\begin{lstlisting}[style=syntax] \def\psset@constI#1{\edef\psk@constI{#1}} \def\psset@constII#1{\edef\psk@constII{#1}} \psset{constI=1,constII=0} -\end{verbatim} +\end{lstlisting} These two "'constants"` have the following meaning: \[ @@ -309,9 +333,10 @@ f(t) = constI \cdot J_n + constII \noindent where $constI$ and $constII$ must be real PostScript expressions, e.g.: -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psset{constI=2.3,constII=t k sin 1.2 mul 0.37 add} -\end{verbatim} +\end{lstlisting} The Bessel function is plotted with the parametricplot macro, this is the reason why the variable is named \verb+t+. The internal procedure \verb+k+ @@ -370,11 +395,12 @@ The integral sin and cosin are defined as \end{align} % \noindent The syntax of the macros is -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psSi[options]{xStart}{xEnd} \pssi[options]{xStart}{xEnd} \psCi[options]{xStart}{xEnd} -\end{verbatim} +\end{lstlisting} \begin{LTXexample}[pos=t] @@ -427,11 +453,12 @@ value of $x$ in the plot. The third one uses the \CMD{psIntegral} macro to perfo to the convolution, where the integration is performed from $a$ to $b$. The syntax of these macros is: -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psIntegral[<options>]{xStart}{xEnd}(a,b){ function } \psCumIngegral[<options>]{xStart}{xEnd}{ function } \psConv[<options>]{xStart}{xEnd}(a,b){ function f }{ function g } -\end{verbatim} +\end{lstlisting} In the first macro, the function should be created such that it accepts two values: \verb|<x t function>| should be a value. For the second and the third functions, they only need to accept one @@ -475,7 +502,24 @@ The result (in red) is a trapezoid function. \clearpage \section{Distributions} -\subsection{Normal Distribution (Gauss)} +All distributions which use the $\Gamma$- or $\ln\Gamma$-function need the \verb+pst-math+ package, +it defines the PostScript functions \verb+GAMMA+ and \verb+GAMMALN+. \verb+\pst-func+ reads by default the PostScript +file \verb+pst-math.pro+. It is part of any \TeX\ distribution and should also be on +your system, otherwise install or update it from \textsc{CTAN}. It must the latest version. + +\begin{LTXexample}[pos=l,width=7cm] +\begin{pspicture*}(-0.5,-0.5)(6.2,5.2) + \psaxes{->}(0,0)(6,5) + \psset{plotpoints=100,linewidth=1pt} + \psplot[linecolor=red]{0.01}{4}{ x GAMMA } + \psplot[linecolor=blue]{0.01}{5}{ x GAMMALN } +\end{pspicture*} +\end{LTXexample} + + + + +\subsection{Normal distribution (Gauss)} The Gauss function is defined as % \begin{align} @@ -483,18 +527,12 @@ f(x) &= \dfrac{1}{\sigma\sqrt{2\pi}}\,e^{-\dfrac{\left(x-\mu\right)^2}{2\sigma{} \end{align} % \noindent The syntax of the macros is -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psGauss[options]{xStart}{xEnd} \psGaussI[options]{xStart}{xEnd} -\end{verbatim} +\end{lstlisting} -%%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=<value>+, 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=<value>+ and \verb+mue=<value>+ for the horizontal shift, which can also be set in the usual way with \verb+\psset+. It is @@ -503,7 +541,8 @@ significant only for the \verb+psGauss+- and \verb+\psGaussI+-macro. The default and has one special option, called \verb+Simpson+, which defines the number of intervalls per step and is predefined with 5. -\bgroup + +\begin{LTXexample}[pos=t,preset=\centering,wide=true] \psset{yunit=4cm,xunit=3} \begin{pspicture}(-2,-0.2)(2,1.4) % \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0] @@ -517,27 +556,10 @@ and is predefined with 5. \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} +\end{LTXexample} -\subsection{Binomial Distribution}\label{sec:bindistri} +\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]$. @@ -556,10 +578,21 @@ P_p(n|N) &= \binom{N}{n}p^nq^{N-n} \\ where $(N; n)$ is a binomial coefficient and $P$ the probability. The syntax is quite easy: -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psBinomial[<options>]{N}{probability p} +\psBinomial[<options>]{m,N}{probability p} +\psBinomial[<options>]{m,n,N}{probability p} \psBinomialN[<options>]{N}{probability p} -\end{verbatim} +\end{lstlisting} + +\begin{itemize} +\item with one argument $N$ the sequence $0\ldots N$ is calculated and plotted +\item with two arguments $m,N$ the sequence $0\ldots N$ is calculated and + the sequence $m\ldots N$ is plotted +\item with three arguments $m,n,N$ the sequence $0\ldots N$ is calculated and + the sequence $m\ldots n$ is plotted +\end{itemize} There is a restriction in using the value for N. It depends to the probability, but in general one should expect problems with $N>100$. PostScript cannot handle such small values and there will @@ -583,7 +616,7 @@ the macro \CMD{psBinomial} and not for the normalized one! \begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=1cm,yunit=10cm}% -\begin{pspicture}(-1,-0.1)(8,0.6)% +\begin{pspicture}(-1,-0.05)(8,0.6)% \psaxes[Dy=0.2,dy=0.2\psyunit]{->}(0,0)(-1,0)(8,0.5) \uput[-90](8,0){$k$} \uput[90](0,0.5){$P(X=k)$} \psBinomial[linecolor=red,markZeros,printValue,fillstyle=solid, @@ -593,16 +626,26 @@ the macro \CMD{psBinomial} and not for the normalized one! \begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=1cm,yunit=10cm}% +\begin{pspicture}(-1,-0.05)(8,0.6)% +\psaxes[Dy=0.2,dy=0.2\psyunit]{->}(0,0)(-1,0)(8,0.5) +\uput[-90](8,0){$k$} \uput[90](0,0.5){$P(X=k)$} +\psBinomial[linecolor=black!30]{0,7}{0.6} +\psBinomial[linecolor=blue,markZeros,printValue,fillstyle=solid, + fillcolor=blue,barwidth=0.4]{2,5,7}{0.6} +\end{pspicture} +\end{LTXexample} + + +\begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=0.25cm,yunit=10cm} -\begin{pspicture*}(-1,-0.1)(61,0.52) +\begin{pspicture*}(-1,-0.05)(61,0.52) \psaxes[Dx=5,dx=5\psxunit,Dy=0.2,dy=0.2\psyunit]{->}(60,0.5) \uput[-90](60,0){$k$} \uput[0](0,0.5){$P(X=k)$} \psBinomial[markZeros,linecolor=red]{4}{.5} \psset{linewidth=1pt} -\psBinomial[linecolor=green]{5}{.5} -\psBinomial[linecolor=blue]{10}{.5} -\psBinomial[linecolor=red]{20}{.5} -\psBinomial[linecolor=magenta]{50}{.5} +\psBinomial[linecolor=green]{5}{.5} \psBinomial[linecolor=blue]{10}{.5} +\psBinomial[linecolor=red]{20}{.5} \psBinomial[linecolor=magenta]{50}{.5} \psBinomial[linecolor=cyan]{75}{.5} \end{pspicture*} \end{LTXexample} @@ -674,8 +717,10 @@ valid vor \CMD{psBinomialN}. The option \verb+showpoints+ is valid if \verb+curv \end{LTXexample} -\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}) +\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} @@ -688,7 +733,7 @@ Viewing the distribution as a function of the expected number of successes \end{align} % instead of the sample size $N$ for fixed $p$, equation (2) then becomes -eq.~\ref{normaldistri} +eq.~\ref{eq: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} @@ -698,7 +743,8 @@ 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}$) +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!} @@ -716,9 +762,13 @@ Letting the sample size become large ($N\to\infty$), the distribution then appr % which is known as the Poisson distribution and has the follwing syntax: -{\ttfamily -\textbackslash psPoisson[settings]\{N\}\{$\lambda$\} -} + +\begin{lstlisting}[style=syntax] +\psPoisson[settings]{N}{lambda} +\psPoisson[settings]{M,N}{lambda} +\end{lstlisting} + +in which \texttt{M} is an optional argument with a default of 0. \begin{LTXexample}[pos=t,preset=\centering] @@ -731,6 +781,214 @@ which is known as the Poisson distribution and has the follwing syntax: \end{pspicture} \end{LTXexample} +\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[printValue,valuewidth=20]{2,11}{6} % M,N lambda +\psaxes[Dy=0.1,dy=0.1\psyunit]{->}(0,0)(-1,0)(14,0.2) +\end{pspicture} +\end{LTXexample} + + +\clearpage +\subsection{Gamma distribution} +A gamma distribution is a general type of statistical distribution that is related +to the beta distribution and arises naturally in processes for which the waiting +times between Poisson distributed events are relevant. Gamma distributions have +two free parameters, labeled alpha and beta. +The gamma distribution with parameters $\alpha$, $\beta$ is defined as +\[ +f(x)=\frac{\beta(\beta x)^{\alpha-1}e^{-\beta x}}{\Gamma(\alpha)} \qquad +\text{for $x>0$ and $\alpha$, $\beta>0$}\] +% +and has the syntax + +\begin{lstlisting}[style=syntax] +\psGammaDist[options]{x0}{x1} +\end{lstlisting} + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=1.2cm,yunit=10cm,plotpoints=200} +\begin{pspicture*}(-0.75,-0.05)(9.5,0.6) + \psGammaDist[linewidth=1pt,linecolor=red]{0.01}{9} + \psGammaDist[linewidth=1pt,linecolor=blue,alpha=0.3,beta=0.7]{0.01}{9} + \psaxes[Dy=0.1]{->}(0,0)(9.5,.6) +\end{pspicture*} +\end{LTXexample} + + +\clearpage +\subsection{$\chi^2$-distribution} +The $\chi^2$-distribution is a continuous probability distribution. It +usually arises when a k-dimensional vector's orthogonal components are +independent and each follow a standard normal distribution. +The length of the vector will then have a $\chi^2$-distribution. + +\iffalse +If Y_i have normal independent distributions with mean 0 and variance 1, then +chi^2=sum_(i==1)^rY_i^2 +(1) + +is distributed as chi^2 with r degrees of freedom. This makes a chi^2 distribution +a gamma distribution with theta=2 and alpha=r/2, where r is the number of degrees of freedom. + +More generally, if chi_i^2 are independently distributed according to a chi^2 +distribution with r_1, r_2, ..., r_k degrees of freedom, then +sum_(j==1)^kchi_j^2 + +is distributed according to chi^2 with r=sum_(j==1)^(k)r_j degrees of freedom. +\fi + +The $\chi^2$ with parameter $\nu$ is the same as a Gamma distribution + with $\alpha=\nu/2$ and $\beta=1/2$ and the syntax + +\begin{lstlisting}[style=syntax] +\psChiIIDist[options]{x0}{x1} +\end{lstlisting} + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=1.2cm,yunit=10cm,plotpoints=200} +\begin{pspicture*}(-0.75,-0.05)(9.5,.65) + \multido{\rnue=0.5+0.5,\iblue=0+10}{10}{% + \psChiIIDist[linewidth=1pt,linecolor=blue!\iblue,nue=\rnue]{0.01}{9}} + \psaxes[Dy=0.1]{->}(0,0)(9.5,.6) +\end{pspicture*} +\end{LTXexample} + +\iffalse +The cumulative distribution function is +\begin{align*} +D_r(\chi^2) &= int_0^{\chi^2}\frac{t^{r/2-1}e^{-t/2}\mathrm{d}t}{\Gamma(1/2r)2^{r/2}} \\ + + &= 1-\frac{\Gamma(1/2r,1/2\chi^2)}{\Gamma(1/2r)} +\end{align*} +\fi + + + +%The $\chi^2_\nu$-distribution has mode $\nu-2$ for $\nu\geq2$. + +\clearpage +\subsection{Student's $t$-distribution} + +A statistical distribution published by William Gosset in 1908 under his %. His employer, Guinness Breweries, +%required him to publish under a +pseudonym %, so he chosed +"`Student"'. +%Given N independent measurements x_i, let +%t=(x^_-mu)/(s/sqrt(N)), +The $t$-distribution with parameter $\nu$ has the density function +\[ +f(x)=\frac1{\sqrt{\nu\pi}}\cdot + \frac{\Gamma[(\nu+1)/2]}{\Gamma(\nu/2)}\cdot\frac1{[1+(x^2/\nu)]^{(\nu+1)/2}} \qquad +\text{for $-\infty<x<\infty$ and $\nu>0$}\] +% +and the following syntax + +\begin{lstlisting}[style=syntax] +\psTDist[options]{x0}{x1} +\end{lstlisting} + + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=1.25cm,yunit=10cm} +\begin{pspicture}(-6,-0.1)(6,.5) + \psaxes[Dy=0.1]{->}(0,0)(-4.5,0)(5.5,0.5) + \psset{linewidth=1pt,plotpoints=100} + \psGauss[mue=0,sigma=1]{-4.5}{4.5} + \psTDist[linecolor=blue]{-4}{4} + \psTDist[linecolor=red,nue=4]{-4}{4} +\end{pspicture} +\end{LTXexample} + + +%The $t_\nu$-distribution has mode 0. + +\clearpage +\subsection{$F$-distribution} +A continuous statistical distribution which arises in the testing of +whether two observed samples have the same variance. + +The F-distribution with parameters $\mu$ and $\nu$ has the probability function +\[ +f_{n,m}(x)=\frac{\Gamma[(\mu+\nu)/2]}{\Gamma(\mu/2)\Gamma(\nu/2)}\cdot + \left(\mu/\nu\right)^{\mu/2}\frac{x^{(\mu/2)-1}}{[1+(\mu x/\nu)]^{(\mu+\nu)/2}}\quad +\text{ for $x>0$ and $\mu$, $\nu>0$}\] +% +and the syntax + +\begin{lstlisting}[style=syntax] +\psFDist[options]{x0}{x1} +\end{lstlisting} +% +The default settings are $\mu=1$ and $\nu=1$. + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=2cm,yunit=10cm,plotpoints=100} +\begin{pspicture*}(-0.5,-0.07)(5.5,0.8) + \psline[linestyle=dashed](0.5,0)(0.5,0.75) + \psline[linestyle=dashed](! 2 7 div 0)(! 2 7 div 0.75) + \psset{linewidth=1pt} + \psFDist{0.1}{5} + \psFDist[linecolor=red,nue=3,mue=12]{0.01}{5} + \psFDist[linecolor=blue,nue=12,mue=3]{0.01}{5} + \psaxes[Dy=0.1]{->}(0,0)(5,0.75) +\end{pspicture*} +\end{LTXexample} + + +\clearpage +\subsection{Beta distribution} + +A general type of statistical distribution which is related to the gamma distribution. +Beta distributions have two free parameters, which are labeled according to one of two +notational conventions. The usual definition calls these $\alpha$ and $\beta$, and the other +uses $\beta^\prime=\beta-1$ and $\alpha^\prime=\alpha-1$. The beta distribution is +used as a prior distribution for binomial proportions in Bayesian analysis. +% +%The plots are for various values of ($\alpha,\beta$) with $\alpha=1$ and $\beta$ ranging from 0.25 to 3.00. +% +The domain is [0,1], and the probability function P(x) is given by +% +\[ +P(x) = \frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}(1-x)^{\beta-1}x^{\alpha-1} +\quad\text{ $\alpha,\beta>0$} +\] +% +and has the syntax (with a default setting of $\alpha=1$ and $\beta=1$): + +\begin{lstlisting}[style=syntax] +\psBetaDist[options]{x0}{x1} +\end{lstlisting} +% + + +\begin{LTXexample}[pos=t,preset=\centering] +\psset{xunit=10cm,yunit=5cm} +\begin{pspicture*}(-0.1,-0.1)(1.1,2.05) + \psset{linewidth=1pt} + \multido{\rbeta=0.25+0.25,\ired=0+5,\iblue=50.0+-2.5}{20}{% + \psBetaDist[beta=\rbeta,linecolor=red!\ired!blue!\iblue]{0.01}{0.99}} + \psaxes[Dy=0.2,Dx=0.1]{->}(0,0)(1,2.01) +\end{pspicture*} +\end{LTXexample} + + +\iffalse +\clearpage +\subsection{Bose-Einstein distribution} +A distribution which arises in the study of integer spin particles in physics, +\[ +P(x)=\frac{x^s}{e^{x-mu}-1}\qquad\text{with $s\in\mathbb{Z}$ and $\mu\in\mathbb{R}} +\] +% +and has the syntax (with a default setting of $s=1$ and $\mu=1$): + +\begin{lstlisting}[style=syntax] +\psBoseEInsteinDist[options]{x0}{x1} +\end{lstlisting} +\fi \clearpage @@ -777,9 +1035,9 @@ If $r$ is a rational, then a superellipse is algebraic. However, for irrational 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} +\begin{lstlisting}[style=syntax] \psLame[settings]{r} -\end{verbatim} +\end{lstlisting} It is internally ploted as a parametric plot with $0\le\alpha\le360$. Available keywords are \verb+radiusA+ and \verb+radiusB+, both are preset to 1, but can have any valid value @@ -811,9 +1069,9 @@ pixel needs $120$ thousand calculations of the function value. The user still de this area in his own coordinates, the translation into pixel (pt) is done internally by the macro. -\begin{verbatim} +\begin{lstlisting}[style=syntax] \psplotImp[<options>](xMin,yMin)(xMax,yMax){<function f(x,y)>} -\end{verbatim} +\end{lstlisting} The function must be of $f(x,y)=0$ and described in PostScript code, or alternatively with the option \verb+algebraic+ (\verb+pstricks-add+) in an algebraic form. No other value names than $x$ and $y$ @@ -901,9 +1159,9 @@ for polar plots are also possible (see next example). This macro shows the behaviour of a rotated function around the x-axis. -\begin{verbatim} +\begin{lstlisting}[style=syntax] \psVolume[<options>](xMin,xMax){<steps>}{<function f(x)>} -\end{verbatim} +\end{lstlisting} $f(x)$ has to be described as usual for the macro psplot. @@ -1023,9 +1281,10 @@ $f(x)$ has to be described as usual for the macro psplot. \section{\CMD{psPrintValue}}\label{sec:printValue} This new macro allows to print single values of a math function. It has the syntax -\begin{verbatim} + +\begin{lstlisting}[style=syntax] \psPrintValue[<options>]{<PostScript code>} -\end{verbatim} +\end{lstlisting} Important is the fact, that \CMD{psPrintValue} works on \PS\ side. For \TeX\ it is only a box of zero dimension. This is the reason why you have to put it into a box, which reserves horizontal @@ -1074,13 +1333,14 @@ valuewidth & <number> & 10 & the width of the string for the converted \section{Credits} -Denis Girou | Manuel Luque | Timothy Van Zandt - +Gerry Coombes | Denis Girou | Christophe Jorssen | Manuel Luque | Timothy Van Zandt +\bgroup +\raggedright \nocite{*} \bibliographystyle{plain} \bibliography{pst-func-doc} - +\egroup \end{document} diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro index 56b43d8c605..df17f4578d6 100644 --- a/Master/texmf-dist/dvips/pst-func/pst-func.pro +++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro @@ -15,7 +15,7 @@ %% `pst-func' is a PSTricks package to plot special math functions %% %% -%% version 0.06 / 2006-04-16 Herbert Voss <voss _at_ pstricks.de> +%% version 0.07 / 2007-08-30 Herbert Voss <voss _at_ pstricks.de> % /tx@FuncDict 100 dict def tx@FuncDict begin @@ -188,6 +188,20 @@ tx@FuncDict begin } for /I a SFunc b SFunc add s1 4 mul add s2 2 mul add 3 div h mul def } def +% +/LogGamma { 5 dict begin % z on stack + /z ED + /sum 0 def + /k 1 def + { + z k div dup 1 add ln sub dup + abs eps8 lt { pop exit } if + sum add /sum exch def + /k k 1 add def + } loop + sum z ln sub CEuler z mul sub + end +} def % % subroutines for complex numbers, given as an array [a b] @@ -325,4 +339,5 @@ tx@FuncDict begin /cxconv { % theta RadtoDeg dup sin exch cos cxmake2 } def +% end 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 ab399eb9ec9..2d0dcae366e 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -28,11 +28,12 @@ % interface to the `xkeyval' package \pst@addfams{pst-func} -\def\fileversion{0.49} -\def\filedate{2007/12/23} +\def\fileversion{0.50} +\def\filedate{2007/08/27} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} +\pstheader{pst-math.pro}% for GAMMALN % \define@key[psset]{pst-func}{xShift}{\def\psk@xShift{#1}} \psset[pst-func]{xShift=0} @@ -195,7 +196,8 @@ % \define@key[psset]{pst-func}{sigma}{\def\psk@sigma{#1 }} \define@key[psset]{pst-func}{mue}{\def\psk@mue{#1 }} -\psset[pst-func]{sigma=0.5,mue=0} +\define@key[psset]{pst-func}{nue}{\def\psk@nue{#1 }} +\psset[pst-func]{sigma=0.5,mue=0,nue=1} % \def\psGauss{\@ifnextchar[{\psGauss@i}{\psGauss@i[]}} \def\psGauss@i[#1]#2#3{{% @@ -386,26 +388,44 @@ \psset[pst-func]{printValue=false,barwidth=1} % \def\psBinomial{\pst@object{psBinomial}} -\def\psBinomial@i#1#2{% +\def\psBinomial@i#1#2{\psBinomial@ii#1,,,\@nil{#2}}% +\def\psBinomial@ii#1,#2,#3,#4\@nil#5{% + \def\pst@tempA{#2}% + \ifx\pst@tempA\@empty + \psBinomial@iii{0}{#1}{#1}{#5}% + \else + \def\pst@tempA{#3}% + \ifx\pst@tempA\@empty\psBinomial@iii{#1}{#2}{#2}{#5}% + \else\psBinomial@iii{#1}{#2}{#3}{#5}\fi + \fi}% +\def\psBinomial@iii#1#2#3#4{% \begin@SpecialObj% \addto@pscode{ /scx { \pst@number\psxunit mul } def /scy { \pst@number\psyunit mul } def - /N #1 def - /p #2 def + /m #1 def + /n #2 def + /N #3 def + /p #4 def /dx \psFunc@barwidth 2 div def /q 1 p sub def - /kOld dx neg def + /kOld dx neg m add def kOld scx 0 moveto % starting point -% /Y 1 def % start value - 0 1 N { % N times + 0 1 m 1 sub { + /k exch def % save loop variable + k 0 eq + { /Y q N exp def } + { /Y Y N k sub 1 add mul k div p mul q div def } + ifelse + } for + m 1 n { % n-m+1 times /k exch def % save loop variable k 0 eq { /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 - \ifPst@markZeros k dx add scx 0 L \fi + kOld scx Y scy L k dx add scx Y scy L + \ifPst@markZeros k dx add scx 0 L kOld 1 add scx 0 L \fi \ifPst@printValue gsave \psk@PSfont findfont \psk@fontscale scalefont setfont Y \psk@valuewidth string cvs @@ -417,11 +437,10 @@ } for \ifPst@markZeros\else k dx add scx 0 L \fi % last line down to x-axis }% - \psk@fillstyle - \pst@stroke + \psk@fillstyle% + \pst@stroke% \end@SpecialObj% -} -% +}% \def\psBinomialN{\pst@object{psBinomialN}} \def\psBinomialN@i#1#2{% \pst@killglue @@ -476,24 +495,33 @@ \ignorespaces% } % -\def\psPoisson{\pst@object{psPoisson}} -\def\psPoisson@i#1#2{% +\def\psPoisson{\pst@object{psPoisson}}% with contributions from Gerry Coombes +\def\psPoisson@i#1#2{\psPoisson@ii#1,,\@nil{#2}}% +\def\psPoisson@ii#1,#2,#3\@nil#4{% + \def\pst@tempA{#2}% + \ifx\pst@tempA\@empty\psPoisson@iii{0}{#1}{#4}\else + \psPoisson@iii{#1}{#2}{#4}\fi}% +\def\psPoisson@iii#1#2#3{% M N lambda \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 + /M #1 def + /N #2 def + /lambda #3 def + /elambda Euler #3 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 + /kOld dx neg M add def % addition of M here + kOld scx 0 moveto % starting point + /Y elambda def % start value + 0 1 M 1 sub { % skip over first M-1 rectangles + /k exch def % whilst recursing probabilities + k 0 eq { /Y elambda def }{ /Y Y lambda mul k div def } ifelse + } for % nothing happens if M=0 + M 1 N { % N-M+1 times + /k exch def % save loop variable + k 0 eq { /Y elambda def }{ /Y Y lambda mul k div def } ifelse + 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 @@ -511,6 +539,86 @@ \end@SpecialObj% } % +\define@key[psset]{pst-func}{alpha}{\pst@checknum{#1}\psk@alpha } % gamma +\define@key[psset]{pst-func}{beta}{\pst@checknum{#1}\psk@beta } % gamma +\psset[pst-func]{alpha=0.5,beta=0.5} +% +\def\psGammaDist{\pst@object{psGammaDist}} +\def\psGammaDist@i#1#2{% + \ifdim#1pt<\z@ \psframebox*{\color{red}!!!\#1 must be greater than 0!!!} + \else + \addbefore@par{plotpoints=500,alpha=0.5,beta=0.5}% + \begin@SpecialObj + \psplot{#1}{#2}{ + \psk@beta x mul \psk@alpha exp x div Euler \psk@beta neg x mul \psk@alpha GAMMALN sub exp mul} + \end@SpecialObj% + \ignorespaces% + \fi% +} +% +\def\psBetaDist{\pst@object{psBetaDist}} +\def\psBetaDist@i#1#2{% + \ifdim#1pt<\z@ \psframebox*{\color{red}!!!\#1 must be greater than 0!!!} + \else + \addbefore@par{plotpoints=200,alpha=1,beta=1}% + \begin@SpecialObj + \psplot{#1}{#2}{ + \psk@beta \psk@alpha add GAMMA + \psk@beta GAMMA \psk@alpha GAMMA mul div + 1 x sub \psk@beta 1.0 sub exp mul + x \psk@alpha 1.0 sub exp mul } + \end@SpecialObj% + \ignorespaces% + \fi% +} +% +\def\psChiIIDist{\pst@object{psChiIIDist}} +\def\psChiIIDist@i#1#2{% + \addbefore@par{plotpoints=500,nue=1}% + \begin@SpecialObj +% \ifdim\psk@nue pt<\z@ \psframebox*{\color{red}!!!nue must be greater than 0!!!} +% \else + \psplot{#1}{#2}{% + x 2 div \psk@nue 2 div exp x div Euler -0.5 x mul \psk@nue 2 div GAMMALN sub exp mul }% +% \fi% + \end@SpecialObj% + \ignorespaces% +} +% +\def\psTDist{\pst@object{psTDist}} +\def\psTDist@i#1#2{% + \addbefore@par{plotpoints=500}% + \begin@SpecialObj + \ifdim\psk@nue pt<\z@ \psframebox*{\color{red}!!!nue must be greater than 0!!!} + \else + \psplot{#1}{#2}{ + 1 x 2 exp \psk@nue div 1 add \psk@nue 1 add 2 div exp div + \psk@nue Pi mul sqrt div + Euler \psk@nue 1 add 2 div GAMMALN \psk@nue 2 div GAMMALN sub exp mul + }% + \fi% + \end@SpecialObj% + \ignorespaces% +} +% +\def\psFDist{\pst@object{psFDist}} +\def\psFDist@i#1#2{% + \ifdim#1pt<\z@ \psframebox*{\color{red}!!!\#1 must be greater than 0!!!} + \else + \addbefore@par{plotpoints=500,mue=1}% + \begin@SpecialObj + \psplot{#1}{#2}{ + x \psk@mue mul \psk@nue div dup \psk@mue 2 div exp x div + exch 1 add \psk@mue \psk@nue add 2 div exp div + Euler \psk@mue \psk@nue add 2 div GAMMALN + \psk@mue 2 div GAMMALN sub \psk@nue 2 div GAMMALN sub exp mul + }% + \end@SpecialObj% + \fi% + \ignorespaces% +} + +% % Superellipese / Lamefunction \define@key[psset]{pst-func}{radiusA}{\pst@getlength{#1}\pst@radiusA} \define@key[psset]{pst-func}{radiusB}{\pst@getlength{#1}\pst@radiusB} @@ -554,10 +662,13 @@ /Func \ifPst@algebraic (#5) tx@addDict begin AlgParser end cvx \else { #5 } \fi def \fi /xPixel xMax xMin sub \pst@number\psxunit mul round cvi def - /yPixel yMax yMin sub \pst@number\psxunit mul round cvi def + /yPixel yMax yMin sub \pst@number\psyunit mul round cvi def /dx xMax xMin sub xPixel div def /dy yMax yMin sub yPixel div def - /setpixel { dy div exch dx div exch \pst@number\pslinewidth 2 div 0 360 arc fill } bind def + /setpixel { + dy div exch + dx div exch + \pst@number\pslinewidth 2 div 0 360 arc fill } bind def % /VZ true def % suppose that F(x,y)>=0 /x xMin def /y yMin def Func 0.0 lt { /VZ false def } if % erster Wert |