{"blog_title":"\u9a5a\u7570\u306e\u30a2\u30cb\u30f2\u30bf\u793e\u4f1a\u5fa9\u5e30\u306e\u4e88\u5099","height":"190","version":"1.0","blog_url":"https://mikuhatsune.hatenadiary.com/","author_name":"MikuHatsune","provider_url":"https://hatena.blog","provider_name":"Hatena Blog","author_url":"https://blog.hatena.ne.jp/MikuHatsune/","width":"100%","image_url":null,"type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmikuhatsune.hatenadiary.com%2Fentry%2F20110829%2F1314593448\" title=\"Python\u3067\u30e2\u30f3\u30c6\u30ab\u30eb\u30ed - \u9a5a\u7570\u306e\u30a2\u30cb\u30f2\u30bf\u793e\u4f1a\u5fa9\u5e30\u306e\u4e88\u5099\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","categories":["Python","R"],"published":"2011-08-29 13:50:48","title":"Python\u3067\u30e2\u30f3\u30c6\u30ab\u30eb\u30ed","description":"Python\u3067\u4f55\u304b\u66f8\u3044\u3066\u307f\u308b\u7df4\u7fd2\u3002 \u3067\u30e2\u30f3\u30c6\u30ab\u30eb\u30ed\u3057\u3066\u5186\u5468\u7387\u3092\u6c42\u3081\u308b\u3002 import random # \u64ec\u4f3c\u4e71\u6570\u767a\u751f import math # \u6570\u5b66\u95a2\u6570 trials=1000000 # \u3084\u308c\u308b\u3060\u3051 res=range(0,trials) for i in res: x=random.random() y=random.random() z=math.pow(x,2) + math.pow(y,2) if math.sqrt(z) <= 1: res[i]=1 else: res[i]=0 Decimal(4*sum(res))/Decimal(trials) # \u6d6e\u52d5\u5c0f\u6570\u70b9\u306f\u3069\u3046\u3084\u3063\u305f\u3089\u697d\u2026","url":"https://mikuhatsune.hatenadiary.com/entry/20110829/1314593448"}