学習環境
- 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
- 参考書籍
ラング線形代数学(上)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の6章(行列式)、5(置換)、練習問題2.を取り組んでみる。
コード(Emacs)
HTML5
<pre id="output0"></pre> <button id="run0">run</button> <button id="clear0">clear</button> <script src="sample2.js"></script>
JavaScript
let pre0 = document.querySelector('#output0'),
btn0 = document.querySelector('#run0'),
btn1 = document.querySelector('#clear0'),
p = (x) => pre0.textContent += x + '\n',
range = (start, end, step=1) => {
let res = [];
for (let i = start; i < end; i += step) {
res.push(i);
}
return res;
};
let nums1 = range(1, 4),
nums2 = range(1, 5),
a = {1:2, 2:3, 3:1},
b = {1:3, 2:1, 3:2},
c = {1:3, 2:2, 3:1},
d = {1:2, 2:3, 3:1, 4:4},
e = {1:2, 2:1, 3:4, 4:3},
f = {1:3, 2:2, 3:4, 4:1},
a1 = {1:3, 2:1, 3:2},
b1 = {1:2, 2:3, 3:1},
c1 = {1:3, 2:2, 3:1},
d1 = {1:3, 2:1, 3:2, 4:4},
e1 = {1:2, 2:1, 3:4, 4:3},
f1 = {1:4, 2:2, 3:1, 4:3};
let output = () => {
[[a, a1], [b, b1], [c, c1]]
.forEach(([f, f1], i) =>
p(`${String.fromCodePoint('a'.codePointAt(0) + i)}: ` +
`${nums1.map((i) => f[i]).map((i) => f1[i])}`));
[[d, d1], [e, e1], [f, f1]]
.forEach(([f, f1], i) =>
p(`${String.fromCodePoint('a'.codePointAt(0) + i + 4)}: ` +
`${nums2.map((i) => f[i]).map((i) => f1[i])}`));
};
btn0.onclick = output;
btn1.onclick = () => pre0.textContent = '';
output();
0 コメント:
コメントを投稿