学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- 数式入力ソフト(TeX, MathML): MathType
- MathML対応ブラウザ: Firefox、Safari
- MathML非対応ブラウザ(Internet Explorer, Microsoft Edge, Google Chrome...)用JavaScript Library: MathJax
- 参考書籍
Head First Statistics (Dawn Griffiths (著)、黒川 利明 (翻訳)、木下 哲也 (翻訳)、黒川 洋 (翻訳)、黒川 めぐみ (翻訳)、オライリージャパン)の7章(幾何分布、二項分布、ポアソン分布 - いろいろな離散確率分布)、ポップコーンの機械になってみよう(p. 309)を取り組んでみる。
ポップコーンの機械になってみよう(p. 309)
コード(Emacs)
HTML5
<pre id="output0"></pre> <button id="run">run</button> <button id="clear0">clear</button> <script src="sample8.js"></script>
JavaScript
let pre0 = document.querySelector('#output0'),
btn0 = document.querySelector('#run'),
btn1 = document.querySelector('#clear0'),
p = (x) => pre0.textContent += x,
range = (start, end, step=1) => {
let res = [];
for (let i = start; i < end; i += step) {
res.push(i);
}
return res;
};
let output = () => {
p(
[Math.E ** (-3.4), Math.E ** (-3.4) * 3.4 ** 3 / 6]
.map((x, i) => `${i + 1}: ${x}`)
.join('\n')
);
};
btn0.onclick = output;
btn1.onclick = () => pre0.textContent = '';
output();
0 コメント:
コメントを投稿