{"id":18261665,"url":"https://github.com/timudk/introduction_to_mcmc","last_synced_at":"2026-05-16T00:34:54.361Z","repository":{"id":91804000,"uuid":"139355090","full_name":"timudk/introduction_to_mcmc","owner":"timudk","description":"A brief introduction to Markov chain Monte Carlo methods","archived":false,"fork":false,"pushed_at":"2018-07-28T21:09:11.000Z","size":1575,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T18:53:16.394Z","etag":null,"topics":["markov-chain","markov-chain-monte-carlo","matlplotlib","numpy","python","stochastic"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timudk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-01T19:13:20.000Z","updated_at":"2024-03-02T21:19:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"74c769a5-d4e7-4a00-bea1-7950502987b6","html_url":"https://github.com/timudk/introduction_to_mcmc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timudk%2Fintroduction_to_mcmc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timudk%2Fintroduction_to_mcmc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timudk%2Fintroduction_to_mcmc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timudk%2Fintroduction_to_mcmc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timudk","download_url":"https://codeload.github.com/timudk/introduction_to_mcmc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247952744,"owners_count":21023942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markov-chain","markov-chain-monte-carlo","matlplotlib","numpy","python","stochastic"],"created_at":"2024-11-05T11:04:37.195Z","updated_at":"2026-05-16T00:34:49.309Z","avatar_url":"https://github.com/timudk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction to Markov chain Monte Carlo methods\nThis project has been developed as part of the class AMATH777 - Stochastic Processes in the Physical Sciences at the University of Waterloo. The code is entirely written in Python. A documentation in form of a report as well as a presentation can be found [here](https://github.com/timudk/introduction_to_mcmc/tree/master/documentation).\n\n# Code description\nThe code is based on the following packages:\n* NumPy\n* matplotlib\n\nCheck (and potentially download the two packages) using pip:\n```console\nfoo@bar:~$ pip install numpy matplotlib\n```\n\n## uniform_samples_using_linear_congruential_generator.py\nThis example produces a sequence of samples for the uniform distribution U([0,1]) using a linear congruential generator (LCG). A description of the method can be found at https://en.wikipedia.org/wiki/Linear_congruential_generator.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/timudk/introduction_to_mcmc/blob/master/sample_output/uniform_samples.jpg\" width=\"750\"\u003e\n\n## pi_monte_carlo.py\nThis example approximates pi numerically using a Monte Carlo estimator I = (4/N) SUM_{i=1}^{N} h(x^(i), y^(i)) where h() is the indicator function h(x,y) = {1 if x^2+y^2 \u003c= 1 and 0 otherwise} and the tupels (x^(i), y^(i)) are drawn from the uniform distribution U([0,1]x[0,1]).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/timudk/introduction_to_mcmc/blob/master/sample_output/pi_monte_carlo.jpg\" width=\"750\"\u003e\n  \n## metropols.py\nThis examples produces a sequence of samples drawn from the non-normalized distribution f(x) = 0.3exp(-0.2x^2) + 0.7exp(-0.2(x-10)^2) using the Metropolis algorithm with a normal proposal distribution (see [Andrieu et al.](http://www.cs.ubc.ca/~arnaud/andrieu_defreitas_doucet_jordan_intromontecarlomachinelearning.pdf) for further details).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/timudk/introduction_to_mcmc/blob/master/sample_output/metropolis.jpg\" width=\"750\"\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimudk%2Fintroduction_to_mcmc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimudk%2Fintroduction_to_mcmc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimudk%2Fintroduction_to_mcmc/lists"}