Questions tagged [random]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
129 views

A question about AdaptiveMonteCarlo method in NIntegrate

I’m currently getting to grips with the AdaptiveMonteCarlo method in the NIntegrate function. I’ve been using the sub-method <...
3
votes
1answer
161 views

Random number generation of a Multivariate PDF

I want to simulate random data with a multivariate PDF. I see that five years ago this needed to be directly coded into mathematica directly, but it seems as though there is recent support for ...
3
votes
1answer
243 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
1answer
237 views

Place spheres randomly in a box without collisions?

Suppose I have a distribution of sphere radii, $P(r)$. I need to sample configurations of $N$ spheres in a cubic box of side $L$ (assume they fit), where the $N$ spheres have radii following the ...
10
votes
4answers
786 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 ...
1
vote
1answer
93 views

Evaluation of `RandomChoice` in a summation

Of course the familiar summation Sum[i, {i,n}] yields $n (1 + n)/2$. I'd like to add integers with an arbitrary randomly chosen sign (+ or -) before each term ...
4
votes
2answers
488 views

Solving a differential equation with colored Gaussian noise

I'm trying to reproduce the following equation: With $ n(t) $ defined as: Assuming $ g_A=g_B=1 $ I tried using NDSolve but struggle with the last term ...
0
votes
1answer
237 views

Generate data through RandomVariate from an interpolated distribution [duplicate]

I have a few data point, that I can interpolate into a distribution. I want to be able to generate points that follow this distribution, but Mathematica does not seem to be happy. Here is my code: <...
0
votes
3answers
105 views

Creating multiple random 2d data

I want to create a certain number n of 2d random data, which have the following structure: ...
0
votes
0answers
100 views

Sphere packing with target volume fraction

I've stumbled upon this sphere packing question, and now I have another related one. How can I have a function that returns a sphere packing with a target volume fraction? Sphere can obviously have ...
2
votes
4answers
219 views

Generate a random Fibonacci sequence

I want to generate the random sequence defined by $a_n = a_{n-2} + \beta(n)a_{n-1}$ where $\beta$ takes the values $\pm1$. My attempt is: ...
2
votes
0answers
822 views

Stochastic Gradient Descent with constraints

Let's say we have a convex objective function $f(\textbf{x})$, with $\textbf{x}\in R^n$ which we want to minimise under a set of constraints. The problem is that calculating $f$ exactly is not ...
2
votes
1answer
101 views

EstimatedProcess estimate biased?

I'm estimating the ARProcess parameters of a set of 1000 time series generated with an ARProcess and RandomFunction. Each time ...
0
votes
1answer
149 views

Plotting using RandomReal output [closed]

...
1
vote
1answer
136 views

Question about RandomSeed option in AdaptiveMonteCarlo NIntegrate method

I've been familiarising myself with the different options available in the AdaptiveMonteCarlo method for NIntegrate but one of ...
1
vote
1answer
70 views

How to generate number of points in a m/m/c/c process with Poisson arrival and exponential service time?

I am considering the Earling-B or m/m/c/c process. Let the request arrival rate follows Poisson Process with average rate, $\lambda$ Let the service time follows Exponential Distribution, i.e., $\...
7
votes
1answer
576 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 ...
0
votes
1answer
72 views

Evaluating expression involving a family of probability distributions

I'm trying to use Mathematica to solve a problem involving any continuous probability distribution $F(t)$ such that: $$\begin{align*} F(t)&=0, \; t\leq0\\ F(t)&=1, \; t\geq1 \end{align*}$$ ...
0
votes
0answers
147 views

Is RandomInteger significantly different from RandomReal or RandomVariate[UniformDistribution]?

Consider the following thought experiment: Take a sample of n points and calculate the Mean and StandardDeviation of the points ...
0
votes
1answer
268 views

How to get a random real number in the half-open interval [0.0,1.0)? [duplicate]

As far as I understand, RandomReal[] is able to generate random numbers between 0.0 and 1.0 so thinking in Terms of an interval this means [0.0,1.0]. Now I want to ...
0
votes
1answer
125 views

Methods offered by SeedRandom

Regarding on the Mathematica documentation, SeedRandom offers several methods, which are distingushable in terms of degree of randomness I guess. Does anybody have ...
6
votes
1answer
235 views

Basic Gaussian Process simulation/ white noise - massive problem

I have a certain problem with Mathematica or more precisely, myself handling it. It is correlated with a mathematical problem and its realization/simulation in Mathematica. I want to start with the ...
1
vote
1answer
294 views

ListLinePlot for specific range [closed]

I'm trying to plot the following code starting x-axis from 12 and ending on 30, and nos starting on 0, because the first 11 steps have information I dont need. How can I do that? ...
3
votes
1answer
434 views

How to generate random non-overlapping cylinders of fixed radius and height in a fixed cube?

I have seen these two questions (first) (second) which are related to generating non-overlapping cylinders in a cube. I am trying to adapt them to my goal which is to generate random non-overlapping ...
0
votes
2answers
661 views

MCMC Metropolis–Hastings algorithm

I am trying to implement Metropolis–Hastings algorithm to find parameters. I basically followed this PDF. It seems it works but gives me off parameters. Note: This is the Metropolis algorithm not ...
4
votes
0answers
289 views

Problem with the accuracy of the real-coded Genetic algorithm

Since there is no Genetic algorithm implemented in the Mathematica i tried to write a very simple genetic algorithm myself. The accuracy of the results depend upon rounding up the obtained parameters. ...
1
vote
1answer
69 views

RandomVariate from Multiplying distributions

Mathematica's RandomVariate works fine with the KernelMixtureDistribution[] function, but it doesn't seem to work if you wish to ...
0
votes
0answers
90 views

Generate random numbers for each time-step that are correlated

I want to generate Gaussian distributed random numbers, but i want them to be correlated, e.g $E[\epsilon(t)\epsilon(t')]=C(t-t')$ where $C$ is some function and $E[\cdot]$ denotes the expectation ...
7
votes
2answers
2k views

How to generate password

I would like to generate a random password of a defined length which can easily be typed in with a standard keyboard. As a start I tried the following: ...
3
votes
3answers
440 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 $\...
4
votes
3answers
208 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 ...
5
votes
0answers
45 views

Random Number Generation on Parallel Cores [duplicate]

So, I've noticed an odd trend in some of my Mathematica results recently- I'm running large Monte Carlo simulations on a system that involves running several jobs independently, each on a different ...
1
vote
1answer
252 views

Cloud-based random question generator

Is there any way to create a micro site that generates a random question type and keeps the same question until the right answer has been inputted? I tried ...
2
votes
3answers
193 views

Draw from continuous-discrete distribution

I have a random variable with a CDF that is almost everywhere differentiable, but has a point mass somewhere: ...
1
vote
1answer
58 views
3
votes
2answers
699 views

Generating random points on a Klein's bottle [duplicate]

There is a neat way in Mathematica to generate random points on a sphere. Note that "randomness" is defined (somewhat not mathematically strictly) so that the points must be evenly distributed over ...
3
votes
2answers
456 views

Animate trajectory of Brownian motion

I'm hoping to animate the trajectory of a 2D Brownian Motion. Here's my attempt, which is based on what I've read in Mathematica's documentation: ...
7
votes
1answer
726 views

How can I generate pink noise using Mathematica?

I need a time series of pink noise. How can I generate pink noise using Mathematica?
2
votes
5answers
436 views

Exclude zero when sampling random integers

I want to generate triplets of random integers over where the integers are in the range -9 to 9 (inclusive) but excluding zero. How can I do that? I have the following table. ...
3
votes
1answer
213 views

Generate coronograph speckle pattern in mathematica

How to simulate the radial coronograph "speckle-noise" in this image? The 3 circled objects are exoplanets. Their star has been blocked out by a coronagraph, resulting in optical noise ...
1
vote
1answer
64 views

Creating time varying 2d coordinates with OrnsteinUhlenbeckProcess

I see that I can create time varying 1d data with e.g. ...
2
votes
2answers
124 views

Locally randomizing a path on a graph

I have a walk $v_1 \ldots v_n$ on a graph $G$ and I want to apply the following operation to it: I wish to choose two indexes, $l$, $k$, and replace the sub-path from $v_l$ to $v_k$ with one of the ...
2
votes
1answer
86 views

Fix the outcome of a smooth function from a 1D random field

I have created a smooth function from a 1D random field. I used an existing code (Efficiently generating n-D Gaussian random fields) to generate random numbers with the correct Gaussian statistics, ...
3
votes
2answers
369 views

Generation of 'n' random symmetric matrices

I want to generate 3 random symmetric matrices, each of dimension 3 whose elements are normally distributed. It could be done simply as ...
3
votes
2answers
81 views

Make a RandomChoice inside a RecurrenceTable at each time of use, rather than once at time of definition

I recently watched the Numberphile video "Chaos Game" and I am trying to recreate the phenomenon discussed therein. The video depicts the following process: First, draw 3 points somewhere within the ...
5
votes
1answer
881 views

Brownian dynamics simulation

is there any way to improve computational speed of the following Brownian dynamics simulation of a trapped particle in the Markovian case ? I time-discretized the equation of motion and then use a ...
0
votes
0answers
32 views

RandomVariate and Map, strange behavior noticed

I'm performing Bayesian Analysis and I have written this piece of code ...
3
votes
1answer
529 views

Random walk with decreasing step size

I have to make simulation of a random walk that gets smaller and smaller. Each step the x-axis gets rescaled 1/2 and y-axis by 1/Sqrt[2]. So one needs more and more ...
4
votes
2answers
234 views

Get random solution for equation with $n$ parameters and infinite solutions?

I'm trying to get a random solution for an equation with arbitrary number of parameters which has infinite solutions. Note that the answer must be in n dimensions ...
3
votes
2answers
257 views

How can one generate an open-ended sequence of low-discrepancy points in 3D?

I'd like a low-discrepancy sequence of points over a 3D-hypercube $[-1,1]^3$, but don't want to have to commit to a fixed number $n$ of points beforehand, that is just see how the numerical ...

1
3 4
5
6 7
14