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

How to do a random Monte Carlo scan and getting the outputs in a data file

I have some python program let's say 'Test.py' it has a class and inside this in the init I have to introduce three random variables. import math class Vector(): def __init__(self,vx,vy,vz): self.x=vx self.y=vy self.z=vz def…
user105697
  • 39
  • 2
  • 9
-1
votes
1 answer

How to perform a random parameter MC scan in python?

I have to perform a Monte-Carlo scan over the parameters suppose x, y, z in the range x->(4, 8), y->(-5, 7), z->(1,9) and for 4000 random parameter points in these given ranges, I have to determine value of some functions defined by x, y, z. So, how…
user105697
  • 39
  • 2
  • 9
-1
votes
1 answer

Private setction and classes OMP, Random C++. Problem with understanding with a result

The task is to calculate PI with MonteCarlo and OpenMP. The code is below: #include #include #include #include #define numSamples 10000000 int main() { double I, t1, t2, x, y; …
Rumato
  • 147
  • 7
-1
votes
2 answers

How do you evaluate a trained reinforcement learning agent whether it is trained or not?

I am new to reinforcement learning agent training. I have read about PPO algorithm and used stable baselines library to train an agent using PPO. So my question here is how do I evaluate a trained RL agent. Consider for a regression or…
-1
votes
3 answers

Simulation of a nba draft lottery in python

I am trying to write a mock lottery simulator as a thought excercize and for some introductory python practice, where each team would have 2x the odds of getting the first pick as the team that preceded them in the standings. The code below works…
tim82
  • 1
-1
votes
1 answer

Forecasting Future Price Based on _n-1 Observation

I am creating a Monte Carlo simulation with 1000 simulations over 252 days (1000x252 matrix). Currently, my code only uses S0 to calculate future prices, but I need to calculate future prices using n-1 price (markov). My current code…
soup12
  • 15
  • 5
-1
votes
1 answer

How do I find the percentage error in a Monte Carlo algorithm?

I have written a Monte Carlo program to integrate a function f(x). I have now been asked to calculate the percentage error. Having done a quick literature search, I found that this can be given with the equation %error = (sqrt(var[f(x)]/n))*100,…
pinkbonsai
  • 71
  • 6
-1
votes
2 answers

Dice Game Simulation

I have this question for an assignment: Your friend has devised a game with two players. The two players, called A and B, take turns rolling an ordinary six-sided die, with A being the first to roll. The first player who rolls a six wins the…
-1
votes
1 answer

Shuffle under constraints

I have a question from a book on Monte Carlos Methods that I am working through and I can not figure it out. The question is as follows: Obtain random shuffles of the cards: club 2, 3, 4, 5, 6; diamond 2, 3, 4, 5, 6; heart 2, 3, 4, 5, 6; and spade…
Evan Raines
  • 3
  • 1
  • 1
-1
votes
2 answers

Store in array single value produced by each step in a for loop VBA

I have exactly the problem stated in this discussion: Storing and Printing values in Array - VBA but I need to see them through debug, not only print them. Substantially, I created this code: Sub Montecarlo() Dim X0, Xi, T, dt, m, s, Zi, dXi As…
GPace
  • 3
  • 4
-1
votes
1 answer

How can I do Monte Carlo Simulation in AMPL CPLEX?

I am minimizing my objective function. I have a parameter > param Preq{i in 1..n:=Uniform(0.002,Pmax/n) Where Pmax is .0095 and n is 12. How can I introduce Monte Carlo Simulation in my model file using this Uniform parameter?
Amigo
  • 41
  • 6
-1
votes
3 answers

Generate a Probability Density Function based on P10, P50 and P90 values in Python

I want to use P10, P50 and P90 values as input to: A) generate a probability density function (This feels like a Myerson distribution, but I can't figure out how to do that in Python. There's an addon in Excel which does exactly that though;…
flash
  • 41
  • 1
  • 3
-1
votes
2 answers

Geometric Brownian Motion; Simulation of Stock Price

I made a GBM function in C++ and I believe I am getting too much of a range of stock prices when I start with an initial price of 100 the output can be from [50,400]. I am not sure what I am doing wrong in my code, I am guessing there is something…
user7758778
-1
votes
1 answer

Crude Monte-Carlo integration goes wrong with more points

I am using this crude monte-carlo integration technique to find out the value of $\pi$ and noticed that the integration value steadily deviates from the actual value as I increase the number of sample points. The code…
user8624414
-1
votes
1 answer

Why is my random number generator only generating on random number?

I am writing an Ising model using Monte Carlo algorithm. Why is my random number generator only generating one random number? The value of a and b is not changing as expected. Even though the random number generator is pseudorandom, the numbers are…