2020年7月11日土曜日

学習環境

続 解析入門 (原書第2版) (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第1章(ベクトル)、7(ベクトル積)の練習問題6の解答を求めてみる。


  1. A = ( a 1 , a 2 , a 3 )

    とおく。

    A × A = ( a 2 a 3 - a 3 a 2 , a 31 - a 13 , a 12 - a 21 ) = ( 0 , 0 , 0 ) = O

    (証明終)

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import Matrix
from sympy.abc import a, b, c

print('6.')


class TestCross(TestCase):
    def test(self):
        A = Matrix([a, b, c])
        self.assertEqual(A.cross(A), Matrix([0, 0, 0]))


if __name__ == "__main__":
    main()

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% ./sample6.py -v
6.
test (__main__.TestCross) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.006s

OK
%

0 コメント:

コメントを投稿