summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-06-14 23:12:09 +0000
committerKarl Berry <karl@freefriends.org>2008-06-14 23:12:09 +0000
commit1b839cac605520b4304daee2b100f17d559d70fd (patch)
tree69387c208249272ddf9b844ebb69407b0c26d905
parent9730d4afc5aab909a3458657d73cba817cf1e3da (diff)
pst-func update (14jun08)
git-svn-id: svn://tug.org/texlive/trunk@8736 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/Changes4
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdfbin2324861 -> 2654114 bytes
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex151
-rw-r--r--Master/texmf-dist/tex/generic/pst-func/pst-func.tex73
4 files changed, 211 insertions, 17 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes
index d97578831f2..49914efffed 100644
--- a/Master/texmf-dist/doc/generic/pst-func/Changes
+++ b/Master/texmf-dist/doc/generic/pst-func/Changes
@@ -1,4 +1,7 @@
..... pst-func.tex
+0.55 2008-06-12 added code for Thomae's function, aka popcorn function
+0.54 2008-03-22 added Bernstein code for Bernstein polynomials with
+ optional argument for the envolope curve
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
@@ -54,6 +57,7 @@
..... pst-func.pro
+0.09 2008-03-22 added Bernstein code for Bernstein polynomials
0.08 2008-03-21 added BezierCurve code for Bezier curves of up to
order 9
0.07 2007-08-30 new subroutine LogGamma
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 7b45c55c800..fe3a82af098 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
Binary files 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 c8193b69342..ddf50223156 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
@@ -10,6 +10,7 @@
\usepackage{longtable}
%\usepackage{fancyhdr}
%\pagestyle{fancy}
+\usepackage{xkvview}
\usepackage{pstricks}
\usepackage{pst-func}
\let\pstFuncFV\fileversion
@@ -18,7 +19,7 @@
\usepackage{babel}
\usepackage{showexpl}
\lstset{pos=t,wide=true,language=PSTricks,
- morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl}}
+ morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl},basicstyle=\small\ttfamily}
\lstdefinestyle{syntax}{backgroundcolor=\color{blue!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt,
frame=single}
%
@@ -42,6 +43,7 @@ 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:
+ Jean-C\^ome Charpentier,
Martin Chicoine,
Gerry Coombes,
John Frampton,
@@ -185,8 +187,8 @@ changed in the usual way.
\endgroup
-
-\section{\CMD{psPolynomial}}
+\section{Polynomials}
+\subsection{\CMD{psPolynomial}}
The polynomial function is defined as
\begin{align}
f(x) &= a_0 + a_1x + a_2x^2 + a_3x^3 + \ldots +a_{n-1}x^{n-1} + a_nx^n\\
@@ -364,7 +366,98 @@ options can be set in the usual way with \verb+\psset+.
\end{pspicture*}
\end{LTXexample}
+\clearpage
+\subsection{\CMD{psBernstein}}
+The polynomials defined by
+%
+\[ B_{i,n}(t)=\binom{n}{i}t^i(1-t)^{n-i} \]
+%
+where $\tbinom{n}{k}$ is a binomial coefficient are named Bernstein polynomials of degree $n$.
+They form a basis for the power polynomials of degree $n$.
+The Bernstein polynomials satisfy symmetry
+\[B_{i,n}(t)=B_{n-i,n}(1-t)\]
+positivity \[B_{i,n}(t)\ge0 \mbox{\qquad for } 0\le t\le1\]
+normalization \[\sum_{i=0}^nB_{i,n}(t)=1\]
+and $B_{i,n}$ with $i!=0$, $n$ has a single unique local maximum of
+\[i^in^{-n}(n-i)^{n-i}\binom{n}{i}\]
+occurring at $t=\frac{i}{n}$.
+The envelope $f_n(x)$ of the Bernstein polynomials $B_{i,n}(x)$ for $i=0,1,\ldots,n$
+is given by \[f_n(x)=\frac{1}{\sqrt{\pi n\cdot x(1-x)}}\]
+illustrated below for $n=20$.
+
+\begin{lstlisting}[style=syntax]
+\psBernstein[<options>](tStart,tEnd)(i,n)
+\end{lstlisting}
+
+The \verb=(tStart,tEnd)= are \emph{optional} and preset by \verb=(0,1)=. The only new optional
+argument is the boolean key \texttt{envelope}, which plots the envelope curve instead
+of the Bernstein polynomial.
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{0,0}$,90]
+ \psBernstein[linecolor=red,linewidth=1pt](0,0)
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{i,1}$,90]
+ \psBernstein[linecolor=blue,linewidth=1pt](0,1)
+ \psBernstein[linecolor=blue,linewidth=1pt](1,1)
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{i,2}$,90]
+ \multido{\i=0+1}{3}{\psBernstein[linecolor=red,
+ linewidth=1pt](\i,2)}
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{i,3}$,90]
+ \multido{\i=0+1}{4}{\psBernstein[linecolor=magenta,
+ linewidth=1pt](\i,3)}
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{i,4}$,90]
+ \multido{\i=0+1}{5}{\psBernstein[linecolor=cyan,
+ linewidth=1pt](\i,4)}
+\end{pspicture}
+\end{LTXexample}
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture}(-0.1,-0.05)(1.1,1.1)
+ \multido{\i=0+1}{20}{\psBernstein[linecolor=green,
+ linewidth=1pt](\i,20)}
+ \psBernstein[envelope,linecolor=black](0.02,0.98)(0,20)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{i,20}$,180]
+\end{pspicture}
+\end{LTXexample}
+
+\begin{LTXexample}[width=5cm,pos=l]
+\psset{xunit=4.5cm,yunit=3cm}
+\begin{pspicture*}(-0.2,-0.05)(1.1,1.1)
+ \psaxes{->}(0,0)(1,1)[$t$,0][$B_{env}$,180]
+ \multido{\i=2+1}{20}{\psBernstein[envelope,
+ linewidth=1pt](0.01,0.99)(0,\i)}
+\end{pspicture*}
+\end{LTXexample}
+
+
+\psset{unit=1cm}
\clearpage
\section{\CMD{psFourier}}
@@ -1083,7 +1176,7 @@ 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
+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}
@@ -1102,8 +1195,8 @@ and has the syntax (with a default setting of $\alpha=1$ and $\beta=1$):
\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}}
+ \multido{\rbeta=0.25+0.25,\ired=0+5,\rblue=50.0+-2.5}{20}{%
+ \psBetaDist[beta=\rbeta,linecolor=red!\ired!blue!\rblue]{0.01}{0.99}}
\psaxes[Dy=0.2,Dx=0.1]{->}(0,0)(1,2.01)
\end{pspicture*}
\end{LTXexample}
@@ -1190,9 +1283,40 @@ and unit.
\end{LTXexample}
\egroup
+
\clearpage
+\section{\CMD{psThomae} -- the popcorn function}
+
+Thomae's function, also known as the popcorn function,
+the raindrop function, the ruler function or the
+Riemann function, is a modification of the Dirichlet function.
+This real-valued function f(x) is defined as follows:
+
+\[ f(x)=\begin{cases}
+ \frac{1}{q}\mbox{ if }x=\frac{p}{q}\mbox{ is a rational number}\\
+ 0\mbox{ if }x\mbox{ is irrational}
+ \end{cases}
+\]
+It is assumed here that $\mathop{gcd}(p,q) = 1$ and $q > 0$ so that the function is well-defined
+and nonnegative. The syntax is:
+\begin{lstlisting}[style=syntax]
+\psThomae[options](x0,x1){points}
+\end{lstlisting}
+
+\verb+(x0,x1)+ is the plotted interval, both values must be grater zero and $x_1>x_0$.
+The plotted number of points is the third parameter.
+
+\begin{LTXexample}[width=6cm,wide=false]
+\psset{unit=4cm}
+\begin{pspicture}(-0.1,-0.2)(2.5,1.15)
+ \psaxes{->}(0,0)(2.5,1.1)
+ \psThomae[dotsize=2.5pt,linecolor=red](0,2){300}
+\end{pspicture}
+\end{LTXexample}
+
+\clearpage
\section{\CMD{psplotImp} -- plotting implicit defined functions}
This macro is still experimental! For a given area, the macro calculates in a
first step row by row for every pixel (1pt) the function $f(x,y)$ and checks for an
@@ -1433,16 +1557,18 @@ PSfont & PS font name & Times & only valid \PS font names are possible, e
fontscale & <number> & 10 & the font scale in pt\\
valuewidth & <number> & 10 & the width of the string for the converted
real number; if it is too small, no value is printed\\
+decimals & <number> & -1 & the number of printed decimals, a negative value
+ prints all possible digits.\\
\end{tabularx}
\begin{center}
\psset{fontscale=12}
-\makebox[2em]{x(deg)} \makebox[5em]{$\sin x$} \makebox[5em]{$\cos x$}
+\makebox[2em]{x(deg)} \makebox[5em]{$\sin x$} \makebox[4em]{$\cos x$}\hspace{1em}
\makebox[5em]{$\sqrt x$}\makebox[7em]{$\sin x+\cos x$}\makebox[6em]{$\sin^2 x+\cos^2 x$}\\[3pt]
\multido{\iA=0+10}{18}{
\makebox[1em]{\iA}
\makebox[5em]{\psPrintValue[PSfont=Helvetica]{\iA\space sin}}
- \makebox[5em]{\psPrintValue[PSfont=Courier,fontscale=10]{\iA\space cos}}
+ \makebox[4em][r]{\psPrintValue[PSfont=Courier,fontscale=10,decimals=3]{\iA\space cos}}\hspace{1em}
\makebox[5em]{\psPrintValue[valuewidth=15,linecolor=blue,PSfont=AvantGarde]{\iA\space sqrt}}
\makebox[7em]{\psPrintValue[PSfont=Times-Italic]{\iA\space dup sin exch cos add}}
\makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\iA\space dup sin dup mul exch cos dup mul add}}\\}
@@ -1452,12 +1578,12 @@ valuewidth & <number> & 10 & the width of the string for the converted
\begin{lstlisting}
\psset{fontscale=12}
-\makebox[2em]{x(deg)} \makebox[5em]{$\sin x$} \makebox[5em]{$\cos x$}
+\makebox[2em]{x(deg)} \makebox[5em]{$\sin x$} \makebox[4em]{$\cos x$}\hspace{1em}
\makebox[5em]{$\sqrt x$}\makebox[7em]{$\sin x+\cos x$}\makebox[6em]{$\sin^2 x+\cos^2 x$}\\[3pt]
\multido{\iA=0+10}{18}{
\makebox[1em]{\iA}
\makebox[5em]{\psPrintValue[PSfont=Helvetica]{\iA\space sin}}
- \makebox[5em]{\psPrintValue[PSfont=Courier,fontscale=10]{\iA\space cos}}
+ \makebox[4em][r]{\psPrintValue[PSfont=Courier,fontscale=10,decimals=3]{\iA\space cos}\hspace{1em}}
\makebox[5em]{\psPrintValue[valuewidth=15,linecolor=blue,PSfont=AvantGarde]{\iA\space sqrt}}
\makebox[7em]{\psPrintValue[PSfont=Times-Italic]{\iA\space dup sin exch cos add}}
\makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\iA\space dup sin dup mul exch cos dup mul add}}\\}
@@ -1477,6 +1603,11 @@ valuewidth & <number> & 10 & the width of the string for the converted
\end{pspicture}
\end{LTXexample}
+\clearpage
+\section{List of all optional arguments for \texttt{pst-func}}
+
+\xkvview{family=pst-func,columns={key,type,default}}
+
\section{Credits}
Rafal Bartczuk | Gerry Coombes | Denis Girou | Christophe Jorssen | Manuel Luque | Timothy Van Zandt
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 04f571e2014..b1a9af308f5 100644
--- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
+++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
@@ -1,3 +1,4 @@
+%% $Id: pst-func.tex 16 2008-03-02 16:51:07Z herbert $
%%
%% This is file `pst-func.tex',
%%
@@ -28,8 +29,8 @@
% interface to the `xkeyval' package
\pst@addfams{pst-func}
-\def\fileversion{0.52}
-\def\filedate{2008/03/21}
+\def\fileversion{0.55}
+\def\filedate{2008/06/12}
\message{`PST-func' v\fileversion, \filedate\space (hv)}
%
\pstheader{pst-func.pro}
@@ -311,16 +312,18 @@
}
%
\define@key[psset]{pst-func}{PSfont}{\def\psk@PSfont{/#1 }}
-\define@key[psset]{pst-func}{valuewidth}{\def\psk@valuewidth{#1 }}
-\define@key[psset]{pst-func}{fontscale}{\def\psk@fontscale{#1 }}
-\psset[pst-func]{PSfont=Times-Roman,fontscale=10,valuewidth=10}
+\define@key[psset]{pst-func}{valuewidth}{\pst@getint{#1}\psk@valuewidth }
+\define@key[psset]{pst-func}{fontscale}{\pst@checknum{#1}\psk@fontscale }
+\define@key[psset]{pst-func}{decimals}{\pst@getint{#1}\psk@decimals }
+\psset[pst-func]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1}
%
\def\psPrintValue{\pst@object{psPrintValue}}
\def\psPrintValue@i#1{%
\begin@SpecialObj
\addto@pscode{
gsave \psk@PSfont findfont \psk@fontscale scalefont setfont
- #1 \psk@valuewidth string cvs 0 0 moveto show grestore
+ #1 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
+ \psk@valuewidth string cvs 0 0 moveto show grestore
}%
\end@SpecialObj%
}
@@ -743,6 +746,7 @@
\ignorespaces%
}
\def\tx@BezierShowPoints{ tx@Dict begin /Points ED BezierShowPoints end }
+\def\tx@BezierCurve{ tx@FuncDict begin BezierCurve Points end }
\def\pst@BezierType{2 } % the default
%
\def\psBezier#1{% % allowed order is 1 ... 9
@@ -758,11 +762,66 @@
\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
+ \tx@BezierCurve
\ifshowpoints \tx@BezierShowPoints \else pop \fi
}%
\end@OpenObj}
%
+\def\tx@Bernstein{ tx@FuncDict begin Bernstein end }
+\define@boolkey[psset]{pst-func}[Pst@]{envelope}[true]{}
+\psset[pst-func]{envelope=false}
+%
+\def\psBernstein{\pst@object{psBernstein}}% \psBernstein[options](t1,t2)(i,n)
+\def\psBernstein@i(#1,#2){%
+ \@ifnextchar({\psBernstein@ii(#1,#2)}{\psBernstein@ii(0,1)(#1,#2)}}
+%
+\def\psBernstein@ii(#1,#2)(#3,#4){% (tStart,tEnd)(i,n)
+ \addbefore@par{plotpoints=200}%
+ \begin@OpenObj
+ \addto@pscode{%
+ /ScreenCoor { \tx@ScreenCoor } def
+ #1\space #2\space
+ 1.0 \psk@plotpoints\space div % step=1/plotpoints
+ #3\space #4\space
+% on stack we have tStart tEnd epsilon i n
+ \ifPst@envelope true \else false \fi
+ \tx@Bernstein
+ }%
+ \end@OpenObj}
+%
+\def\psThomae{\pst@object{psThomae}}
+\def\psThomae@i(#1,#2)#3{%
+ \addbefore@par{dotsize=1pt}
+ \begin@ClosedObj
+ \addto@pscode{
+ 1 1 #3 {
+ dup
+ /ipSave ED % save loop value
+ /ip ED % dito
+ 1 1 #3 {
+ dup
+ /iqSave ED % sabve loop value
+ /iq ED % dito
+ {
+ iq 0 le { exit } if
+ ip iq mod
+ /ip iq def
+ /iq ED
+ } loop
+ ip 1 eq {
+ /xVal ipSave iqSave div def
+ xVal #1 ge { xVal #2 le {
+ \psk@dotsize
+ \@nameuse{psds@\psk@dotstyle}
+ \pst@usecolor\pslinecolor xVal 1 iqSave div \tx@ScreenCoor
+ 2 copy moveto Dot } if } if
+ } if
+ } for
+ } for
+ }%
+ \end@ClosedObj%
+}
+%
%
\catcode`\@=\PstAtCode\relax
%