Abstract
The generation of pseudo-random discrete probability distributions is of paramount importance for a wide range of stochastic simulations spanning from Monte Carlo methods to the random sampling of quantum states for investigations in quantum information science. In spite of its significance, a thorough exposition of such a procedure is lacking in the literature. In this article, we present relevant details concerning the numerical implementation and applicability of what we call the iid, normalization, and trigonometric methods for generating an unbiased probability vector p=(p 1,⋯ ,p d). An immediate application of these results regarding the generation of pseudo-random pure quantum states is also described.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
Roughly speaking, randomness is the fact that, even using all the information that we have about a physical system, in some situations it is impossible, or unfeasible, for us to predict exactly what will be the future state of that system. Randomness is a facet of nature that is ubiquitous and very influential in our society and in others [1–3]. As a consequence, it is also an essential aspect of our science and technology. The related research theme, that was motivated initially mainly by gambling and led eventually to probability theory [4, 5], is nowadays a crucial part of many different fields of study such as computational simulations, information theory, cryptography, statistical estimation, system identification, and many others [6–12].
One rapid-growing area of research for which randomness is a key concept is the maturing field of quantum information science (QIS). Our main aim in this interdisciplinary field is understanding how quantum systems can be harnessed in order to use all Nature’s potentialities for information storage, processing, transmission, and protection [13–15].
Quantum mechanics [16, 17] is at present one of the fundamental theories of Nature. The essential mathematical object in this theory is the density operator (or density matrix) ρ. It embodies all our knowledge about the preparation of the system, i.e., about its state. From the mathematical point of view, a density matrix is simply a positive semi-definite matrix (notation: ρ≥0) with trace equal to one (Tr(ρ)=1). Such kind of matrix can be written as \(\rho ={{\sum }_{\mathrm {j}}}r_{\mathrm {j}}{\Pi }_{\mathrm {j}}\), which is known as the spectral decomposition of ρ. In the last equation, πj is the projector (πjπk=δ jkπj and \({\sum }_{\mathrm {j}}{\Pi }_{\mathrm {j}}=\mathbb {I}_{\mathrm {d}}\), where \(\mathbb {I}_{\mathrm {d}}\) is the d−dimensional identity matrix). From the positivity of ρ follows that, besides it being Hermitian and hence having real eigenvalues, its eigenvalues are also non-negative, r j ≥0. Since the trace function is base independent, the eigenvalues of ρ must sum up to one, \(\text {Tr}(\rho )=\textstyle {{\sum }_{j}}r_{\mathrm {j}}=1\). Thus, we see that the set {r j} possesses all the features that define a probability distribution (see, e.g., Ref. [4]).
The generation of pseudo-random quantum states is an essential tool for inquires in QIS (see, e.g., Refs. [18–30]) and involves two parts. The first one is the generation of pseudo-random sets of projectors {πj}, that can be cast in terms of the creation of pseudo-random unitary matrices. There are several methods for accomplishing this last task [31–34], whose details shall not be discussed here. Here, we will address the second part, which is the generation of pseudo-random discrete probability distributions [35–37], dubbed here as pseudo-random probability vectors (pRPV).
In this article, we go into the details of three methods for generating numerically pRPV. We present the problem details in Section 2. The Section 3 is devoted to present a simple method, the iid method, and to show that it is not useful for the task regarded in this article. In Section 4, the standard normalization method is discussed. The bias of the pRPV appearing in its naive-direct implementation is highlighted. A simple solution to this problem via random shuffling of the pRPV components is then presented. In Section 5, we consider the trigonometric method. After discussing some issues regarding its biasing and numerical implementation, we study and compare the probability distribution generated and the computer time required by the last two methods when the dimension of the pRPV is varied. The conclusions and prospects are presented in Section 6.
2 The Problem
By definition, a discrete probability distribution [4] is a set of non-negative real numbers,
that sum up to one,
In this article, we will utilize the numbers p j as the components of a probability vector
Despite the lack of consensus regarding the meaning of probabilities [4], here we can consider p j simply as the relative frequency with which a particular value x j of a physical observable modeled by a random variable X is obtained in measurements of that observable under appropriate conditions.
We would like to generate numerically a pseudo-random probability vector p whose components \(\{p_{\mathrm {j}}\}_{\mathrm {j=1}}^{d}\) form a probability distribution, i.e., respect (1) and (2). In addition, we would like the pRPV to be unbiased, i.e., the components of p must have similar probability distributions. A necessary condition for fulfilling this last requisite is that the average value of p j (notation: 〈p j〉) becomes closer to 1/d as the number of pRPV generated becomes large.
At the outset, we will need a pseudo-random number generator (pRNG). In this article, we use the Mersenne Twister pRNG [38], that yields pseudo-random numbers (pRN) with uniform distribution in the interval [0,1]. We observe however that the results reported in this article can also be applied when dealing with true random numbers [39, 40].
3 The iid Method
A simple way to generate an unbiased pseudo-random probability vector p=(p 1,⋯ ,p d) is as follows. If we create d independent pseudo-random numbers x j with identical probability distributions in the interval [0,1] (so the name of the method) and set
we will obtain a well-defined discrete probability distribution, i.e., p j≥0 and \({\sum }_{\mathrm {j}=1}^{d}p_{\mathrm {j}}=1\). Besides, as p is unbiased, the mean value of p j approaches 1/d as the number of samples grows.
Nevertheless, we should note that the sum \({\sum }_{\mathrm {k}=1}^{d}x_{\mathrm {k}}\) shall be typically greater than one. This in turn will lead to the impossibility for the occurrence of pRPVs with one of its components equal (or even close) to one. As can be seen in Fig. 1, this problem becomes more and more important as d increases. Therefore, this kind of drawback totally precludes the applicability of the iid method for the task regarded in this article.
4 The Normalization Method
Lets us begin our discussion of this method by considering a probability vector with dimension d=2, i.e., p=(p 1,p 2). If the pRNG is used to obtain p 1∈[0,1] and we impose the normalization to get p 2=1−p 1, we are guaranteed to generate an uniform distribution for p j∈[0,1] for both j=1 and j=2.
If d=3 then p=(p 1,p 2,p 3) and the pRNG is used again (two times) to obtain p 1∈[0,1] and p 2∈[0,1−p 1]. Note that the interval for p 2 was changed because of the normalization of the probability distribution, which is also used to write p 3=1−(p 1+p 2). As p 1 is equiprobable in [0,1], for a large number of samples of the pRPV, its mean value will be 1/2. This shall restrict the values of the other components of p, shifting the “center” of their probability distributions to 1/4, thus biasing the pRPV. Of course, if one increases the dimension of the pRPV, the same effect continues to be observed, as is illustrated in the table below for 106 pRPV generated for each value of d.
The probability distributions for the four components of the probability vector p=(p 1,p 2,p 3,p 4) are shown in Fig. 2. For the sake of illustration, the spaces for the pRPV are sketched geometrically in Fig. 3 for the cases d=2 and d=3. We observe that the procedure for generating p as explained above is the motivation for the name of the method, the normalization method.
A simple solution for the biasing problem just discussed is shuffling the components of the pRPV in each run of the numerical experiment. This can be done, for example, by generating a random permutation of {1,2,⋯ ,d−1,d}, let us call it {k 1,k 2,⋯ ,k d−1,k d}, and defining a new pRPV as
In the table below, the mean value of the components of q is presented, for 106 pRPV generated.
In the inset of Fig. 2, an example with the resulting probability distributions for the four components of q=(q 1,q 2,q 3,q 4) is presented.
From the discussion above we see that in addition to the d−1 pRN needed for the biased pRPV, we have to generate another d−1 pRN for the shuffling used in order to obtain an unbiased pRPV (because \({\sum }_{\mathrm {j}=1}^{d}j=d(d+1)/2\)), resulting in a total of 2(d−1) pRN per pRPV.
5 The Trigonometric Method
As the name indicates, this method uses a trigonometric parametrization [35, 37] for the components of the probability vector \(\vec {p}=(p_{1},\cdots ,p_{\mathrm {d}})\):
with 𝜃 0=π/2 (so the name trigonometric method). More explicitly,
A simple application of the equality \(\cos ^{2}\theta _{\mathrm {j}}+\sin ^{2}\theta _{\mathrm {j}}=1\) to this last equation shows that p j ≥0 and \({\sum }_{\mathrm {j}=1}^{d}p_{\mathrm {j}}=1\). Therefore, this parametrization, which utilizes d−1 angles 𝜃 j, leads to a well-defined probability distribution \(\{p_{\mathrm {j}}\}_{\mathrm {j}=1}^{d}\).
Let us regard the numerical generation of an unbiased pseudo-random probability vector by starting with the parametrization in (6). Of course, this task is accomplished if the components of the pRPV are created with uniform probability distributions. Thus, we can proceed as follows. We begin with p d and go all the way to p 1 imposing that each p j must be uniformly distributed in [0,1]. Thus, we must have
and the other angles 𝜃 j, with j=1,⋯ ,d−2, should be generated as shown in the next equation:
where t j, with j=1,⋯ ,d−1, are pseudo-random numbers with uniform distribution in the interval [0,1]. For obvious reasons, this manner of generating a pRPV is very unstable, and therefore inappropriate, for numerical implementations.
A possible way out of this nuisance is simply to ignore the squared cosines in the denominator of (9). That is to say, we may generate the angles using, e.g.,
for all j=1,⋯ ,d−1. This procedure will give us an uniform distribution for \(\cos ^{2}\theta _{\mathrm {j}}\) and \(\sin ^{2}\theta _{\mathrm {j}}\), but will also increase the chance for the components p j with more terms to have values closer to zero. Thus, there is the issue of a biased pRPV again. A possible solution for this problem is, once more, shuffling. The next two tables show the average value of the components of 106 pRPV generated via the trigonometric method before, 〈p j〉, and after, 〈q j〉, shuffling.
As was the case with the normalization method, for the trigonometric method, we need to generate 2(d−1) pRN per pRPV, d−1 for the angles and d−1 for the random permutation. Nevertheless, because of the additional multiplications in (6), the computation time for the last method is in general a little greater than that for the former, as is shown in Fig. 4.
One may wonder if the normalization and trigonometric methods, that are at first sight distinct, lead to the same probability distributions for the pRPV’s components and also if they produce an uniform distribution for the generated points in the probability hyperplane. We provide some evidences for positive answers to both questions in Figs. 5 and 6, respectively.
6 Concluding Remarks
In this article, we discussed thoroughly the three methods for generating pseudo-random discrete probability distributions. We showed that the iid method is not a suitable choice for the problem studied here and identified some difficulties for the numerical implementation of the trigonometric method. The fact that in a direct application of both the normalization and trigonometric methods, one shall generate biased probability vectors was emphasized. Then the shuffling of the pseudo-random probability vector components was shown to solve this problem at the cost of the generation of additional d−1 pseudo-random numbers for each pRPV.
It is worthwhile recalling that pure quantum states in \(\mathbb {C}^{d}\) can be written in terms of the computational basis \(\{|c_{j}\rangle \}_{j=1}^{d}\) as follows:
where \(c_{\mathrm {j}}\in \mathbb {C}\) and \(\phi _{\mathrm {j}}\in \mathbb {R}\). The normalization of |ψ〉 implies that the set {p j} is a probability distribution. Thus, the results reported in this article are seen to have a rather direct application for the generation of unbiased pseudo-random state vectors.
We observe however that the content presented in this article can be useful not only for the generation of pseudo-random quantum states in quantum information science, but also for stochastic numerical simulations in other areas of science. An interesting problem for future investigations is with regard to the possibility of decreasing the number of pRN, and thus the computer time required for generating an unbiased pRPV.
References
D.J. Bennett. Randomness (Harvard University Press, Cambridge, 1998)
L. Mlodinow. The Drunkard’s walk: How randomness rules our lives (Pantheon Books, New York, 2008)
M. Bell, K. Gottfried, M. Veltman. John Bell on the foundations of quantum mechanics (World Scientific, Singapore, 2001)
M.H. DeGroot. Probability and statistics (Addison-Wesley, Reading, 1975)
E.T. Jaynes. Probability Theory: The Logic of Science (Cambridge University Press, New York, 2003)
D.P. Landau, K. Binder. A guide to Monte Carlo simulations in statistical Physics (Cambridge University Press, Cambridge, 2009)
T.M. Cover, J.A. Thomas. Elements of Information Theory (Wiley, New Jersey, 2006)
M.A. Carlton, J.L. Devore. Probability with Applications in Engineering, Science, and Technology (Springer, New York, 2014)
H.V. Ribeiro, E.K. Lenzi, R.S. Mendes, G.A. Mendes, L.R. da Silva, Symbolic sequences and Tsallis entropy. Braz. J. Phys. 39, 444 (2009)
Á.L. Rodrigues, M.J. de Oliveira, Continuous time stochastic models for vehicular traffic on highways. Braz. J. Phys. 34, 1 (2004)
F.J. Resende, B.V. Costa, Using random number generators in Monte Carlo simulations. Phys. Rev. E. 58, 5183 (1998)
K.C. Mundim, D.E. Ellis, Stochastic classical molecular dynamics coupled to functional density theory: Applications to large molecular systems. Braz. J. Phys. 29, 199 (1999)
M.A. Nielsen, I.L. Chuang. Quantum Computation and Quantum Information (Cambridge University Press, Cambridge, 2000)
M.M. Wilde. Quantum Information Theory (Cambridge University Press, Cambridge, 2013)
J. Maziero, R. Auccaise, L.C. Celeri, D.O. Soares-Pinto, E.R. deAzevedo, T.J. Bonagamba, R.S. Sarthour, I.S. Oliveira, R.M. Serra, Quantum discord in nuclear magnetic resonance systems at room temperature. Braz. J. Phys. 43, 86 (2013)
A. Peres. Quantum Theory: Concepts and methods (Kluwer, New York, 2002)
J.J. Sakurai, J. Napolitano. Modern Quantum Mechanics, 2nd edn (Pearson education, San Francisco, 2011)
J. Grondalski, D.M. Etlinger, D.F.V. James, The fully entangled fraction as an inclusive measure of entanglement applications. Phys. Lett. A. 300, 573 (2002)
R.V. Ramos, Numerical algorithms for use in quantum information. J. Comput. Phys. 192, 95 (2003)
D. Girolami, G. Adesso, Observable measure of bipartite quantum correlations. Phys. Rev. Lett. 108, 150403 (2012)
D. Girolami, G. Adesso, Quantum discord for general two-qubit states: Analytical progress. Phys. Rev. A. 83, 052108 (2011)
J. Batle, M. Casas, A.R. Plastino, A. Plastino, Entanglement, mixedness, and q-entropies. Phys. Lett. A. 296, 251 (2002)
J. Batle, A.R. Plastino, M. Casas, A. Plastino, On the entanglement properties of two-rebits systems. Phys. Lett. A. 298, 301 (2002)
J. Batle, M. Casas, A. Plastino, A.R. Plastino, Maximally entangled mixed states and conditional entropies. Phys. Rev. A. 71, 024301 (2005)
M. Roncaglia, A. Montorsi, M. Genovese, Bipartite entanglement of quantum states in a pair basis. Phys. Rev. A. 90, 062303 (2014)
S. Vinjanampathy, A.R.P. Rau, Quantum discord for qubit–qudit systems. J. Phys. A: Math. Theor. 45, 095303 (2012)
X.-M. Lu, J. Ma, Z. Xi, X. Wang, Optimal measurements to access classical correlations of two-qubit states. Phys. Rev. A. 83, 012327 (2011)
F.M. Miatto, K. Piché, T. Brougham, R.W. Boyd, Recovering full coherence in a qubit by measuring half of its environment, arXiv:1502.07030
J. Shang, Y.-L. Seah, H.K. Ng, D.J. Nott, B.-G. Englert, Monte Carlo sampling from the quantum state space. I. New J. Phys. 17, 043017 (2015)
Y.-L. Seah, J. Shang, H.K. Ng, D.J. Nott, B.-G. Englert, Monte Carlo sampling from the quantum state space. II. New J. Phys. 17, 043018 (2015)
G.W. Stewart, The efficient generation of random orthogonal matrices with an application to condition estimators. SIAM J. Numer. Anal. 17, 403 (1980)
K. życzkowski, M. Kuś, J. Phys. A. Math. Gen. 27, 4235 (1994)
E. Brüning, H. Mäkelä, A. Messina, F. Petruccione, Parametrizations of density matrices. J. Mod. Opt. 59, 1 (2012)
J. Emerson, Y.S. Weinstein, M. Saraceno, S. Lloyd, D.G. Cory, Pseudo-random unitary operators for quantum information processing. Science. 302, 2098 (2003)
V. Vedral, M.B. Plenio, Entanglement measures and purification procedures. Phys. Rev. A. 57, 1619 (1998)
K. życzkowski, P. Horodecki, A. Sanpera, M. Lewenstein, Volume of the set of separable states. Phys. Rev. A. 58, 883 (1998)
T. Radtke, S. Fritzsche, Simulation of n-qubit quantum systems. IV. Parametrizations of quantum states, matrices and probability distributions. Comput. Phys. Comm. 179, 647 (2008)
M. Matsumoto, T. Nishimura, Mersenne Twister: A 623-dimensionally equidistributed uniform pseudorandom number generator. ACM Trans. Model. Comput. Sim. 8, 3 (1998)
M. Wahl, M. Leifgen, M. Berlin, T. Röhlicke, H.-J. Rahn, O. Benson, An ultrafast quantum random number generator with provably bounded output bias based on photon arrival time measurements. Appl. Phys. Lett. 98, 171105 (2011)
J.A. Miszczak, Employing online quantum random number generators for generating truly random quantum states in Mathematica. Comput. Phys. Comm. 184, 257 (2013)
Acknowledgments
This work was supported by the Brazilian funding agencies: Conselho Nacional de Desenvolvimento Científico e Tecnológico (CNPq) and Instituto Nacional de Ciência e Tecnologia de Informação Quântica (INCT-IQ). We thank the Group of Quantum Information and Emergent Phenomena and the Group of Condensed Matter Theory at Universidade Federal de Santa Maria for stimulating discussions. We also thank the Referee for his(her) constructive comments.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Maziero, J. Generating Pseudo-Random Discrete Probability Distributions. Braz J Phys 45, 377–382 (2015). https://doi.org/10.1007/s13538-015-0337-8
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s13538-015-0337-8