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
0
votes
1 answer

Speeding up rnorm in for cycle

I'm trying to write a function for estimate uncertainty budget based on Monte Carlo method. Here I'll report just the piece of code I need to speed up. inout<-function(var1,svar1,var2,svar2){ M<-10^6 …
Ndr
  • 550
  • 3
  • 15
0
votes
1 answer

Area sampling vs BRDF sampling in rendering

This is a theoretical question. I am currently studying the rendering equation and I don't understand in which case area sampling or hemisphere sampling is better and why. Another thing I would like to know is that if the result would be better if…
Devious
  • 96
  • 1
  • 10
0
votes
1 answer

Record a variation of a cell - excel

my problem is: I have a matrix in excel then a function (repeated N times) that extract from this matrix a random number. This happen everytime i hit F9 or everytime something change in the sheet. After this i have another cell with a sum of all…
rikymiami
  • 71
  • 2
  • 4
  • 14
0
votes
1 answer

Simulating Pi using Monte Carlo

This code estimates the value of pi and it then compares it to the real pi value by a certain accuracy which is defined as 'c'. Then it decreases 'c' to a smaller number and does the calculation again. The values of c are…
user87566
  • 73
  • 1
  • 3
  • 7
0
votes
1 answer

Random walk within ROI of an image

I'm working on a diffusion MRI project and have a c++ problem which I need help with. Background: I have a .nii image as a reference in which I would like a control node (which is part of a spline) to perform a random walk within a constrained ROI…
0
votes
1 answer

Monte Carlo Simulation of Irregular Shape

need a working example of how to do this, i have a bmp file showing the shape of a lake, the bmp's size is the rectangular area and known. i need to take this picture and estimate the lake size. so far, i have a script that generates a giant matrix…
afrotaint
  • 296
  • 1
  • 3
  • 13
0
votes
1 answer

Find equity for a move Backgammon

I would like to know if there is a formula to calculate the equity of a board. Let's suppose we have a board like: The dice values are 3 and 6. How would I find the best move in this situation? I also found a website, I want to make an algorithm…
0
votes
3 answers

Scheme Monte-Carlo-Sampling

I am trying to determine the number of marbles that fall within a given circle (radius 1) given that they have random x and y coordinates. My overall goal is to find an approximate value for pi by using monte carlo sampling by multiplying by 4 the…
John Friedrich
  • 343
  • 5
  • 21
0
votes
0 answers

VaR calculation through different R package

My question is what would be the better method of VaR calculation among below two:, also any small code snippet will be great as a starting point for me. 1st method: I am trying to using a Generalized Pareto Distribution(GPD) there. I think R…
pmr
  • 998
  • 2
  • 13
  • 27
0
votes
1 answer

Optimizing slow VBA code

The code ( takes randomly generated 2d array (R,C)) and breaks results down in 2 arrays for each month (21 days) ( 1 for the average , 1 for the exposure ) Public R As Double Public C As Integer Public Strike,Spot,Ton As Double Public Ton As…
0
votes
1 answer

Sampling a hemisphere using an arbitary distribtuion

I am writing a ray tracer and I wish to fire rays from a point p into a hemisphere above that point according to some distribution. 1) I have derived a method to uniformly sample within a solid angle (defined by theta) above p Image phi =…
Seb
  • 3,655
  • 3
  • 17
  • 17
0
votes
2 answers

Monte Carlo simulation with condition loop in MATLAB

I am a physicist. I have written a code on Monte Carlo simulation with condition loop. I am getting some error in running this simulation code. I want to consider the positive value of the simulation result. When I run the code, I get an error. I…
sus89
  • 1
  • 2
0
votes
2 answers

not random enough for monte carlo

I am trying to generate values from a normal distribution using a monte carlo method, as per the website http://math60082.blogspot.ca/2013/03/c-coding-random-numbers-and-monte-carlo.html I modified the code a bit from the original so it calculates…
metric-space
  • 541
  • 4
  • 14
0
votes
2 answers

Using Monte Carlo method to find a specific probability of a certain dice output in Python 3.2

I'm in a statistics class and we are constantly being given "dice problems" with various constrains. This is a probability problem, where I need to evaluate the probability of an event by using the Monte Carlo method. I know I could integrate my…
0
votes
1 answer

Numerical integration of a discontinuous function in multiple dimensions

I have a function f(x) = 1/(x + a+ b*I*sign(x)) and I want to calculate the integral of dx dy dz f(x) f(y) f(z) f(x+y+z) f(x-y - z) over the entire R^3 (b>0 and a,- b are of order unity). This is just a representative example -- in practice I…