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
2 answers

Monte Carlo Simulation

I'm a student in a Java Programming class. My problem deals with an interpretation of the Monte Carlo Simulation. I'm supposed to find the probability that three quarters or three pennies will be picked out of a purse that has 3 quarters and 3…
C516
  • 9
  • 1
  • 1
  • 5
0
votes
1 answer

Monte Carlo Method. Triple Integral. Python. unsupported operand parent(s) for '+'

I try to approximate triple integral ∫∫∫xyzdV , where S=[0,1]×[0,1]×[0,1] using Monte Carlo method. I have this code: from numpy import * import time from scipy.integrate import tplquad numpoints=100000 # number of random sample points I2d=0.0 #…
Sage
  • 53
  • 1
  • 5
0
votes
1 answer

CUDA - Generating the Halton sequence in parallel

I want to write a kernel in CUDA that would generate the Halton sequence in parallel, with 1 value generated and stored by each thread. Looking at the sequence, it would seem that generating each subsequent value in the sequence involves work done…
Aakash Jain
  • 1,963
  • 17
  • 29
0
votes
1 answer

random.random or random.choice for Monte Carlo simulation?

I want to apply a simple Monte Carlo simulation on a variable that has three distinct values. Should I use random.random and assign the float to a variable value, or use random.choice(["a", "b", "c"])?
IordanouGiannis
  • 4,149
  • 16
  • 65
  • 99
0
votes
1 answer

Estimate pi with Gamma function in Python Monte Carlo method

I'm trying to write a code in python using the Monte Carlo method to estimate pi (where pi = gamma(1/2)**2). I should write a code saying that sqrt(pi) is the area of a square enclosing the function gamma(x=1/2) times the total number of random…
JadeChee
  • 89
  • 1
  • 17
0
votes
1 answer

Running an allocation simulation repeatedly breaks after the first run

Background I have a bunch of students, their desired projects and the supervisors for the respective projects. I'm running a battery of simulations to see which projects the students end up with, which will allow me to get some useful statistics…
PizzAzzra
  • 715
  • 13
  • 25
0
votes
1 answer

Volume with Monte Carlo method

I have a question. I must build a program to calculate a volume of a cube with Monte Carlo method. Cube has a beginning in (0,0,0) on XYZ axis. There can also be some spheres. The spheres can be in cube then the volume of cube is := cube vol. -…
0
votes
1 answer

Error:'no variables defined' in stata when using monte carlo simulation

I have written the program below and keep getting the error message that my variables are not defined. Can somebody plese see where the error is and how I should adapt the code? Really nothing seems to work. program define myreg, rclass drop…
user3387899
  • 601
  • 5
  • 18
0
votes
0 answers

turn a Poisson Monte Carlo function into matrix in R

Just curious, essentially, i'm trying to implement my function x which is a Poisson Monte Carlo into a 1000*50 matrix, Would be something like this? n <-50 # sample size=50 for each simulated data set nsim <-1000 # 1000 simulation…
ddc
  • 1
  • 2
0
votes
1 answer

Generating a Markov transition matrix with known, but stochastic, state times

I have looked for an answer for a while, but with no luck. I am trying to develop a discrete time Markov model. Presently, I have 5 states, with the 5th state being the absorbing state. I also know the variable time durations that each state…
Simon Bush
  • 407
  • 2
  • 9
0
votes
1 answer

Local volatility model Matlab

I am trying to do a Monte Carlo simulation of a local volatility model, i.e. dSt = sigma(St,t) * St dWt . Unfortunately the Matlab package class sde can not be applied, as the function is rather complex. For this reason I am simulating this SDE…
Mathin
  • 1
  • 1
0
votes
0 answers

How to fill bidimensional arrays in fortran90

i have an issue about filling a bidimensional array in Fortran90. in my program I extract different sets of random numbers and check them as uncertainties to my measurements ustar and Tstar, and i get uerr and terr. Now I want to put uerr and terr…
0
votes
0 answers

For loop issues for a Markov chain Monte Carlo

So here is my next problem. I am trying to to loop through and find out how many of the entries in State_Space have a 1 as their 25th entry yet it keeps telling me that the answer is 0. Here is the code. import random import…
0
votes
1 answer

Excel VBA: Conditional erase parts of worksheet

I have a workbook in structure not very unlike this one (but much more advanced): https://www.youtube.com/watch?v=UeGncSFijUM That is : (1)a worksheet where a row makes some calculations involving rand() and where the result value is carried over to…
Anders
  • 147
  • 1
  • 1
  • 12
0
votes
1 answer

Matlab - graph points paint

I am using Monte Carlo Simulation to calculate the probability of failure and I want to paint the points which represents the failure (in red) in the scatter histogram. I can I do it? The code is below % Histograms hist(S,20) hold…
user3641311
  • 175
  • 2
  • 11