2020年4月1日水曜日

学習環境

新装版 数学読本3 (松坂 和夫(著)、岩波書店)の第10章(新しい数とその表示ー複素数と複素平面)、10.1(複素平面)、複素数の極形式の問8の解答を求めてみる。


  1. 絶対値について。

    i z - = i z - = z - = z

    偏角について。

    arg i z - = arg i + arg z - = π 2 - arg z

    よって、 複素数

    i z -

    は 点 z の座標軸のあいだの角を2等分する直線

    y = x

    に関して対称な点である。

    (証明終)

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, I, Matrix, plot
import random

print('8.')


class MyTestCase(TestCase):
    def test(self):
        a, b = symbols('a, b', real=True)
        z = a + b * I
        z1 = I * z.conjugate()
        z2 = (z + z1) / 2
        c, d = z2.as_real_imag()
        self.assertEqual(d / c, 1)
        z3 = z1 - z
        v = Matrix(z3.as_real_imag())
        self.assertEqual(v.dot(Matrix([1, 1])), 0)


x = symbols('x')
zs = [random.randrange(-10, 10) + random.randrange(-10, 10) * I
      for _ in range(2)]
zs1 = [I * z.conjugate() for z in zs]
abs0 = [z.as_real_imag() for z in zs]
abs1 = [z.as_real_imag() for z in zs1]

p = plot(x,
         *[b / a * x for a, b in abs0],
         *[b / a * x for a, b in abs1],
         *[b for _, b in abs0],
         *[b for _, b in abs1],
         (x, -5, 5),
         ylim=(-5, 5),
         legend=True,
         show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']

for o, color in zip(p, colors):
    o.line_color = color

p.show()
p.save(f'sample8.png')

if __name__ == "__main__":
    main()

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

% ./sample8.py -v
8.
test (__main__.MyTestCase) ... ok

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

OK
%

0 コメント:

コメントを投稿