Questions tagged [random]

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

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

How to carry out a different function based on weighted probabilities

I am looking to carry out a function based on weighted probabilities I have looked at using If[] and random numbers but ...
1
vote
1answer
52 views

Pick single random value from WhiteNoiseProcess

I have the following: m = 6.137*10^-13; k = 1.5*m; stddev = Sqrt[2*k]*Sqrt[m]; whiteNoise = WhiteNoiseProcess[stddev] How can I produce a function that gives me ...
3
votes
1answer
80 views

Generation of Binary number from some distribution function

In mathematica, RandomInteger[] generates binary numbers (0 or 1) with equal probablity (uniform distribution). If I wish to generate the binary numbers with ...
1
vote
1answer
112 views

Plot the critical points of degree $d$ polynomials with zeros randomly chosen in given region

I wish to be able to scatter slightly (by at most some fixed $\varepsilon>0$) the zeros of a given complex polynomial $p(z)$ in a random way, and then see the effect on the critical points. For ...
1
vote
1answer
71 views

create one list from one list with random sample

I have a list, then I want to pick 2 elements (RandomSample[list,2]) put them in a new list (those two element will be one element in the new list, like list of ...
2
votes
1answer
95 views

Generating the cumulative distribution function (CDF) of a tuple made by RandomFunction

I use the RandomFunction to generate a continuous random function (trying to model a rough surface): ...
4
votes
2answers
325 views

Distribution of Function of Random Sum of Random Variables

Let $ S = \sum_{i=1}^n X_i$ where: Each $X_i$ is independently 3 or 9 (with equal probability), and The sample size $n$ is itself an independent random variable where $N \sim \text{NegativeBinomial}(...
0
votes
3answers
104 views

How to get a function within ConstantArray to evaluate for each list element?

Here is my code example: ConstantArray[RandomInteger[{1, 5}], 10] However as my output I get something like ...
3
votes
3answers
594 views

2D Random walk under specific boundary

I try to create the code so that from initial point (that I can set), code runs so that it performs random walk, yet it turns off once the point hits the wall. I tried this method however, I was not ...
0
votes
1answer
90 views

Run Block of Code in For Loop

Suppose I want to conduct an experiment 10,000 times in which a random sample of size $n=20$ from a beta distribution is collected and then the values of four different estimators are collected. At ...
2
votes
2answers
81 views

How to create ordered and custom formatted random matrices?

I'm trying to generate square grid templates to drill holes on a plate for a fragmentation experiment. I have three different problems that I'm not finding a way to solve using the documentation, they ...
3
votes
1answer
413 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 ...
16
votes
1answer
159 views

RandomChoice output isn't packed

Why isn't the output of RandomChoice a packed array? For instance: RandomChoice[{.5, .2, .3} -> {1, 2, 3}, 10] Developer`PackedArrayQ @ % {1, 2, 3, 1, 3, 1, ...
8
votes
6answers
873 views

Efficient binarization of a list

I am generating a list of 1's, 2's, and 3's with different probabilities for each number. I then convert this list into three binarized lists, giving a list of the locations of each digit in the ...
1
vote
1answer
205 views

ItoProcess and/or RandomFunction numerical failure for coupled SDEs

I'm trying to simulate a physical system including noise using the ItoProcess command, the system is governed by two coupled differential equations. The potential ...
7
votes
2answers
234 views

matrix with chosen elements distributed in a random position

I would like to generate a matrix whose dimension is L^2 and whose entries can be only in a finite set but in random positions in the matrix. such as ...
1
vote
0answers
107 views

Dealing with Vector Outputs from ItoProcess, RandomProcess (Stochastic Differential Equations)

I'm modeling stochastic chemical kinetics and the ItoProcess[] function has served me well. I am trying to write an efficient code to analyze many (Paths) trajectories of several different reagents (...
2
votes
1answer
298 views

Plotting sine curves with different random noises

I would like to generate data in Mathematica that follows a sinusoidal curve. However, I would like to add a Gaussian noise to the curves so as to reproduce graphs ...
7
votes
2answers
251 views

Take random sample of paths in a graph

I have a directed graph with 51 nodes. I want to extract a (big) random sample of the possible paths from node $i$ to node $j$. I know that I can generate a list that contains all the paths with <...
0
votes
1answer
306 views

Need to add a different random number to each part of the table

I have a table with x rows. For one column of the table, I want to add a different random real to each element. I have generated a list of x random real numbers and called it 'tolerance'. Here's the ...
0
votes
1answer
134 views

Improve random generation of matrices

My problem is too plenty of subtleties that a detailed explaination would be boring. I will try to state my problem in a more general way. I have a 5x5 matrix called $M$ which depends on several ...
1
vote
1answer
54 views

Calling function with random output twice

I would like to call a function, which creates some random output (let's say a random integer) in a single expression twice. A minimal example: ...
3
votes
3answers
84 views

SkewNormalDistribution with a mean value

Since it got incredibly good answers the last time i posted a question, i try it again! ;-) I programmed a chemical/physical simulation in mathematica, where i can use residence time distribution as ...
3
votes
4answers
450 views

Any built-in function for this code?

Is there any build in function or shorter version of this? Assume I have 3 reactions time and each reaction occurs randomly. Generate rand=RandomReal[] if rand<0....
3
votes
1answer
142 views

Unexpected behavior of ToBoundaryMesh and ToElementMesh

This question is about functions ToBoundaryMesh and ToElementMesh. I use both functions successively because I need information ...
4
votes
1answer
170 views

First order ODE with random force

I need to solve using first order Euler method some simple equation $ \frac{dc}{dt} +3 c = f(t) $ where $f(t)$ is random delta-correlated force: $<f(t_1)f(t_2)>=2A \delta(t_1-t_2)$ Searching ...
1
vote
3answers
121 views

Number of realizations in NExpectation, Method Monte Carlo

I have been looking in NExpectation about how large the sample size is when Mathematica performs Monte Carlo simulation. For example, if we write ...
9
votes
5answers
358 views

Probability a random triangle on a circle contains the origin

Another great video from 3Blue1Brown describes a neat proof (at about 5:45) that this has to be 25%. I wanted to do the experiment in Mathematica as a way of showing how exploring the problem ...
4
votes
0answers
136 views

Generating random interlocking regions (i.e. countries)

I am trying to subdivide a finite portion of the plane into a set of at least 20 or so random interlocking shapes, with the shape boundaries having a fractal dimension around that of borders between ...
13
votes
4answers
2k views

Building a Noisy Function

Here's a nice function with a nice plot: f[t_] := Exp[-Abs[t]] Sin[t]; Plot[f[t], {t, -10, 10}, PlotRange -> All] What I would like to do is to make it noisy.....
9
votes
3answers
750 views

Creating random configurations of spherocylinders or cylinders

About the setting: We have a 3D simulation box with side $l$ and our catesian coordinate system is set with its origin at the centre of the box. We have a number $N$ of spherocylinders of aspect ...
7
votes
2answers
1k views

Generate white noise in 2D

I am trying to generate a random (white noise) signal, as mentioned in the section Frequency Synthesis of Landscapes (and clouds) on this website. The problem I have is that I do not know if ...
1
vote
0answers
74 views

MultinormalDistribution not having the right mean [closed]

I am using the function MultinormalDistribution to generate a random vector using the following code: ...
8
votes
1answer
275 views

Generate random matrix where the entries in each column are drawn from a different range

I know that you can generate an $m\times n$ matrix of random numbers by RandomReal[range, {m, n}], where e.g. range = {0, 1}. ...
1
vote
0answers
87 views

Issue with RandomFunction and TimeSeriesModelFit in V11.2

I have a notebook which was working with V11 and now not working with V11.2. I have wind speed data with a regular timestep of 1hr. Taking a month : ...
3
votes
3answers
100 views

Average number of uniform variates needed for their sum to be $> 1$ should be $\approx e$

An interesting tweet from Fermat's Library proves that the average number of random values [0,1] that are needed to Total > 1 is about $e$ (2.718...). I don't get ...
30
votes
3answers
1k views

Implementing a planetary terrain generation algorithm

From this (now deleted) question I found this site where the author discusses a simple technique for random terrain generation on a sphere. The method discussed is as follows: start with a ...
1
vote
0answers
152 views

Parallelization of Monte Carlo numerical integration

I'm trying to parallelize some integral. What I do: I define integrand: ...
1
vote
1answer
145 views

Modeling Dependent Joint Distribution

I'm trying to model the joint pdf of (X,Y) from example 4.5.8 of the text Statistical Inference 2nd Edition, Casella, Berger (pg 199 of the pdf). Essentially, X ~ Uniform[0,1] Z ~ Unfiorm[0,1/10] Y ...
3
votes
1answer
111 views

How can I use WienerProcess with TimeSeriesForecast?

I created a TimeSeries from Date-Value-Pairs, which I imported from a .csv-File diffp = Import["path/difficultyp.csv", "Data"]; tsdiff = TimeSeries[diffp]; I ...
7
votes
5answers
609 views

Stop Mathematica from rounding the value

My task is simple. Calculate the average value for 10^7 dice throws using computer pseudo-random-number-generator. x := RandomInteger[{1, 6}] gives me one ...
1
vote
2answers
410 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
977 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
960 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
206 views

Generating invertible matrix with lines within a given set

Consider the set options given as below ...
0
votes
0answers
120 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
159 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
238 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
230 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
784 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 2 3
4
5
14