From 8328d8188fb85a8733a4f03c71b40f415ac51365 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 22 Mar 2008 23:29:41 +0000 Subject: pst-func 0.53 git-svn-id: svn://tug.org/texlive/trunk@7087 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pst-func/Changes | 8 +- Master/texmf-dist/doc/generic/pst-func/README | 1 + .../doc/generic/pst-func/pst-func-doc.pdf | Bin 2298948 -> 2324861 bytes .../doc/generic/pst-func/pst-func-doc.tex | 178 +++++++++++++++++++-- 4 files changed, 169 insertions(+), 18 deletions(-) (limited to 'Master/texmf-dist/doc/generic') diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes index 79457f263ef..d97578831f2 100644 --- a/Master/texmf-dist/doc/generic/pst-func/Changes +++ b/Master/texmf-dist/doc/generic/pst-func/Changes @@ -1,6 +1,8 @@ ..... pst-func.tex -0.52 2008-03-02 - changes macros from SpecialObj to OpenObj to allow - using inside \pscustom +0.53 2008-03-21 - added macro \psBezier# for Bezier curves of order + #=1...9 with 2..10 pairs of coordinates +0.52 2008-03-02 - changes macros from SpecialObj to OpenObj, which allows the use + of the macros inside \pscustom 0.51 2008-02-27 - enable filling support for \psIntegral and \psCumIntegral (suggested by Rafal Bartczuk) 0.50 2007-08-30 - modified \psPoisson{m,N}{Lambda} (Gerry Coombes) @@ -52,6 +54,8 @@ ..... pst-func.pro +0.08 2008-03-21 added BezierCurve code for Bezier curves of up to + order 9 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 diff --git a/Master/texmf-dist/doc/generic/pst-func/README b/Master/texmf-dist/doc/generic/pst-func/README index c1b86678790..3dbe4b5fed4 100644 --- a/Master/texmf-dist/doc/generic/pst-func/README +++ b/Master/texmf-dist/doc/generic/pst-func/README @@ -1,4 +1,5 @@ pst-func: plotting special mathematical functions: +-- psBezier -- psPolynomial (with derivations) -- psFourier -- psBessel 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 74cc078a126..7b45c55c800 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 fb9e4d2a250..c8193b69342 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,8 +1,9 @@ -\documentclass[dvips,a4paper,11pt,english]{article} +\documentclass[dvips,a4paper,english]{article} \usepackage[T1]{fontenc} -\usepackage[latin1]{inputenc} -\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[utf8]{inputenc} +%\usepackage{pamathx}% use this if you have the palatino math font +\usepackage{arev}% use this if you do not have the palatino math font +%\usepackage[scaled=0.9]{luximono}% use this if you do not have the palatino math font \usepackage{url} \usepackage{amsmath} \usepackage{tabularx} @@ -25,6 +26,7 @@ \def\PS{PostScript\xspace} \def\CMD#1{{\ttfamily\textbackslash #1}} \def\dt{\ensuremath{\,\mathrm{d}t}} +\def\Index#1{\index{#1}#1} % \def\pshlabel#1{\footnotesize#1} \def\psvlabel#1{\footnotesize#1} @@ -40,12 +42,13 @@ plotting special mathematical functions\\[5mm] % was build with VTeX/Free (\protect\url{http://www.micropress-inc.com/linux})}\\ \author{Herbert Vo\ss\thanks{% Thanks to: - \mbox{Martin Chicoine}, - \mbox{Gerry Coombes}, - \mbox{John Frampton}, - \mbox{Attila Gati}, - \mbox{Lars Kotthoff}, - and \mbox{Jose-Emilio Vila-Forcen}. + Martin Chicoine, + Gerry Coombes, + John Frampton, + Attila Gati, + Horst Gierhardt, + Lars Kotthoff, + and Jose-Emilio Vila-Forcen. }} \date{\today} @@ -65,6 +68,124 @@ of having older versions, go to \url{http://www.CTAN.org/} and load the newest v \clearpage +\section{\CMD{psBezier\#}} +This macro can plot a B\'ezier spline from order 1 up to 9 which needs +(order+1) pairs of given coordinates. + +Given a set of $n+1$ control points $P_0$, $P_1$, \ldots, $P_n$, the corresponding \Index{B\'ezier} curve +(or \Index{Bernstein-B\'ezier} curve) is given by + +\begin{align} +C(t)=\sum_{i=0}^n P_i B_{i,n}(t) +\end{align} + +Where $B_{i,n}(t)$ is a Bernstein polynomial $B_{i,n}(t)=\binom{n}{i}t^i(1-t)^{n-i}$, + and $t \in [0,1]$. +The Bézier curve starts through the first and last given point and +lies within the convex hull of all control points. The curve is tangent +to $P_1-P_0$ and $P_n-P_{n-1}$ at the endpoint. +Undesirable properties of Bézier curves are their numerical instability for +large numbers of control points, and the fact that moving a single control +point changes the global shape of the curve. The former is sometimes avoided +by smoothly patching together low-order Bézier curves. + +The macro \CMD{psBezier} (note the upper case B) expects the number of the order +and $n=order+1$ pairs of coordinates: + +\begin{lstlisting}[style=syntax] +\psBezier#[](x0,y0)(x1,y1)...(xn,yn) +\end{lstlisting} + +The number of steps between the first and last control points is given +by the keyword \verb=plotpoints= and preset to 200. It can be +changed in the usual way. + + +\begin{lstlisting} +\psset{showpoints=true,linewidth=1.5pt} +\begin{pspicture}(-2,-2)(2,2)% order 1 -- linear + \psBezier1{<->}(-2,0)(-2,2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 2 -- quadratric + \psBezier2{<->}(-2,0)(-2,2)(0,2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 3 -- cubic + \psBezier3{<->}(-2,0)(-2,2)(0,2)(2,2) +\end{pspicture}\qquad + +\vspace{1cm} +\begin{pspicture}(-2,-2)(2,2)% order 4 -- quartic + \psBezier4{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 5 -- quintic + \psBezier5{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 6 + \psBezier6{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2) +\end{pspicture}\qquad + +\vspace{1cm} +\begin{pspicture}(-2,-2)(2,2)% order 7 + \psBezier7{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 8 + \psBezier8{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2)(-2,0) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 9 + \psBezier9{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2)(-2,0)(0,0) +\end{pspicture} +\end{lstlisting} + + +\begingroup +\psset{showpoints=true,linewidth=1.5pt} +\begin{pspicture}(-2,-2)(2,2)% order 1 -- linear + \psBezier1{<->}(-2,0)(-2,2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 2 -- quadratric + \psBezier2{<->}(-2,0)(-2,2)(0,2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 3 -- cubic + \psBezier3{<->}(-2,0)(-2,2)(0,2)(2,2) +\end{pspicture}\qquad + +\vspace{1cm} +\begin{pspicture}(-2,-2)(2,2)% order 4 -- quartic + \psBezier4{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 5 -- quintic + \psBezier5{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 6 + \psBezier6{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2) +\end{pspicture}\qquad + +\vspace{1cm} +\begin{pspicture}(-2,-2)(2,2)% order 7 + \psBezier7{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 8 + \psBezier8{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2)(-2,0) +\end{pspicture}\qquad +% +\begin{pspicture}(-2,-2)(2,2)% order 9 + \psBezier9{<->}(-2,0)(-2,2)(0,2)(2,2)(2,0)(2,-2)(0,-2)(-2,-2)(-2,0)(0,0) +\end{pspicture} +\endgroup + + + \section{\CMD{psPolynomial}} The polynomial function is defined as \begin{align} @@ -73,6 +194,7 @@ f^{\prime}(x) &= a_1 + 2a_2x + 3a_3x^2 + \ldots +(n-1)a_{n-1}x^{n-2} + na_nx^{n- f^{\prime\prime}(x) &= 2a_2 + 6a_3x + \ldots +(n-1)(n-2)a_{n-1}x^{n-3} + n(n-1)a_nx^{n-2} \end{align} + \noindent so \verb+pst-func+ needs only the coefficients of the polynomial to calculate the function. The syntax is @@ -260,7 +382,7 @@ syntax is similiar to \verb+psPolynomial+, except that there are two kinds of coefficients: \begin{lstlisting}[style=syntax] -\psPolynomial[cosCoeff=a0 a1 a2 ..., sinCoeff=b1 b2 ...]{xStart}{xEnd} +\psFourier[cosCoeff=a0 a1 a2 ..., sinCoeff=b1 b2 ...]{xStart}{xEnd} \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 @@ -385,6 +507,7 @@ way, at the cost of some reduction in graphics resolution. \end{LTXexample} + \clearpage \section{\CMD{psSi}, \CMD{pssi} and \CMD{psCi}} The integral sin and cosin are defined as @@ -519,7 +642,7 @@ your system, otherwise install or update it from \textsc{CTAN}. It must the late - +\clearpage \subsection{Normal distribution (Gauss)} The Gauss function is defined as % @@ -560,6 +683,8 @@ and is predefined with 5. \end{LTXexample} + +\clearpage \subsection{Binomial distribution}\label{sec:bindistri} These two macros plot binomial distribution, \CMD{psBinomialN} the normalized one. It is always @@ -661,6 +786,7 @@ P(k) &= P(k-1)\cdot\frac{N-k+1}{k}\cdot\frac{p}{1-p} \end{align} + \begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=1cm,yunit=5cm}% \begin{pspicture}(-3,-0.15)(4,0.55)% @@ -671,6 +797,7 @@ P(k) &= P(k-1)\cdot\frac{N-k+1}{k}\cdot\frac{p}{1-p} \end{LTXexample} + \begin{LTXexample}[pos=t,preset=\centering] \psset{yunit=10} \begin{pspicture*}(-8,-0.07)(8.1,0.55) @@ -693,10 +820,13 @@ P(k) &= P(k-1)\cdot\frac{N-k+1}{k}\cdot\frac{p}{1-p} \end{pspicture*} \end{LTXexample} + + For the normalized distribution the plotstyle can be set to \verb+curve+ (\verb+plotstyle=curve+), then the binomial distribution looks like a normal distribution. This option is only valid vor \CMD{psBinomialN}. The option \verb+showpoints+ is valid if \verb+curve+ was chosen. + \begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=1cm,yunit=10cm}% \begin{pspicture*}(-4,-0.06)(4.1,0.57)% @@ -707,6 +837,7 @@ valid vor \CMD{psBinomialN}. The option \verb+showpoints+ is valid if \verb+curv \end{pspicture*} \end{LTXexample} + \begin{LTXexample}[pos=t,preset=\centering] \psset{xunit=1cm,yunit=10cm}% \begin{pspicture*}(-4,-0.06)(4.2,0.57)% @@ -718,6 +849,7 @@ valid vor \CMD{psBinomialN}. The option \verb+showpoints+ is valid if \verb+curv \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 @@ -792,6 +924,7 @@ in which \texttt{M} is an optional argument with a default of 0. \end{LTXexample} + \clearpage \subsection{Gamma distribution} A gamma distribution is a general type of statistical distribution that is related @@ -993,15 +1126,15 @@ and has the syntax (with a default setting of $s=1$ and $\mu=1$): \clearpage -\section{\CMD{psLame} -- Lamé Curve, a superellipse} +\section{\CMD{psLame} -- Lam\'e Curve, a superellipse} A superellipse is a curve with Cartesian equation % \begin{align} \left|\frac{x}{a}\right|^r + \left|\frac{y}{b}\right|^r & =1 \end{align} % -first discussed in 1818 by Gabriel Lamé (1795--1870)% -\footnote{Lamé worked on a wide variety of different topics. +first discussed in 1818 by Gabriel Lam\'e (1795--1870)% +\footnote{Lam\'e worked on a wide variety of different topics. His work on differential geometry and contributions to Fermat's Last Theorem are important. He proved the theorem for $n = 7$ in 1839.}. A superellipse may be described parametrically by @@ -1011,7 +1144,7 @@ x = a\cdot\cos^{\frac{2}{r}} t\\ y = b\cdot\sin^{\frac{2}{r}} t \end{align} % -Superellipses with $a=b$ are also known as Lamé curves or Lamé ovals and +Superellipses with $a=b$ are also known as Lam\'e curves or Lam\'e ovals and the restriction to $r>2$ is sometimes also made. The following table summarizes a few special cases. Piet Hein used $\frac{5}{2}$ with a number of different $\frac{a}{b}$ ratios for various of his projects. For example, he used $\frac{a}{b}=\frac{6}{5}$ @@ -1331,10 +1464,23 @@ valuewidth & & 10 & the width of the string for the converted \end{lstlisting} +\section{Examples} + +\begin{LTXexample}[preset=\centering] +\psset{xunit=0.5cm,yunit=20cm,arrowscale=1.5} +\begin{pspicture}(-1,-0.1)(21,0.2) +\psChiIIDist[linewidth=1pt,nue=5]{0.01}{19.5} +\psaxes[labels=none,ticks=none]{->}(20,0.2) +\pscustom[fillstyle=solid,fillcolor=red!30]{% + \psChiIIDist[linewidth=1pt,nue=5]{8}{19.5}% + \psline(20,0)(8,0)} +\end{pspicture} +\end{LTXexample} \section{Credits} Rafal Bartczuk | Gerry Coombes | Denis Girou | Christophe Jorssen | Manuel Luque | Timothy Van Zandt +and \url{http://mathworld.wolfram.com} \bgroup \raggedright -- cgit v1.2.3