summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-10-08 22:32:27 +0000
committerKarl Berry <karl@freefriends.org>2009-10-08 22:32:27 +0000
commite41ca94a9a98557cd2d5f67315b50811a6672e3e (patch)
treea6b9d3fb6382245cd9bdceafb735b2976bc47a2c
parent9bc61b9b115e4172c7a751e24511e4a5ce0247a0 (diff)
pst-func 0.60 (8oct09)
git-svn-id: svn://tug.org/texlive/trunk@15699 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/Changes3
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/README3
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/pst-func-doc.pdfbin2854625 -> 2865093 bytes
-rw-r--r--Master/texmf-dist/doc/generic/pst-func/pst-func-doc.tex66
-rw-r--r--Master/texmf-dist/dvips/pst-func/pst-func.pro6
-rw-r--r--Master/texmf-dist/tex/generic/pst-func/pst-func.tex90
6 files changed, 140 insertions, 28 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-func/Changes b/Master/texmf-dist/doc/generic/pst-func/Changes
index 1b0f4d4691c..51c913f08f7 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.60 2009-10-08 - modified \psPrintValue to allow algebraic function mode
+ - fix bug with algebraic=true for all macros with \psplot
+ which need postfix code
0.59 2009-01-23 - add option \psk@xShift for \psPrintValue
0.58 2008-12-08 - add the ChebyshevT and ChebyshevU (first and second kind)
the macros are only wrappers for the PS routines
diff --git a/Master/texmf-dist/doc/generic/pst-func/README b/Master/texmf-dist/doc/generic/pst-func/README
index bc9e337e31e..3538fe8df75 100644
--- a/Master/texmf-dist/doc/generic/pst-func/README
+++ b/Master/texmf-dist/doc/generic/pst-func/README
@@ -1,5 +1,6 @@
pst-func: plotting special mathematical functions:
-- psBezier
+-- Chebyshev polynomials
-- psPolynomial (with derivations)
-- psBernstein (with envelope option)
-- psFourier
@@ -41,4 +42,4 @@ 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.
-%% $Id: README 56 2008-11-14 15:55:45Z herbert $
+%% $Id: README 82 2009-01-23 17:38:22Z herbert $
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 e15923af2fe..ccedb089716 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 d5770da871b..d121a0b1399 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,11 +1,25 @@
-%% $Id: pst-func-doc.tex 72 2009-01-08 22:00:47Z herbert $
-\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings
- headexclude,footexclude,oneside]{pst-doc}
+%% $Id: pst-func-doc.tex 137 2009-10-08 18:15:14Z herbert $
+\documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,
+ smallheadings, headexclude,footexclude,oneside]{pst-doc}
\usepackage[utf8]{inputenc}
\usepackage{pst-func}
\let\pstFuncFV\fileversion
\usepackage{pstricks-add}
\usepackage{pst-math}
+\renewcommand\bgImage{%
+\psset{yunit=4cm,xunit=3}
+\begin{pspicture}(-2,-0.2)(2,1.4)
+ \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}}
+
\lstset{pos=t,wide=true,language=PSTricks,
morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl},basicstyle=\footnotesize\ttfamily}
%
@@ -22,6 +36,7 @@
\maketitle
\tableofcontents
+\psset{unit=1cm}
\clearpage
@@ -47,6 +62,7 @@ Rafal Bartczuk,
Horst Gierhardt,
Christophe Jorssen,
Lars Kotthoff,
+ Buddy Ledger,
Manuel Luque,
Jose-Emilio Vila-Forcen,
Timothy Van Zandt,
@@ -72,7 +88,7 @@ Where $B_{i,n}(t)$ is a Bernstein polynomial $B_{i,n}(t)=\binom{n}{i}t^i(1-t)^{n
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
+Undesirable properties of \Index{Bézier curve}s 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.
@@ -177,7 +193,7 @@ changed in the usual way.
\subsection{Chebyshev polynomials}
-The polynomials of the first (ChebyshevT) kind are defined through the identity
+The polynomials of the first (\Lps{ChebyshevT}) kind are defined through the identity
\[ T_n(\cos\theta)=\cos(n\theta)\]
@@ -194,7 +210,7 @@ and
&= \sum_{n=0}^\infty T_n(x)t^n
\end{align}
-The polynomials of second kind (ChebyshevU) can be generated by
+The polynomials of second kind (\Lps{ChebyshevU}) can be generated by
\begin{align}
g(t,x) &= \frac{1}{1-2xt+t^2}\\
@@ -202,7 +218,7 @@ The polynomials of second kind (ChebyshevU) can be generated by
\end{align}
\LPack{pst-func} defines the \TeX-macros \Lcs{ChebyshevT} for the
-first kind and \Lcs{ChebyshevU} for the second kind of Chebyshev polynomials.
+first kind and \Lcs{ChebyshevU} for the second kind of \Index{Chebyshev polynomials}.
These \TeX-macros cannot be used outside of PostScript, they are only wrappers
for \verb+tx@FuncDict begin ChebyshevT end+ and the same for \Lcs{ChebyshevU}.
@@ -344,7 +360,7 @@ polynomial to calculate the function. The syntax is
With the option \Lkeyword{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}$; \Lkeyword{xShift}=1
-moves the graph of the polynomial function one unit to the right.
+moves the graph of the \Index{polynomial function} one unit to the right.
\begin{center}
@@ -1684,7 +1700,8 @@ $f(x)$ has to be described as usual for the macro \Lcs{psplot}.
This new macro allows to \Index{print} single values of a math function. It has the syntax
\begin{BDef}
-\Lcs{psPrintValue}\OptArgs\Largb{PostScript code}
+\Lcs{psPrintValue}\OptArgs\Largb{PostScript code}\\
+\Lcs{psPrintValue}\OptArg{algebraic,\ldots}\Largb{x value, algebraic code}
\end{BDef}
Important is the fact, that \Lcs{psPrintValue} works on \PS\ side. For \TeX\ it is only a box of
@@ -1704,6 +1721,7 @@ There are the following valid options for \Lcs{psPrintValue}:
\Lkeyword{decimals} & <number> & -1 & the number of printed decimals, a negative value
prints all possible digits.\\
\Lkeyword{xShift} & <number> & 0 & the x shift in pt for the output, relative to the current point.\\
+\Lkeyword{algebraic} & <boolean> & false & function in algebraic notation.\\
\end{tabularx}
\begin{center}
@@ -1734,6 +1752,36 @@ There are the following valid options for \Lcs{psPrintValue}:
\makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\iA\space dup sin dup mul exch cos dup mul add}}\\}
\end{lstlisting}
+With enabled \Lkeyword{algebraic} option there must be two arguments, separated by a comma.
+The first one is the x value as a number, which can also be PostScript code, which leaves a
+number on the stack. The second part is the function described in algebraic notation.
+Pay attention, in algebraic notation angles must be in radian and not degrees.
+
+\begin{center}
+\psset{algebraic, fontscale=12}% All functions now in algebraic notation
+\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{\rA=0+0.1}{18}{\makebox[1em]{\rA}
+ \makebox[5em]{\psPrintValue[PSfont=Helvetica,xShift=-10]{\rA, sin(x)}}
+ \makebox[4em][r]{\psPrintValue[PSfont=Courier,fontscale=10,decimals=3,xShift=-20]{\rA,cos(x)}}\hspace{1em}
+ \makebox[5em]{\psPrintValue[comma,valuewidth=15,linecolor=blue,PSfont=AvantGarde]{\rA,sqrt(x)}}
+ \makebox[7em]{\psPrintValue[PSfont=Times-Italic]{\rA,sin(x)+cos(x)}}
+ \makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\rA,sin(x)^2+cos(x)^2}}\\}
+\end{center}
+
+\bigskip
+
+\begin{lstlisting}
+\psset{algebraic, fontscale=12}% All functions now in algebraic notation
+\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{\rA=0+0.1}{18}{\makebox[1em]{\rA}
+ \makebox[5em]{\psPrintValue[PSfont=Helvetica,xShift=-10]{\rA, sin(x)}}
+ \makebox[4em][r]{\psPrintValue[PSfont=Courier,fontscale=10,decimals=3,xShift=-20]{\rA,cos(x)}}\hspace{1em}
+ \makebox[5em]{\psPrintValue[comma,valuewidth=15,linecolor=blue,PSfont=AvantGarde]{\rA,sqrt(x)}}
+ \makebox[7em]{\psPrintValue[PSfont=Times-Italic]{\rA,sin(x)+cos(x)}}
+ \makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\rA,sin(x)^2+cos(x)^2}}\\}
+\end{lstlisting}
\section{Examples}
diff --git a/Master/texmf-dist/dvips/pst-func/pst-func.pro b/Master/texmf-dist/dvips/pst-func/pst-func.pro
index e1093708323..f21fa6b8318 100644
--- a/Master/texmf-dist/dvips/pst-func/pst-func.pro
+++ b/Master/texmf-dist/dvips/pst-func/pst-func.pro
@@ -1,4 +1,4 @@
-%% $Id: pst-func.pro 72 2009-01-08 22:00:47Z herbert $
+%% $Id: pst-func.pro 82 2009-01-23 17:38:22Z herbert $
%%
%% This is file `pst-func.pro',
%%
@@ -16,7 +16,7 @@
%% `pst-func' is a PSTricks package to plot special math functions
%%
%%
-%% version 0.10 / 2009-01-08 Herbert Voss <voss _at_ pstricks.de>
+%% version 0.11 / 2009-01-19 Herbert Voss <voss _at_ pstricks.de>
%
/tx@FuncDict 100 dict def
tx@FuncDict begin
@@ -250,7 +250,7 @@ tx@FuncDict begin
} for
} def
%
-/Simpson { % on stack must be a b M
+/Simpson { % on stack must be a b M --- simple version ---
% /SFunc must be defined
/M ED /b ED /a ED
/h b a sub M 2 mul div 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 c3bbc38e39a..88b322b1c7d 100644
--- a/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
+++ b/Master/texmf-dist/tex/generic/pst-func/pst-func.tex
@@ -1,4 +1,4 @@
-%% $Id: pst-func.tex 72 2009-01-08 22:00:47Z herbert $
+%% $Id: pst-func.tex 137 2009-10-08 18:15:14Z herbert $
%%
%% This is file `pst-func.tex',
%%
@@ -29,8 +29,8 @@
% interface to the `xkeyval' package
\pst@addfams{pst-func}
-\def\fileversion{0.59}
-\def\filedate{2009/01/23}
+\def\fileversion{0.60}
+\def\filedate{2009/10/08}
\message{`PST-func' v\fileversion, \filedate\space (hv)}
%
\pstheader{pst-func.pro}
@@ -53,7 +53,7 @@
\def\psFourier@i[#1]#2#3{{%
\pst@killglue
\psset{#1}
- \psplot{#2}{#3}{%
+ \psplot[algebraic=false]{#2}{#3}{%
/type (cos) def
/Fourier {
aload length /n exch def
@@ -210,7 +210,7 @@
\pst@killglue%
\psset{plotpoints=200}%
\psset{#1}%
- \psplot{#2}{#3}{%
+ \psplot[algebraic=false]{#2}{#3}{%
Euler x \psk@mue sub dup mul 2 div \psk@sigma dup mul div neg exp
1.0 \psk@sigma div TwoPi sqrt div mul%
}%
@@ -323,11 +323,17 @@
\psset[pst-func]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1}
%
\def\psPrintValue{\pst@object{psPrintValue}}
-\def\psPrintValue@i#1{%
+\def\psPrintValue@i#1{\expandafter\psPrintValue@ii#1,,\@nil}
+\def\psPrintValue@ii#1,#2,#3\@nil{% #1,#2 only for algebraic code
\begin@SpecialObj
\addto@pscode{
gsave \psk@PSfont findfont \psk@fontscale scalefont setfont
- #1 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
+ \ifPst@algebraic
+ /x #1 def
+ /Func (#2) tx@AlgToPs begin AlgToPs end cvx def
+ Func
+ \else #1 \fi
+ \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
\psk@valuewidth string cvs /Output exch def % save output
\ifPst@comma % do we have to change dot to comma
0 1 Output length 1 sub {
@@ -339,6 +345,60 @@
}%
\end@SpecialObj%
}
+
+\define@boolkey[psset]{pst-func}[Pst@]{round}[true]{}%
+\define@boolkey[psset]{pst-func}[Pst@]{science}[true]{%
+ \ifPst@science\def\psk@Scin{true }\else\def\psk@Scin{false }\fi}
+\psset[pst-func]{science=false,round=false}
+\def\psPrintValueNew{\pst@object{psPrintValueNew}}
+\def\psPrintValueNew@i#1{\expandafter\psPrintValueNew@ii#1,,\@nil}
+\def\psPrintValueNew@ii#1,#2,#3\@nil{% #1,#2 only for algebraic code
+ \begin@SpecialObj
+ \addto@pscode{ % thanks to Buddy Ledger
+ /mfont { \psk@PSfont findfont \psk@fontscale scalefont setfont } bind def
+ /mfontexp { \psk@PSfont findfont \psk@fontscale 1.2 div scalefont setfont } bind def
+ /s1 { /Symbol findfont \psk@fontscale scalefont setfont } bind def
+ \ifPst@algebraic
+ /x #1 def
+ /Func (#2) tx@AlgToPs begin AlgToPs end cvx def
+ Func
+ \else #1 \fi
+ /value ED
+ \psk@Scin {
+ value 0 ne { value log floor cvi /expon ED }{ /expon 0 def } ifelse
+ value 10 expon exp div
+ \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul
+ \ifPst@round round \else cvi \fi exch div } if
+ \psk@decimals 0 eq { cvi } if /numb ED
+ expon \psk@valuewidth string cvs /expon exch def
+ numb \psk@valuewidth string cvs /Output exch def
+ \ifPst@comma % do we have to change dot to comma
+ 0 1 Output length 1 sub {
+ /Index exch def
+ Output Index get 46 eq { Output Index 44 put } if
+ } for
+ \fi
+ /txspc \psk@fontscale 4 div def
+ \psk@xShift\space 0 moveto mfont Output show
+ txspc 0 rmoveto s1 (\string\264) show
+ txspc 0 rmoveto mfont (10) show
+ txspc 2 div txspc 1.5 mul rmoveto mfontexp expon show }
+ { value
+ \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul
+ \ifPst@round round \else cvi \fi exch div } if
+ \psk@decimals 0 eq { cvi } if %inserted to handle decimals=0
+ \psk@valuewidth string cvs /Output ED
+ \ifPst@comma % do we have to change dot to comma
+ 0 1 Output length 1 sub {
+ /Index exch def
+ Output Index get 46 eq { Output Index 44 put } if
+ } for
+ \fi
+ \psk@xShift\space 0 moveto mfont Output show
+ } ifelse
+ }%
+ \end@SpecialObj%
+}
%
% Integrals 2006-01-16
% Jose-Emilio Vila-Forcen, Herbert Voss
@@ -574,7 +634,7 @@
\else
\addbefore@par{plotpoints=500,alpha=0.5,beta=0.5}%
\begin@OpenObj
- \psplot{#1}{#2}{
+ \psplot[algebraic=false]{#1}{#2}{
\psk@beta x mul \psk@alpha exp x div Euler \psk@beta neg x mul \psk@alpha GAMMALN sub exp mul}
\end@OpenObj%
\fi%
@@ -587,7 +647,7 @@
\else
\addbefore@par{plotpoints=200,alpha=1,beta=1}%
\begin@OpenObj
- \psplot{#1}{#2}{
+ \psplot[algebraic=false]{#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
@@ -603,7 +663,7 @@
\begin@OpenObj
% \ifdim\psk@nue pt<\z@ \psframebox*{\color{red}!!!nue must be greater than 0!!!}
% \else
- \psplot{#1}{#2}{%
+ \psplot[algebraic=false]{#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@OpenObj%
@@ -619,7 +679,7 @@
\use@par
\ifdim\psk@nue pt<\z@ \psframebox*{\color{red}!!!nue must be greater than 0!!!}
\else
- \psplot{#1}{#2}{
+ \psplot[algebraic=false]{#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
@@ -638,7 +698,7 @@
\begingroup
\addbefore@par{plotpoints=500,mue=1}%
\use@par
- \psplot{#1}{#2}{
+ \psplot[algebraic=false]{#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
@@ -735,8 +795,8 @@
\pst@killglue
\begingroup
\use@par
- \psplot[fillstyle=none]{#1}{#2}{#4}% original function
- \psplot[fillstyle=none]{#1}{#2}{#4 neg}% mirrored at the x-axis
+ \psplot[algebraic=false,fillstyle=none]{#1}{#2}{#4}% original function
+ \psplot[algebraic=false,fillstyle=none]{#1}{#2}{#4 neg}% mirrored at the x-axis
\multido{\iA=1+1}{#3}{% run it #3 times with increment \A
\pscustom{% to get a closed filled ellipse
\code{ % the PS code
@@ -756,7 +816,7 @@
8 div exch)% draw again the ellipse to get the borderline.
\psset{plotstyle=line,linestyle=dashed,
plotpoints=40,dotstyle=*,dotsize=0.5pt}
- \psplot{#1}{#2}{#4}\psplot{#1}{#2}{#4 neg}
+ \psplot[algebraic=false]{#1}{#2}{#4}\psplot{#1}{#2}{#4 neg}
% draw again the curves to get the borderline
\endgroup%
\ignorespaces%