Questions tagged [monte-carlo]

Questions on Monte Carlo methods, methods that require the repeated generation of (pseudo-, quasi-)random numbers for computing their results.

Filter by
Sorted by
Tagged with
0 votes
0 answers
61 views

Numerical integration library interfacing with eigen

I am looking for a numerical integration library like this one. The examples look very appealing but I see that all test functions use very barebones C arrays. Do you have any recommendations of ...
0 votes
0 answers
38 views

How to perform a monte carlo simulation on a honeycomb lattice with first, second and third nearest neighbor interactions?

I want to perform monte carlo simulation on a honeycomb lattice. Can someone please help me on how to define a matrix for these interactions and how many terms there will be while sampling the ...
1 vote
0 answers
86 views

Monte Carlo simulation for the quantum oscillator in the path integral approach

The theory Consider a quantum harmonic oscillator described by the potential $V(q)=\frac{1}{2}m\omega^2 x^2$. In the path integral formulation, the partition function can be written as $$Z\propto\int ...
3 votes
1 answer
55 views

Measurement of observables in Parallel Tempering Monte Carlo simulations

I'm doing Metropolis-Hastings Monte Carlo simulations of a classical spin Hamiltonian at different temperatures using the parallel tempering algorithm. I have managed to obtain constant exchange rates ...
1 vote
1 answer
117 views

How to sample points uniformly over a region of the unit sphere

I am looking for a way to sample points uniformly around a particular point on the unit sphere. Working on spherical coordinates we can express any point on the unit sphere as $(\sin\theta \cos\phi, \...
2 votes
0 answers
52 views

How to implement a generic monte carlo algorithm for n-dimensional integration?

A very visual picture for Monte Carlo integration is the approximation of $\pi$, by sampling in a square which contains a quarter of the unit circle. We can extend this picture to 3 dimensions, by ...
3 votes
1 answer
219 views

Importance Sampling for multidimensional integrals and random numbers from multivariable pdf's

I am aiming to get a numerical value for a five-dimensional integral using Monte Carlo Integration. I am getting good results using the Mean Value Method, but I would like to try to use Importance ...
6 votes
0 answers
94 views

What is the best method to do a MC Integration of a multidimensional integral where the integration limits depend upon other variables?

What is the best method to do a Monte Carlo Integration of a multidimensional integral where the integration limits depend upon other variables? I am interested in getting a numerical value of a 5 ...
4 votes
0 answers
83 views

Sample Average Approximation vs. Numerical Integration

To calculate the expected value of objective functions, we have two choices: Sample Average Approximation (SAA): $$ \frac{1}{N}\sum_{i=1}^N f(x,\xi^i). $$ Numerical Integration (e.g., Monte Carlo ...
  • 41
1 vote
3 answers
492 views

Optimization on MCMC codes

I am looking for MCMC codes with a GPU suport (like NVIDIA or OpenCL libraries) to make faster run chains. If someone could have a state of the art ...
-1 votes
1 answer
104 views

Montecarlo - impact of single / double precision

I am looking at a paper comparing performance of two pricers: same model (based on Monte Carlo simulation) but one implemented on CPU (C++) and one implemented on GPU (Cuda) The paper mentions the ...
0 votes
0 answers
55 views

Comparison of computational complexities of MD versus MC simulations

In my humble understanding MD simulations of systems with short-range(like LJ interactions) and long-range(electrostatic) has a computational complexity $O(N . log(N))$. What will be the computational ...
2 votes
2 answers
309 views

Generating particles from a distribution function using Monte Carlo

I have been given a 4D ($x, y, v_x, v_y$) distribution function, $f(x,y,v_x, v_y)$, generated by an external code. I want to generate a set of particles from this distribution function, say 10k ...
user avatar
0 votes
1 answer
129 views

Good method for correlated samples and estimating autocorrelation times

I'm working on a Monte Carlo project similar to the Ising model. I've found many examples on which I've based my code. From some papers I read on binning analysis, the errors after each binning step ...
0 votes
0 answers
76 views

Why is perfect sampling not used in large-scale lattice model simulations?

The statistical physics literature is replete with papers describing simulations of lattice models, such as the Ising model. Typically, these are done through Monte Carlo methods, such as the ...
  • 105
0 votes
0 answers
115 views

Error in Monte Carlo integration

I am looking for a concise description to help me understand the error for Monte Carlo Integration using Uniform Sampling and Importance Sampling For Importance Sampling I have that the error is just ...
3 votes
2 answers
1k views

Use Monte Carlo integration to compute the volume and centre of mass in Python

In particular, I want to focus on finding the volume $V$ because I will need it to start working on solving the centre of mass This $3D$ homogenous body (Torus section) is defined by $$x^2 + \left(\...
1 vote
0 answers
39 views

Discretization formula for a system of two differential equations. "Solution to one of these is the initial condition of the other". In which sense?

Consider the following stochastic differential equation \begin{equation} dy=\left(A-\left(A+B\right)y\right)dt+C\sqrt{y\left(1-y\right)}dW\tag{1} \end{equation} where $A$, $B$ and $C$ are parameters ...
0 votes
2 answers
245 views

Different questions about "Inverse Physics problems"

I am in a context of forecasts in astrophysics. Don't be too rude if questions seem to you stupid or naive but rather indulgent, I am just looking for better undertsand all these numerical methods of ...
1 vote
1 answer
70 views

Which are the right configurations in the Markov chain of a Hamiltonian Monte Carlo algorithm?

I have a question about the Markov Chain Hamiltonian Monte Carlo (MCHMC). Hamiltonian Monte Carlo is known as Hybrid Monte Carlo too. I'll describe the steps of the algorithm. We have at the ...
  • 113
2 votes
1 answer
108 views

Question regarding the energy computation of the Ising-Spin Model

In most of the Monte-Carlo-Algorithms I studied, I found, at the place where they compute the energy, always a line of code, where they divided by four. For example, this code-snippet is taken from ...
  • 23
2 votes
0 answers
80 views

Random Orthogonal Matrix Generation

This post is inspired by N. Higham post "What is Random Orthogonal matrix?". In this post, N. Higham links to the two papers: G. W. Stewart, The efficient generation of random orthogonal matrices ...
  • 8,542
0 votes
1 answer
214 views

Is this behaviour normal for a Lennard-Jones monte carlo simulation?

I am simulating a Lennard-Jones fluid using MC simulation. The code always uses a reduced unit. I want to find the potential energy of the system. Periodic boundary condition implemented. I have ...
0 votes
1 answer
425 views

Why the magnetisation shows abrupt behaviour for this 3D ising spin system

I am trying to simulate a 3D Ising spin system (+1 & -1) using Monte Carlo Metropolis Algorithm. I want to get different physical quantities from this simulation like magnetization, Average Energy,...
4 votes
1 answer
416 views

Absence of Discontinuity in Specific Heat Plot Simulated by Ising Model

I am working on 2D Ising model, when I plot "specific heat vs temperature", I can't see any discontinuity at critical temperature around Tc ~ 2.7K. I am enclosing results of all other thermodynamic ...
  • 276
3 votes
0 answers
74 views

Hit-n-Run Monte Carlo on convex polytope

So, I'm currently trying to implement a MCMC to uniformly sampling hyper-points from the polytope defined as $\mathbb{K}=\{x\in\mathbb{R}^{n}\;\;\text{s.t.}\;\; A\,x=b \}$ in the specific case where, ...
3 votes
1 answer
2k views

Calculation of Mean Square Displacement for Brownian dynamics system with Lennard Jones interactions in python3

I have a problem getting a sensible result for the Mean Square Displacement (MSD) for a simulation of $N$ particles under Brownian dynamics with Lennard-Jones interaction between them with or without ...
3 votes
1 answer
176 views

How to optimize sampling for global sensitivity analysis

What is a good way to sample parameters for performing global sensitivity analysis? Some methods are defined using integrals, some are use Monte Carlo. How do these compare?
5 votes
0 answers
101 views

Probability approximation: monte carlo VS sde

I have a probability measure $\mu$ (say, in $\mathbb{R}^{d}$, with density) and I want to approximate it numerically. Today I noticed that my measure is ergotic for a certain Stochastic Differential ...
  • 121
3 votes
1 answer
181 views

Computing autocorrelations of configurations in Monte Carlo simulations

In the context of Monte Carlo simulations, I am trying to learn how I should ensure that the configurations of my system are not correlated for the chosen interval of measurements. I have found out ...
2 votes
0 answers
42 views

Monte Carlo domain not-so-dense

I already posted it on Physics SE, but maybe this is a better place: I have a 5D integral being calculated with a Monte Carlo uniform random sampling. The issue is that the region of integration is ...
1 vote
2 answers
244 views

Dealing neighbor list in NVT Monte Carlo (MC) simulation

I'm making a NVT Monte Carlo (MC) simulation code with only short range interaction. I found many MC tutorial codes (usually Lennard-Jones system) in online. However, most of them are doing energy ...
0 votes
1 answer
70 views

Change of random variables and check by plot

Question As a test, I transform a uniform distribution over the unit square. But when I check the transformed distribution with Monte Carlo, it is wrong. What went wrong? Thanks. Problem Random ...
  • 163
0 votes
1 answer
127 views

Monte Carlo - Random Walk Simulation - polyfit the log log data points?

This is part of the code in matlab for a random-walk simulation. To test the code, I'm using steps=[30]; there will be more values, but I want to run it for 1 trial to decrease code processing. <...
-1 votes
1 answer
113 views

Writing parallel code for molecular computation [duplicate]

I recently moved towards computational biophysics from an experimental science background. As of now, I am learning the fundamentals and doing some basic monte carlo simulations of LJ fluid on my ...
  • 9
2 votes
2 answers
61 views

Generating a random number based on a numerical distribution function

I have a probability distribution function that I don't have its analytical form (so I can't determine its CDF). How can I generate random numbers based on this distribution function? I'm looking for ...
1 vote
2 answers
2k views

2D Ising Model, heat capacity decreases with lattice size

The problem I'm trying to make a metropolis simulation of the 2D Ising model. Basically, it's the following, for each monte-carlo step: Visit each lattice site, Compute energy required to flip ...
1 vote
1 answer
166 views

Weighted Monte Carlo Integration

I have a function $F(x)$ which drops exponentially (like differential QCD cross section vs. Invariant mass). I want to perform Monte-Carlo integration. The problem is that only small $x$'s which have ...
4 votes
2 answers
382 views

Mean-squared displacement in Monte Carlo studies

Is measuring mean-squared-displacement in Monte Carlo simulations uncommon? I'm very interested to find out if this has actually ever been tried. For instance, in the context of spheres, or ...
1 vote
0 answers
66 views

Is there a software package for Quantum Monte Carlo estimation of the exchange correlation functional?

Quantum Monte Carlo (QMC) calculations historically have been used to parameterise the exchange-correlation functionals for Density Functional Theory (DFT). For example, this article explains a way to ...
  • 191
2 votes
2 answers
1k views

Computing the Ising Model for NiO

I am trying to compute the Ising model for NiO. As O carries no magnetic moment, I only need to consider the case of Ni which requires a second nearest neighbour Ising model. As can be seen in the ...
0 votes
1 answer
114 views

Sampling simulation steps logarithmically

The common case of for instance a Monte Carlo simulation is, if we want to run our simulation for $N$ steps, we define a delta $\Delta,$ such that $N/\Delta = n$ tells us the frequency with which we ...
3 votes
1 answer
168 views

Diffusion properties of hard spheres in Monte Carlo simulation

In standard Monte Carlo simulations, say for hard sphere systems, how should one compute the mean-squared displacement of the spheres in order to extract dynamical properties such as the diffusion ...
1 vote
0 answers
23 views

Uniform distribution in 3D space [duplicate]

Posted this at math stack exchange as well, but alas no replies! So, I have been trying to find ways of distributing particles of spherical or other shape in 3D space, e.g. rectangular space. Random() ...
  • 45
3 votes
1 answer
16k views

2D Ising Model in Python

I am trying to calculate the energy, magnetization and specific heat of a two dimensional lattice using the metropolis monte carlo algorithm. ...
  • 31
2 votes
0 answers
722 views

Using C/C++ for Markov chain Monte Carlo (MCMC) methods

I'm working on optimizing the parameters of a mathematical model to fit experimental data, using an existing formula for the likelihood of observing the data given a set of parameter values. At the ...
4 votes
1 answer
215 views

Simple Monte Carlo in C++, result dependent from seed

I implemented as an exercise a program to sample the statistics of the escape time of a Brownian particle in a potential well. I used the Euler-Maruyama method to numerically integrate the ...
0 votes
2 answers
104 views

Physical meaning behind the choice of the proposal distribution in Markov Chain Monte Carlo (MCMC) methods

Let us consider the conventions on names used in the theoretical derivation of Metropolis-Hastings Monte Carlo as outlined here, for the sake of common nomenclature. What we are building is a step-...
0 votes
1 answer
70 views

Applying pressure on simulation box

We have a 3D simulation box (cubic, side $L$) filled with $N$ non-overlapping objects (say spheres). We are interested to study the evolution of the system under an applied pressure in the z-direction ...
4 votes
0 answers
134 views

How to stochastically estimate the trace of a matrix?

Specifically, the diagonal elements (can possibly both positive and negative) of the matrix can be computed efficiently but the total number is large ($\mathcal O(10^{18})$). My first thought about ...