首页 » Python代写 » Python代写|Monte Carlo simulation: Importance sampling

Python代写|Monte Carlo simulation: Importance sampling

本次加拿大代写是一个python蒙特卡洛模拟相关的Homework

Instead of choosing configurations (states) randomly, then weighting them with exp( / ) −E k T B ,
we choose configurations with a probability exp( / ) −E k T B and then weight them evenly.

Consider a particle moving in the one-dimensional space under a potential U = 1/2kx2. The
probability density function for the particle position x is given by f x ae ( ) = −U x k T ( )/ B in which
a is a normalization constant for f x dx ( ) 1

For simplicity, we set k T k B / 1 = for computational purpose.

(a) Use the Metropolis algorithm to generate a sequence of states (i.e. a sequence of particle
position x, also called a Markov chain) according to the PDF and evaluate the expectation
values (mean values) of x , x2 , x3 , and x4 .

(b) Plot the histogram of the x values in the sequence and compare it with the PDF f x ( ) .
Long runs are necessary for obtaining good results: (i) We must wait for a sufficiently long
time to let the sequence reach equilibrium distribution; (ii) The sequence for averaging must
be long enough to reduce statistical fluctuations.


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank