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
7
votes
5 answers

Monte Carlo Method of finding pi using C

I have written a function that takes in a long long value n and uses that as the number of iterations to go through. The function should give a good estimate of pi, however, all the values for large n tends towards 3.000, and not 3.1415,so I am not…
Pengibaby
  • 373
  • 2
  • 11
7
votes
2 answers

How to do a simple Gaussian mixture sampling and PDF plotting with NumPy/SciPy?

I add three normal distributions to obtain a new distribution as shown below, how can I do sampling according to this distribution in python? import matplotlib.pyplot as plt import scipy.stats as ss import numpy as np x = np.linspace(0, 10,…
Maybe
  • 2,129
  • 5
  • 25
  • 45
7
votes
2 answers

Binary tree that stores partial sums: Name and existing implementations

Consider a sequence of n positive real numbers, (ai), and its partial sum sequence, (si). Given a number x ∊ (0, sn], we have to find i such that si−1 < x ≤ si. Also we want to be able to change one of the ai’s without having to update all partial…
Philipp
  • 48,066
  • 12
  • 84
  • 109
7
votes
1 answer

MCTS UCT with a scoring system

I'm trying to solve a variant of 2048 by a Monte-Carlo Tree Search. I found that UCT could a good way to have some trade-off between exploration/exploitation. My only issue is that all the versions I've seen assume that the score is a win…
Atol
  • 569
  • 4
  • 12
7
votes
2 answers

Can't accurately calculate pi on Python

I am new member here and I'm gonna drive straight into this as I've spent my whole Sunday trying to get my head around it. I'm new to Python, having previously learned coding on C++ to a basic-intermediate level (it was a 10-week university…
Stuart Aitken
  • 949
  • 1
  • 13
  • 30
7
votes
6 answers

Computing a mean confidence interval without storing all the data points

For large n (see below for how to determine what's large enough), it's safe to treat, by the central limit theorem, the distribution of the sample mean as normal (gaussian) but I'd like a procedure that gives a confidence interval for any n. The…
dreeves
  • 26,430
  • 45
  • 154
  • 229
7
votes
3 answers

Python Numerical Integration for Volume of Region

For a program, I need an algorithm to very quickly compute the volume of a solid. This shape is specified by a function that, given a point P(x,y,z), returns 1 if P is a point of the solid and 0 if P is not a point of the solid. I have tried using…
Lambda
  • 270
  • 2
  • 12
7
votes
3 answers

What to Do when Monte Carlo Tree Search Hits Memory Limit

I have taken interest into monte carlo tree search applied in games recently. I have read several papers, but i use "Monte-Carlo Tree Search" A Phd thesis by Chaslot, G as i find it more easy to understand the basics of monte carlo tree search I…
bysreg
  • 793
  • 1
  • 9
  • 30
7
votes
4 answers

What's the best trick to speed up a monte carlo simulation?

Whenever I run large scale monte carlo simulations in S-Plus, I always end up growing a beard while I wait for it to complete. What are the best tricks for running monte carlo simulations in R? Any good examples of running processes in a…
griffin
  • 3,158
  • 8
  • 37
  • 34
6
votes
4 answers

Efficient way to generate random contingency tables?

What is an efficient way to generate a random contingency table? A contingency table is defined as a rectangular matrix such that the sum of each row is fixed, and the sum of each column is fixed, but the individual elements may be anything as long…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
6
votes
2 answers

How does MCMC help bayesian inference?

Literature says that the metropolis-hasting algorithm in MCMC is one of the most important algorithms developed last century and is revolutional. Literature also says that it is such development in MCMC that gave bayesian statistics a second birth.…
Kid_Learning_C
  • 2,605
  • 4
  • 39
  • 71
6
votes
2 answers

How does Monte Carlo Search Tree work?

Trying to learn MCST using YouTube videos and papers like this one. http://www0.cs.ucl.ac.uk/staff/D.Silver/web/Applications_files/grand-challenge.pdf However I am not having much of a luck understanding the details beyond the high level theoretical…
jiminssy
  • 2,149
  • 6
  • 28
  • 45
6
votes
3 answers

Probability density function from a paper, implemented using C++, not working as intended

So i'm implementing a heuristic algorithm, and i've come across this function. I have an array of 1 to n (0 to n-1 on C, w/e). I want to choose a number of elements i'll copy to another array. Given a parameter y, (0 < y <= 1), i want to have a…
hfingler
  • 1,931
  • 4
  • 29
  • 36
6
votes
4 answers

Monte Carlo Tree Search, Backpropagation (Backup) step: Why change perspective of reward value?

I've been reading through the Monte Carlo Tree Search survey paper by Browne et. al: http://ccg.doc.gold.ac.uk/papers/browne_tciaig12_1.pdf "A Survey of Monte Carlo Tree Search Methods" I'm wrestling with just one piece of the pseudocode on p. 9. My…
Bob Smith
  • 143
  • 2
  • 7
6
votes
2 answers

Different Results of Monte Carlo Integration Due To Output

I've just recently stumbled upon a C++ bug/feature, that I can't fully understand and was hoping someone with a better knowledge of C++ here could point me in the right direction. Below you will find my attempt at finding out the area under the…
jst
  • 596
  • 1
  • 4
  • 8