/ Published in: JavaScript
URL: http://invoice.etax.nat.gov.tw/etaxinfo_1.htm
計算該期期望值。
特獎一組
- 1 / 10^8 * 200000
- ans = 0.002
頭獎一組
- a = [200000 40000 10000 4000 1000 200]';
- xa = [10^0 10^1 10^2 10^3 10^4 10^5];
- xb = [0 10^0 10^1 10^2 10^3 10^4];
- x = xa - xb;
- y = 10^8;
- x / y * a
- ans = 0.32060
增開六獎一組
- 10^5 / 10^8 * 200
- ans = 0.2
Expand |
Embed | Plain Text
/* javascript: var ax = 0; var bx = [0.002, 0.3206, 0.2]; var cx, th = document.getElementsByTagName("th"); var dx = new Array(); for (cx = 0; cx < th.length; cx++) switch (th[cx].textContent) { case "特獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; case "頭獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; case "增開六獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; } for (cx = 0; cx < dx.length; cx++) ax += bx[cx] * dx[cx].length; alert(ax + " is the expected value."); undefined; */ var ax = 0; var bx = [0.002, 0.3206, 0.2]; var cx, th = document.getElementsByTagName("th"); var dx = new Array(); for (cx = 0; cx < th.length; cx++) switch (th[cx].textContent) { case "特獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; case "頭獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; case "增開六獎": dx.push( th[cx].nextSibling.textContent.split("、") ); break; } for (cx = 0; cx < dx.length; cx++) ax += bx[cx] * dx[cx].length; alert(ax + " is the expected value."); undefined;
You need to login to post a comment.
