Questions tagged [random]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
345 views

How to convert from C to Mathematica?

I am trying to understand what is explained in this webpage, in the section entitled "Generating noise with different power spectra laws". After reading that section, I thought I could do it in ...
9
votes
5answers
918 views

Simple Birth Death Process

I am trying to implement simple birth death process. Why my code does not work? Any suggestion. Thanks. Cross posted http://community.wolfram.com/groups/-/m/t/1205656 ...
11
votes
1answer
554 views

Does `SeedRandom` give the same set of random numbers across operating systems?

If I use SeedRandom[12345] RandomReal[{0,1},100] I get the same random numbers on two versions of Mathematica: 10.4.1.0 on Windows 10 and 11.1.1.0 on Windows 7. ...
3
votes
2answers
189 views

Generating invertible matrix with lines within a given set

Consider the set options given as below ...
0
votes
0answers
70 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
145 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
177 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
172 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
751 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
79 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
344 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
156 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
92 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
82 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 ...
1
vote
3answers
153 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 values $\pm1$. My attempt is ...
2
votes
0answers
668 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
84 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
132 views

Plotting using RandomReal output [closed]

...
1
vote
1answer
106 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
65 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
499 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
66 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
113 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
190 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
116 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
175 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
231 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
374 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
533 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
253 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
62 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
85 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
331 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
195 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
215 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
174 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
52 views
3
votes
2answers
670 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
384 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
564 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
296 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
185 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 known as ...
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
119 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
71 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
319 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
64 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
827 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 ...