Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

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
23 views

Monte-Carlo metropolis algorithm for Ising model

I am using the Monte-Carlo metropolis algorithm to simulate the Ising model. Since the convergence is slow near $T_c$, I am looking for a method to speed up the problem. What I did was instead of ...
Michael's user avatar
  • 61
1 vote
1 answer
118 views

Is it possible to run a Metropolis Monte Carlo simulation in parallel?

Is it possible to run a Metropolis Monte Carlo simulation in parallel? Suppose I perform a Metropolis Monte Carlo simulation using four threads. Suppose, the programming source code divides a ...
user366312's user avatar
6 votes
2 answers
955 views

Implementation of Monte-Carlo Integration

After reading the Wikipedia page for Monte-Carlo integration, I have understood the basic idea but I am having trouble implementing it for a general case. The integration that I am trying to do is $$ \...
Michael's user avatar
  • 61
0 votes
1 answer
68 views

How can I determine if a system is equilibrated?

Cross-posted in CrossValidated.SE and MMSE I am experimenting with a new MCMC protocol and new research. In the context of Monte Carlo simulation, a "state of equilibrium" refers to a ...
user366312's user avatar
0 votes
0 answers
72 views

How can I compute the longest relaxation time?

Cross-posted on Stats.SE and on MMSE. In the case of Monte Carlo simulations: Autocorrelation Time ($\tau_{\text{int}}$): A measure of how many steps are needed for the correlations in the chain to ...
user366312's user avatar
1 vote
0 answers
81 views

Regarding the difference between Metropolis-Hastings and Wolff algorithm (synchronous vs asynchronous) applied to Ising Model?

I am trying to self-learn concepts at the intersection of physics and programming. When reading up on the Ising Model, I find that the typical programming tutorial (such as this one) covers the ...
user23358153's user avatar
2 votes
1 answer
181 views

How can I compute autocorrelation values of end to end vector?

I obtained a list of $\overrightarrow{r}_{end-to-end}$ from a Monte Carlo simulation of polymer movement. ...
user366312's user avatar
0 votes
1 answer
66 views

draw a log-log plot of MSD (mean square displacement) versus `t` of a movement of the polymer chain

Cross-posted on MMSE (Matter Modeling Stack Exchange). The following are the movements of the center of mass of a polymer chain over time in a monte carlo simulation. ...
user366312's user avatar
1 vote
1 answer
114 views

How to plot random points in 3 dimensions in order to calculate volume of a torus through Monte Carlo integration

I am new to Monte Carlo integration and have been tasked with using MC integration in order to calculate the volume of a torus with inner radius 5cm and outer radius 10cm. Below is the code I have ...
mikejacob's user avatar
  • 111
0 votes
1 answer
79 views

Determining the importance of different parameters in a simulation

Suppose that I have a function of, say, three parameters, $f(p_1,p_2,p_3)$ whose output is a field(s) (e.g. velocity field) and is dependent on some real-valued parameters (e.g. viscosity, density, ...
NNN's user avatar
  • 760
2 votes
2 answers
115 views

Automatic Differentiation In the Presence of Jump Points

I have a complex monte-carlo cashflow model that traditionally uses the finite difference (FD) method to calculate its derivative at any given point. To improve model performance, I coded forward-mode ...
Mild_Thornberry's user avatar
0 votes
0 answers
127 views

what is the proper way to update the XY model for a Metropolis MC simulation

I am trying to do a 2D simulation of the classical XY model in order to observe vortexes in the system. I am not really interested at the moment in calculating variables such as Magnetization because ...
Mephistopheles Faust's user avatar
1 vote
0 answers
46 views

Monte Carlo simulation of classical Heisenberg model doesn't represent Curie curve

I've created a JavaScript file to execute and log average energy and magnetization values of 2D lattice classical Heisenberg model. I run the simulation with parameters, ...
M. Çağlar TUFAN's user avatar
0 votes
1 answer
84 views

Monte Carlo simulation of many-body wave function overlaps

Consider two wavefunctions $\psi_{1}$ and $\psi_{2}$ over $\otimes_{i=1}^{N}S$. I want to evaluate the overlap between these two functions numerically: $$ \int d\tau \psi_{2}^{\star}\psi_{1} $$ in the ...
Gattu Mytraya's user avatar
0 votes
0 answers
61 views

Absence of discontinuity in Specific Heat in liquid-gas transition (Based on the Ising Model)

I'm trying to do a model for the transition liquid-gas based on the Ising model and the metropolis algorithm, instead of using values of spins, I'm saying that a cell is occupied by a particle or not. ...
madcreatorfr's user avatar
0 votes
0 answers
159 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 ...
KeynesCoeFen's user avatar
0 votes
0 answers
79 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 ...
Shashank's user avatar
1 vote
0 answers
244 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 ...
My Code is a Flying Circus's user avatar
3 votes
1 answer
67 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 ...
David Leonardo Ramos's user avatar
1 vote
1 answer
137 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, \...
David Leonardo Ramos's user avatar
2 votes
0 answers
66 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 ...
infinitezero's user avatar
3 votes
1 answer
388 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 ...
pollux33's user avatar
6 votes
0 answers
96 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 ...
pollux33's user avatar
4 votes
0 answers
96 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 ...
Keith's user avatar
  • 41
1 vote
3 answers
604 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 ...
user avatar
-1 votes
1 answer
150 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 ...
Alex Dino's user avatar
0 votes
0 answers
67 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 ...
dexterdev's user avatar
2 votes
2 answers
457 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
155 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 ...
Daniel Sela's user avatar
0 votes
0 answers
91 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 ...
alligator's user avatar
  • 105
0 votes
0 answers
139 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 ...
Student146's user avatar
3 votes
2 answers
2k 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(\...
Student146's user avatar
1 vote
0 answers
42 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 ...
Strictly_increasing's user avatar
0 votes
2 answers
250 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 ...
user avatar
1 vote
1 answer
71 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 ...
Eleuname's user avatar
  • 113
2 votes
1 answer
176 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 ...
MLK's user avatar
  • 23
2 votes
0 answers
116 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 ...
Anton Menshov's user avatar
  • 8,672
0 votes
1 answer
245 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 ...
Endeavour 's user avatar
0 votes
1 answer
506 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,...
Endeavour 's user avatar
4 votes
1 answer
499 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 ...
147875's user avatar
  • 276
3 votes
0 answers
77 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, ...
Davide Papapicco's user avatar
3 votes
1 answer
3k 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 ...
Constantine Black's user avatar
3 votes
1 answer
181 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?
Chris Rackauckas's user avatar
5 votes
0 answers
117 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 ...
duccio's user avatar
  • 121
3 votes
1 answer
345 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 ...
user929304's user avatar
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 ...
LowFieldTheory's user avatar
1 vote
2 answers
311 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 ...
Ji woong Yu's user avatar
0 votes
1 answer
71 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 ...
R zu's user avatar
  • 163
0 votes
1 answer
140 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. <...
ThermoRestart's user avatar
-1 votes
1 answer
122 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 ...
Phil's user avatar
  • 9