All Questions
Tagged with distributions random
101 questions
54
votes
8
answers
8k
views
How to generate random points in a region?
The Mathematica 10 documentation was updated for FindInstance adding support for regions.
In my use case, I'm trying to sample points in a set of disks:
...
51
votes
3
answers
6k
views
RandomVariate from 2-dimensional probability distribution
A probability distribution can be created in Mathematica (I am using 8.0.1) with e.g.
...
23
votes
3
answers
13k
views
How to generate a RandomVariate of a custom distribution?
I'm trying to generate a pseudorandom variate out of a custom distribution. Suppose I want define a custom distribution, and for the sake of simplicity I define a Poisson distribution (the ...
22
votes
2
answers
2k
views
Efficient Generation of Random Variates from a Copula Distribution
I have a 7-asset portfolio for which I want to simulate daily log-deltas using a Student T copula. The marginal distributions are all either Stable or TsallisQGaussian. Using NMaximize, I have ...
21
votes
5
answers
1k
views
Sisyphus Random Walk
A Sisyphus Random Walk evolves as follows: With probability (r) you advance the position of the walker by +1. With probability (1-r) the walker resets at x0 = 0.
To simulate the probability of reset ...
20
votes
3
answers
2k
views
Generating uniform random points over a binary image
So I recently read this excellent post about generating random points over arbitrary regions. I hope Wolfram eventually builds that functionality into Mathematica's ...
18
votes
1
answer
2k
views
Speed up adding Poisson noise to an image
I'm simulating some images corrupted with Poisson noise, but I'm encountering a few problems with performance. According to the documentation on ImageEffect, one ...
16
votes
1
answer
470
views
RandomVariate returns values outside the support of a PDF
Bug introduced in 8.0.1 and fixed in 10.2.0
Let $X$ be a random variable with pdf:
dist = ProbabilityDistribution[1/(Abs[x]*Log[Abs[x]]^2), {x, -E^-2, E^-2}]
...
14
votes
3
answers
249
views
13
votes
2
answers
7k
views
What is the best distribution for my histogram?
I defined a security bound for a random walk (cube with 15 length) and I have this code to obtain a sample of the random times at which the random walk crosses the boundary for the first time:
...
12
votes
2
answers
600
views
Sampling a phase space uniformly for a given energy?
The energy for a 1D harmonic oscillator can be written:
$$
E = \frac{1}{2 m} p^2 + \frac{m \omega^2}{2} x^2
$$
where x is position and p is the momentum.
I would like to sample phase space $(x,p)$ ...
10
votes
4
answers
845
views
Uniform distribution on z = 1 − √( x ^2 + y ^2) , z ≥ 0 [duplicate]
Let $S$ belong to ${\rm I\!R^3}$, $z = 1 − \sqrt{x^2 + y^2}$ , $z ≥ 0$.
I need to write a program that generates a random point on $S$ with uniform distribution. I've tried to use
...
10
votes
2
answers
200
views
Possible bug in VonMisesDistribution?
Bug introduced in 10.2 or earlier and fixed in 10.3
Observe:
...
8
votes
1
answer
657
views
Inconsistent DistributionFitTest results?
In pondering this question, I used Mariana's function to generate the following data.
...
8
votes
2
answers
170
views
Custom graph distribution
I am working with random graphs a lot. It's quite easy to describe random graph using, adjacency matrix or just a list of edges. However I am thinking that I might benefit from describing random ...
8
votes
1
answer
898
views
How to implement Monte Carlo Importance Sample in 2D or in N dimensions?
So far i have managed to implement the Crude Monte Carlo (CMC) and the Importance Sample Monte Carlo (ISMC) for unidimensional problems.
Consider the function ...
7
votes
5
answers
1k
views
Survival Probability for Random Walks
The Survival Probability for a walker starting at the origin is defined as the probability that the walker stays positive through n steps. Thanks to the Sparre-Andersen Theorem I know this PDF is ...
7
votes
2
answers
2k
views
Can this code be changed to run faster?
I've worked for several days trying to get this code to run faster. The imported data is 15MB.
...
7
votes
3
answers
774
views
How to randomly erode a 3D distribution of points with Mma 7.0?
Suppose we have a 3D distribution of points, like the spherical ball example below :
...
7
votes
3
answers
1k
views
Creating a custom distribution with specified skew and kurtosis
Let's say I want to create a simulated sample of returns for a given investing/trading strategy. I know that my strategy is profitable on 64% of trades, that the ratio of mean win / mean loss is 0.72, ...
7
votes
3
answers
3k
views
How do I define a two point random variable?
How do I define a random variable $X$ such that $Pr[X=x_1]=p_1$ and $Pr[X=x_2]=p_2$ where the values $x_i$, $i=1,\,2$ are just symbols and the probabilities $p_i$, $i=1,\,2$ are symbolic expressions ...
7
votes
1
answer
378
views
RandomVariate does not fill range of PDF of distribution
I've declared my own probability distribution as follows
dist[a_, b_] := ProbabilityDistribution[Cos[(b x)/2]^2 Sinc[a x]^2, {x, -400, 400}];
When I try to ...
7
votes
1
answer
393
views
How to distribute points on a Sphere[] cap from a normal distribution?
I was wondering if one could distribute points on a "cap" of a sphere, following a normal distribution of the points instead of a uniform distribution. This normal could be centered at the ...
7
votes
4
answers
467
views
How to generate two group of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal? [closed]
I want to have two groups of $n$ random numbers $u_i$ and $v_i$ in $U(0,1)$, such that $\sum u_i = \sum v_i$
What I tried is:
I can firstly get $u_i$ by ...
7
votes
3
answers
148
views
7
votes
0
answers
80
views
6
votes
2
answers
903
views
Speed up RandomVariate on a custom probability distribution
I have created a custom probability distribution:
...
6
votes
1
answer
584
views
RandomVariate cannot sample from a custom multivariate ProbabilityDistribution
Let us try to define 2D distribution through PDF:
...
5
votes
2
answers
693
views
How do you generate a random number with a pre-specified probability distribution?
I want to generate a random real number between 0 and 1 but not distributed uniformly but with a probability distribution say, 2 Sin[ pi x ]^2 which integrates to 1 ...
5
votes
1
answer
79
views
Random normalised variable generation
I want to generate 8 random variables (in reality to form 4 complex numbers) such that the sum of the 8 variables squared is equal to unity. The aim of generating such numbers is to perform a quantum ...
4
votes
2
answers
637
views
Generate a random PDF
How can I generate a random probability density function $p(x)$ in the domain $[0,1]$? Is there a single Mathematica function to do so?
4
votes
3
answers
274
views
RandomVariate of ProbabilityDistribution returns values outside the support of a CDF (non-symmetric PDF)
From this post (95069) I can see that this question has been been given a workaround for symmetric PDFs and that the bug was eventually addressed. I checked and the fix is still in place for my ...
4
votes
1
answer
274
views
Random Variate generating strange results when using ProbabilityDistribution
Bug introduced in 10.1 and fixed in 10.3
I have created a probability distribution that follows a general normal distribution, given by:
$$
\frac{b *e^{-\left(\frac{\sqrt{(x-u )^2}}{a }\right)^{b }}}...
4
votes
2
answers
488
views
Colors associated to parts of a 3D distribution of points
Suppose we have a long list of random points (in Cartesian coordinates) in 3D space.
coords := ...;
Until now, I was associating colors in a radial way, from the ...
4
votes
2
answers
173
views
Optimize RandomVariate for a $1/x^4$ distribution
I'm working with the following code, where I define a probability distribution proportional to $1/x^4$.
...
4
votes
2
answers
190
views
Maximum of all distances between any pairs of vertices of a random triangle
Given a set $S_n$ of $n$ points selected uniformly at random in a $d$-ball, I want to estimate the average length of the longest side of a triangle having as vertices any three distinct points of $S_n$...
4
votes
2
answers
770
views
Time inhomogeneous Markov Chain in Mathematica
I would like to create a discrete 2-state Markov process, where the switching probabilities in the transition matrix vary with time.
I can currently do the following, which creates a process with ...
4
votes
1
answer
1k
views
Radial Random Walk
I'm trying to generate a spherical distribution of radial random walk points in 3D space. The following code works, but the random walk lines aren't radial. Why ? Where is my mistake ?
...
4
votes
3
answers
876
views
Construct Distribution Histogram From Random Variable
Given a Beta Random Variable $X$ with parameters $\alpha, \beta$ and a positive constant $n$, suppose I am interested in the distribution of:
$$Y:=\lfloor nX\rfloor$$
Suppose I want a histogram ...
4
votes
1
answer
92
views
RandomVariate does not evaluate a Hyperbolic Distribution
Any Idea why I can't get a result from this expression:
...
4
votes
1
answer
74
views
Speeding up RandomVariate with custom probability distribution
I have the defined a custom distribution, which is a Gaussian where the exponent can be any real n greater than 0 (set to actually be >0.5 in use), i.e.
...
3
votes
3
answers
3k
views
Random non-overlapping disks in a square
I've found a nice code snippet by @belisarius from this question, that I'll reproduce here for reference:
...
3
votes
1
answer
390
views
Sampling a Dirichlet Distribution efficiently
I'm sampling a DirichletDistribution like so:
...
3
votes
2
answers
978
views
Generating a range of numbers according to some rules
I'm pretty new to Mathematica, and I'm mainly a programmer so I don't have a lot of knowledge about maths.
I want to generate a set of UNIQUE incremental numbers (series) according to the following ...
3
votes
1
answer
239
views
How to use Mathematica to find the maximum expected value of multiple normal distributions?
Is it possible to calculate the maximum expected value of $ n (n\geq 2) $ independent (identical distributed) random variables that follow a normal distribution? If possible, how to find it? If it ...
3
votes
3
answers
888
views
Produce a probability vector with uniform distribution [duplicate]
A probability vector is a vector $\mathbf{p}=(p_1,p_2,\ldots,p_n)$ with the following properties:
$\sum_{i=1}^{n}p_i=1$
$p_i\geq 0$
Assume that the set of all possible probability vectors is $\...
3
votes
1
answer
194
views
How to generate random variate in custom domain for a distribution?
I have a distribution defined in a particular domain of the variable but now I want to generate a random variable not in the entire domain but only in a subset of the domain. Here is what I'm trying ...
3
votes
1
answer
827
views
Simulate random sample from defined probability density function
Suppose I define a function in mathematica that has all of the properties of a valid probability density function. Would it be possible to have Mathematica simulate a random sample of a given size of ...
3
votes
1
answer
475
views
First passage time distribution in mathematica
I'm trying to calculate first passage time distribution for some processes in Mathematica. First I tried to calculate this for Wiener process with zero drift and $\sigma = 1$ and the absorbing ...
3
votes
1
answer
253
views
Generate a uniform distribution over an $n$-simplex employing quasi-random low-discrepancy points
This post is intended in a similar direction to an earlier one Can I use Compile to speed up InverseCDF? . I now wish to generate uniform points in an $n$-simplex (specifically $n=8$), making use of ...