Debian Codegraph @

texmf-dist/doc/generic/pst-math/pst-math-doc.tex

raw
1 %% $Id: pst-math-doc.tex 741 2023-07-03 17:53:43Z herbert $
2 \DocumentMetadata{}
3 \documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,
4 headings=small, headinclude=false,footinclude=false,oneside,abstract=on]{pst-doc}
5 \usepackage{pst-math}
6 \let\pstMathFV\fileversion
7 \usepackage{pstricks-add}
8 \lstset{pos=t,wide=true,language=PSTricks,
9 morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl},basicstyle=\footnotesize\ttfamily}
10 %
11 \def\pshlabel#1{\footnotesize#1}
12 \def\psvlabel#1{\footnotesize#1}
13 %
14 \makeatletter
15 \def\DefOfOperator{\@ifstar{\DefOfOperator@}{\DefOfOperator@@}}
16 \def\DefOfOperator@#1#2#3#4{{\operator@font#1}:\left\{\begin{array}{ccc} #2&\to&#3\\
17 x&\mapsto&#4\end{array}\right.}
18 \def\DefOfOperator@@#1#2#3{{\operator@font#1}:\left\{\begin{array}{ccc} #2&\to&#3\\
19 x&\mapsto&{\operator@font#1}(x)\end{array}\right.}
20 \makeatother
21
22 \addbibresource{\jobname.bib}
23
24
25 \begin{document}
26
27 \title{\texttt{pst-math}}
28 \subtitle{Special mathematical PostScript functions; v.\pstMathFV}
29 \author{Christoph Jorssen\\Herbert Vo\ss}
30 \docauthor{Herbert Vo\ss}
31 \date{\today}
32 \maketitle
33
34 \tableofcontents
35
36 \clearpage
37
38 \begin{abstract}
39 \noindent
40 \LPack{pst-math} is an extension to the \Index{PostScript} language. The files \LFile{pst-math.sty}
41 and \LFile{pst-math.tex} are only wrapper files for the \LFile{pst-math.pro} file, which
42 defines all the new mathematical functions for use with PostScript.
43
44 \vfill\noindent
45 Thanks to: \\
46 Denis Bitouzé;
47 Frédéric Bréal;
48 Jacques L'helgoualc'h;
49 Patrice M\'egret;
50 Dominik Rodriguez
51 \end{abstract}
52
53
54 \clearpage
55
56 \section{Introduction}
57 \nxLPack{pst-math} defines \Lcs{pstPi} on \TeX\ level which expects 1,2,3 or 4 as
58 parameter. It is not available on PostScript level.
59
60 \begin{BDef}
61 \Lcs{pstPI}\Larg\#
62 \end{BDef}
63
64 \Lcs{pstPI}1 $\Rightarrow$ $\pi$\\
65 \Lcs{pstPI}2 $\Rightarrow$ $\dfrac{\pi}{2}$\\[2pt]
66 \Lcs{pstPI}3 $\Rightarrow$ $\dfrac{\pi}{3}$\\[2pt]
67 \Lcs{pstPI}4 $\Rightarrow$ $\dfrac{\pi}{4}$
68
69
70 \section{Trigonometry}
71
72 \LPack{pst-math} introduces natural trigonometric PostScript operators \Lps{COS}, \Lps{SIN} and \Lps{TAN} defined by
73 \[\DefOfOperator{cos}{\mathbb R}{[-1,1]}\]
74 \[\DefOfOperator{sin}{\mathbb R}{[-1,1]}\]
75 \[\DefOfOperator{tan}{\mathbb R\backslash\{k\dfrac{\pi}2,k\in\mathbb Z\}}{\mathbb R}\]
76 where $x$ is in \emph{radians}. \Lps{TAN} does \emph{not} produce a PS error\footnote{\nxLps{TAN} is defined with
77 Div, a special PSTricks operator rather than with div, the default PS operator.} when $x=k\dfrac{\pi}{2}$.
78
79 \begin{center}
80 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
81 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
82 num & \Lps{COS} & real & Return \Index{cosine} of \textsf{num} radians \\
83 num & \Lps{SIN} & real & Return \Index{sine} of \textsf{num} radians \\
84 num & \Lps{TAN} & real & Return \Index{tangent} of \textsf{num} radians\\\hline
85 \end{tabular}
86 \end{center}
87
88 %\begin{LTXexample}[pos=t,wide=false]
89 \begin{pspicture}*(-5,-2)(5,2)
90 \SpecialCoor % For label positionning
91 \psaxes[labels=y,Dx=\pstPI2]{->}(0,0)(-5,-2)(5,2)
92 \uput[-90](!PI 0){$\pi$} \uput[-90](!PI neg 0){$-\pi$}
93 \uput[-90](!PI 2 div 0){$\frac{\pi}2$}
94 \uput[-90](!PI 2 div neg 0){$-\frac{\pi}2$}
95 \psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COS}
96 \psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SIN}
97 \psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TAN}
98 \end{pspicture}
99 %\end{LTXexample}
100
101
102 \begin{lstlisting}
103 \begin{pspicture}*(-5,-2)(5,2)
104 \SpecialCoor % For label positionning
105 \psaxes[labels=y,Dx=\pstPI2]{->}(0,0)(-5,-2)(5,2)
106 \uput[-90](!PI 0){$\pi$} \uput[-90](!PI neg 0){$-\pi$}
107 \uput[-90](!PI 2 div 0){$\frac{\pi}2$}
108 \uput[-90](!PI 2 div neg 0){$-\frac{\pi}2$}
109 \psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COS}
110 \psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SIN}
111 \psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TAN}
112 \end{pspicture}
113 \end{lstlisting}
114
115
116 \LPack{pst-math} introduces natural trigonometric postscript
117 operators \Lps{ACOS}, \Lps{ASIN} and \Lps{ATAN} defined by
118
119 \[\DefOfOperator{acos}{[-1,1]}{[0,\pi]}\]
120 \[\DefOfOperator{asin}{[-1,1]}{[-\dfrac{\pi}2,\dfrac{\pi}2]}\]
121 \[\DefOfOperator{atan}{\mathbb R}{]-\dfrac{\pi}2,\dfrac{\pi}2[}\]
122
123 \begin{center}
124 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
125 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
126 num & \Lps{ACOS} & angle & Return \Index{arccosine} of \textsf{num} in radians \\
127 num & \Lps{ASIN} & angle & Return \Index{arcsine} of \textsf{num} in radians \\
128 num & \Lps{ATAN} & angle & Return \Index{arctangent} of \textsf{num} in radians \\
129 num & \Lps{ASEC} & angle & Return \Index{arcsecans} of \textsf{num} in radians \\
130 num & \Lps{ACSC} & angle & Return \Index{arccosecans} of \textsf{num} in radians \\\hline
131 \end{tabular}
132 \end{center}
133
134 \medskip\noindent
135 \begin{tabularx}{\linewidth}{!{\vrule width3pt}X}
136 \Lps{ATAN} is \emph{not} defined as the already existing PS operator \Lps{atan}. \Lps{ATAN} needs only \emph{one}
137 argument on the stack.
138 \end{tabularx}
139
140 \begin{LTXexample}[pos=t,wide=false]
141 \begin{pspicture}(-5,-2)(5,4)
142 \SpecialCoor % For label positionning
143 \psaxes[labels=x,Dy=\pstPI2]{->}(0,0)(-5,-2)(5,4)
144 \uput[0](!0 PI){$\pi$} \uput[0](!0 PI 2 div){$\frac{\pi}2$}
145 \uput[0](!0 PI 2 div neg){$-\frac{\pi}2$}
146 \psset{linewidth=1.5pt,yMaxValue=4}
147 \psplot[linecolor=blue]{-1}{1}{x ACOS} \psplot[linecolor=red]{-1}{1}{x ASIN}
148 \psplot[linecolor=green]{-5}{5}{x ATAN}
149 \psplot[linestyle=dashed,linecolor=cyan,arrows=-*]{-5}{-1}{x ASEC}
150 \psplot[linestyle=dashed,linecolor=cyan,arrows=*-]{1}{5}{x ASEC}
151 \psplot[linestyle=dashed,linecolor=magenta,arrows=-*]{-5}{-1}{x ACSC}
152 \psplot[linestyle=dashed,linecolor=magenta,arrows=*-]{1}{5}{x ACSC}
153 \end{pspicture}
154 \end{LTXexample}
155
156 \clearpage
157 \section{Hyperbolic trigonometry}
158
159 \LPack{pst-math} introduces hyperbolic trigonometric postscript operators
160 \Lps{COSH}, \Lps{SINH} and \Lps{TANH} defined by
161
162 \[\DefOfOperator{cosh}{\mathbb R}{[1,+\infty[}\]
163 \[\DefOfOperator{sinh}{\mathbb R}{\mathbb R}\]
164 \[\DefOfOperator{tanh}{\mathbb R}{]-1,1[}\]
165
166 \begin{center}
167 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
168 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
169 num & \Lps{COSH} & real & Return \Index{hyperbolic cosine} of \textsf{num} \\
170 num & \Lps{SINH} & real & Return \Index{hyperbolic sine} of \textsf{num} \\
171 num & \Lps{TANH} & real & Return \Index{hyperbolic tangent} of \textsf{num}\\\hline
172 \end{tabular}
173 \end{center}
174
175 \begin{LTXexample}[pos=t,wide=false]
176 \begin{pspicture}*(-5,-5)(5,5)
177 \psaxes{->}(0,0)(-5,-5)(5,5)
178 \psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COSH}
179 \psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SINH}
180 \psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TANH}
181 \end{pspicture}
182 \end{LTXexample}
183
184 \LPack{pst-math} introduces reciprocal \Index{hyperbolic} trigonometric postscript operators \Lps{ACOSH}, \Lps{ASINH} and
185 \Lps{ATANH} defined by
186 \[\DefOfOperator{acosh}{[1,+\infty[}{\mathbb R}\]
187 \[\DefOfOperator{asinh}{\mathbb R}{\mathbb R}\]
188 \[\DefOfOperator{atanh}{]-1,1[}{\mathbb R}\]
189
190 \begin{center}
191 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
192 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
193 num & \Lps{ACOSH} & real & Return \Index{reciprocal hyperbolic cosine} of \textsf{num} \\
194 num & \Lps{ASINH} & real & Return \Index{reciprocal hyperbolic sine} of \textsf{num} \\
195 num & \Lps{ATANH} & real & Return \Index{reciprocal hyperbolic tangent} of \textsf{num}\\\hline
196 \end{tabular}
197 \end{center}
198
199 \begin{LTXexample}[pos=t,wide=false]
200 \begin{pspicture}(-5,-4)(5,4)
201 \psaxes{->}(0,0)(-5,-4)(5,4)
202 \psplot[linewidth=1.5pt,linecolor=blue]{1}{5}{x ACOSH}
203 \psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x ASINH}
204 \psplot[linewidth=1.5pt,linecolor=green]{-.999}{.999}{x ATANH}
205 \end{pspicture}
206 \end{LTXexample}
207
208 \section{Other operators}
209
210 \LPack{pst-math} introduces postscript operator \Lps{EXP} defined by
211 \[\DefOfOperator{exp}{\mathbb R}{\mathbb R}\]
212
213 \begin{center}
214 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
215 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
216 num & \Lps{EXP} & real & Return \Index{exponential} of \textsf{num}\\\hline
217 \end{tabular}
218 \end{center}
219
220 \begin{LTXexample}[pos=t,wide=false]
221 \begin{pspicture}*(-5,-1)(5,5)
222 \psaxes{->}(0,0)(-5,-0.5)(5,5)
223 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x EXP}
224 \end{pspicture}
225 \end{LTXexample}
226
227 \LPack{pst-math} introduces postscript operator \Lps{GAUSS} defined by
228
229 \[\DefOfOperator*{gauss}{\mathbb R}{\mathbb R}{\displaystyle\frac{1}{\sqrt{2\pi\sigma^2}}\exp-\frac{(x-\overline x)^2}{2\sigma^2}}\]
230
231 \begin{center}
232 \begin{tabularx}{\linewidth}{@{} >{\sffamily}l l >{\sffamily}l X @{} }
233 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
234 num1 num2 num3 & \Lps{GAUSS} & real & Return gaussian of \textsf{num1} with
235 mean \textsf{num2} and \Index{standard deviation} \textsf{num3}\\\hline
236 \end{tabularx}
237 \end{center}
238
239 \begin{LTXexample}[pos=t,wide=false]
240 \psset{yunit=5}
241 \begin{pspicture}(-5,-.1)(5,1.1)
242 \psaxes{->}(0,0)(-5,-.1)(5,1.1)
243 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x 2 2 GAUSS}
244 \psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x 0 .5 GAUSS}
245 \end{pspicture}
246 \end{LTXexample}
247
248 \LPack{pst-math} introduces postscript operator \Index{SINC} defined by
249 \[\DefOfOperator*{sinc}{\mathbb R}{\mathbb R}{\displaystyle\frac{\sin x}x}\]
250
251 \begin{center}
252 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
253 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
254 num & \Lps{SINC} & real & Return \Index{cardinal sine} of \textsf{num} radians\\\hline
255 \end{tabular}
256 \end{center}
257
258 \begin{LTXexample}[pos=t,wide=false]
259 \psset{xunit=.25,yunit=3}
260 \begin{pspicture}(-20,-.5)(20,1.5)
261 \SpecialCoor % For label positionning
262 \psaxes[labels=y,Dx=\pstPI1]{->}(0,0)(-20,-.5)(20,1.5)
263 \uput[-90](!PI 0){$\pi$} \uput[-90](!PI neg 0){$-\pi$}
264 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x SINC}
265 \end{pspicture}
266 \end{LTXexample}
267
268 \LPack{pst-math} introduces postscript operator \Lps{GAMMA} and \Lps{GAMMALN} defined by
269
270 \[\DefOfOperator*{\Gamma}{\mathbb{R} \backslash\mathbb{Z}}{\mathbb R}{\displaystyle\int_0^\infty t^{x-1}\mathrm e^{-t}\,\mathrm d t}\]
271 \[\DefOfOperator*{\ln\Gamma}{]0,+\infty[}{\mathbb R}{\ln\displaystyle\int_0^t t^{x-1}\mathrm e^{-t}\,\mathrm d t}\]
272
273 \begin{center}
274 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
275 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
276 num & \Lps{GAMMA} & real & Return $\Gamma$\index{Gamma func@$\Gamma$ function} function of \textsf{num}\\
277 num & \Lps{GAMMALN} & real & Return \Index{logarithm} of $\Gamma$ function of \textsf{num}\\\hline
278 \end{tabular}
279 \end{center}
280
281 \begin{LTXexample}[pos=t,wide=false]
282 \begin{pspicture*}(-.5,-.5)(6.2,6.2)
283 \psaxes{->}(0,0)(-.5,-.5)(6,6)
284 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=200]{.1}{6}{x GAMMA}
285 \psplot[linecolor=red,linewidth=1.5pt,plotpoints=200]{.1}{6}{x GAMMALN}
286 \end{pspicture*}
287 \end{LTXexample}
288
289 \begin{LTXexample}[pos=t,wide=false]
290 \psset{xunit=.25,yunit=3}
291 \begin{pspicture}(-20,-.5)(20,1.5)
292 \psaxes[Dx=5,Dy=.5]{->}(0,0)(-20,-.5)(20,1.5)
293 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x BESSEL_J0}
294 \psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x BESSEL_J1}
295 \end{pspicture}
296 \end{LTXexample}
297
298 \begin{LTXexample}[pos=t,wide=false]
299 \psset{xunit=.5,yunit=3}
300 \begin{pspicture}*(-1.5,-.75)(19,1.5)
301 \psaxes[Dx=5,Dy=.5]{->}(0,0)(-1,-.75)(19,1.5)
302 \psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{0.0001}{20}{x BESSEL_Y0}
303 \psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{0.0001}{20}{x BESSEL_Y1}
304 %\psplot[linecolor=green,plotpoints=1000]{0.0001}{20}{x 2 BESSEL_Yn}
305 \end{pspicture}
306 \end{LTXexample}
307
308 \section{Numerical integration}
309
310 \begin{center}
311 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
312 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
313 num num /var $\lbrace$ function $\rbrace$ num & \Lps{SIMPSON} & real & Return $\displaystyle\int\limits_a^b f(t)\mathrm{d}t$\\
314 num
315 \end{tabular}
316 \end{center}
317
318 %a b var f Ierr
319
320 the first two variables are the low and high boundary \Index{integral}, both can be values or
321 \PS\ expressions. \verb+/var+ is the definition of the integrated variable (not x!), which is
322 used in the following function description, which must be inside of braces. The last
323 number is the tolerance for the step adjustment. The function \Lps{SIMPSON} can be
324 nested.
325
326 \begin{LTXexample}[pos=t,wide=false]
327 \psset{xunit=.75}
328 \begin{pspicture*}[showgrid=true](-0.4,-3.4)(10,3)
329 \psplot[linestyle=dashed,linewidth=1.5pt]{.1}{10}{1 x div}
330 \psplot[linecolor=red,linewidth=1.5pt]{.1}{10}{
331 1 % start
332 x % end
333 /t % variable
334 { 1 t div } % function
335 .001 % tolerance
336 SIMPSON } %
337 \psplot[linecolor=blue,linewidth=1.5pt]{.1}{10}{1 x /t { 1 t div } 1 SIMPSON }
338 \end{pspicture*}
339 \end{LTXexample}
340
341
342
343 \begin{LTXexample}[pos=t,wide=false]
344 %%% Gaussian and relative integral from -x to x to its value sqrt{pi}
345 \psset{unit=2}
346 \begin{pspicture}[showgrid=true](-3,-1)(3,1)
347 \psplot[linecolor=red,linewidth=1.5pt]{-3}{3}{Euler x dup mul neg exp }
348 \psplot[linecolor=green,linewidth=1.5pt]{-3}{3}
349 { x neg x /t { Euler t dup mul neg exp } .001 SIMPSON Pi sqrt div}
350 \end{pspicture}
351 \end{LTXexample}
352
353
354 \psset{unit=1.75cm}
355 %%% successive polynomial developments of sine-cosine
356 \begin{pspicture}[showgrid=true](-3,-2)(3,2)
357 \psaxes{->}(0,0)(-3,-2)(3,2)
358 \psset{linewidth=1.5pt}
359 \psplot[linecolor=green, algebraic=false, plotpoints=61, showpoints=true]
360 {-3}{3}{0 x /tutu
361 {1 0 tutu /toto { toto } .1 SIMPSON sub}
362 .01 SIMPSON }
363 \psplot[linecolor=blue, algebraic=false, plotpoints=61, showpoints=true]
364 {-3}{3}{1 0 x /tata
365 {0 tata /tutu
366 {1 0 tutu /toto { toto } .1 SIMPSON sub}
367 .01 SIMPSON }
368 .01 SIMPSON sub}
369 \psplot[linecolor=yellow, algebraic=false, plotpoints=61, showpoints=true]
370 {-3}{3}{0 x /titi
371 {1 0 titi /tata
372 {0 tata /tutu
373 {1 0 tutu /toto { toto } .1 SIMPSON sub}
374 .01 SIMPSON }
375 .01 SIMPSON sub}
376 .01 SIMPSON }
377 \psplot[linecolor=red, algebraic=false, plotpoints=61, showpoints=true]
378 {-3}{3}{1 0 x /tyty
379 {0 tyty /titi
380 {1 0 titi /tata
381 {0 tata /tutu
382 {1 0 tutu /toto { toto } .1 SIMPSON sub}
383 .01 SIMPSON }
384 .01 SIMPSON sub}
385 .01 SIMPSON }
386 .01 SIMPSON sub}
387 \psplot[linecolor=magenta, algebraic=false, plotpoints=61, showpoints=true]
388 {-3}{3}{0 x /tete
389 {1 0 tete /tyty
390 {0 tyty /titi
391 {1 0 titi /tata
392 {0 tata /tutu
393 {1 0 tutu /toto { toto } .1 SIMPSON sub}
394 .01 SIMPSON }
395 .01 SIMPSON sub}
396 .01 SIMPSON }
397 .01 SIMPSON sub}
398 .01 SIMPSON }%%% FIVE nested calls
399 \end{pspicture}
400 \psset{unit=1cm}
401
402 \begin{lstlisting}
403 \psset{unit=1.75cm}
404 %%% successive polynomial developments of sine-cosine
405 \begin{pspicture}[showgrid=true](-3,-2)(3,2)
406 \psaxes{->}(0,0)(-3,-2)(3,2)
407 \psplot[linecolor=green, algebraic=false, plotpoints=61, showpoints=true]
408 {-3}{3}{0 x /tutu
409 {1 0 tutu /toto { toto } .1 SIMPSON sub}
410 .01 SIMPSON }
411 \psplot[linecolor=blue, algebraic=false, plotpoints=61, showpoints=true]
412 {-3}{3}{1 0 x /tata
413 {0 tata /tutu
414 {1 0 tutu /toto { toto } .1 SIMPSON sub}
415 .01 SIMPSON }
416 .01 SIMPSON sub}
417 \psplot[linecolor=yellow, algebraic=false, plotpoints=61, showpoints=true]
418 {-3}{3}{0 x /titi
419 {1 0 titi /tata
420 {0 tata /tutu
421 {1 0 tutu /toto { toto } .1 SIMPSON sub}
422 .01 SIMPSON }
423 .01 SIMPSON sub}
424 .01 SIMPSON }
425 \psplot[linecolor=red, algebraic=false, plotpoints=61, showpoints=true]
426 {-3}{3}{1 0 x /tyty
427 {0 tyty /titi
428 {1 0 titi /tata
429 {0 tata /tutu
430 {1 0 tutu /toto { toto } .1 SIMPSON sub}
431 .01 SIMPSON }
432 .01 SIMPSON sub}
433 .01 SIMPSON }
434 .01 SIMPSON sub}
435 \psplot[linecolor=magenta, algebraic=false, plotpoints=61, showpoints=true]
436 {-3}{3}{0 x /tete
437 {1 0 tete /tyty
438 {0 tyty /titi
439 {1 0 titi /tata
440 {0 tata /tutu
441 {1 0 tutu /toto { toto } .1 SIMPSON sub}
442 .01 SIMPSON }
443 .01 SIMPSON sub}
444 .01 SIMPSON }
445 .01 SIMPSON sub}
446 .01 SIMPSON }%%% FIVE nested calls
447 \end{pspicture}
448 \end{lstlisting}
449
450
451 \iffalse
452
453 \begin{LTXexample}[pos=t,wide=false]
454 % ce code definit la fonction [cos(2pix cos(t))-cos(2pix)]^2 / sin(t) avec x=h/lambda
455 \def\Func{
456 0.01 3.1
457 /t
458 { TwoPi x mul t COS mul COS TwoPi x mul COS sub 2 exp t SIN div } def
459 .01 SIMPSON 60 mul }
460 % D = 2*(cos^2(2pix))/Func
461 \def\fD{TwoPi x mul COS dup mul 2 mul \Func\space div}
462 \psset{llx=-1.5cm,lly=-0.5cm,urx=0.2cm,ury=0.2cm,
463 xAxisLabel={$h/\lambda$},xAxisLabelPos={0.5,-45},yAxisLabel={$R_r$ en ohms},
464 yAxisLabelPos={-0.1,150}}
465 \begin{psgraph}[Dy=50,Dx=0.1,xticksize=300 0,yticksize=1 0,
466 comma=true,axesstyle=frame](0,0)(1,300){10cm}{5cm}
467 \psplot{0}{1}{\Func}
468 \psplot[linecolor=red]{0.01}{.1}{\fD}%
469 \end{psgraph}
470 \end{LTXexample}
471
472 \fi
473
474 \section{Random numbers}
475 Package \LPack{pst-math} supports the creation of random number lists where a number will
476 appear only once. %But there is a different handling of the macros for Lua\LaTeX\ and the
477 %other \TeX\ engines. %With Lua\TeX\ all random numbers are build with the help of Lua which
478 %has the advantage that there will be no problem with \TeX's limited parameter stack size.
479
480
481 \begin{BDef}
482 \Lcs{defineRandIntervall}\Largr{min,max}{maxNo}\\
483 \Lcs{makeSimpleRandomNumberList}\% multiple values possible\\
484 \Lcs{makeRandomNumberList} \% no multiple values!\\
485 \Lcs{getNumberFromList}\Largb{number}
486 \end{BDef}
487
488 The list of the random numbers is \Lcs{RandomNumbers}, a comma separated list of the values.
489 It can be used for own purpuses.
490
491
492 \begin{LTXexample}[pos=t]
493 \defineRandIntervall(1,50){30}
494 \makeSimpleRandomNumberList
495 Random list: \RandomNumbers
496
497 \psforeach{\iA}{1,2,..,30}{\getNumberFromList{\iA}~}
498 \end{LTXexample}
499
500
501 In the next example a random number appears only \emph{once} in the list. There are no multiple
502 numbers:
503
504
505 \begin{LTXexample}[pos=t]
506 \defineRandIntervall(1,30){30}
507 \makeRandomNumberList
508 \psforeach{\iA}{1,2,..,30}{\getNumberFromList{\iA}~}
509 \end{LTXexample}
510
511
512
513
514 \begin{LTXexample}[pos=t]
515 \newcounter{RandNo}
516 \def\n{5} \def\N{\the\numexpr\n*\n}
517 \defineRandIntervall(1,\N){\N}
518 \makeRandomNumberList \setcounter{RandNo}{1}
519 \begin{pspicture}(\n,\n)
520 \psgrid[subgriddiv=0,gridlabels=0pt]
521 \multido{\rRow=0.5+1.0}{\n}{\multido{\rCol=0.5+1.0}{\n}{%
522 \rput(\rCol,\rRow){\getNumberFromList{\theRandNo}}%
523 \stepcounter{RandNo}}}
524 \end{pspicture}
525 \setcounter{RandNo}{1}
526 \def\n{10} \def\N{\the\numexpr\n*\n}
527 \defineRandIntervall(1,\N){\N}
528 \makeRandomNumberList \setcounter{RandNo}{1}
529 \begin{pspicture}(\n,\n)
530 \psgrid[subgriddiv=0,gridlabels=0pt]
531 \multido{\rRow=0.5+1.0}{\n}{\multido{\rCol=0.5+1.0}{\n}{%
532 \rput(\rCol,\rRow){\getNumberFromList{\theRandNo}}%
533 \stepcounter{RandNo}}}
534 \end{pspicture}
535 \end{LTXexample}
536
537
538
539
540 \clearpage
541
542 \section{Numerical functions}
543
544 \begin{center}
545 \begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
546 \emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
547 num & \Lps{norminv} & real & Return $\mathop{norminv}(num)$\\
548 \end{tabular}
549 \end{center}
550
551
552 \begin{LTXexample}[width=5cm,wide=false]
553 \psset{xunit=5}
554 \begin{pspicture}(-0.1,-3)(1.1,4)
555 \psaxes{->}(0,0)(0,-3)(1.1,4)
556 \psplot[plotpoints=200,algebraic,linecolor=red]{0}{0.9999}{norminv(x)}
557 \end{pspicture}
558 \end{LTXexample}
559
560
561
562 These function returns the inverse normal.
563
564 \bgroup
565 \raggedright
566 \nocite{*}
567 \printbibliography
568 \egroup
569
570 \printindex
571
572
573 \end{document}