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

Monte Carlo error

I've written a monte carlo program to calculate ln(2). I generate random x in the range 1-2 and random y in the range 0-1. If y<1/x I add 1 to my count. My estimate of ln(2) is count/n (i.e. frac from above). I'm trying to find the error in my…
Goods
  • 225
  • 2
  • 10
0
votes
0 answers

Function to write Approximate Bayesian Computation with Population Monte Carlo method in R

I am trying to write a function that can calculate Approximate Bayesian Computation using the Population Monte Carlo method. However, I ran into some troubles with my R code with the following…
Stongals
  • 1
  • 2
0
votes
2 answers

Monte Carlo Pi not accurate

I am having trouble with my Monte Carlo Pi program calculating properly. Basically, pi is only displaying up to 2 decimal points only at the moment, and I feel the calculation has gone wrong somewhere as the closest pi calculation as number gets…
BelieveMe
  • 69
  • 1
  • 1
  • 7
0
votes
0 answers

r simulation - stock price monte carlo simulation

I have to simulate 1000 random paths for the next 10 days of a stock's value. Here is my code, but it doesn't work: for(i in 1:90) { # simulate price for future 90 days z<-rnorm(3) # generate normal random vector v<-mu+t(C)%*%z …
0
votes
1 answer

Running a function multiple times and printing the results for each separate run

Hey so I'm relatively new and I'm having trouble running the Monte Carlo simulation and printing the results: import random import math def computePI(throws): throws = 100 radius = 1 ontarget = 0 offtarget = 0 numthrows = 0 while throws < 10000000: …
Alan Hao
  • 3
  • 1
0
votes
4 answers

Memory Error Python

I am trying to process a Monte Carlo Algorithm to calculate the value of pi. When I try to give a large input as mentioned in the program below. I get a memory error. What should i do to rectify it? The code is a s follows: def PiCalc(): N_ok=0 …
Sandy.Arv
  • 607
  • 10
  • 34
0
votes
1 answer

Probability using Monte Carlo

I need to do a Monte Carlo simulation in R for this problem: Three tourists arrive in a town that has five hotels. What is the probability that the three tourists each sign into a different hotel? And what is the probability they all sign in at the…
natiguvi
  • 1
  • 2
0
votes
1 answer

Generate random numbers inside spmd in matlab

I am running a Monte carlo simulation in Matlab using parallelisation due to the extensive time that the simulation takes to run. The main objective is create a really big panel data set and use that to estimate some regressions. The problem is that…
0
votes
1 answer

monte carlo sampling in 6D space

I am writing java code for rigid body superposition of two objects (A and B). Object A is fix in a space while object B is free to move in the space. Goal is to get the best matching fit between A and B. In order to find optimal fit between A and…
user1275607
  • 99
  • 1
  • 10
0
votes
2 answers

Significant price difference while calculating call option price using Monte Carlo approach in C++ and Python?

I am trying to calculate the price of a european call option using the Monte Carlo approach. I coded the algorithm in C++ and Python. As far as I know the implementation is correct and as N (the number of trials) gets bigger, the price should…
mickkk
  • 1,172
  • 2
  • 17
  • 38
0
votes
0 answers

Multithreaded Monte Carlo

I am triying to parallelize a loop in my Monte Carlo program which aims to simulate the magnetic properties of manganites. this loop calculates the dipolar magnetic interaction in the lattice. I am new in Multithreading and that's my first test. It…
Rami Zouari
  • 109
  • 1
  • 9
0
votes
0 answers

Monte-Carlo PI on cluster

So, I'm designing a Monte-Carlo PI simulation on a GPU cluster. Currently, I choose one random number generator algorithm, say XorShift7. And due to the algorithm limitation, for one seed, it can generates only 2^32 numbers, since it is a 32bit…
Xiang Zhang
  • 2,831
  • 20
  • 40
0
votes
1 answer

R - mc2d Monte Carlo package, level of uncertainty

I have the following question regarding the mc2d package for Monte Carlo simulations. Given a mc node, i.e. a mc object. How can we get the uncertainty for the values of the distribution? For instance, as an input distribution I am using an uniform…
0
votes
1 answer

Ellipse Volume withMonte Carlo Method

Sorry.I have a homework but I cannot do.I have to write code for between cube and ellipse'volume with Monte Marlo Method.Can you help me? Dimension for cube is 10 and radius for ellipse is 5 and height is 3. Thank you
0
votes
0 answers

Normal curve into a Monte Carlo function in R

I have a Monte Carlo problem that I need to compare with a Normal curve, for now I have this: monte_carlo <- function(T){ K <- 2 beta1 <- 0.131 beta2 <- 0.406 betaa <- c(beta1,beta2) beta<-as.vector(betaa) phi <- 0.6 …