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

Can't fix errors in monte carlo program

I'm trying to write a program that simulates darts being thrown at a standard curve. Whenever I get close to debugging the entire thing something else pops up. So far I am getting a lot of errors like: Error: variable is not declared in this…
0
votes
1 answer

Fast choosing of bits from a set

I'd like to choose a number of random bits from a known bitmask. Ideally I'd like to choose those bits in a random order too, but the task can be split into choosing and shuffling later. Some additional characteristics of the data: the bitmask is…
viraptor
  • 33,322
  • 10
  • 107
  • 191
0
votes
1 answer

Invalid conversion of int to unsigned int

This code is given for the assignment. However, off the bat there is an error in the compute pi monte carlo function. the error stats invalid of conversion from int to unsigned int. Im not sure if this was intended, but i haven't been able to…
0
votes
2 answers

CUDA and Monte Carlo with local behavior defined

I have a question about a strange behavior In CUDA. I am currently developing a Monte Carlo simulation on particles trajectories and I am doing the following the thing. The position p(n) of my particle at a given date t(n) depends on the position…
ALFRAM
  • 193
  • 2
  • 14
0
votes
2 answers

Monte Carlo Method crash?

I have a big problem trying to implement Monte Carlo Method to this function: D=log(T) Where T is a measured time, so T>0, and, obviously, it has a normal distribution. I have 10 measured values of T in the experiment, so I calculate: m_T (mean of…
Shivoham
  • 23
  • 1
  • 6
0
votes
1 answer

How get this 'for loop' to plot 100 values in matlab?

How get this 'for loop' to plot 100 values in matlab? Can't figure out where to include the 'i' This is a monte carlo analysis plot of the operating point of a common-emitter amplifier for i=1:100 Rb = 377000 * (1 + (rand()*2-1)*0.01); Rc =…
Andre Marin
  • 540
  • 1
  • 6
  • 16
0
votes
3 answers

Is there a way to generate a random variate from a non-standard distribution without computing CDF?

I'm trying to write a Monte Carlo simulation. In my simulation I need to generate many random variates from a discrete probability distribution. I do have a closed-form solution for the distribution and it has finite support; however, it is not a…
CraigF
  • 388
  • 3
  • 8
0
votes
2 answers

Python 3.2 Monte Carlo Pi Estimation?

I am just starting out with programming and this assignment is giving me a lot of trouble. How do I change the Monte Carlo code below (used for area under a curve) so that it estimates pi? from random import uniform from math import exp def…
0
votes
0 answers

Speed up monte carlo simulation with nested loop (2)

I would like to know if there is a more efficiency way to speed up below code. It uses a procedure where subsampling is required in the nested loop (which a previous answer https://stackoverflow.com/a/13629611/1176697 help to make more…
barryq
  • 185
  • 1
  • 1
  • 8
0
votes
1 answer

speed up a monte carlo simulation with nested loop in R

I would like to speed up the below monte carlo simulation of a DEA estimate A<-nrow(banks) effm<-matrix(nrow=A, ncol=2) m<-20 B<-100 pb <- txtProgressBar(min = 0, max = A, style=3) for(a in 1:A) { x1<-x[-a,] y1<-y[-a,] …
barryq
  • 185
  • 1
  • 1
  • 8
0
votes
2 answers

Code::blocks max iterations

Possible Duplicate: Max Array Size in C My question is: Does Code::blocks have a max number of iterations for a loop? I am running a monte carlo and I would like to run a million particles through a for loop. But the max it seems to go without…
Shinobii
  • 2,401
  • 5
  • 24
  • 39
0
votes
1 answer

Blackjack simulation in Ruby results in strange probabilities

Below is the code for a simulation of a simple blackjack game. The player and dealer (house) draw two cards. The player then hits until he reaches 17. The dealer (house) then hits until he draws with the player or goes bust. Considering the player…
Spike Fitsch
  • 747
  • 1
  • 7
  • 12
0
votes
1 answer

Advanced video analysys - how to bite it?

I need to do an application that: captures video data from camcorder, do some processing (Monte Carlo methods, Markov's fields and chains, etc.), saves the data as video file, enriched with upper surface containing information about the processing…
0
votes
2 answers

C++ class design for Monte Carlol simulation

I'm trying to build a Monte Carlo object class and am wondering about the best way to design the relevant classes. The structure of the object (called Entity) contains name, description AND a Distribution type which can be of a few different types…
Pete855217
  • 1,570
  • 5
  • 23
  • 35
-1
votes
2 answers

Trouble with zip when running for loop monte carlo sim; python

Working in python 2.7. I'm sure the code is a little unwieldy, but I'll try to explain it as simply as I can. I have two lists: T = [[1,0], [1,0], [0,5]] S = [[1], [3], [2]] I need to add the corresponding value from B to the end of the…
Burton Guster
  • 2,213
  • 8
  • 31
  • 29