This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import uniform | |
import scipy.integrate | |
# 例3.3 | |
a, b = 0, 1 | |
f = lambda x: (np.cos(50 * x) + np.sin(20 * x)) ** 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 練習問題3.1 コーシー・ベイズ推定量をモンテカルロ積分で計算する | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import cauchy, norm | |
import scipy.integrate | |
x = 4 | |
# 分子の被積分関数 | |
func1 = lambda t: t * norm(loc=x).pdf(t) * cauchy.pdf(t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import uniform | |
import scipy.integrate | |
# モンテカルロ積分の収束テスト | |
# 例3.3の場合 | |
N = 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.stats import cauchy, norm | |
import scipy.integrate | |
# モンテカルロ積分の収束テスト | |
# 練習問題3.1 | |
N = 1000 | |
x = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Graphics; | |
import java.awt.Image; | |
import javax.swing.ImageIcon; | |
/* | |
* Created on 2007/05/05 | |
* | |
* ボールクラス | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.MouseMotionListener; | |
import javax.swing.JPanel; | |
/* | |
* Created on 2007/05/05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Graphics; | |
import java.awt.Point; | |
/* | |
* Created on 2005/06/16 | |
* | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.integrate | |
from scipy.stats import norm | |
# 単純な重点サンプリングの例 | |
a = 5.0 | |
# 被積分関数 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.integrate | |
from scipy.stats import norm | |
# 単純な重点サンプリングの例 | |
a = 5.0 | |
# 被積分関数 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import scipy.integrate | |
from scipy.stats import norm | |
# さまざまな平均・標準偏差を持つ正規分布を重点関数gとみなして | |
# 収束速度がどのように変わるか調査 | |
a = 5.0 |