0

I'm a beginner at python and am learning to use MCMC sampling methods, using python's emcee package. As a beginner exercise I want to sample a Maxwell-Boltzmann Distribution. I have an example code which samples a Gaussian, defined through the function below;

    def lnprob(x, mu, icov):
diff = x-mu
return -np.dot(diff,np.dot(icov,diff))/2.0

How would I express a boltzmann distribution in the same way?

Gabriel
  • 40,504
  • 73
  • 230
  • 404
  • https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.maxwell.html – Bill Bell May 14 '17 at 03:19
  • Thanks Bill. So I've use scipy to specify my maxwell distribution now, however when running emcee.sampler using 'pos, prob, state = sampler.run_mcmc(p0, 5000)' I get an error that says 'ValueError: too many values to unpack' even though the amount of input parameters is the same each time i call lnprob? – Grace Lawrence May 14 '17 at 07:31
  • Welcome. You should give us another question so that we can see your all of your code along with that diagnostic. – Bill Bell May 14 '17 at 13:09
  • Hi Bill, Ive added a new post with more details about my question. If you'd still like to help, here's the link to my new question. http://stackoverflow.com/questions/43964707/mcmc-sampling-a-maxwellian-curve-using-pythons-emcee. Thanks! – Grace Lawrence May 14 '17 at 13:56

0 Answers0