学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windowsアプリ)
- iPad
- MyScript Nebo - MyScript(iPadアプリ(iOS))
- 参考書籍
新装版 数学読本3 (松坂 和夫(著)、岩波書店)の第10章(新しい数とその表示ー複素数と複素平面)、10.1(複素平面)、複素の絶対値の問4の解答を求めてみる。
左辺の2乗について。
右辺の2乗について。
場合分け。
の場合、
よって
ゆえに、問題の等式は成り立つ。
の場合も同様。
(証明終)
コード
#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, I, sin, cos
print('4.')
theta, a, b = symbols('theta, a, b', real=True)
alpha = cos(theta) + I * sin(theta)
beta = a + b * I
class MyTestCase(TestCase):
def test1(self):
self.assertEqual(abs(alpha - beta).simplify(),
abs(1 - alpha.conjugate() * beta).simplify())
def test2(self):
self.assertEqual(abs(beta - alpha).simplify(),
abs(1 - beta.conjugate() * alpha).simplify())
if __name__ == "__main__":
main()
入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))
% ./sample4.py -v
4.
test1 (__main__.MyTestCase) ... ok
test2 (__main__.MyTestCase) ... ok
----------------------------------------------------------------------
Ran 2 tests in 0.875s
OK
%
0 コメント:
コメントを投稿