Monte carlo problem sets (광주과학기술원, GIST, 지스트, 황치옥교수님)

Monte Carlo 방법이란? importance sampling과 variance reduction X가 parmaeter가 λ인 exponential distribution 일 때 inverse transform method 를 이용하여 X를 sampling 하기 Monte Carlo 성능 측정하는 방법인 Relative efficiency와 labouriness와 이것의 차이점 \int_{-\infty}^\infty x^2 e^{-x^2}dx / \int_{-\infty}^\infty e^{-x^2} dx 를 importance sampling 이용하여 추정하기 Monte Carlo convergence rate 는 어떻게 유도되는가? EM algorithm을 실행할 때 … Read more

Programming of Buffon’s needle problem without using the number, \pi!

Buffon’s needle problem without $\pi$ 1. Estimate $\pi$ with hit-or-method with samples 2. Run algorithm for solving Buffon’s needle problem with the estimate import pandas as pd import random n_lists = [100000000] # Lists to store results results = [] d = 2 # Monte Carlo simulation for n in n_lists: total_frequencies = 0 for … Read more

Importance sampling implementation

(1). $\int_0^1 \sigma (r) dr \approx \sum_{i=1}^N \sigma(u_i)/N , u_i \sim U[0,1]$ (2). $\int_0^1 2 \sqrt{1-r} \sigma (r) d(-\sqrt{1-r}) $ * Let $F(r) = 1-\sqrt{1-r}$, then the integral in $(2).$ becomes $E_F [ 2 \sqrt{1-r} \sigma(r)]$, since $F^{-1} (U) =2 U – U^2 $, the integral in $(2).$ can be approximated by $\sum_{i=1}^N 2\sqrt{1-F^{-1}(u_i)}\sigma(F^{-1}(u_i))/N$. import … Read more

Hit-or-miss method, and comparison with Buffon’s needle

# 2025 Spring, Montecarlo methods and its applications ##Homework 3 Hit-or-miss method ### Seonggyu Lee #### 2025.03.24 Let $(x_i,y_i)$ be i-th random samples with $x_i \sim U[-1,1], y_i \sim U[-1,1]$ where $ 1 \leq i \leq n$. Let $\hat{\pi}_n = \frac{\sum_{i=1}^n \mathbf{1}(x_i^2 +y_i^2 \leq 1)}{n} \times 4$. I set $n\in \{10, 100, 1000,10000, 100000,1000000,10000000, 100000000\}$ … Read more

Buffon’s needle problem

# 2025 Spring, Montecarlo methods and its applications ##Homework Buffon’s needle ### Seonggyu Lee #### 2025.03.17 $$ p = (2l)/(\pi d) $$ Let $d=2$ and $l=1$. Then $p= 1/\pi$, equivalently $\pi = 1/p$. Let $C$ and $\Theta$ be random variables following uniform distributions, $U[0,2]$ and $U[0,\pi]$, respectively. Let $\hat{p}_n$ be an estimate of $p$, when … Read more

Explicit and Implicit computing

Explicit and Implicit computing Essay about the introduction of the class 2025 Fall Monte Carlo Methods and their Applications (lecturer: Prof. Hwang)  Lee Seonggyu In the first lecture of the class operated by Prof. Hwang, he explained what scientific computing is and classified the approaches of scientific computing. I had thought that scientific computing differs … Read more