diff options
author | Karl Berry <karl@freefriends.org> | 2008-03-22 23:29:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-03-22 23:29:41 +0000 |
commit | 8328d8188fb85a8733a4f03c71b40f415ac51365 (patch) | |
tree | 7ad37fe6429fe77c892d6395d01700f1329ce34b | |
parent | b552fc5adb5017e593f10eeed7bfd18e10e531ac (diff) |
pst-func 0.53
git-svn-id: svn://tug.org/texlive/trunk@7087 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/Changes | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/README | 1 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdf | bin | 2298948 -> 2324861 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex | 178 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-func/pst-func.pro | 50 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-func/pst-func.tex | 23 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-func/pst-func.sty | 7 |
7 files changed, 244 insertions, 23 deletions
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 Binary files differindex 74cc078a126..7b45c55c800 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 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#[<options>](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 & <number> & 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 diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro index df17f4578d6..03bdf15ef53 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.07 / 2007-08-30 Herbert Voss <voss _at_ pstricks.de> +%% version 0.08 / 2008-03-21 Herbert Voss <voss _at_ pstricks.de> % /tx@FuncDict 100 dict def tx@FuncDict begin @@ -38,6 +38,54 @@ tx@FuncDict begin m factorial n factorial m n sub factorial mul div } ifelse } ifelse } def % +/BezierPascal [ + [ 1 ] % 0 + [ 1 1 ] % 1 + [ 1 2 1 ] % 2 + [ 1 3 3 1 ] % 3 + [ 1 4 6 4 1 ] % 4 + [ 1 5 10 10 5 1 ] % 5 + [ 1 6 15 20 15 6 1 ] % 6 + [ 1 7 21 35 35 21 7 1 ] % 7 + [ 1 8 28 56 70 56 28 8 1 ] % 8 + [ 1 9 36 84 126 126 84 36 9 1 ] % 9 +] def +% +/GetBezierCoor { % t on stack + 10 dict begin % hold all local + /t ED + /t1 1 t sub def % t1=1-t + /Coeff BezierPascal BezierType get def % get the coefficients + 0 0 % initial values for x y + BezierType -1 0 { % BezierType,...,2,1,0 + /I ED % I=BezierType,...,2,1,0 + /J BezierType I sub def % J=0,1,2,...,BezierType + /T t I exp Coeff J get mul def % coeff(J)*t^I + /T1 t1 J exp def % t1^J + Points I dup add 1 add get % y(2*I+1) + T mul T1 mul add % the y coordinate + exch % y x + Points I dup add get % x(2*I) + T mul T1 mul add % the x coordinate + exch % x y + } for % x y on stack + end +} def +% +/BezierCurve { % on stack [ coors psk@plotpoints BezierType + /BezierType ED + 1 exch div /epsilon ED + ] /Points ED % yi xi ... y3 x3 y2 x2 y1 x1 y0 x0 + epsilon GetBezierCoor % next Bezier point + Points 0 get Points 1 get % starting point + ArrowA moveto + epsilon epsilon 1 { + /t ED + t GetBezierCoor + t 0.9999 lt { lineto }{ 1 epsilon sub GetBezierCoor 4 2 roll ArrowB pop pop pop pop } ifelse + } for +} def +% /Si { % integral sin from 0 to x (arg on stack) /arg exch def /Sum arg def 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 28027667b8b..04f571e2014 100644 --- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex +++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex @@ -29,7 +29,7 @@ \pst@addfams{pst-func} \def\fileversion{0.52} -\def\filedate{2008/03/02} +\def\filedate{2008/03/21} \message{`PST-func' v\fileversion, \filedate\space (hv)} % \pstheader{pst-func.pro} @@ -742,7 +742,26 @@ \endgroup% \ignorespaces% } - +\def\tx@BezierShowPoints{ tx@Dict begin /Points ED BezierShowPoints end } +\def\pst@BezierType{2 } % the default +% +\def\psBezier#1{% % allowed order is 1 ... 9 + \ifnum#1>0 \ifnum#1<10 \def\pst@BezierType{#1 }\fi\fi% + \pst@object{psBezier}} +\def\psBezier@i{% + \pst@getarrows{% + \addbefore@par{plotpoints=200}% + \begin@OpenObj + \pst@getcoors[\psBezier@ii% +}} +\def\psBezier@ii{% + \addto@pscode{% + \psk@plotpoints % step for Bezier T=0,0+epsilon,0+i*epsilon,...,1 + \pst@BezierType % type of the Bezier curve 2,3,4,... + tx@FuncDict begin BezierCurve Points end + \ifshowpoints \tx@BezierShowPoints \else pop \fi + }% + \end@OpenObj} % % \catcode`\@=\PstAtCode\relax diff --git a/Master/texmf-dist/tex/latex/pst-func/pst-func.sty b/Master/texmf-dist/tex/latex/pst-func/pst-func.sty index 0c975dd68db..3785403fa49 100644 --- a/Master/texmf-dist/tex/latex/pst-func/pst-func.sty +++ b/Master/texmf-dist/tex/latex/pst-func/pst-func.sty @@ -1,8 +1,11 @@ \RequirePackage{pstricks} -\ProvidesPackage{pst-func}[2006/04/22 package wrapper for +\ProvidesPackage{pst-func}[2008/03/21 package wrapper for pst-func.tex (hv)] \input{pst-func.tex} \ProvidesFile{pst-func.tex} [\filedate\space v\fileversion\space `PST-func' (hv)] -\IfFileExists{pst-func.pro}{\@addtofilelist{pst-func.pro}}{}% +\IfFileExists{pst-func.pro}{% + \ProvidesFile{pst-func.pro} + [2008/03/21 v. 0.08, PostScript prologue file (hv)] +\@addtofilelist{pst-func.pro}}{}% \endinput |