Questions tagged [montecarlo]

Monte Carlo methods are stochastic (probabilistic) systems that use many random samples to derive properties of a complex system.

Monte Carlo methods are stochastic methods that use large sample sizes to gather information about a complex system. The outcomes of these trials can then be used to draw generalizations about the system as a whole, without first needing a proper solution.

Monte Carlo methods are especially useful when a numeric solution is available, but which is too complex to solve for directly. They are general enough that their use is widespread; Wikipedia provides a list too exhaustive to reproduce here.

1260 questions
5
votes
1 answer

What does it mean to have a transient state or a transient phase in an Ising model?

I downloaded a simple implementation of the Ising model in C# from this link. I have understood more or less the entire code except the following routine: private static void transient_results(double T) { for (int a = 1; a <=…
user366312
  • 16,949
  • 65
  • 235
  • 452
5
votes
2 answers

Resetting R random number generator (rlecuyer) for inner loops using Snow/doSNOW

I have an outer foreach/dopar parallel loop containing an inner loop. Every instance of the inner loop should work on the same set of random numbers. The rest, i.e. the remaining parts of the outer body and the parallel instances should work as…
g g
  • 304
  • 2
  • 13
5
votes
1 answer

Setting priority queue values to optimize the probability of finding a 'gift'

I have a priority queue of "door numbers". I get the next door number from the priority queue (i.e. the door with the lowest corresponding priority value), and then open the door. Behind the door, there may be a gift or not. Based on the presence /…
5
votes
1 answer

Using OpenMP to calculate the value of PI

I'm trying to learn how to use OpenMP by parallelizing a monte carlo code that calculates the value of PI with a given number of iterations. The meat of the code is this: int chunk = CHUNKSIZE; …
Amit
  • 7,688
  • 17
  • 53
  • 68
5
votes
1 answer

Can Tensorflow work out gradients for integral approximations?

I am trying to use Hamiltonian Monte Carlo (HMC, from Tensorflow Probability) but my target distribution contains an intractable 1-D integral which I approximate with the trapezoidal rule. My understanding of HMC is that it calculates gradients of…
Cobbles
  • 1,748
  • 17
  • 33
5
votes
2 answers

Is there a fast alternative to scipy _norm_pdf for correlated distribution sampling?

I have fit a series of SciPy continuous distributions for a Monte-Carlo simulation and am looking to take a large number of samples from these distributions. However, I would like to be able to take correlated samples, such that the ith sample takes…
NealJMD
  • 864
  • 8
  • 15
5
votes
2 answers

How to I make my AI algorithm play 9 board tic-tac-toe?

In order to make it easy for others to help me I have put all the codes here https://pastebin.com/WENzM41k it will starts as 2 agents compete each other. I'm trying to implement Monte Carlo tree search to play 9-board tic-tac-toe in Python. The…
Vera
  • 61
  • 1
  • 6
5
votes
3 answers

Monte carlo on GPU

Today I had a talk with a friend of mine told me he tries to make some monte carlo simulations using GPU. What was interesting he told me that he wanted to draw numbers randomly on different processors and assumed that there were uncorrelated. But…
MPękalski
  • 6,873
  • 4
  • 26
  • 36
5
votes
1 answer

How to improve Brownian motion monte carlo simulation speed?

I want to make my code run faster for more iterations and runs. Right now my code is too slow, but I don't know what to change to speed it up. I began by coding a kinetic Monte Carlo simulation, then editing it to become a Brownian motion…
5
votes
1 answer

How to compute volume of 10-Dimentional sphere with Monte-Carlo-Method in Python?

I am trying to compute the volume of a 10 dimensional sphere with python, but my computation doesn't work. Here is my code: def nSphereVolume(dim,iter): i = 0 j = 0 r = 0 total0 = 0 total1 = 0 while (i < iter): …
ZelelB
  • 1,836
  • 7
  • 45
  • 71
5
votes
2 answers

Monte Carlo Analysis Python Oil and Gas Volumetrics

I am trying to teach myself python and I wanted to start with learning how to do a monte carlo analysis (I am a scientist by trade who uses MCA alot). I am trying to write a program in that will perform a montecarlo simulation of 7 variables to…
Josiah Hulsey
  • 499
  • 1
  • 7
  • 26
5
votes
2 answers

Running Montecarlo analysis on Google Spreadsheets

A complex Google Spreadsheet has many inputs and one output, and I need to run MonteCarlo analysis on it. In Excel, I would have used a "DYI" MonteCarlo approach by putting formulas like =norminv(rand(),expected_return,st_deviation) on the inputs,…
Oren Pinsky
  • 419
  • 3
  • 19
5
votes
1 answer

Reset Series index without turning into DataFrame

When I use Series.reset_index() my variable turns into a DataFrame object. Is there any way to reset the index of a series without incurring this result? The context is a simulation of random choices based on probability (monte carlo sim), where…
randyslavage
  • 65
  • 1
  • 5
5
votes
2 answers

Shuffle a long list an even longer number of times in Python

I want to shuffle a long sequence (say it is has more than 10000 elements)a lot of times (say 10000). When reading Python Random documentation, I found the following: Note that even for small len(x), the total number of permutations of x can…
srcolinas
  • 497
  • 5
  • 13
5
votes
0 answers

TensorFlow - Implementation of MCTS

I was wondering if there was a simple implementation of Monte Carlo Tree Search that has been done in TF. I couldn't find much, so I'm wondering if you guys know any.
David Huang
  • 63
  • 1
  • 7