Questions tagged [monte-carlo]
Questions on Monte Carlo methods, methods that require the repeated generation of (pseudo-, quasi-)random numbers for computing their results.
141
questions
0
votes
0
answers
50
views
What techniques are there to take averages and errors in a Monte Carlo simulation in C? Can my code be improved?
I'm trying to perform a Monte Carlo simulation in C and these are the steps I'm following:
We assume an infinite reservoir compound of CO and NO molecules with partial pressures 𝑦CO and 𝑦NO(= 1 − 𝑦...
0
votes
0
answers
58
views
Why is Magnetic Susceptibility not showing the expected transition in 2D&3D Ising Model?
I'm trying to code the Ising Model with the metropolis algorithm to study the ferromagnetic-paramagnetic transitions. The code seems to work ; the equilibration happens. While equilibrating, the ...
1
vote
0
answers
35
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 ...
1
vote
1
answer
145
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 ...
6
votes
2
answers
981
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
$$
\...
0
votes
1
answer
77
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 ...
0
votes
0
answers
78
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 ...
1
vote
0
answers
94
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 ...
2
votes
1
answer
215
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.
...
0
votes
1
answer
88
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.
...
1
vote
1
answer
150
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 ...
0
votes
1
answer
82
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, ...
2
votes
2
answers
125
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 ...
0
votes
0
answers
153
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 ...
1
vote
0
answers
50
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,
...
0
votes
1
answer
88
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 ...
0
votes
0
answers
64
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. ...
0
votes
0
answers
194
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
84
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
297
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
72
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
154
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
71
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
422
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
102
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
99
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 ...
1
vote
3
answers
620
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
176
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
80
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
473
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 ...
0
votes
1
answer
170
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
98
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 ...
0
votes
0
answers
144
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
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(\...
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 ...
0
votes
2
answers
251
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
72
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 ...
2
votes
1
answer
185
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 ...
2
votes
0
answers
121
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 ...
0
votes
1
answer
253
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
522
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
514
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 ...
3
votes
0
answers
81
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
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 ...
3
votes
1
answer
187
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
121
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 ...
3
votes
1
answer
451
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
43
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
328
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
72
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 ...