summaryrefslogtreecommitdiff
path: root/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex
blob: c3c2a807464004d10c9cabd126d1fceb25355c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
%% $Id: pst-math-doc.tex 887 2018-12-29 13:17:59Z 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}
\lstset{pos=t,wide=true,language=PSTricks,
    morekeywords={psGammaDist,psChiIIDist,psTDist,psFDist,psBetaDist,psPlotImpl},basicstyle=\footnotesize\ttfamily}
%
\def\pshlabel#1{\footnotesize#1}
\def\psvlabel#1{\footnotesize#1}
%
\makeatletter
\def\DefOfOperator{\@ifstar{\DefOfOperator@}{\DefOfOperator@@}}
\def\DefOfOperator@#1#2#3#4{{\operator@font#1}:\left\{\begin{array}{ccc} #2&\to&#3\\
x&\mapsto&#4\end{array}\right.}
\def\DefOfOperator@@#1#2#3{{\operator@font#1}:\left\{\begin{array}{ccc} #2&\to&#3\\
x&\mapsto&{\operator@font#1}(x)\end{array}\right.}
\makeatother

\addbibresource{\jobname.bib}


\begin{document}

\title{\texttt{pst-math}}
\subtitle{Special mathematical PostScript functions; v.\pstMathFV}
\author{Christoph Jorssen\\Herbert Vo\ss}
\docauthor{Herbert Vo\ss}
\date{\today}
\maketitle

\tableofcontents

\clearpage

\begin{abstract}
\noindent
\LPack{pst-math} is an extension to the \Index{PostScript} language. The files \LFile{pst-math.sty}
and \LFile{pst-math.tex} are only wrapper files for the \LFile{pst-math.pro} file, which
defines all the new mathematical functions for use with PostScript.

\vfill\noindent
Thanks to: \\
Denis Bitouzé;
Jacques L'helgoualc'h; 
Patrice M\'egret; 
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.

\begin{BDef}
\Lcs{pstPI}\Larg\#
\end{BDef}

\Lcs{pstPI}1 $\Rightarrow$ $\pi$\\
\Lcs{pstPI}2 $\Rightarrow$ $\dfrac{\pi}{2}$\\[2pt]
\Lcs{pstPI}3 $\Rightarrow$ $\dfrac{\pi}{3}$\\[2pt]
\Lcs{pstPI}4 $\Rightarrow$ $\dfrac{\pi}{4}$


\section{Trigonometry}

\LPack{pst-math} introduces natural trigonometric PostScript operators \Lps{COS}, \Lps{SIN} and \Lps{TAN} defined by
\[\DefOfOperator{cos}{\mathbb R}{[-1,1]}\]
\[\DefOfOperator{sin}{\mathbb R}{[-1,1]}\]
\[\DefOfOperator{tan}{\mathbb R\backslash\{k\dfrac{\pi}2,k\in\mathbb Z\}}{\mathbb R}\]
where $x$ is in \emph{radians}. \Lps{TAN} does \emph{not} produce a PS error\footnote{\nxLps{TAN} is defined with
Div, a special PSTricks operator rather than with div, the default  PS operator.} when $x=k\dfrac{\pi}{2}$.

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{COS} & real & Return \Index{cosine} of \textsf{num} radians \\
num & \Lps{SIN} & real & Return \Index{sine} of \textsf{num} radians \\
num & \Lps{TAN} & real & Return \Index{tangent} of \textsf{num} radians\\\hline
\end{tabular}
\end{center}

%\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture}*(-5,-2)(5,2)
\SpecialCoor % For label positionning
\psaxes[labels=y,Dx=\pstPI2]{->}(0,0)(-5,-2)(5,2)
\uput[-90](!PI 0){$\pi$}  \uput[-90](!PI neg 0){$-\pi$}
\uput[-90](!PI 2 div 0){$\frac{\pi}2$} 
\uput[-90](!PI 2 div neg 0){$-\frac{\pi}2$}
\psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COS}
\psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SIN}
\psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TAN}
\end{pspicture}
%\end{LTXexample}


\begin{lstlisting}
\begin{pspicture}*(-5,-2)(5,2)
\SpecialCoor % For label positionning
\psaxes[labels=y,Dx=\pstPI2]{->}(0,0)(-5,-2)(5,2)
\uput[-90](!PI 0){$\pi$}  \uput[-90](!PI neg 0){$-\pi$}
\uput[-90](!PI 2 div 0){$\frac{\pi}2$} 
\uput[-90](!PI 2 div neg 0){$-\frac{\pi}2$}
\psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COS}
\psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SIN}
\psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TAN}
\end{pspicture}
\end{lstlisting}


\LPack{pst-math} introduces natural trigonometric postscript 
operators \Lps{ACOS}, \Lps{ASIN} and \Lps{ATAN} defined by

\[\DefOfOperator{acos}{[-1,1]}{[0,\pi]}\]
\[\DefOfOperator{asin}{[-1,1]}{[-\dfrac{\pi}2,\dfrac{\pi}2]}\]
\[\DefOfOperator{atan}{\mathbb R}{]-\dfrac{\pi}2,\dfrac{\pi}2[}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{ACOS} & angle & Return \Index{arccosine} of \textsf{num} in radians \\
num & \Lps{ASIN} & angle & Return \Index{arcsine} of  \textsf{num} in radians \\
num & \Lps{ATAN} & angle & Return \Index{arctangent} of \textsf{num} in radians \\
num & \Lps{ASEC} & angle & Return \Index{arcsecans} of \textsf{num} in radians \\
num & \Lps{ACSC} & angle & Return \Index{arccosecans} of \textsf{num} in radians \\\hline
\end{tabular}
\end{center}

\medskip\noindent
\begin{tabularx}{\linewidth}{!{\vrule width3pt}X}
\Lps{ATAN} is \emph{not} defined as the already existing PS operator \Lps{atan}. \Lps{ATAN} needs only \emph{one}
argument on the stack.
\end{tabularx}

\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture}(-5,-2)(5,4)
\SpecialCoor % For label positionning
\psaxes[labels=x,Dy=\pstPI2]{->}(0,0)(-5,-2)(5,4)
\uput[0](!0 PI){$\pi$}   \uput[0](!0 PI 2 div){$\frac{\pi}2$}
\uput[0](!0 PI 2 div neg){$-\frac{\pi}2$}
\psset{linewidth=1.5pt,yMaxValue=4}
\psplot[linecolor=blue]{-1}{1}{x ACOS} \psplot[linecolor=red]{-1}{1}{x ASIN}
\psplot[linecolor=green]{-5}{5}{x ATAN}
\psplot[linestyle=dashed,linecolor=cyan,arrows=-*]{-5}{-1}{x ASEC}
\psplot[linestyle=dashed,linecolor=cyan,arrows=*-]{1}{5}{x ASEC}
\psplot[linestyle=dashed,linecolor=magenta,arrows=-*]{-5}{-1}{x ACSC}
\psplot[linestyle=dashed,linecolor=magenta,arrows=*-]{1}{5}{x ACSC}
\end{pspicture}
\end{LTXexample}

\clearpage
\section{Hyperbolic trigonometry}

\LPack{pst-math} introduces hyperbolic trigonometric postscript operators 
\Lps{COSH}, \Lps{SINH} and \Lps{TANH} defined by

\[\DefOfOperator{cosh}{\mathbb R}{[1,+\infty[}\]
\[\DefOfOperator{sinh}{\mathbb R}{\mathbb R}\]
\[\DefOfOperator{tanh}{\mathbb R}{]-1,1[}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{COSH} & real & Return \Index{hyperbolic cosine} of \textsf{num} \\
num & \Lps{SINH} & real & Return \Index{hyperbolic sine} of \textsf{num} \\
num & \Lps{TANH} & real  & Return \Index{hyperbolic tangent} of \textsf{num}\\\hline
\end{tabular}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture}*(-5,-5)(5,5)
\psaxes{->}(0,0)(-5,-5)(5,5)
\psplot[linewidth=1.5pt,linecolor=blue]{-5}{5}{x COSH}
\psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x SINH}
\psplot[linewidth=1.5pt,linecolor=green]{-5}{5}{x TANH}
\end{pspicture}
\end{LTXexample}

\LPack{pst-math} introduces reciprocal \Index{hyperbolic} trigonometric postscript operators \Lps{ACOSH}, \Lps{ASINH} and
\Lps{ATANH} defined by
\[\DefOfOperator{acosh}{[1,+\infty[}{\mathbb R}\]
\[\DefOfOperator{asinh}{\mathbb R}{\mathbb R}\]
\[\DefOfOperator{atanh}{]-1,1[}{\mathbb R}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{ACOSH} & real & Return \Index{reciprocal hyperbolic cosine} of  \textsf{num} \\
num & \Lps{ASINH} & real & Return \Index{reciprocal hyperbolic sine} of \textsf{num} \\
num & \Lps{ATANH} & real & Return \Index{reciprocal hyperbolic tangent} of \textsf{num}\\\hline
\end{tabular}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture}(-5,-4)(5,4)
\psaxes{->}(0,0)(-5,-4)(5,4)
\psplot[linewidth=1.5pt,linecolor=blue]{1}{5}{x ACOSH}
\psplot[linewidth=1.5pt,linecolor=red]{-5}{5}{x ASINH}
\psplot[linewidth=1.5pt,linecolor=green]{-.999}{.999}{x ATANH}
\end{pspicture}
\end{LTXexample}

\section{Other operators}

\LPack{pst-math} introduces postscript operator \Lps{EXP} defined by
\[\DefOfOperator{exp}{\mathbb R}{\mathbb R}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{EXP} & real & Return \Index{exponential} of \textsf{num}\\\hline
\end{tabular}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture}*(-5,-1)(5,5)
\psaxes{->}(0,0)(-5,-0.5)(5,5)
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x EXP}
\end{pspicture}
\end{LTXexample}

\LPack{pst-math} introduces postscript operator \Lps{GAUSS} defined by

\[\DefOfOperator*{gauss}{\mathbb R}{\mathbb R}{\displaystyle\frac{1}{\sqrt{2\pi\sigma^2}}\exp-\frac{(x-\overline x)^2}{2\sigma^2}}\]

\begin{center}
\begin{tabularx}{\linewidth}{@{} >{\sffamily}l l >{\sffamily}l X @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num1 num2 num3 & \Lps{GAUSS} & real & Return gaussian of \textsf{num1} with 
    mean \textsf{num2} and \Index{standard deviation} \textsf{num3}\\\hline
\end{tabularx}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\psset{yunit=5}
\begin{pspicture}(-5,-.1)(5,1.1)
\psaxes{->}(0,0)(-5,-.1)(5,1.1)
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x 2 2 GAUSS}
\psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{-5}{5}{x 0 .5 GAUSS}
\end{pspicture}
\end{LTXexample}

\LPack{pst-math} introduces postscript operator \Index{SINC} defined by
\[\DefOfOperator*{sinc}{\mathbb R}{\mathbb R}{\displaystyle\frac{\sin x}x}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{SINC} & real & Return \Index{cardinal sine} of \textsf{num} radians\\\hline
\end{tabular}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\psset{xunit=.25,yunit=3}
\begin{pspicture}(-20,-.5)(20,1.5)
\SpecialCoor % For label positionning
\psaxes[labels=y,Dx=\pstPI1]{->}(0,0)(-20,-.5)(20,1.5)
\uput[-90](!PI 0){$\pi$}   \uput[-90](!PI neg 0){$-\pi$}
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x SINC}
\end{pspicture}
\end{LTXexample}

\LPack{pst-math} introduces postscript operator \Lps{GAMMA} and \Lps{GAMMALN} defined by

\[\DefOfOperator*{\Gamma}{\mathbb{R} \backslash\mathbb{Z}}{\mathbb R}{\displaystyle\int_0^\infty t^{x-1}\mathrm e^{-t}\,\mathrm d t}\]
\[\DefOfOperator*{\ln\Gamma}{]0,+\infty[}{\mathbb R}{\ln\displaystyle\int_0^t t^{x-1}\mathrm e^{-t}\,\mathrm d t}\]

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num & \Lps{GAMMA}   & real & Return $\Gamma$\index{Gamma func@$\Gamma$ function} function of \textsf{num}\\
num & \Lps{GAMMALN} & real & Return \Index{logarithm} of $\Gamma$ function of \textsf{num}\\\hline
\end{tabular}
\end{center}

\begin{LTXexample}[pos=t,wide=false]
\begin{pspicture*}(-.5,-.5)(6.2,6.2)
\psaxes{->}(0,0)(-.5,-.5)(6,6)
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=200]{.1}{6}{x GAMMA}
\psplot[linecolor=red,linewidth=1.5pt,plotpoints=200]{.1}{6}{x GAMMALN}
\end{pspicture*}
\end{LTXexample}

\begin{LTXexample}[pos=t,wide=false]
\psset{xunit=.25,yunit=3}
\begin{pspicture}(-20,-.5)(20,1.5)
\psaxes[Dx=5,Dy=.5]{->}(0,0)(-20,-.5)(20,1.5)
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x BESSEL_J0}
\psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{-20}{20}{x BESSEL_J1}
\end{pspicture}
\end{LTXexample}

\begin{LTXexample}[pos=t,wide=false]
\psset{xunit=.5,yunit=3}
\begin{pspicture}*(-1.5,-.75)(19,1.5)
\psaxes[Dx=5,Dy=.5]{->}(0,0)(-1,-.75)(19,1.5)
\psplot[linecolor=blue,linewidth=1.5pt,plotpoints=1000]{0.0001}{20}{x BESSEL_Y0}
\psplot[linecolor=red,linewidth=1.5pt,plotpoints=1000]{0.0001}{20}{x BESSEL_Y1}
%\psplot[linecolor=green,plotpoints=1000]{0.0001}{20}{x 2 BESSEL_Yn}
\end{pspicture}
\end{LTXexample}

\section{Numerical integration}

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num num /var $\lbrace$ function $\rbrace$ num & \Lps{SIMPSON} & real & Return $\displaystyle\int\limits_a^b f(t)\mathrm{d}t$\\
num 
\end{tabular}
\end{center}

%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
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.

\begin{LTXexample}[pos=t,wide=false]
\psset{xunit=.75}
\begin{pspicture*}[showgrid=true](-0.4,-3.4)(10,3)
  \psplot[linestyle=dashed,linewidth=1.5pt]{.1}{10}{1 x div}
  \psplot[linecolor=red,linewidth=1.5pt]{.1}{10}{
    1           % start 
    x           % end
    /t          % variable
    { 1 t div } % function
    .001        % tolerance 
    SIMPSON }   %
  \psplot[linecolor=blue,linewidth=1.5pt]{.1}{10}{1 x /t { 1 t div } 1 SIMPSON }
\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}
\begin{pspicture}[showgrid=true](-3,-1)(3,1)
  \psplot[linecolor=red,linewidth=1.5pt]{-3}{3}{Euler x dup mul neg exp }
  \psplot[linecolor=green,linewidth=1.5pt]{-3}{3}
     { x neg x /t { Euler t dup mul neg exp } .001 SIMPSON Pi sqrt div}
\end{pspicture}
\end{LTXexample}


\psset{unit=1.75cm}
%%% successive polynomial developments of sine-cosine
\begin{pspicture}[showgrid=true](-3,-2)(3,2)
\psaxes{->}(0,0)(-3,-2)(3,2)
\psset{linewidth=1.5pt}
\psplot[linecolor=green, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /tutu
                 {1 0 tutu /toto { toto } .1 SIMPSON sub} 
                    .01 SIMPSON }
\psplot[linecolor=blue, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{1 0 x /tata
                 {0 tata /tutu
                  {1 0 tutu /toto { toto } .1 SIMPSON sub}
                   .01 SIMPSON }
                    .01 SIMPSON  sub}
\psplot[linecolor=yellow, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /titi
                 {1 0 titi /tata
                  {0 tata /tutu
                   {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                    .01 SIMPSON }
                     .01 SIMPSON  sub}
                      .01 SIMPSON }
\psplot[linecolor=red, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{1 0 x /tyty
                 {0 tyty /titi
                  {1 0 titi /tata
                   {0 tata /tutu
                    {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                     .01 SIMPSON }
                      .01 SIMPSON  sub}
                       .01 SIMPSON }
                        .01 SIMPSON  sub}
\psplot[linecolor=magenta, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /tete
                 {1 0 tete /tyty
                  {0 tyty /titi
                   {1 0 titi /tata
                    {0 tata /tutu
                     {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                      .01 SIMPSON }
                       .01 SIMPSON  sub}
                        .01 SIMPSON }
                         .01 SIMPSON  sub}
                          .01 SIMPSON }%%% FIVE nested calls
\end{pspicture}
\psset{unit=1cm}

\begin{lstlisting}
\psset{unit=1.75cm}
%%% successive polynomial developments of sine-cosine
\begin{pspicture}[showgrid=true](-3,-2)(3,2)
\psaxes{->}(0,0)(-3,-2)(3,2)
  \psplot[linecolor=green, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /tutu
                 {1 0 tutu /toto { toto } .1 SIMPSON sub} 
                    .01 SIMPSON }
  \psplot[linecolor=blue, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{1 0 x /tata
                 {0 tata /tutu
                  {1 0 tutu /toto { toto } .1 SIMPSON sub}
                   .01 SIMPSON }
                    .01 SIMPSON  sub}
  \psplot[linecolor=yellow, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /titi
                 {1 0 titi /tata
                  {0 tata /tutu
                   {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                    .01 SIMPSON }
                     .01 SIMPSON  sub}
                      .01 SIMPSON }
  \psplot[linecolor=red, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{1 0 x /tyty
                 {0 tyty /titi
                  {1 0 titi /tata
                   {0 tata /tutu
                    {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                     .01 SIMPSON }
                      .01 SIMPSON  sub}
                       .01 SIMPSON }
                        .01 SIMPSON  sub}
  \psplot[linecolor=magenta, algebraic=false, plotpoints=61, showpoints=true]
         {-3}{3}{0 x /tete
                 {1 0 tete /tyty
                  {0 tyty /titi
                   {1 0 titi /tata
                    {0 tata /tutu
                     {1 0 tutu /toto { toto } .1 SIMPSON  sub}
                      .01 SIMPSON }
                       .01 SIMPSON  sub}
                        .01 SIMPSON }
                         .01 SIMPSON  sub}
                          .01 SIMPSON }%%% FIVE nested calls
\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\Func{
  0.01 3.1 
  /t 
  { 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))/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}{\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. %But there is a different handling of the macros for Lua\LaTeX\ and the
%other \TeX\ engines. %With Lua\TeX\ all random numbers are build with the help of Lua which
%has the advantage that there will be no problem with \TeX's limited parameter stack size.


\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 are 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}
\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{10} \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}

\begin{center}
\begin{tabular}{@{} >{\sffamily}l l >{\sffamily}l l @{} }
\emph{Stack} & \emph{Operator} & \emph{Result} & \emph{Description} \\\hline
num  & \Lps{norminv} & real & Return $\mathop{norminv}(num)$\\
\end{tabular}
\end{center}


\begin{LTXexample}[width=5cm,wide=false]
\psset{xunit=5}
\begin{pspicture}(-0.1,-3)(1.1,4)
\psaxes{->}(0,0)(0,-3)(1.1,4)
\psplot[plotpoints=200,algebraic,linecolor=red]{0}{0.9999}{norminv(x)}
\end{pspicture}
\end{LTXexample}



These function returns the inverse normal.

\bgroup
\raggedright
\nocite{*}
\printbibliography
\egroup

\printindex


\end{document}