[pstricks] re-using the same random variable
jmpapy
Jean-Michel.Papy at esat.kuleuven.ac.be
Fri Oct 8 15:37:20 CEST 2004
Hello,
Here are two problems:
(1) How to use twice the same random variable at a time in the same
plot?
for instance in the following code:
===============
\begin{pspicture}(-5,-0.2)(5,2)
\psline{-}(-5,0)(5,0)
\psplot[linecolor=red,plotpoints=200,showpoints=true,linestyle=none]{-5}
{5}{rand 2147483647 div rand 2147483647 div 2.72 exp mul} %x.e^{x}
\end{pspicture}
================
it appears that the first variable "rand" and the second one are a
different realization. I wish to compute x.e^{x} and not x1.e^{x2}.
(2) How to use twice the same random variable simultaneously in two
different plot ?
For instance, in the following code:
===============
\begin{pspicture}(-5,-0.2)(5,2)
\psline{-}(-5,0)(5,0)
\psplot[linecolor=red,plotpoints=200,showpoints=true,linestyle=none]{-5}
{5}{
rand 2147483647 div} % x
\psplot[linecolor=blue,plotpoints=200,showpoints=true,linestyle=none]
{-5}{5}{rand 2147483647 div 2 exp} % x^2
\end{pspicture}
================
we have a first realization of a random variable x={x1,...,x200} and on
the second plot we have x^2={y1^2,...,y2^2} and not x={x1^2,...,x2^2}. i
guess it has something to do with the re-initialization of the random
generator but so far I failed to find a convenient code.
any clue is welcome...
regards,
JM
More information about the PSTricks
mailing list