学習環境
- 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
- 参考書籍
線型代数入門(松坂 和夫(著)、岩波書店)の第3章(線型写像)、7(行列の積)、問題1.を取り組んでみる。
コード(Emacs)
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, Matrix
import random
print('1.')
a = [(Matrix([[2, 3, -1],
[4, 5, 6]]),
Matrix([[-1],
[0],
[1]])),
(Matrix([[5, 3],
[2, 1]]),
Matrix([[-1, 3],
[2, -5]])),
(Matrix([[2, 4, -1],
[0, 3, -2]]),
Matrix([[1, -5, 0],
[2, -2, 4],
[0, 3, 1]])),
(Matrix([[5, 0],
[-10, 2],
[3, -1]]),
Matrix([[1, 2, 3],
[4, 5, 6]])),
(Matrix([[5, 6, -3]]),
Matrix([[6],
[-3],
[4]])),
(Matrix([[10],
[-1],
[5]]),
Matrix([[-2, 3, 1]]))]
for i, (A, B) in enumerate(a):
print(f'({chr(ord("a") + i)})')
for t in [A, B, A*B]:
pprint(t)
print()
print()
入出力結果(Terminal, Jupyter(IPython))
$ ./sample1.py 1. (a) ⎡2 3 -1⎤ ⎢ ⎥ ⎣4 5 6 ⎦ ⎡-1⎤ ⎢ ⎥ ⎢0 ⎥ ⎢ ⎥ ⎣1 ⎦ ⎡-3⎤ ⎢ ⎥ ⎣2 ⎦ (b) ⎡5 3⎤ ⎢ ⎥ ⎣2 1⎦ ⎡-1 3 ⎤ ⎢ ⎥ ⎣2 -5⎦ ⎡1 0⎤ ⎢ ⎥ ⎣0 1⎦ (c) ⎡2 4 -1⎤ ⎢ ⎥ ⎣0 3 -2⎦ ⎡1 -5 0⎤ ⎢ ⎥ ⎢2 -2 4⎥ ⎢ ⎥ ⎣0 3 1⎦ ⎡10 -21 15⎤ ⎢ ⎥ ⎣6 -12 10⎦ (d) ⎡ 5 0 ⎤ ⎢ ⎥ ⎢-10 2 ⎥ ⎢ ⎥ ⎣ 3 -1⎦ ⎡1 2 3⎤ ⎢ ⎥ ⎣4 5 6⎦ ⎡5 10 15 ⎤ ⎢ ⎥ ⎢-2 -10 -18⎥ ⎢ ⎥ ⎣-1 1 3 ⎦ (e) [5 6 -3] ⎡6 ⎤ ⎢ ⎥ ⎢-3⎥ ⎢ ⎥ ⎣4 ⎦ [0] (f) ⎡10⎤ ⎢ ⎥ ⎢-1⎥ ⎢ ⎥ ⎣5 ⎦ [-2 3 1] ⎡-20 30 10⎤ ⎢ ⎥ ⎢ 2 -3 -1⎥ ⎢ ⎥ ⎣-10 15 5 ⎦ $
0 コメント:
コメントを投稿