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

Pricing of Asian Option using R

The pricing of the Asian option is approximated, using Monte Carlo simulation, by: delta <- 1/12 T <- 2 S0 <- 100 sigma <- 0.20 K <- 100 r <- 0.01 n <- 10^4 m <- T/delta S <- S0 for(i in 1:n) { for(j in 1:m) { W <- rnorm(1) Si <-…
user6149765
  • 15
  • 1
  • 4
-1
votes
1 answer

Simulating the Geometric Brownian Motion

Background Information: Consider the Pseudocode: Question: What I seem to be having a problem with is the S superscript j part of the Pseudocode of algorithm 1, my professor said that since N = 10,000 and n = 10, I am computing 10 S's. Here is…
user7465838
-1
votes
1 answer

How to use the python += operator correctly?

I am trying to use the += operator but I keep getting incorrect results. We have a hair dresser in a salon who provides a service to her customers. During each day, she has 6 slots to book appointments, the intervals between each appointment are…
-1
votes
1 answer

Need help using randomly generated numbers in a formula using R

This is my code below and all I get is a list of the same values and it doesn't seem like R is taking a randomly generated value, running through the equation and then giving me the results. montecarlo = function(r,v,t,x,k,n) { y = rnorm(n) …
Dmitriy
  • 37
  • 7
-1
votes
1 answer

Monte Carlo integral in R : Hit or Miss with "halton"

I am struggling with the Monte Carlo integral problem in R. y= x^2+cos(x); for x= [0,2] I am supposed to use HitMiss <- function(T,S,method="halton") to solve this problem. T is the number of trails run per sample size in S. S is number of…
Ives Shi
  • 31
  • 1
  • 5
-1
votes
2 answers

Python package for dynamic Monte Carlo / Gillespie algorithm

I am working on a model describing a protein. Molecule may be found in few states, transitions from one state to another are described by matrix containing transition rates. Model can be resolved as set of ordinary differential equations giving nice…
michal_2am
  • 211
  • 1
  • 3
  • 10
-1
votes
2 answers

How many iterations should you make for the simulation to be a 'Monte Carlo simulation' for BER calculations?

Edited question How many iterations should you make for the simulation to be an accurate 'Monte Carlo simulation' for Bit error rate calculations? What is the minimum value? If I want to repeat the simulation by an exponentially growing number for…
HappyBee
  • 133
  • 6
-1
votes
1 answer

MATLAB Simulation of Production Machines Failure - MTBF & MTTR

I want to model production machines' failure in terms of MTBF(mean time between failure) and MTTR(mean time to repair), with exponential distribution. Actually i am modelling a Discrete Event Simulatin (DEV/DEVS) problem. The problem is concerned…
-1
votes
2 answers

How to generate a random numbers between [0,1] with 3 fractions

I want to generate random numbers between 0 and 1 (0 and 1 are included) but with only 3 fractions after the decimal point, like these: 0.000, 0.214, 0.523, 0.451, 0.102, 1.000 The aim of the three decimal is not for printing. I want to implement…
Nano
  • 3
  • 4
-1
votes
1 answer

Monte Carlo Simulation using Excel Solver

I am trying to figure out what the optimal number of products I should make per day are, displaying the values in a chart and then using the chart to find the optimal number of products to make per day. Cost of production: $4 Sold for: $12…
-1
votes
1 answer

Pi in openmp not depends on threads

I have a problem with OpenMp. I need to compute Pi with OpenMP and Monte Carlo. I write simple program and i am reading number of threads from command line. Now it is working not stable sometimes 1 thread is faster than 16. Have anyine idea what am…
-1
votes
4 answers

Difficulty Comparing Clusters in R - Inconsistant Labeling

I am attempting to run a monte carlo simulation that compares two different clustering techniques. The following code generates a dataset according to random clustering and then applies two clustering techniques (kmeans and sparse k means). My issue…
-1
votes
2 answers

Integral 0 to pi/2 using montecarlo in R

Trying to find integral (o to pi/2) of x^2 cosx using montecarlo method. This is my first time so need some direction. To generate random number should I transform the limit of the integral to (0,1) or can I generate random numbers with the…
greenH0rn
  • 65
  • 2
  • 9
-1
votes
1 answer

Monte Carlo in MATLAB

When I try to run this program: n = 10000; Constant = 5.0; A = 10; B = 5; C = 1.335; Drand = (0.02*randn(1,n)) + 0.242*ones(1,n); Erand = (0.005*randn(1,n)) + 0.536*ones(1,n); P = (Constant*A*B*(1.0/C))*(Drand.*(1.0-Erand.)); plot(P); I get…
Bisu
  • 13
  • 3
-2
votes
3 answers

monte carlo integration on a R^5 hypercube in MATLAB

I need to write MATLAB code that will integrate over a R^5 hypercube using Monte Carlo. I have a basic algorithm that works when I have a generic function. But the function I need to integrate is: ∫dA A is an element of R^5. If I had ∫f(x)dA then…
JJJ
  • 597
  • 2
  • 7
  • 14