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

Monte Carlo method locating the minimum point in a function through parallel programming

I have a problem where my code below was working prefect with the arg commands 100 100 0 100 0 100 0.5 but now it just says make: 100: Not a directory package MonteCarloMini; import java.util.concurrent.RecursiveTask; import…
-1
votes
1 answer

Plotting a graph using a function applied to elements in an array

I'm trying to plot a graph where the x-values are denoted by the array below: player_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] And the y values correspond to the value of the function below, when each of the elements in…
-1
votes
2 answers

Cython optimisation for ising model

This is my first post, I am trying to make an ising model simulation using a monte carlo algorithm. I order to optimise the code I am currently trying to use Cython. However for now the execution time of the python and cython programm are identical.…
-1
votes
1 answer

How to create pseudo random values using Monte Carlo method?

I have a non-stationary (Periodicity+Trend) time series (Ts) data of one dimension which contains nan values. I want to generate 10000 pseudo-random values of the Ts based on its probability distribution. DATA_LINK distribution of normalized data…
-1
votes
3 answers

Trying to generate a conditional coin flip

So I'm a trying to create a function which first flips an unbiased coin but if the result is heads it flips a biased coin with 0.75 probability of heads. If it shows tails then the next flip is unbiased. I've tried the following code but I can only…
-1
votes
1 answer

C++ Complex number expression for integrating

I'm trying to implement Monte-Carlo method to solve an integral and can't figure an approximation for my function. double function(double x) { std::complex fz = (pow(-7 * pow(x, 4) - 3 * x + 11, 1.0/3.0) / pow(-2 * pow(x, 6) - 14 * x -…
Suspense
  • 85
  • 1
  • 1
  • 9
-1
votes
1 answer

Calculating NPV using Monte Carlo simulation

I am wondering if anyone can provide me links or idea about how i can calculate stochastic npv after monte carlo simulation and how i can calculate probability of npv>0? We first calculated deterministic npv with all the assumptions and then I took…
-1
votes
1 answer

Down and In Call Option using Monte Carlo in C++

I am trying to write a C++ program that runs a Monte Carlo simulation to approximate the theoretical price of a down-and-in call option with a barrier between the moment of pricing and the option expiry. I implemented a BarrOption constructed but I…
erindj
  • 7
  • 2
-1
votes
1 answer

We want a robot (roomba in our case) to know it's location in a given room

OK, So we want our robot - roomba (the nice vacuum cleaner) to know it's location in a given room. That means we have the map of the room and the robot is put somewhere and needs to know in a short time where it is located. We saw a lot of…
-1
votes
2 answers

I am looking to find Pi using Monte Carlo Simulation. But somehow I got lost with my own code

I am doing some online research and tutorial, then got stuck when i tried to find an approximation of pi using monte Carlo. import math import random import time import numpy as np import matplotlib.pyplot as plt random.seed(1234) old_est = 0 n =…
merdyst
  • 9
  • 3
-1
votes
1 answer

Montecarlo Simulation using R (how to "translate" Stata codes for R)

I need to run the same exercise (Monte Carlo simulations) from Stata to R. The codes I have used in Stata are the codes bellow. How can I do this using R? (I have searched for many tutorials, but I still didn't manage to do it in R). * Simulations…
-1
votes
2 answers

How do I program a spatially dependend random number distribution?

I wrote a routine that distributes circles randomly (uniformly) with an arbitrary diameter in my study area. def no_nearby_dots(new_dot, dots_sim, min_distance): for dot in dots_sim: if np.sqrt((dot[0] - new_dot[0]) ** 2 + (dot[1] -…
user14309137
-1
votes
2 answers

R Proble with Monte Carlo Simulation

How I could solve this exercise: Let U come from a uniform (0,1) distribution and Z come from a standard normal distribution. Let X = pZ + (1-p)U. Estimate p when X has a variance of 0.4. Maybe I should install.packages('polynom')? p is equal to…
Andrea Garcia
  • 127
  • 2
  • 8
-1
votes
1 answer

Is there a faster alternative to find() function in MATLAB?

I'm running a kinetic Monte Carlo simulation code wherein I have a large sparse array of which I first calculate cumsum() and then find the first element greater than or equal to a given value using find(). vecIndex = find(cumsum(R) >= threshold,…
arpitrathi
  • 157
  • 1
  • 7
-1
votes
1 answer

Running a simulation without using looping in R

I have the following code for a Monte Carlo simulation: function (muC1,sigmaC1,muC2,sigmaC2,Msim=10000) { # a grand loop simulation program for the lifetime of # a simple system of components. This system has # two branches. The first branch…
lgfaulk
  • 3
  • 1