# Tagged Questions

Questions about random number generation and the properties of numbers so generated.

3 views

### averaging over large number of random realizations

I want to run following for few hundreds of a random variable set. This calculates: generate normal random variable find gain with squaring calculate performance metric find ...
49 views

### Evaluating a list of randomly sampled triplets with a function of three variables

I'm new to Mathematica. I need to generate a list of 1000 triplets of random numbers {r, p, t}, so that 0 < r < 1, ...
104 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 ...
127 views

### What is the symbol FENone for?

I have run into the symbol FENone multiple times. What is this symbol, and what is it designed to indicate? All I could find is that FE indicates the front-end, but it's unfortunately a very ...
258 views

### Why does't SeedRandom work here?

From the docs on SeedRandom, SeedRandom[] resets the generator, using as a seed the time of day and certain attributes of ...
65 views

### List of unequal random numbers [duplicate]

How can I generate a list of 10 random integer numbers in the range between 0 and 100 so that all random numbers are unequal?
294 views

### Efficiently generating samples from an urn with maximum per element constraint?

I need to sample from a distribution that is a hybrid of uniform and hypergeometric in the sense that all elements are sampled uniformly until an element reaches some specified maximum observations, ...
57 views

### Random Matrix with criteria

I want to construct $k$ lists $M$ of positions $(i,j)$ for a matrix $X$ of size $n\times m$, where all entries are "painted" with "white" color. The distribution of such a list $M$ must obey the ...
197 views

### Stochastic Predator-Prey model using Gillespie's SSA

I'm trying to model the predator-prey situation using SSA. I am very new to Mathematica so my handling of matrices is probably terrible, and that's probably adding to my confusion: ...
503 views

### Gillespie Stochastic Simulation Algorithm

The Gillespie SSA is a Monte Carlo stochastic simulation algorithm to find the trajectory a dynamic system described by a reaction (or interaction) network, e.g. chemical reactions or ecological ...
103 views

Observe: ...
3k 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: ...
1k views

### Random walk on a sphere

I'm trying to program a random walk on a sphere with Mathematica. I found this code while I was searching, but I'm not getting results from it. I waited an entire day, but my PC didn't finish ...
82 views

### How do I save the generated 2d random array for the next use? [duplicate]

I generated a 2d random array in $x-y$ plane with L = 10; random = Table[{x, y, RandomReal[{-1, 1}]}, {x, 0, L, L/10}, {y, 0, L, L/10}]; Now I want to save it ...
105 views

### How to make classification results replicable?

Let's suppose I have a simple classification problem: ...
231 views

### Random walk on a Sierpinski gasket

I am trying to simulate a random walk on a Sierpinski gasket. The best strategy i could come up with is to use Nearest point function to determine the next possible step of my walker. But this creates ...
88 views

### Selecting and plotting points belonging to a region from a random sample

I'm facing a problem with RandomReal when using ListPlot to plot some constrained points. I found that at every run of MA kernel ...
2k views

### Vectors with a certain magnitude in Mathematica

For a user-specified magnitude, is there a way to have Mathematica produce any 3D vector with that magnitude?
258 views

### Generating a two-dimensional random walk [closed]

I am new to programming inMathematica, and I am trying to pick up a few things by myself. As an exercise, I wanted to generate a two-dimensional random walk starting at the origin, and then moving a ...
64 views

### How to use Compile? Bivariate Gibbs Sampler

I am trying to use compile to speed up my Gibbs sampler. I know I can use Reap and Sow to speed up tremendously. I have a more complicated Bayesian posterior that I want to speed up with compile so I ...
54 views

### Random distribution of some Lists on a distinct matrix

I have 3 functions as below ...
71 views

### Classifier Random Forest Accuracy Not Consistent

I tried running a random forest classifier over different training sample sizes. The results are very strange because I could not replicate my accuracy with the same sample size in the second ...
272 views

### Calculating overlapped area between random circles

Suppose I am plotting random circles like in the following example: m=125; ...
116 views

### Generation of six Random numbers related by a constraint

I want to generate six Random numbers $a,b,c,d,e,f$ (all are real and positive). They are related by $a^2+b^2+c^2+d^2+e^2=1$ and $f$ is between 0 and 3. How can I generate those numbers?
49 views

### Randomized Control of Time Series Data

I am trying to randomize the order of a time series data set. I generated my data as: ts5 = RandomFunction[FractionalBrownianMotionProcess[.5], {0, 999, 1}] ...
244 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, ...
85 views

### Sampling a Dirichlet Distribution efficiently

I'm sampling a DirichletDistribution like so: ...
277 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?
143 views

### RandomInteger: speed with long lists

I noticed an interesting effect with RandomInteger when looking at the time to create 10^8 random integers. The following code lines all take about 0.5 seconds on a ...
256 views

### Calculate $\pi$ using Monte Carlo methods

I know that we can have an estimate of $\pi$ using Monte Carlo methods. I know that we make a huge loop and each time we take randomly two numbers in the range [0,1] and calculate the number of ...
76 views

### Random 3D cylinders plot [duplicate]

I have seen this trivial example for circles ...
74 views

### The correct assignment of probability distribution to generate random variables

I'm asking you for a help to solve a difficult (for myself) task. Now I will tell you what and why I'm trying to implement. The task is to simulate the passage of elementary particles through a ...
46 views

### Generating random Kraus operators

I am trying to generate (randomly) set of square matrices $\{K_m\}$ with the properties that $$\sum_{i=1}K_i^{\dagger}.K_i=I_n,$$ where $I_n$ is the identity matrix of order $n$. So, the input should ...
53 views

### Simulating a Boolean model in a uniform square

I am looking to simulate a Boolean model with specified Poisson point process. ...
70 views

### How to generate samples from an arbitrary continuous pdf?

If I define an arbitrary pdf p[x_] for a arbitrary-dimensional continuous variable x, how can I use Mathematica to create a function that will return a set of n random samples of x with distribution p?...
90 views

### Optimization of custom probability distibutions?

Consider the two tests: Timing[Do[RandomVariate[NormalDistribution[0.5, 0.3]], {200}]] {0.001188, Null} ...
129 views

### Periodic boundary conditions for two walkers

For some reason I'm getting infinite loops most of the time i run this. Perhaps the periodic boundary conditions are wrong. Seems like the probability of the two positions to be the same is extremely ...
85 views

### Draw independent samples from conditional distribution at a fast rate

I would like to draw samples from the following conditional distribution of the following (don't ask why): ...
303 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)$ ...
74 views

...
578 views

### Manipulate 2D random walk

Consider the first $10000$ digits of $\sqrt{2}$ and present them as a “random walk” by converting them in base 4 representing 4 directions. Following code produces this random walk ...
97 views

### How to change random values in manipulate?

I made a Manipulate box that is working very well, using lots of random numbers. I would like to add a button to "reset" (i.e. to change, randomize, or reselect) all the random parameters. Here's ...
96 views

### Animated discrete plot for a generalised random walk

I have a number of possible outcomes $R=\{r_i\}$, with $r_i\in\mathbb{Z}$ and corresponding probabilities of occurrence $P=\{p_i \}$, with $p_i \in [0,1]$ and $\sum_i p_i=1$. I am wondering whether ...
199 views

### How to define a set of two random orthogonal unit vectors?

I need to define a random set of two orthogonal unit vectors. The code below doesn't give proper unit and orthogonal vectors : ...
79 views

### How to define a stochastic electromagnetic field? [closed]

I would like to show the effect of a stochastic electromagnetic field on a relativistic charged particle, using a manipulate box. The field should be randomly varying in time and in space, and be ...
83 views

### Maximum Likelihood Estimation of Gamma-distribution Scale parameter

I have the following tasks: Generate random sample with given parameters shape = 2, scale = 0.001 and shape = 2, scale = 1/1200 for the right censored sample; Using Maximum Likelihood Method ...
29 views

### Missing Completely at Random MCAR

Many other stats packages have tests for MCAR but Mathematica doesn't seem to. Have a I missed something? If not what would a simple implementation in MMA look like. (disclaimer I'm new to MCAR ...
110 views

### Random bipartite graphs?

RandomGraph[{n,m}] generates a random graph with $n$ vertices and $m$ edges. I want to generate a random bipartite graph, like ...