texlive[49403] Master/texmf-dist: pst-math (13dec18)

commits+karl at tug.org commits+karl at tug.org
Thu Dec 13 23:50:09 CET 2018


Revision: 49403
          http://tug.org/svn/texlive?view=revision&revision=49403
Author:   karl
Date:     2018-12-13 23:50:09 +0100 (Thu, 13 Dec 2018)
Log Message:
-----------
pst-math (13dec18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/generic/pst-math/Changes
    trunk/Master/texmf-dist/doc/generic/pst-math/README
    trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.pdf
    trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.tex
    trunk/Master/texmf-dist/dvips/pst-math/pst-math.pro
    trunk/Master/texmf-dist/tex/generic/pst-math/pst-math.tex
    trunk/Master/texmf-dist/tex/latex/pst-math/pst-math.sty

Modified: trunk/Master/texmf-dist/doc/generic/pst-math/Changes
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-math/Changes	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/doc/generic/pst-math/Changes	2018-12-13 22:50:09 UTC (rev 49403)
@@ -1,4 +1,5 @@
-..... pst-math.pro
+..... pst-math.sty/pro
+0.64 2018-12-13  - added macros for creating lists of randoms
 0.63 2014-07-30  - added the arc secans functions
 0.61 2010-10-02  - moved vasicek into pst-func to make the
                    probability available as parameter
@@ -11,5 +12,3 @@
 0.1              first CTAN version (cj)
 
 
-..... pst-math.sty
-

Modified: trunk/Master/texmf-dist/doc/generic/pst-math/README
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-math/README	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/doc/generic/pst-math/README	2018-12-13 22:50:09 UTC (rev 49403)
@@ -1,18 +1,8 @@
 pst-math: PostScript extension for mathematical functions:
 
-Save the files pst-math.sty|pro|tex in a directory, which is part of your 
-local TeX tree. The pro file should go into $TEXMF/dvips/pstricks/
-Then do not forget to run texhash to update this tree.
-For more information  see the documentation of your LATEX distribution 
-on installing packages into your local TeX system or read the 
-TeX Frequently Asked Questions:
-(http://www.tex.ac.uk/cgi-bin/texfaq2html?label=instpackages).
+The macros for random numbers cannot be used with xelatex!
 
-pst-math needs pst-plot (pstricks-add) and pstricks, which should 
-be part of your local TeX installation, otherwise get it from a 
-CTAN server, f.ex. ftp://ftp.ctan.org
+hvoss at tug.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 859 2018-12-13 15:31:03Z herbert $

Modified: trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.tex	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/doc/generic/pst-math/pst-math-doc.tex	2018-12-13 22:50:09 UTC (rev 49403)
@@ -1,7 +1,6 @@
-%% $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}
-\usepackage[utf8]{inputenc}
+%% $Id: pst-math-doc.tex 859 2018-12-13 15:31:03Z herbert $
+\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,
+   headings=small, headinclude=false,footinclude=false,oneside,abstract=on]{pst-doc}
 \usepackage{pst-math}
 \let\pstMathFV\fileversion
 \usepackage{pstricks-add}
@@ -19,6 +18,9 @@
 x&\mapsto&{\operator at font#1}(x)\end{array}\right.}
 \makeatother
 
+\addbibresource{\jobname.bib}
+
+
 \begin{document}
 
 \title{\texttt{pst-math}}
@@ -46,6 +48,9 @@
 Dominik Rodriguez
 \end{abstract}
 
+
+\clearpage
+
 \section{Introduction}
 \nxLPack{pst-math} defines \Lcs{pstPi} on \TeX\ level which expects 1,2,3 or 4 as
 parameter. It is not available on PostScript level.
@@ -311,7 +316,7 @@
 %a b var f Ierr
 
 the first two variables are the low and high boundary \Index{integral}, both can be values or
-\PS expressions. \verb+/var+ is the definition of the integrated variable (not x!), which is
+\PS\ expressions. \verb+/var+ is the definition of the integrated variable (not x!), which is
 used in the following function description, which must be inside of braces. The last
 number is the tolerance for the step adjustment. The function \Lps{SIMPSON} can be
 nested.
@@ -331,6 +336,8 @@
 \end{pspicture*}
 \end{LTXexample}
 
+
+
 \begin{LTXexample}[pos=t,wide=false]
 %%% Gaussian and relative integral from -x to x to its value sqrt{pi}
 \psset{unit=2}
@@ -438,26 +445,93 @@
 \end{pspicture}
 \end{lstlisting}
 
+
+\iffalse
+
 \begin{LTXexample}[pos=t,wide=false]
 % ce code definit la fonction [cos(2pix cos(t))-cos(2pix)]^2 / sin(t) avec x=h/lambda
-\def\F{
+\def\Func{
   0.01 3.1 
   /t 
-  { TwoPi x mul t COS mul COS TwoPi x mul COS sub 2 exp t SIN div }
+  { TwoPi x mul t COS mul COS TwoPi x mul COS sub 2 exp t SIN div } def
    .01 SIMPSON  60 mul }
-% D = 2*(cos^2(2pix))/F
-\def\fD{TwoPi x mul COS dup mul 2 mul \F\space div}
+% D = 2*(cos^2(2pix))/Func
+\def\fD{TwoPi x mul COS dup mul 2 mul \Func\space div}
 \psset{llx=-1.5cm,lly=-0.5cm,urx=0.2cm,ury=0.2cm,
   xAxisLabel={$h/\lambda$},xAxisLabelPos={0.5,-45},yAxisLabel={$R_r$ en ohms},
   yAxisLabelPos={-0.1,150}}
 \begin{psgraph}[Dy=50,Dx=0.1,xticksize=300 0,yticksize=1 0,
-  comma=true,axesstyle=frame](0,0)(1,300){10cm}{5cm}
-  \psplot{0}{1}{\F}
+    comma=true,axesstyle=frame](0,0)(1,300){10cm}{5cm}
+  \psplot{0}{1}{\Func}
   \psplot[linecolor=red]{0.01}{.1}{\fD}%
 \end{psgraph}
 \end{LTXexample}
 
+\fi
 
+\section{Random numbers}
+Package \LPack{pst-math} supports the creation of random number lists where a number will
+appear only once. 
+
+\begin{BDef}
+\Lcs{defineRandIntervall}\Largr{min,max}{maxNo}\\
+\Lcs{makeSimpleRandomNumberList}\% multiple values possible\\
+\Lcs{makeRandomNumberList}      \% no multiple values!\\
+\Lcs{getNumberFromList}\Largb{number}
+\end{BDef}
+
+The list of the random numbers is \Lcs{RandomNumbers}, a comma separated list of the values.
+It can be used for own purpuses.
+
+
+\begin{LTXexample}[pos=t]
+\defineRandIntervall(1,50){30}
+\makeSimpleRandomNumberList 
+Random list: \RandomNumbers
+
+\psforeach{\iA}{1,2,..,30}{\getNumberFromList{\iA}~}
+\end{LTXexample}
+
+
+In the next example a random number appears only \emph{once} in the list. There no multiple
+numbers:
+
+
+\begin{LTXexample}[pos=t]
+\defineRandIntervall(1,30){30}
+\makeRandomNumberList
+\psforeach{\iA}{1,2,..,30}{\getNumberFromList{\iA}~}
+\end{LTXexample}
+
+
+
+
+\begin{LTXexample}[pos=t]
+\newcounter{RandNo} \setcounter{RandNo}{1}
+\def\n{5} \def\N{\the\numexpr\n*\n}
+\defineRandIntervall(1,\N){\N}
+\makeRandomNumberList  \setcounter{RandNo}{1}
+\begin{pspicture}(\n,\n)
+  \psgrid[subgriddiv=0,gridlabels=0pt]
+  \multido{\rRow=0.5+1.0}{\n}{\multido{\rCol=0.5+1.0}{\n}{%
+      \rput(\rCol,\rRow){\getNumberFromList{\theRandNo}}%
+     \stepcounter{RandNo}}}
+\end{pspicture}
+\setcounter{RandNo}{1}
+\def\n{6} \def\N{\the\numexpr\n*\n}
+\defineRandIntervall(1,\N){\N}
+\makeRandomNumberList  \setcounter{RandNo}{1}
+\begin{pspicture}(\n,\n)
+  \psgrid[subgriddiv=0,gridlabels=0pt]
+  \multido{\rRow=0.5+1.0}{\n}{\multido{\rCol=0.5+1.0}{\n}{%
+      \rput(\rCol,\rRow){\getNumberFromList{\theRandNo}}%
+     \stepcounter{RandNo}}}
+\end{pspicture}
+\end{LTXexample}
+
+
+
+
 \clearpage
 
 \section{Numerical functions}
@@ -479,18 +553,16 @@
 \end{LTXexample}
 
 
+
 These function returns the inverse normal.
 
 \bgroup
 \raggedright
 \nocite{*}
-\bibliographystyle{plain}
-\bibliography{pst-math-doc}
+\printbibliography
 \egroup
 
 \printindex
 
 
-
-
 \end{document}

Modified: trunk/Master/texmf-dist/dvips/pst-math/pst-math.pro
===================================================================
--- trunk/Master/texmf-dist/dvips/pst-math/pst-math.pro	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/dvips/pst-math/pst-math.pro	2018-12-13 22:50:09 UTC (rev 49403)
@@ -3,8 +3,8 @@
 %
 % Author          : Christophe JORSSEN 
 % Author          : Herbert Voß <hvoss at tug.org>
-% Last Mod        : $Date: 2014/07/30 $
-% Version         : 0.63 $
+% Last Mod        : $Date: 2018/12/13 $
+% Version         : 0.64 $
 %
 /PI 3.14159265359 def
 /ENeperian 2.71828182846 def

Modified: trunk/Master/texmf-dist/tex/generic/pst-math/pst-math.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/pst-math/pst-math.tex	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/tex/generic/pst-math/pst-math.tex	2018-12-13 22:50:09 UTC (rev 49403)
@@ -20,8 +20,8 @@
 \csname PSTmathLoaded\endcsname
 \let\PSTmathLoaded\endinput
 \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
-\def\fileversion{0.63}
-\def\filedate{2014/07/30}
+\def\fileversion{0.64}
+\def\filedate{2018/12/13}
 \message{`pst-math' v\fileversion\space, (CJ,hv)}
 
 \pstheader{pst-math.pro}
@@ -28,4 +28,5 @@
 %
 \def\pstPI#1{\ifcase#1\or3.141593\or1.570796\or1.047198\or0.785398\fi}
 %
+
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/pst-math/pst-math.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/pst-math/pst-math.sty	2018-12-13 22:49:55 UTC (rev 49402)
+++ trunk/Master/texmf-dist/tex/latex/pst-math/pst-math.sty	2018-12-13 22:50:09 UTC (rev 49403)
@@ -1,9 +1,96 @@
-\ProvidesPackage{pst-math}[2014/07/30 package wrapper for PSTricks pst-math.tex]
+% $Id: pst-math.sty 859 2018-12-13 15:31:03Z herbert $
+%%
+%% This is file `pst-math.sty'.
+%%
+%% IMPORTANT NOTICE:
+%%
+%% pst-math Copyright (C) 2019-     Herbert Voss <hvoss at tug.org>
+%%
+%% This package may be distributed under the terms of the LaTeX Project
+%% Public License, as described in lppl.txt in the base LaTeX distribution.
+%% Either version 1.0 or, at your option, any later version.
+%%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{pst-math}[2018/12/13 v 0.64package wrapper for PSTricks pst-math.tex]
+\RequirePackage{pst-calculate}
 \input pst-math.tex
 \ProvidesFile{pst-math.tex}
   [\filedate\space v\fileversion\space `PST-math' (hv)]
-\IfFileExists{pst-math.pro}{%
-  \ProvidesFile{pst-math.pro}
-    [2014/07/30 v. 0.63,  PostScript prologue file (hv)]
+\IfFileExists{pst-math.pro}{\ProvidesFile{pst-math.pro}%
+    [2018/12/13 v. 0.64,  PostScript prologue file (hv)]
 \@addtofilelist{pst-math.pro}}{}%
+
+\newcounter{Rand at No}\newcounter{Random at Left}\newcounter{Random at Right}\newcounter{Random at No@max}%
+\setcounter{Rand at No}{0}\setcounter{Random at Left}{1}\setcounter{Random at Right}{1000}%
+
+\def\defineRandIntervall(#1,#2)#3{%
+  \setcounter{Random at Left}{#1}%
+  \setcounter{Random at Right}{#2}%
+  \setcounter{Random at No@max}{#3}%
+  \setcounter{Rand at No}{0}%
+  \def\RandomNumbers{}%
+}
+
+\def\RandomNumbers{}%\pscalculate{randint(\theRandom at Left,\theRandom at Right)}}
+
+\def\makeSimpleRandomNumberList{%
+  \def\RandomNumbers{}%
+  \psforeach{\iA}{1,2,..,\theRandom at No@max}{%
+    \edef\@Number{\pscalculate{randint(\theRandom at Left,\theRandom at Right)}}% Zufallszahl
+    \ifnum\iA=1
+      \xdef\RandomNumbers{\@Number}%
+    \else
+      \xdef\RandomNumbers{\RandomNumbers,\@Number}%
+    \fi
+%    \typeout{\RandomNumbers}%
+  }%
+}
+%
+\def\makeRandomNumberList{%
+  \edef\@Number{\pscalculate{randint(\theRandom at Left,\theRandom at Right)}}% Zufallszahl
+  \ifnum\theRand at No=\z@
+    \xdef\RandomNumbers{\@Number}%
+    \stepcounter{Rand at No}%
+    \xdef\@Number{\pscalculate{randint(\theRandom at Left,\theRandom at Right)}}% Zufallszahl
+  \fi
+  \add at Number{\@Number}\RandomNumbers!!}
+
+\def\add at Number#1#2!!{\edef\x{\noexpand\add at Number@i#1;#2,,\relax}\x}
+\def\add at Number@i#1;#2,#3,#4\relax{%
+  \ifx\relax#2\relax % we found new number
+    \xdef\RandomNumbers{\RandomNumbers,#1}%
+    \stepcounter{Rand at No}%
+    \ifnum\theRand at No>\theRandom at No@max
+      \def\next{}% Neue Zahl?
+    \else 
+      \def\next{\makeRandomNumberList}
+    \fi%
+  \else
+    \ifnum#1=#2 % no new number
+      \def\next{\makeRandomNumberList}%
+    \else 
+      \ifx\relax#3\relax 
+        \def\next{\add at Number@i#1;,,\relax}%
+      \else %
+        \def\next{\add at Number@i#1;#3,#4\relax}%
+      \fi
+    \fi
+  \fi
+  \ifnum\theRand at No<\theRandom at No@max \next \fi
+}
+\def\getNumberFromList#1{%
+  \global\count0 = 1
+  \edef\x{\noexpand\get at Index#1;\RandomNumbers}\x,,\relax}
+\def\get at Index#1;#2,#3,#4\relax{%
+  \ifnum\the\count0=#1 
+    \def\next{#2}%
+  \else
+    \global\advance\count0 by 1
+    \def\next{\get at Index#1;#3,#4\relax}%
+  \fi
+  \next
+}
+
+
 \endinput



More information about the tex-live-commits mailing list