Tagged Questions

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

166 views

Von Neumann's method to generate points uniformly distributed on a region of a n-sphere surface

I am trying to generate points uniformly distributed on a region of a single n-sphere surface (all angles in hyperspheric coordinates are between 0 and Pi/2). I decided to use von Neumann's method ...
157 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 ...
492 views

Creating a fast random array generator

I want to create N x N array of random numbers. (N is an integer). The constraints are, each element should be between 0 to l(integer) ( here 0<= l <= N) and the sum of elements in each row ...
131 views

Random generation of three-non-collinear and four-non-coplanar points in 3D space

Please, take a look to this code. How it can be improved so that the time execution becomes smaller? ...
157 views

...
111 views

Sum considers RandomInteger[] as a constant

Perhaps this is expected behavior, but I was kind of surprised by the following: ...
2k views

Generating 250 random points crashes the kernel, but not 249

Fixed in 10.1.0. Consider the following function, which generates uniformly random points on the surface of the 2-sphere: ...
1k views

Random real numbers that sum up to specific value [duplicate]

In here, it works with "Integer". What if I want 5 positive real numbers that sum to 1? RandomChoice[IntegerPartitions[100, {5}]]/100. That will work. But only ...
66 views

Getting RandomChoice to work in Manipulate function

I'm a beginner mathematica programmer and I am tryin to create my first demonstration. This code should represent what happens if one changes the size of the reading frame, calculating the nucleotide ...
1k views

Generate nonoverlapping random circles [duplicate]

I want to distribute n circles unformly in an area(e.g. free plannar space). The circles could touch each other but cannot overlap. ...
73 views

How to randomly create disks with randomized radii under given specific cover ratio? [duplicate]

I want to create uniformly distributed disks(dots) in a specific rectangular area. Suppose: the disk radii should be uniformly between $a$ and $b$ ($0<a<b$); there is no interaction between ...
92 views

RandomVariate form a Specific Distribution with Restrictions

There are a lot of questions about generating random numbers form both uni-variate and bi-variate distributions. Mathematica has a lot of built in distributions for that purpose. However, I could not ...
68 views

Help with Multivariate ProbabilityDistribution

I wish to obtain numbers from ...
326 views

Monte Carlo Volume Calculation and Speed Up

I am trying to do a Monte Carlo area calculation for an irregular area defined by: $$0 \le x \le 1, 10 \le y \le 13, y \ge 12 \cos(x), y \ge 10 + x^3$$ I used the code with modifications (so I can ...
302 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)$ ...
415 views

TemporalData, RandomFunction, Loops: Extracting data from TemporalData sets?

I'm doing a finance project for my differential equations class to explore stochastic processes. I'm exploring IRA retirement funds. From the project write-up: Standing assumption: at time of ...
880 views

Generating Random Real numbers with certain numbers not included

I'm writing a program that i need 1000 real number between -3 and 6. the code that I used for generating and saving them was l = RandomReal[{-3, 6}, 1000] But I ...
130 views

Generate non-overlapping permutations

Let l be a list l = Flatten[Range[7] & /@ Range[12]]; (* 1,2,3,4,5,6,7,1,2,3,4,5,6,7,... *) The question is to ...
106 views

A constraint to RandomReal for sum of numbers equal to arbitrary n

I want to generate some random numbers but respect a constraint. So I use RandomReal[{0,1},N,WorkingPrecision -> 2] I want to fix a constraint in order ...
440 views

Assign a randomly generated list to variable

Bug introduced in 10.0.0 and fixed in 10.0.2 I don't know if this is a silly question, but it really baffles me. So please help me understand this behavior. ...
225 views

How to figure out the seed I used to generate several random numbers given that I didn't used SeedRandom at first place?

After generating thousands of random numbers, I figured out that I didn't used SeedRandom to store the seed. Is there a way for me to know what seed was used to generate these numbers? Thanks in ...
323 views

Generate random nxn matrix with all negative eigenvalues

I need to generate an nxn matrix with random entries, but I also need all of the eigenvalues to be negative (real or complex doesn't matter). I have: ...
89 views

Why does RandomFunction return variable number of data points?

I am using the following code snippet to generate Compound Poisson process random numbers: ...
350 views

Coloring random points in an annulus

I have found the following random generator to generate points in an annulus in stackoverflow on stackoverflow ...
318 views

Random Integer Sequences

I want to construct a random square matrix in the following manner: a) Three states [0 | 1 | 2] are repeated ...
97 views

Verify positive definiteness using random numbers

I wish to verify whether T'T - IdentityMatrix[2] is always positive definite for a certain choice of elements of T'T. ...
74 views

Parallelization and evaluation of random number generation

Suppose I have the following functions: ...
1k views

Generating random symmetric matrix

Suppose first that I want to generate a matrix whose elements are independent and identically distributed (i.i.d.) with distribution dist. This is easy: ...
123 views

Sublists of Random Permutations

What is an efficient way to create a list of (psudo)randomly chosen permutations? I'm trying to create a list like below: ...
100 views

FindProcessParameters for Fractional Brownian Motion Returns Error

I have the following data: ...
102 views

What ProcessEstimator Options can I use with FractionalBrownianMotionProcess

I can generate an fBm process: ...
614 views

Computing the Hurst exponent or fractal dimension of fractional Brownian motion

The Hurst exponent is related to the fractal dimension by noticing that the fractal dimension $D$ is equal to $2-H$, where $d$ is the intrinsic dimension and $H$ is the Hurst exponent, for 1-D ...
482 views

Optimizing Monte Carlo simulation of a Pred-Prey model

My assignment and code As part of an assignment for one of my classes, I'm trying to run a "massive" Monte Carlo simulation in Parallel on the follow model: ...
2k 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: ...
248 views

658 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 ...
315 views

Create a list of random reals

How can I create a list of random pairs $(x,y)$ where $0<y<x<1$ and $x,y \in \mathbb{R}$ ? I can't seem to place that inequality restriction on the random numbers that are generated.
32 views

Generating a Table with a certian Density [duplicate]

How do I create a random table of 0's and 1's with a certain density instead of a probability? For Example: Manipulate[ Table[RandomChoice[{1 - density, density} -> {0, 1}, {10}]], {...
144 views

Simulated Annealing for NMinimize[] always returning the same solution

I have a function defined as follows: ...
2k views

Random numbers that sum up to specific value

I would like to generate a list with random numbers, which add up to a specific value. While[Total[x] == 28, x = RandomInteger[{0, 28}, 5];Print[x]] The random ...
209 views

Generate Random 3D Network using GraphPlot3D and loop

Instead of writing all this out I want to do the same thing with a loop and be able to manipulate n and k. The idea is to create a randomly generated network where n is the number of nodes and k is ...
148 views

Probability Distribution of a Multivariate Hypergeometric distribution and maximum probability

Hello to all Mathematica Users! I have this question: Consider a box which contains 69 balls. 17 red, 1 white, 29 blue and 22 green balls. There will be picked 7 balls randomly, without putting the ...
150 views

Creating nested matrix using random integers

How do i create 15x2 matrix with 2x2 random integer elements? My code only returned identical 2x2 elements:
251 views

How to generate a random binary tree with a given number of vertices and with a given shape, namely compact or elongated

I tried to generate a random binary tree with a Table of RandomInteger and to give a shape with a ...
620 views

Skip other If conditions

I'm trying to write a code to "random" move in a matrix but it can't go to a certain position if it has a certain value (in this case I'm using the number 2). How do I make it to skip all other If ...
Simulating a bounded continuous random walk in $n$-dimensions
You're given three $n$-dimensional real vectors, $\mathbf{x_0}$, $\mathbf{a}$ and $\mathbf{b}$, with $\mathbf{a} \le \mathbf{x_0} \le \mathbf{b}$ (vector inequality means component-wise inequality). ...